headroom-cms 0.1.9 → 0.1.10

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 (123) hide show
  1. package/admin/assets/{AdminsPage-Bt_ekZen.js → AdminsPage-BIWASote.js} +1 -1
  2. package/admin/assets/AllContentPage-1gXe2OC7.js +1 -0
  3. package/admin/assets/{ApiKeysPage-BfWCxGhC.js → ApiKeysPage-BBW4ATBx.js} +1 -1
  4. package/admin/assets/AuditPage-B5GGFWGG.js +1 -0
  5. package/admin/assets/BlockEditor-CQpF8tYb.css +1 -0
  6. package/admin/assets/BlockEditor-ClskiZoX.js +176 -0
  7. package/admin/assets/BlockTypeEditPage-CY0gCPei.js +1 -0
  8. package/admin/assets/BlockTypesPage-D8Me6OeX.js +1 -0
  9. package/admin/assets/{BulkActionBar-TRiXXLQd.js → BulkActionBar--35xjnOP.js} +1 -1
  10. package/admin/assets/CollectionEditPage-y8t0ZO89.js +1 -0
  11. package/admin/assets/{CollectionsPage-ClplrxNn.js → CollectionsPage-BQmGXpvW.js} +1 -1
  12. package/admin/assets/{ContentCreatePage-DfYcEH1u.js → ContentCreatePage-DlgxamOe.js} +1 -1
  13. package/admin/assets/ContentEditPage-WkSbCnnG.js +1 -0
  14. package/admin/assets/ContentField-D04Uo1Ov.js +1 -0
  15. package/admin/assets/ContentListPage-BDMx7pWb.js +1 -0
  16. package/admin/assets/CustomBlockPreview-Cs9bFDh4.js +479 -0
  17. package/admin/assets/FieldRenderer-wE-mtqZB.js +2 -0
  18. package/admin/assets/FilterBar-kFcOLffg.js +1 -0
  19. package/admin/assets/FloatingComposerController-D4uLQfUX-C0Lhbmda.js +1 -0
  20. package/admin/assets/IconPicker-BrgSAsa_.js +3 -0
  21. package/admin/assets/{LoginPage-DutieANA.js → LoginPage-Bi7TBzK4.js} +1 -1
  22. package/admin/assets/MediaField-B-Cz8TlK.js +1 -0
  23. package/admin/assets/MediaPage-C84p9d1U.js +1 -0
  24. package/admin/assets/Pagination-CuHwUPHi.js +1 -0
  25. package/admin/assets/RelationshipPicker-Dv7GaLcU.js +1 -0
  26. package/admin/assets/{SiteSettingsPage-BtCC3RKc.js → SiteSettingsPage-nBT7NzkA.js} +1 -1
  27. package/admin/assets/{SiteUserEditPage-ClHmp0T-.js → SiteUserEditPage-DroUTii9.js} +1 -1
  28. package/admin/assets/SiteUsersPage-iVXPCBPe.js +1 -0
  29. package/admin/assets/{SitesPage-Bw_WBN6v.js → SitesPage-BefZeWuJ.js} +1 -1
  30. package/admin/assets/{SubmissionDetailPage-DS08LGxd.js → SubmissionDetailPage-ktmzzOE1.js} +1 -1
  31. package/admin/assets/SubmissionEditPage-C-ykTI2t.js +1 -0
  32. package/admin/assets/SubmissionListPage-DA-8deUy.js +1 -0
  33. package/admin/assets/{TagInput-BILCaC9b.js → TagInput-d-Hw1fkL.js} +1 -1
  34. package/admin/assets/{TagsPage-DdeZokow.js → TagsPage-BZzDvcKa.js} +1 -1
  35. package/admin/assets/{UsersPage-B0vLxjrg.js → UsersPage-CnQAOOGF.js} +1 -1
  36. package/admin/assets/{WebhookEditPage-SlJE4d3z.js → WebhookEditPage-KeS8hmdW.js} +1 -1
  37. package/admin/assets/{WebhooksPage-C6lGZLpr.js → WebhooksPage-CASjmlPN.js} +1 -1
  38. package/admin/assets/{card-hXVtlM0q.js → card-CZTHR2Qa.js} +1 -1
  39. package/admin/assets/checkbox-DEgzM8H9.js +1 -0
  40. package/admin/assets/{collapsible-B414SspL.js → collapsible-D3d29uJp.js} +1 -1
  41. package/admin/assets/{command-fvBFHye4.js → command-CdzYw11U.js} +1 -1
  42. package/admin/assets/contentStatus-CkPi9Dh6.js +1 -0
  43. package/admin/assets/{core.esm-B_kcYf6n.js → core.esm-DdQHdRkd.js} +2 -2
  44. package/admin/assets/index-BA3y7HJs.js +18 -0
  45. package/admin/assets/index-c7UygSvP.css +1 -0
  46. package/admin/assets/popover-BFw_h3j6.js +1 -0
  47. package/admin/assets/radix-C5ZmWuuL.js +51 -0
  48. package/admin/assets/select-dX9e6VDt.js +1 -0
  49. package/admin/assets/{serializeToText-DR_WnxiI.js → serializeToText-Zin3gYPm.js} +1 -1
  50. package/admin/assets/{sortable.esm-QyXA6fio.js → sortable.esm-qVEMoaTg.js} +1 -1
  51. package/admin/assets/{table-DLoIbCQ5.js → table-Dk7eeOt2.js} +1 -1
  52. package/admin/assets/{textarea-vSXNxwTe.js → textarea-CpDSUg2s.js} +1 -1
  53. package/admin/assets/useAdminResolver-Bljb4XGQ.js +1 -0
  54. package/admin/assets/useContent-CW0tm0FY.js +1 -0
  55. package/admin/assets/useContentSearch-_bwacEth.js +1 -0
  56. package/admin/assets/{useMedia-e3sqWm_t.js → useMedia-Cu5N4rY8.js} +1 -1
  57. package/admin/assets/usePageTitle-DYvuJQp6.js +1 -0
  58. package/admin/assets/useSiteUsers-CKtC_8Jc.js +1 -0
  59. package/admin/assets/{useTags-f7AVSLuj.js → useTags-ybsMbCst.js} +1 -1
  60. package/admin/assets/{useWebhooks-BH_r8-Mo.js → useWebhooks-BAB-3sLa.js} +1 -1
  61. package/admin/assets/yjs-tXBm_srz.js +5 -0
  62. package/admin/index.html +3 -3
  63. package/admin/sw.js +1 -1
  64. package/dist/admin-site.d.ts +12 -0
  65. package/dist/admin-site.d.ts.map +1 -1
  66. package/dist/admin-site.js +8 -1
  67. package/dist/admin-site.js.map +1 -1
  68. package/dist/api.d.ts +7 -0
  69. package/dist/api.d.ts.map +1 -1
  70. package/dist/api.js +8 -1
  71. package/dist/api.js.map +1 -1
  72. package/dist/collaboration.d.ts +55 -0
  73. package/dist/collaboration.d.ts.map +1 -0
  74. package/dist/collaboration.js +141 -0
  75. package/dist/collaboration.js.map +1 -0
  76. package/dist/index.d.ts +12 -0
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +29 -4
  79. package/dist/index.js.map +1 -1
  80. package/dist/storage.d.ts +2 -0
  81. package/dist/storage.d.ts.map +1 -1
  82. package/dist/storage.js +33 -0
  83. package/dist/storage.js.map +1 -1
  84. package/lambda/api/bootstrap +0 -0
  85. package/lambda/webhook-worker/bootstrap +0 -0
  86. package/package.json +1 -1
  87. package/src/admin-site.ts +20 -1
  88. package/src/api.ts +15 -1
  89. package/src/collaboration.ts +187 -0
  90. package/src/index.ts +44 -4
  91. package/src/sst-env.d.ts +28 -0
  92. package/src/storage.ts +35 -0
  93. package/admin/assets/AllContentPage-CFqEMAl9.js +0 -1
  94. package/admin/assets/AuditPage-BE0XIUl2.js +0 -1
  95. package/admin/assets/BlockEditor-6wqsThJ7.js +0 -179
  96. package/admin/assets/BlockEditor-Cp_wZ2xN.css +0 -1
  97. package/admin/assets/BlockTypeEditPage-CuNJfZw0.js +0 -1
  98. package/admin/assets/BlockTypesPage-BIMBVxBs.js +0 -1
  99. package/admin/assets/CollectionEditPage-BqX_0cC2.js +0 -1
  100. package/admin/assets/ContentEditPage-D3Rvlktk.js +0 -2
  101. package/admin/assets/ContentListPage-zmO8Is4d.js +0 -1
  102. package/admin/assets/CustomBlockPreview-C6HqS4xv.js +0 -479
  103. package/admin/assets/FieldBuilder-36tfpSyM.js +0 -3
  104. package/admin/assets/FilterBar-DhRwTqFv.js +0 -1
  105. package/admin/assets/MediaField-J2TLG_fu.js +0 -1
  106. package/admin/assets/MediaPage-DZZKMGF4.js +0 -1
  107. package/admin/assets/RelationshipPicker-CDFs4TMW.js +0 -1
  108. package/admin/assets/SiteUsersPage-AyJvcVM7.js +0 -1
  109. package/admin/assets/SubmissionEditPage-Brf-DK2X.js +0 -1
  110. package/admin/assets/SubmissionListPage-DNMzQZHS.js +0 -1
  111. package/admin/assets/checkbox-WGrS3sUr.js +0 -1
  112. package/admin/assets/contentStatus-BmaiYVOm.js +0 -1
  113. package/admin/assets/index-Cir9tY_P.js +0 -18
  114. package/admin/assets/index-DACBYsKM.css +0 -1
  115. package/admin/assets/popover-D5_HjjUC.js +0 -1
  116. package/admin/assets/radix-C1kb_NqW.js +0 -51
  117. package/admin/assets/select-_uJYxzeZ.js +0 -1
  118. package/admin/assets/useAdminResolver-D-LlmquD.js +0 -1
  119. package/admin/assets/useContent-e8beBIuq.js +0 -1
  120. package/admin/assets/useContentSearch-DOjveB9t.js +0 -1
  121. package/admin/assets/useDebouncedValue-C-cQUcLG.js +0 -1
  122. package/admin/assets/usePageTitle-BNSba9_L.js +0 -1
  123. package/admin/assets/useSiteUsers-BdnvuM2E.js +0 -1
@@ -0,0 +1,176 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FloatingComposerController-D4uLQfUX-C0Lhbmda.js","assets/react-vendor-C2CvUxFh.js","assets/tanstack-Bs3zYPPV.js","assets/index-BA3y7HJs.js","assets/radix-C5ZmWuuL.js","assets/index-c7UygSvP.css","assets/yjs-tXBm_srz.js","assets/command-CdzYw11U.js","assets/MediaField-B-Cz8TlK.js","assets/useMedia-Cu5N4rY8.js","assets/select-dX9e6VDt.js","assets/card-CZTHR2Qa.js","assets/media-url-DIg_vSyf.js","assets/FieldRenderer-wE-mtqZB.js","assets/textarea-CpDSUg2s.js","assets/checkbox-DEgzM8H9.js","assets/core.esm-DdQHdRkd.js","assets/sortable.esm-qVEMoaTg.js","assets/ContentField-D04Uo1Ov.js","assets/popover-BFw_h3j6.js","assets/useContentSearch-_bwacEth.js","assets/CustomBlockPreview-Cs9bFDh4.js"])))=>i.map(i=>d[i]);
2
+ import{j as E}from"./tanstack-Bs3zYPPV.js";import{r as C,b as aE,a as Ev,g as cp,R as Re,u as lE,f as xv}from"./react-vendor-C2CvUxFh.js";import{aK as Qi,be as Cv,bf as kv,bg as up,D as cE,k as uE,l as dE,m as fE,n as hE,a1 as pE,L as Wa,j as Tv,bh as wv,X as Sv,I as qa,B as Bs,o as mE,a3 as gE,aE as vv,ad as Av}from"./index-BA3y7HJs.js";import{W as Xr,ai as Nv,R as Iv,aj as Mv,ak as _v,al as Df,am as Ov,T as Rv,P as Lv,C as Dv,A as Pv,a as Bv,an as Fv,o as Hv,L as Uv,p as Vv,n as $v,a6 as jv,a4 as zv,a5 as Wv,aa as qv,ab as Gv,ac as Yv,a8 as Kv,a9 as Qv,a3 as Xv,_ as Zv,a0 as Jv,Z as eA,d as tA,ao as nA,ap as rA,aq as oA,g as iA,ar as sA,I as aA,f as lA,as as cA,at as uA,c as dA,ad as fA,ae as hA}from"./radix-C5ZmWuuL.js";import{B as ug,k as pA,l as mA,m as gA,n as bA,o as yA,p as Xo,q as Gl,s as cd,u as bE,D as yE,v as dg,x as EE,y as fg,z as xE,S as CE,U as kE,A as EA,C as xA,Y as er,E as CA,F as zr,G as TE,H as kA,I as TA,J as wA,K as SA,L as vA,M as wE,N as AA,P as NA,Q as SE,R as IA,T as ud,V as Pf,W as Bf,X as MA,Z as _A,_ as OA,$ as hg,a0 as Fs,a1 as RA,i as pg,j as mg,h as LA}from"./yjs-tXBm_srz.js";import{P as hu,S as vE}from"./command-CdzYw11U.js";import{M as DA}from"./MediaField-B-Cz8TlK.js";import{m as Ff}from"./media-url-DIg_vSyf.js";import{F as PA}from"./FieldRenderer-wE-mtqZB.js";import{C as BA}from"./CustomBlockPreview-Cs9bFDh4.js";import{a as FA}from"./ContentField-D04Uo1Ov.js";const HA=e=>class{constructor(n){this._=n}destroy(){e(this._)}},UA=HA(clearTimeout),dp=(e,t)=>new UA(setTimeout(t,e));function pu(){return typeof window<"u"}function Do(e){return fp(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wr(e){var t;return(t=(fp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fp(e){return pu()?e instanceof Node||e instanceof Mn(e).Node:!1}function ct(e){return pu()?e instanceof Element||e instanceof Mn(e).Element:!1}function Yt(e){return pu()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function aa(e){return!pu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function Ia(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function VA(e){return/^(table|td|th)$/.test(Do(e))}function mu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $A=/transform|translate|scale|rotate|perspective|filter/,jA=/paint|layout|strict|content/,Vo=e=>!!e&&e!=="none";let dd;function hp(e){const t=ct(e)?Wn(e):e;return Vo(t.transform)||Vo(t.translate)||Vo(t.scale)||Vo(t.rotate)||Vo(t.perspective)||!gu()&&(Vo(t.backdropFilter)||Vo(t.filter))||$A.test(t.willChange||"")||jA.test(t.contain||"")}function zA(e){let t=Zr(e);for(;Yt(t)&&!Wr(t);){if(hp(t))return t;if(mu(t))return null;t=Zr(t)}return null}function gu(){return dd==null&&(dd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dd}function Wr(e){return/^(html|body|#document)$/.test(Do(e))}function Wn(e){return Mn(e).getComputedStyle(e)}function bu(e){return ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zr(e){if(Do(e)==="html")return e;const t=e.assignedSlot||e.parentNode||aa(e)&&e.host||wr(e);return aa(t)?t.host:t}function AE(e){const t=Zr(e);return Wr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yt(t)&&Ia(t)?t:AE(t)}function wo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=AE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Mn(o);if(i){const a=Hf(s);return t.concat(s,s.visualViewport||[],Ia(o)?o:[],a&&n?wo(a):[])}else return t.concat(o,wo(o,[],n))}function Hf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const WA=["top","right","bottom","left"],gg=["start","end"],bg=WA.reduce((e,t)=>e.concat(t,t+"-"+gg[0],t+"-"+gg[1]),[]),Xi=Math.min,vn=Math.max,Yl=Math.round,Ga=Math.floor,gr=e=>({x:e,y:e}),qA={left:"right",right:"left",bottom:"top",top:"bottom"};function yg(e,t,n){return vn(e,Xi(t,n))}function ds(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function br(e){return e.split("-")[1]}function NE(e){return e==="x"?"y":"x"}function IE(e){return e==="y"?"height":"width"}function Vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ME(e){return NE(Vr(e))}function _E(e,t,n){n===void 0&&(n=!1);const r=br(e),o=ME(e),i=IE(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ql(s)),[s,Ql(s)]}function GA(e){const t=Ql(e);return[Kl(e),t,Kl(t)]}function Kl(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Eg=["left","right"],xg=["right","left"],YA=["top","bottom"],KA=["bottom","top"];function QA(e,t,n){switch(e){case"top":case"bottom":return n?t?xg:Eg:t?Eg:xg;case"left":case"right":return t?YA:KA;default:return[]}}function XA(e,t,n,r){const o=br(e);let i=QA(xr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Kl)))),i}function Ql(e){const t=xr(e);return qA[t]+e.slice(t.length)}function ZA(e){return{top:0,right:0,bottom:0,left:0,...e}}function JA(e){return typeof e!="number"?ZA(e):{top:e,right:e,bottom:e,left:e}}function Xl(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}var eN=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Zl=eN.join(","),OE=typeof Element>"u",Zi=OE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jl=!OE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},ec=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):ec(t.parentNode));return s},tN=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},RE=function(t,n,r){if(ec(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Zl));return n&&Zi.call(t,Zl)&&o.unshift(t),o=o.filter(r),o},tc=function(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!ec(s,!1))if(s.tagName==="SLOT"){var a=s.assignedElements(),l=a.length?a:s.children,c=tc(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=Zi.call(s,Zl);u&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!ec(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=tc(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},LE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},DE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||tN(t))&&!LE(t)?0:t.tabIndex},nN=function(t,n){var r=DE(t);return r<0&&n&&!LE(t)?0:r},rN=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},PE=function(t){return t.tagName==="INPUT"},oN=function(t){return PE(t)&&t.type==="hidden"},iN=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},sN=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},aN=function(t){if(!t.name)return!0;var n=t.form||Jl(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=sN(o,t.form);return!i||i===t},lN=function(t){return PE(t)&&t.type==="radio"},cN=function(t){return lN(t)&&!aN(t)},uN=function(t){var n,r=t&&Jl(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,a,l;for(i=!!((s=o)!==null&&s!==void 0&&(a=s.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&o;){var c,u,d;r=Jl(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Cg=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},dN=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var i=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(t).visibility==="hidden")return!0;var s=Zi.call(t,"details>summary:first-of-type"),a=s?t.parentElement:t;if(Zi.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Jl(t);if(c&&!c.shadowRoot&&o(c)===!0)return Cg(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(uN(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Cg(t);return!1},fN=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zi.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Uf=function(t,n){return!(n.disabled||oN(n)||dN(n,t)||iN(n)||fN(n))},Vf=function(t,n){return!(cN(n)||DE(n)<0||!Uf(t,n))},hN=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},BE=function(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,a=s?o.scopeParent:o,l=nN(a,s),c=s?BE(o.candidates):a;l===0?s?n.push.apply(n,c):n.push(a):r.push({documentOrder:i,tabIndex:l,item:o,isScope:s,content:c})}),r.sort(rN).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},yu=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Vf.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:hN}):r=RE(t,n.includeContainer,Vf.bind(null,n)),BE(r)},pN=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Uf.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=RE(t,n.includeContainer,Uf.bind(null,n)),r},FE=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Zi.call(t,Zl)===!1?!1:Vf(n,t)};function mN(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function HE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function gN(){return/apple/i.test(navigator.vendor)}function $f(){const e=/android/i;return e.test(mN())||e.test(HE())}function bN(){return HE().includes("jsdom/")}const kg="data-floating-ui-focusable",yN="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _i(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function pn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ho(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fd(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function EN(e){return e.matches("html,body")}function rn(e){return e?.ownerDocument||document}function xN(e){return Yt(e)&&e.matches(yN)}function Tg(e){return e?e.getAttribute("role")==="combobox"&&xN(e):!1}function wg(e){return e?e.hasAttribute(kg)?e:e.querySelector("["+kg+"]")||e:null}function Ui(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Ui(e,o.id,n)])}function Sg(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){const i=e.find(s=>s.id===o);o=i?.parentId,i&&(r=r.concat(i))}return r}function hd(e){e.preventDefault(),e.stopPropagation()}function CN(e){return"nativeEvent"in e}function kN(e){return e.mozInputSource===0&&e.isTrusted?!0:$f()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function TN(e){return bN()?!1:!$f()&&e.width===0&&e.height===0||$f()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jf(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var wN=typeof document<"u",SN=function(){},Kt=wN?C.useLayoutEffect:SN;const vN={...aE};function tr(e){const t=C.useRef(e);return Kt(()=>{t.current=e}),t}const AN=vN.useInsertionEffect,NN=AN||(e=>e());function bn(e){const t=C.useRef(()=>{});return NN(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const Ma=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function UE(e,t){const n=yu(e,Ma()),r=n.length;if(r===0)return;const o=_i(rn(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function VE(e){return UE(rn(e).body,1)||e}function $E(e){return UE(rn(e).body,-1)||e}function Hs(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!pn(n,r)}function IN(e){yu(e,Ma()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function vg(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ag(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=ME(t),a=IE(s),l=xr(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(br(t)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}async function MN(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ds(t,e),p=JA(h),y=a[f?d==="floating"?"reference":"floating":d],b=Xl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),O=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},M=Xl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:k,strategy:l}):x);return{top:(b.top-M.top+p.top)/O.y,bottom:(M.bottom-b.bottom+p.bottom)/O.y,left:(b.left-M.left+p.left)/O.x,right:(M.right-b.right+p.right)/O.x}}const _N=50,ON=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:MN},l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ag(c,r,l),f=r,h=0;const p={};for(let g=0;g<i.length;g++){const y=i[g];if(!y)continue;const{name:b,fn:x}=y,{x:k,y:O,data:M,reset:A}=await x({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=k??u,d=O??d,p[b]={...p[b],...M},A&&h<_N&&(h++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):A.rects),{x:u,y:d}=Ag(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}};function RN(e,t,n){return(e?[...n.filter(o=>br(o)===e),...n.filter(o=>br(o)!==e)]:n.filter(o=>xr(o)===o)).filter(o=>e?br(o)===e||(t?Kl(o)!==o:!1):!0)}const LN=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:s,placement:a,platform:l,elements:c}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=bg,autoAlignment:h=!0,...p}=ds(e,t),g=d!==void 0||f===bg?RN(d||null,h,f):f,y=await l.detectOverflow(t,p),b=((n=s.autoPlacement)==null?void 0:n.index)||0,x=g[b];if(x==null)return{};const k=_E(x,i,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==x)return{reset:{placement:g[0]}};const O=[y[xr(x)],y[k[0]],y[k[1]]],M=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:O}],A=g[b+1];if(A)return{data:{index:b+1,overflows:M},reset:{placement:A}};const D=M.map(N=>{const K=br(N.placement);return[N.placement,K&&u?N.overflows.slice(0,2).reduce((F,q)=>F+q,0):N.overflows[0],N.overflows]}).sort((N,K)=>N[1]-K[1]),Y=((o=D.filter(N=>N[2].slice(0,br(N[0])?2:3).every(K=>K<=0))[0])==null?void 0:o[0])||D[0][0];return Y!==a?{data:{index:b+1,overflows:M},reset:{placement:Y}}:{}}}},DN=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=ds(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=xr(o),x=Vr(a),k=xr(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=f||(k||!g?[Ql(a)]:GA(a)),A=p!=="none";!f&&A&&M.push(...XA(a,g,p,O));const D=[a,...M],z=await l.detectOverflow(t,y),Y=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&Y.push(z[b]),d){const L=_E(o,s,O);Y.push(z[L[0]],z[L[1]])}if(N=[...N,{placement:o,overflows:Y}],!Y.every(L=>L<=0)){var K,F;const L=(((K=i.flip)==null?void 0:K.index)||0)+1,H=D[L];if(H&&(!(d==="alignment"?x!==Vr(H):!1)||N.every(G=>Vr(G.placement)===x?G.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:H}};let re=(F=N.filter(W=>W.overflows[0]<=0).sort((W,G)=>W.overflows[1]-G.overflows[1])[0])==null?void 0:F.placement;if(!re)switch(h){case"bestFit":{var q;const W=(q=N.filter(G=>{if(A){const te=Vr(G.placement);return te===x||te==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(te=>te>0).reduce((te,S)=>te+S,0)]).sort((G,te)=>G[1]-te[1])[0])==null?void 0:q[0];W&&(re=W);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}},PN=new Set(["left","top"]);async function BN(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=xr(n),a=br(n),l=Vr(n)==="y",c=PN.has(s)?-1:1,u=i&&l?-1:1,d=ds(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const FN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await BN(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},HN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x,y:k}=b;return{x,y:k}}},...c}=ds(e,t),u={x:n,y:r},d=await i.detectOverflow(t,c),f=Vr(xr(o)),h=NE(f);let p=u[h],g=u[f];if(s){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=p+d[b],O=p-d[x];p=yg(k,p,O)}if(a){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=g+d[b],O=g-d[x];g=yg(k,g,O)}const y=l.fn({...t,[h]:p,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:s,[f]:a}}}}}},UN=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=ds(e,t),u=await s.detectOverflow(t,c),d=xr(o),f=br(o),h=Vr(o)==="y",{width:p,height:g}=i.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,k=p-u.left-u.right,O=Xi(g-u[y],x),M=Xi(p-u[b],k),A=!t.middlewareData.shift;let D=O,z=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),A&&!f){const N=vn(u.left,0),K=vn(u.right,0),F=vn(u.top,0),q=vn(u.bottom,0);h?z=p-2*(N!==0||K!==0?N+K:vn(u.left,u.right)):D=g-2*(F!==0||q!==0?F+q:vn(u.top,u.bottom))}await l({...t,availableWidth:z,availableHeight:D});const Y=await s.getDimensions(a.floating);return p!==Y.width||g!==Y.height?{reset:{rects:!0}}:{}}}};function jE(e){const t=Wn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Yt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Yl(n)!==i||Yl(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function pp(e){return ct(e)?e:e.contextElement}function Vi(e){const t=pp(e);if(!Yt(t))return gr(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=jE(t);let s=(i?Yl(n.width):n.width)/r,a=(i?Yl(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const VN=gr(0);function zE(e){const t=Mn(e);return!gu()||!t.visualViewport?VN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $N(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function ii(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=pp(e);let s=gr(1);t&&(r?ct(r)&&(s=Vi(r)):s=Vi(e));const a=$N(i,n,r)?zE(i):gr(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Mn(i),h=r&&ct(r)?Mn(r):r;let p=f,g=Hf(p);for(;g&&r&&h!==p;){const y=Vi(g),b=g.getBoundingClientRect(),x=Wn(g),k=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,O=b.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=k,c+=O,p=Mn(g),g=Hf(p)}}return Xl({width:u,height:d,x:l,y:c})}function Eu(e,t){const n=bu(e).scrollLeft;return t?t.left+n:ii(wr(e)).left+n}function WE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Eu(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function jN(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=wr(r),a=t?mu(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=gr(1);const u=gr(0),d=Yt(r);if((d||!d&&!i)&&((Do(r)!=="body"||Ia(s))&&(l=bu(r)),d)){const h=ii(r);c=Vi(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?WE(s,l):gr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function zN(e){return Array.from(e.getClientRects())}function WN(e){const t=wr(e),n=bu(e),r=e.ownerDocument.body,o=vn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=vn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Eu(e);const a=-n.scrollTop;return Wn(r).direction==="rtl"&&(s+=vn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Ng=25;function qN(e,t){const n=Mn(e),r=wr(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=gu();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=Eu(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Ng&&(i-=p)}else c<=Ng&&(i+=c);return{width:i,height:s,x:a,y:l}}function GN(e,t){const n=ii(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Yt(e)?Vi(e):gr(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Ig(e,t,n){let r;if(t==="viewport")r=qN(e,n);else if(t==="document")r=WN(wr(e));else if(ct(t))r=GN(t,n);else{const o=zE(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Xl(r)}function qE(e,t){const n=Zr(e);return n===t||!ct(n)||Wr(n)?!1:Wn(n).position==="fixed"||qE(n,t)}function YN(e,t){const n=t.get(e);if(n)return n;let r=wo(e,[],!1).filter(a=>ct(a)&&Do(a)!=="body"),o=null;const i=Wn(e).position==="fixed";let s=i?Zr(e):e;for(;ct(s)&&!Wr(s);){const a=Wn(s),l=hp(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ia(s)&&!l&&qE(e,s))?r=r.filter(u=>u!==s):o=a,s=Zr(s)}return t.set(e,r),r}function KN(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?mu(t)?[]:YN(t,this._c):[].concat(n),r],a=Ig(t,s[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<s.length;f++){const h=Ig(t,s[f],o);l=vn(h.top,l),c=Xi(h.right,c),u=Xi(h.bottom,u),d=vn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function QN(e){const{width:t,height:n}=jE(e);return{width:t,height:n}}function XN(e,t,n){const r=Yt(t),o=wr(t),i=n==="fixed",s=ii(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=gr(0);function c(){l.x=Eu(o)}if(r||!r&&!i)if((Do(t)!=="body"||Ia(o))&&(a=bu(t)),r){const h=ii(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?WE(o,a):gr(0),d=s.left+a.scrollLeft-l.x-u.x,f=s.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function pd(e){return Wn(e).position==="static"}function Mg(e,t){if(!Yt(e)||Wn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return wr(e)===n&&(n=n.ownerDocument.body),n}function GE(e,t){const n=Mn(e);if(mu(e))return n;if(!Yt(e)){let o=Zr(e);for(;o&&!Wr(o);){if(ct(o)&&!pd(o))return o;o=Zr(o)}return n}let r=Mg(e,t);for(;r&&VA(r)&&pd(r);)r=Mg(r,t);return r&&Wr(r)&&pd(r)&&!hp(r)?n:r||zA(e)||n}const ZN=async function(e){const t=this.getOffsetParent||GE,n=this.getDimensions,r=await n(e.floating);return{reference:XN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JN(e){return Wn(e).direction==="rtl"}const eI={convertOffsetParentRelativeRectToViewportRelativeRect:jN,getDocumentElement:wr,getClippingRect:KN,getOffsetParent:GE,getElementRects:ZN,getClientRects:zN,getDimensions:QN,getScale:Vi,isElement:ct,isRTL:JN};function YE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tI(e,t){let n=null,r;const o=wr(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||t(),!f||!h)return;const p=Ga(d),g=Ga(o.clientWidth-(u+f)),y=Ga(o.clientHeight-(d+h)),b=Ga(u),k={rootMargin:-p+"px "+-g+"px "+-y+"px "+-b+"px",threshold:vn(0,Xi(1,l))||1};let O=!0;function M(A){const D=A[0].intersectionRatio;if(D!==l){if(!O)return s();D?s(!1,D):r=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!YE(c,e.getBoundingClientRect())&&s(),O=!1}try{n=new IntersectionObserver(M,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,k)}n.observe(e)}return s(!0),i}function mp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=pp(e),u=o||i?[...c?wo(c):[],...t?wo(t):[]]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?tI(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[x]=b;x&&x.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,g=l?ii(e):null;l&&y();function y(){const b=ii(e);g&&!YE(g,b)&&n(),g=b,p=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const nI=FN,rI=LN,oI=HN,iI=DN,sI=UN,aI=(e,t,n)=>{const r=new Map,o={platform:eI,...n},i={...o.platform,_c:r};return ON(e,t,{...o,platform:i})};var lI=typeof document<"u",cI=function(){},Il=lI?C.useLayoutEffect:cI;function nc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nc(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!nc(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function KE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _g(e,t){const n=KE(e);return Math.round(t*n)/n}function md(e){const t=C.useRef(e);return Il(()=>{t.current=e}),t}function uI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=C.useState(r);nc(f,r)||h(r);const[p,g]=C.useState(null),[y,b]=C.useState(null),x=C.useCallback(G=>{G!==A.current&&(A.current=G,g(G))},[]),k=C.useCallback(G=>{G!==D.current&&(D.current=G,b(G))},[]),O=i||p,M=s||y,A=C.useRef(null),D=C.useRef(null),z=C.useRef(u),Y=l!=null,N=md(l),K=md(o),F=md(c),q=C.useCallback(()=>{if(!A.current||!D.current)return;const G={placement:t,strategy:n,middleware:f};K.current&&(G.platform=K.current),aI(A.current,D.current,G).then(te=>{const S={...te,isPositioned:F.current!==!1};L.current&&!nc(z.current,S)&&(z.current=S,Xr.flushSync(()=>{d(S)}))})},[f,t,n,K,F]);Il(()=>{c===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[c]);const L=C.useRef(!1);Il(()=>(L.current=!0,()=>{L.current=!1}),[]),Il(()=>{if(O&&(A.current=O),M&&(D.current=M),O&&M){if(N.current)return N.current(O,M,q);q()}},[O,M,q,N,Y]);const H=C.useMemo(()=>({reference:A,floating:D,setReference:x,setFloating:k}),[x,k]),re=C.useMemo(()=>({reference:O,floating:M}),[O,M]),W=C.useMemo(()=>{const G={position:n,left:0,top:0};if(!re.floating)return G;const te=_g(re.floating,u.x),S=_g(re.floating,u.y);return a?{...G,transform:"translate("+te+"px, "+S+"px)",...KE(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:S}},[n,a,re.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:q,refs:H,elements:re,floatingStyles:W}),[u,q,H,re,W])}const qr=(e,t)=>{const n=nI(e);return{name:n.name,fn:n.fn,options:[e,t]}},xu=(e,t)=>{const n=oI(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cu=(e,t)=>{const n=iI(e);return{name:n.name,fn:n.fn,options:[e,t]}},rc=(e,t)=>{const n=sI(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{const n=rI(e);return{name:n.name,fn:n.fn,options:[e,t]}};function dI(e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const fI="data-floating-ui-focusable",Og="active",Rg="selected",hI={...aE};let Lg=!1,pI=0;const Dg=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+pI++;function mI(){const[e,t]=C.useState(()=>Lg?Dg():void 0);return Kt(()=>{e==null&&t(Dg())},[]),C.useEffect(()=>{Lg=!0},[]),e}const gI=hI.useId,XE=gI||mI;function bI(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const yI=C.createContext(null),EI=C.createContext(null),ZE=()=>{var e;return((e=C.useContext(yI))==null?void 0:e.id)||null},ku=()=>C.useContext(EI);function Ji(e){return"data-floating-ui-"+e}function hn(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Pg=Ji("safe-polygon");function gd(e,t,n){if(n&&!jf(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function bd(e){return typeof e=="function"?e():e}function xI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=e,{enabled:a=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,h=ku(),p=ZE(),g=tr(c),y=tr(l),b=tr(n),x=tr(d),k=C.useRef(),O=C.useRef(-1),M=C.useRef(),A=C.useRef(-1),D=C.useRef(!0),z=C.useRef(!1),Y=C.useRef(()=>{}),N=C.useRef(!1),K=bn(()=>{var W;const G=(W=o.current.openEvent)==null?void 0:W.type;return G?.includes("mouse")&&G!=="mousedown"});C.useEffect(()=>{if(!a)return;function W(G){let{open:te}=G;te||(hn(O),hn(A),D.current=!0,N.current=!1)}return i.on("openchange",W),()=>{i.off("openchange",W)}},[a,i]),C.useEffect(()=>{if(!a||!g.current||!n)return;function W(te){K()&&r(!1,te,"hover")}const G=rn(s.floating).documentElement;return G.addEventListener("mouseleave",W),()=>{G.removeEventListener("mouseleave",W)}},[s.floating,n,r,a,g,K]);const F=C.useCallback(function(W,G,te){G===void 0&&(G=!0),te===void 0&&(te="hover");const S=gd(y.current,"close",k.current);S&&!M.current?(hn(O),O.current=window.setTimeout(()=>r(!1,W,te),S)):G&&(hn(O),r(!1,W,te))},[y,r]),q=bn(()=>{Y.current(),M.current=void 0}),L=bn(()=>{if(z.current){const W=rn(s.floating).body;W.style.pointerEvents="",W.removeAttribute(Pg),z.current=!1}}),H=bn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function W(pe){if(hn(O),D.current=!1,u&&!jf(k.current)||bd(x.current)>0&&!gd(y.current,"open"))return;const v=gd(y.current,"open",k.current);v?O.current=window.setTimeout(()=>{b.current||r(!0,pe,"hover")},v):n||r(!0,pe,"hover")}function G(pe){if(H()){L();return}Y.current();const v=rn(s.floating);if(hn(A),N.current=!1,g.current&&o.current.floatingContext){n||hn(O),M.current=g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe,!0,"safe-polygon")}});const ve=M.current;v.addEventListener("mousemove",ve),Y.current=()=>{v.removeEventListener("mousemove",ve)};return}(k.current==="touch"?!pn(s.floating,pe.relatedTarget):!0)&&F(pe)}function te(pe){H()||o.current.floatingContext&&(g.current==null||g.current({...o.current.floatingContext,tree:h,x:pe.clientX,y:pe.clientY,onClose(){L(),q(),H()||F(pe)}})(pe))}function S(){hn(O)}function ye(pe){H()||F(pe,!1)}if(ct(s.domReference)){const pe=s.domReference,v=s.floating;return n&&pe.addEventListener("mouseleave",te),f&&pe.addEventListener("mousemove",W,{once:!0}),pe.addEventListener("mouseenter",W),pe.addEventListener("mouseleave",G),v&&(v.addEventListener("mouseleave",te),v.addEventListener("mouseenter",S),v.addEventListener("mouseleave",ye)),()=>{n&&pe.removeEventListener("mouseleave",te),f&&pe.removeEventListener("mousemove",W),pe.removeEventListener("mouseenter",W),pe.removeEventListener("mouseleave",G),v&&(v.removeEventListener("mouseleave",te),v.removeEventListener("mouseenter",S),v.removeEventListener("mouseleave",ye))}}},[s,a,e,u,f,F,q,L,r,n,b,h,y,g,o,H,x]),Kt(()=>{var W;if(a&&n&&(W=g.current)!=null&&(W=W.__options)!=null&&W.blockPointerEvents&&K()){z.current=!0;const te=s.floating;if(ct(s.domReference)&&te){var G;const S=rn(s.floating).body;S.setAttribute(Pg,"");const ye=s.domReference,pe=h==null||(G=h.nodesRef.current.find(v=>v.id===p))==null||(G=G.context)==null?void 0:G.elements.floating;return pe&&(pe.style.pointerEvents=""),S.style.pointerEvents="none",ye.style.pointerEvents="auto",te.style.pointerEvents="auto",()=>{S.style.pointerEvents="",ye.style.pointerEvents="",te.style.pointerEvents=""}}}},[a,n,p,s,h,g,K]),Kt(()=>{n||(k.current=void 0,N.current=!1,q(),L())},[n,q,L]),C.useEffect(()=>()=>{q(),hn(O),hn(A),L()},[a,s.domReference,q,L]);const re=C.useMemo(()=>{function W(G){k.current=G.pointerType}return{onPointerDown:W,onPointerEnter:W,onMouseMove(G){const{nativeEvent:te}=G;function S(){!D.current&&!b.current&&r(!0,te,"hover")}u&&!jf(k.current)||n||bd(x.current)===0||N.current&&G.movementX**2+G.movementY**2<2||(hn(A),k.current==="touch"?S():(N.current=!0,A.current=window.setTimeout(S,bd(x.current))))}}},[u,r,n,b,x]);return C.useMemo(()=>a?{reference:re}:{},[a,re])}let Bg=0;function wi(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Bg);const i=()=>e?.focus({preventScroll:n});o?i():Bg=requestAnimationFrame(i)}function yd(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&aa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function CI(e){return"composedPath"in e?e.composedPath()[0]:e.target}function kI(e){return e?.ownerDocument||document}const $i={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Fg(e){return e==="inert"?$i.inert:e==="aria-hidden"?$i["aria-hidden"]:$i.none}let Ya=new WeakSet,Ka={},Ed=0;const TI=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function JE(e){return e?aa(e)?e.host:JE(e.parentNode):null}const wI=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=JE(n);return e.contains(r)?r:null}).filter(n=>n!=null);function SI(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,s=wI(t,e),a=new Set,l=new Set(s),c=[];Ka[o]||(Ka[o]=new WeakMap);const u=Ka[o];s.forEach(d),f(t),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(Do(p)!=="script")if(a.has(p))f(p);else{const g=i?p.getAttribute(i):null,y=g!==null&&g!=="false",b=Fg(i),x=(b.get(p)||0)+1,k=(u.get(p)||0)+1;b.set(p,x),u.set(p,k),c.push(p),x===1&&y&&Ya.add(p),k===1&&p.setAttribute(o,""),!y&&i&&p.setAttribute(i,i==="inert"?"":"true")}})}return Ed++,()=>{c.forEach(h=>{const p=Fg(i),y=(p.get(h)||0)-1,b=(u.get(h)||0)-1;p.set(h,y),u.set(h,b),y||(!Ya.has(h)&&i&&h.removeAttribute(i),Ya.delete(h)),b||h.removeAttribute(o)}),Ed--,Ed||($i.inert=new WeakMap,$i["aria-hidden"]=new WeakMap,$i.none=new WeakMap,Ya=new WeakSet,Ka={})}}function Hg(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=kI(e[0]).body;return SI(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const gp={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},oc=C.forwardRef(function(t,n){const[r,o]=C.useState();Kt(()=>{gN()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ji("focus-guard")]:"",style:gp};return E.jsx("span",{...t,...i})}),vI={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ex=C.createContext(null),Ug=Ji("portal");function AI(e){e===void 0&&(e={});const{id:t,root:n}=e,r=XE(),o=tx(),[i,s]=C.useState(null),a=C.useRef(null);return Kt(()=>()=>{i?.remove(),queueMicrotask(()=>{a.current=null})},[i]),Kt(()=>{if(!r||a.current)return;const l=t?document.getElementById(t):null;if(!l)return;const c=document.createElement("div");c.id=r,c.setAttribute(Ug,""),l.appendChild(c),a.current=c,s(c)},[t,r]),Kt(()=>{if(n===null||!r||a.current)return;let l=n||o?.portalNode;l&&!fp(l)&&(l=l.current),l=l||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,l.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(Ug,""),l=c||l,l.appendChild(u),a.current=u,s(u)},[t,n,r,o]),i}function xd(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=AI({id:n,root:r}),[s,a]=C.useState(null),l=C.useRef(null),c=C.useRef(null),u=C.useRef(null),d=C.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return C.useEffect(()=>{if(!i||!o||f)return;function g(y){i&&Hs(y)&&(y.type==="focusin"?vg:IN)(i)}return i.addEventListener("focusin",g,!0),i.addEventListener("focusout",g,!0),()=>{i.removeEventListener("focusin",g,!0),i.removeEventListener("focusout",g,!0)}},[i,o,f]),C.useEffect(()=>{i&&(h||vg(i))},[h,i]),E.jsxs(ex.Provider,{value:C.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:a}),[o,i]),children:[p&&i&&E.jsx(oc,{"data-type":"outside",ref:l,onFocus:g=>{if(Hs(g,i)){var y;(y=u.current)==null||y.focus()}else{const b=s?s.domReference:null,x=$E(b);x?.focus()}}}),p&&i&&E.jsx("span",{"aria-owns":i.id,style:vI}),i&&Xr.createPortal(t,i),p&&i&&E.jsx(oc,{"data-type":"outside",ref:c,onFocus:g=>{if(Hs(g,i)){var y;(y=d.current)==null||y.focus()}else{const b=s?s.domReference:null,x=VE(b);x?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const tx=()=>C.useContext(ex);function Vg(e){return C.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t)})},e)}const $g=20;let yo=[];function bp(){yo=yo.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function NI(e){bp(),e&&Do(e)!=="body"&&(yo.push(new WeakRef(e)),yo.length>$g&&(yo=yo.slice(-$g)))}function jg(){bp();const e=yo[yo.length-1];return e?.deref()}function II(e){const t=Ma();return FE(e,t)?e:yu(e,t)[0]||e}function zg(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=Ma(),i=pN(e,r).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return FE(a,r)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const MI=C.forwardRef(function(t,n){return E.jsx("button",{...t,type:"button",ref:n,tabIndex:-1,style:gp})});function _I(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:s=0,returnFocus:a=!0,restoreFocus:l=!1,modal:c=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:h=()=>[]}=e,{open:p,onOpenChange:g,events:y,dataRef:b,elements:{domReference:x,floating:k}}=t,O=bn(()=>{var Ee;return(Ee=b.current.floatingContext)==null?void 0:Ee.nodeId}),M=bn(h),A=typeof s=="number"&&s<0,D=Tg(x)&&A,z=TI(),Y=z?i:!0,N=!Y||z&&f,K=tr(o),F=tr(s),q=tr(a),L=ku(),H=tx(),re=C.useRef(null),W=C.useRef(null),G=C.useRef(!1),te=C.useRef(!1),S=C.useRef(-1),ye=C.useRef(-1),pe=H!=null,v=wg(k),ze=bn(function(Ee){return Ee===void 0&&(Ee=v),Ee?yu(Ee,Ma()):[]}),ve=bn(Ee=>{const De=ze(Ee);return K.current.map(Ne=>x&&Ne==="reference"?x:v&&Ne==="floating"?v:De).filter(Boolean).flat()});C.useEffect(()=>{if(r||!c)return;function Ee(Ne){if(Ne.key==="Tab"){pn(v,_i(rn(v)))&&ze().length===0&&!D&&hd(Ne);const Ke=ve(),ft=ho(Ne);K.current[0]==="reference"&&ft===x&&(hd(Ne),Ne.shiftKey?wi(Ke[Ke.length-1]):wi(Ke[1])),K.current[1]==="floating"&&ft===v&&Ne.shiftKey&&(hd(Ne),wi(Ke[0]))}}const De=rn(v);return De.addEventListener("keydown",Ee),()=>{De.removeEventListener("keydown",Ee)}},[r,x,v,c,K,D,ze,ve]),C.useEffect(()=>{if(r||!k)return;function Ee(De){const Ne=ho(De),ft=ze().indexOf(Ne);ft!==-1&&(S.current=ft)}return k.addEventListener("focusin",Ee),()=>{k.removeEventListener("focusin",Ee)}},[r,k,ze]),C.useEffect(()=>{if(r||!d)return;function Ee(){te.current=!0,setTimeout(()=>{te.current=!1})}function De(ft){const Fe=ft.relatedTarget,Tn=ft.currentTarget,zt=ho(ft);queueMicrotask(()=>{const It=O(),_=!(pn(x,Fe)||pn(k,Fe)||pn(Fe,k)||pn(H?.portalNode,Fe)||Fe!=null&&Fe.hasAttribute(Ji("focus-guard"))||L&&(Ui(L.nodesRef.current,It).find(P=>{var U,oe;return pn((U=P.context)==null?void 0:U.elements.floating,Fe)||pn((oe=P.context)==null?void 0:oe.elements.domReference,Fe)})||Sg(L.nodesRef.current,It).find(P=>{var U,oe,ne;return[(U=P.context)==null?void 0:U.elements.floating,wg((oe=P.context)==null?void 0:oe.elements.floating)].includes(Fe)||((ne=P.context)==null?void 0:ne.elements.domReference)===Fe})));if(Tn===x&&v&&zg(v,K),l&&Tn!==x&&!(zt!=null&&zt.isConnected)&&_i(rn(v))===rn(v).body){Yt(v)&&v.focus();const P=S.current,U=ze(),oe=U[P]||U[U.length-1]||v;Yt(oe)&&oe.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(D||!c)&&Fe&&_&&!te.current&&Fe!==jg()&&(G.current=!0,g(!1,ft,"focus-out"))})}const Ne=!!(!L&&H);function Ke(){hn(ye),b.current.insideReactTree=!0,ye.current=window.setTimeout(()=>{b.current.insideReactTree=!1})}if(k&&Yt(x))return x.addEventListener("focusout",De),x.addEventListener("pointerdown",Ee),k.addEventListener("focusout",De),Ne&&k.addEventListener("focusout",Ke,!0),()=>{x.removeEventListener("focusout",De),x.removeEventListener("pointerdown",Ee),k.removeEventListener("focusout",De),Ne&&k.removeEventListener("focusout",Ke,!0)}},[r,x,k,v,c,L,H,g,d,l,ze,D,O,K,b]);const Le=C.useRef(null),Et=C.useRef(null),Pe=Vg([Le,H?.beforeInsideRef]),We=Vg([Et,H?.afterInsideRef]);C.useEffect(()=>{var Ee,De;if(r||!k)return;const Ne=Array.from((H==null||(Ee=H.portalNode)==null?void 0:Ee.querySelectorAll("["+Ji("portal")+"]"))||[]),ft=(De=(L?Sg(L.nodesRef.current,O()):[]).find(zt=>{var It;return Tg(((It=zt.context)==null?void 0:It.elements.domReference)||null)}))==null||(De=De.context)==null?void 0:De.elements.domReference,Fe=[k,ft,...Ne,...M(),re.current,W.current,Le.current,Et.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,K.current.includes("reference")||D?x:null].filter(zt=>zt!=null),Tn=c||D?Hg(Fe,!N,N):Hg(Fe);return()=>{Tn()}},[r,x,k,c,K,H,D,Y,N,L,O,M]),Kt(()=>{if(r||!Yt(v))return;const Ee=rn(v),De=_i(Ee);queueMicrotask(()=>{const Ne=ve(v),Ke=F.current,ft=(typeof Ke=="number"?Ne[Ke]:Ke.current)||v,Fe=pn(v,De);!A&&!Fe&&p&&wi(ft,{preventScroll:ft===v})})},[r,p,v,A,ve,F]),Kt(()=>{if(r||!v)return;const Ee=rn(v),De=_i(Ee);NI(De);function Ne(Fe){let{reason:Tn,event:zt,nested:It}=Fe;if(["hover","safe-polygon"].includes(Tn)&&zt.type==="mouseleave"&&(G.current=!0),Tn==="outside-press")if(It)G.current=!1;else if(kN(zt)||TN(zt))G.current=!1;else{let _=!1;document.createElement("div").focus({get preventScroll(){return _=!0,!1}}),_?G.current=!1:G.current=!0}}y.on("openchange",Ne);const Ke=Ee.createElement("span");Ke.setAttribute("tabindex","-1"),Ke.setAttribute("aria-hidden","true"),Object.assign(Ke.style,gp),pe&&x&&x.insertAdjacentElement("afterend",Ke);function ft(){if(typeof q.current=="boolean"){const Fe=x||jg();return Fe&&Fe.isConnected?Fe:Ke}return q.current.current||Ke}return()=>{y.off("openchange",Ne);const Fe=_i(Ee),Tn=pn(k,Fe)||L&&Ui(L.nodesRef.current,O(),!1).some(It=>{var _;return pn((_=It.context)==null?void 0:_.elements.floating,Fe)}),zt=ft();queueMicrotask(()=>{const It=II(zt);q.current&&!G.current&&Yt(It)&&(!(It!==Fe&&Fe!==Ee.body)||Tn)&&It.focus({preventScroll:!0}),Ke.remove()})}},[r,k,v,q,b,y,L,pe,x,O]),C.useEffect(()=>(queueMicrotask(()=>{G.current=!1}),()=>{queueMicrotask(bp)}),[r]),Kt(()=>{if(!r&&H)return H.setFocusManagerState({modal:c,closeOnFocusOut:d,open:p,onOpenChange:g,domReference:x}),()=>{H.setFocusManagerState(null)}},[r,H,c,p,g,d,x]),Kt(()=>{r||v&&zg(v,K)},[r,v,K]);function dt(Ee){return r||!u||!c?null:E.jsx(MI,{ref:Ee==="start"?re:W,onClick:De=>g(!1,De.nativeEvent),children:typeof u=="string"?u:"Dismiss"})}const xt=!r&&Y&&(c?!D:!0)&&(pe||c);return E.jsxs(E.Fragment,{children:[xt&&E.jsx(oc,{"data-type":"inside",ref:Pe,onFocus:Ee=>{if(c){const Ne=ve();wi(o[0]==="reference"?Ne[0]:Ne[Ne.length-1])}else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(G.current=!1,Hs(Ee,H.portalNode)){const Ne=VE(x);Ne?.focus()}else{var De;(De=H.beforeOutsideRef.current)==null||De.focus()}}}),!D&&dt("start"),n,dt("end"),xt&&E.jsx(oc,{"data-type":"inside",ref:We,onFocus:Ee=>{if(c)wi(ve()[0]);else if(H!=null&&H.preserveTabOrder&&H.portalNode)if(d&&(G.current=!0),Hs(Ee,H.portalNode)){const Ne=$E(x);Ne?.focus()}else{var De;(De=H.afterOutsideRef.current)==null||De.focus()}}})]})}const OI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},RI={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Wg=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function LI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=t,g=ku(),y=bn(typeof l=="function"?l:()=>!1),b=typeof l=="function"?y:l,x=C.useRef(!1),{escapeKey:k,outsidePress:O}=Wg(h),{escapeKey:M,outsidePress:A}=Wg(p),D=C.useRef(!1),z=bn(L=>{var H;if(!n||!s||!a||L.key!=="Escape"||D.current)return;const re=(H=i.current.floatingContext)==null?void 0:H.nodeId,W=g?Ui(g.nodesRef.current,re):[];if(!k&&(L.stopPropagation(),W.length>0)){let G=!0;if(W.forEach(te=>{var S;if((S=te.context)!=null&&S.open&&!te.context.dataRef.current.__escapeKeyBubbles){G=!1;return}}),!G)return}r(!1,CN(L)?L.nativeEvent:L,"escape-key")}),Y=bn(L=>{var H;const re=()=>{var W;z(L),(W=ho(L))==null||W.removeEventListener("keydown",re)};(H=ho(L))==null||H.addEventListener("keydown",re)}),N=bn(L=>{var H;const re=i.current.insideReactTree;i.current.insideReactTree=!1;const W=x.current;if(x.current=!1,c==="click"&&W||re||typeof b=="function"&&!b(L))return;const G=ho(L),te="["+Ji("inert")+"]",S=rn(o.floating).querySelectorAll(te);let ye=ct(G)?G:null;for(;ye&&!Wr(ye);){const ve=Zr(ye);if(Wr(ve)||!ct(ve))break;ye=ve}if(S.length&&ct(G)&&!EN(G)&&!pn(G,o.floating)&&Array.from(S).every(ve=>!pn(ye,ve)))return;if(Yt(G)&&q){const ve=Wr(G),Le=Wn(G),Et=/auto|scroll/,Pe=ve||Et.test(Le.overflowX),We=ve||Et.test(Le.overflowY),dt=Pe&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,xt=We&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ee=Le.direction==="rtl",De=xt&&(Ee?L.offsetX<=G.offsetWidth-G.clientWidth:L.offsetX>G.clientWidth),Ne=dt&&L.offsetY>G.clientHeight;if(De||Ne)return}const pe=(H=i.current.floatingContext)==null?void 0:H.nodeId,v=g&&Ui(g.nodesRef.current,pe).some(ve=>{var Le;return fd(L,(Le=ve.context)==null?void 0:Le.elements.floating)});if(fd(L,o.floating)||fd(L,o.domReference)||v)return;const ze=g?Ui(g.nodesRef.current,pe):[];if(ze.length>0){let ve=!0;if(ze.forEach(Le=>{var Et;if((Et=Le.context)!=null&&Et.open&&!Le.context.dataRef.current.__outsidePressBubbles){ve=!1;return}}),!ve)return}r(!1,L,"outside-press")}),K=bn(L=>{var H;const re=()=>{var W;N(L),(W=ho(L))==null||W.removeEventListener(c,re)};(H=ho(L))==null||H.addEventListener(c,re)});C.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=k,i.current.__outsidePressBubbles=O;let L=-1;function H(S){r(!1,S,"ancestor-scroll")}function re(){window.clearTimeout(L),D.current=!0}function W(){L=window.setTimeout(()=>{D.current=!1},gu()?5:0)}const G=rn(o.floating);a&&(G.addEventListener("keydown",M?Y:z,M),G.addEventListener("compositionstart",re),G.addEventListener("compositionend",W)),b&&G.addEventListener(c,A?K:N,A);let te=[];return f&&(ct(o.domReference)&&(te=wo(o.domReference)),ct(o.floating)&&(te=te.concat(wo(o.floating))),!ct(o.reference)&&o.reference&&o.reference.contextElement&&(te=te.concat(wo(o.reference.contextElement)))),te=te.filter(S=>{var ye;return S!==((ye=G.defaultView)==null?void 0:ye.visualViewport)}),te.forEach(S=>{S.addEventListener("scroll",H,{passive:!0})}),()=>{a&&(G.removeEventListener("keydown",M?Y:z,M),G.removeEventListener("compositionstart",re),G.removeEventListener("compositionend",W)),b&&G.removeEventListener(c,A?K:N,A),te.forEach(S=>{S.removeEventListener("scroll",H)}),window.clearTimeout(L)}},[i,o,a,b,c,n,r,f,s,k,O,z,M,Y,N,A,K]),C.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const F=C.useMemo(()=>({onKeyDown:z,...u&&{[OI[d]]:L=>{r(!1,L.nativeEvent,"reference-press")},...d!=="click"&&{onClick(L){r(!1,L.nativeEvent,"reference-press")}}}}),[z,r,u,d]),q=C.useMemo(()=>{function L(H){H.button===0&&(x.current=!0)}return{onKeyDown:z,onMouseDown:L,onMouseUp:L,[RI[c]]:()=>{i.current.insideReactTree=!0}}},[z,c,i]);return C.useMemo(()=>s?{reference:F,floating:q}:{},[s,F,q])}function DI(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=XE(),i=C.useRef({}),[s]=C.useState(()=>bI()),a=ZE()!=null,[l,c]=C.useState(r.reference),u=bn((h,p,g)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:c}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[t,u,f,s,o,d])}function PI(e){e===void 0&&(e={});const{nodeId:t}=e,n=DI({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=C.useState(null),[a,l]=C.useState(null),u=o?.domReference||i,d=C.useRef(null),f=ku();Kt(()=>{u&&(d.current=u)},[u]);const h=uI({...e,elements:{...o,...a&&{reference:a}}}),p=C.useCallback(k=>{const O=ct(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;l(O),h.refs.setReference(O)},[h.refs]),g=C.useCallback(k=>{(ct(k)||k===null)&&(d.current=k,s(k)),(ct(h.refs.reference.current)||h.refs.reference.current===null||k!==null&&!ct(k))&&h.refs.setReference(k)},[h.refs]),y=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),b=C.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),x=C.useMemo(()=>({...h,...r,refs:y,elements:b,nodeId:t}),[h,y,b,t,r]);return Kt(()=>{r.dataRef.current.floatingContext=x;const k=f?.nodesRef.current.find(O=>O.id===t);k&&(k.context=x)}),C.useMemo(()=>({...h,context:x,refs:y,elements:b}),[h,y,b,x])}function Cd(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Og]:s,[Rg]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[fI]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[Og,Rg].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(c))==null?void 0:f.map(y=>y(...p)).find(y=>y!==void 0)}}}else s[c]=u}),s),{})}}function BI(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=C.useCallback(a=>Cd(a,e,"reference"),t),i=C.useCallback(a=>Cd(a,e,"floating"),n),s=C.useCallback(a=>Cd(a,e,"item"),r);return C.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const qg=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase());function Si(e,t){return typeof e=="function"?e(t):e}function FI(e,t){const[n,r]=C.useState(e);return e&&!n&&r(!0),C.useEffect(()=>{if(!e&&n){const o=setTimeout(()=>r(!1),t);return()=>clearTimeout(o)}},[e,n,t]),n}function nx(e,t){t===void 0&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,s=(typeof o=="number"?o:o.close)||0,[a,l]=C.useState("unmounted"),c=FI(n,s);return!c&&a==="close"&&l("unmounted"),Kt(()=>{if(r){if(n){l("initial");const u=requestAnimationFrame(()=>{Xr.flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(u)}}l("close")}},[n,r]),{isMounted:c,status:a}}function HI(e,t){t===void 0&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=t,a=e.placement,l=a.split("-")[0],c=C.useMemo(()=>({side:l,placement:a}),[l,a]),u=typeof s=="number",d=(u?s:s.open)||0,f=(u?s:s.close)||0,[h,p]=C.useState(()=>({...Si(i,c),...Si(n,c)})),{isMounted:g,status:y}=nx(e,{duration:s}),b=tr(n),x=tr(r),k=tr(o),O=tr(i);return Kt(()=>{const M=Si(b.current,c),A=Si(k.current,c),D=Si(O.current,c),z=Si(x.current,c)||Object.keys(M).reduce((Y,N)=>(Y[N]="",Y),{});if(y==="initial"&&p(Y=>({transitionProperty:Y.transitionProperty,...D,...M})),y==="open"&&p({transitionProperty:Object.keys(z).map(qg).join(","),transitionDuration:d+"ms",...D,...z}),y==="close"){const Y=A||M;p({transitionProperty:Object.keys(Y).map(qg).join(","),transitionDuration:f+"ms",...D,...Y})}},[f,k,b,x,O,d,y,c]),{isMounted:g,styles:h}}function rx(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...rx(e,o.id,n)])}function Gg(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let s=0,a=i-1;s<i;a=s++){const[l,c]=t[s]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function UI(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function VI(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,s=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(s===null||a===null||p===0)return s=d,a=f,l=h,null;const g=d-s,y=f-a,x=Math.sqrt(g*g+y*y)/p;return s=d,a=f,l=h,x}const u=d=>{let{x:f,y:h,placement:p,elements:g,onClose:y,nodeId:b,tree:x}=d;return function(O){function M(){hn(o),y()}if(hn(o),!g.domReference||!g.floating||p==null||f==null||h==null)return;const{clientX:A,clientY:D}=O,z=[A,D],Y=CI(O),N=O.type==="mouseleave",K=yd(g.floating,Y),F=yd(g.domReference,Y),q=g.domReference.getBoundingClientRect(),L=g.floating.getBoundingClientRect(),H=p.split("-")[0],re=f>L.right-L.width/2,W=h>L.bottom-L.height/2,G=UI(z,q),te=L.width>q.width,S=L.height>q.height,ye=(te?q:L).left,pe=(te?q:L).right,v=(S?q:L).top,ze=(S?q:L).bottom;if(K&&(i=!0,!N))return;if(F&&(i=!1),F&&!N){i=!0;return}if(N&&ct(O.relatedTarget)&&yd(g.floating,O.relatedTarget)||x&&rx(x.nodesRef.current,b).length)return;if(H==="top"&&h>=q.bottom-1||H==="bottom"&&h<=q.top+1||H==="left"&&f>=q.right-1||H==="right"&&f<=q.left+1)return M();let ve=[];switch(H){case"top":ve=[[ye,q.top+1],[ye,L.bottom-1],[pe,L.bottom-1],[pe,q.top+1]];break;case"bottom":ve=[[ye,L.top+1],[ye,q.bottom-1],[pe,q.bottom-1],[pe,L.top+1]];break;case"left":ve=[[L.right-1,ze],[L.right-1,v],[q.left+1,v],[q.left+1,ze]];break;case"right":ve=[[q.right-1,ze],[q.right-1,v],[L.left+1,v],[L.left+1,ze]];break}function Le(Et){let[Pe,We]=Et;switch(H){case"top":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We+t+1],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We+t+1],Ee=[[L.left,re||te?L.bottom-t:L.top],[L.right,re?te?L.bottom-t:L.top:L.bottom-t]];return[dt,xt,...Ee]}case"bottom":{const dt=[te?Pe+t/2:re?Pe+t*4:Pe-t*4,We-t],xt=[te?Pe-t/2:re?Pe+t*4:Pe-t*4,We-t],Ee=[[L.left,re||te?L.top+t:L.bottom],[L.right,re?te?L.top+t:L.bottom:L.top+t]];return[dt,xt,...Ee]}case"left":{const dt=[Pe+t+1,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe+t+1,S?We-t/2:W?We+t*4:We-t*4];return[...[[W||S?L.right-t:L.left,L.top],[W?S?L.right-t:L.left:L.right-t,L.bottom]],dt,xt]}case"right":{const dt=[Pe-t,S?We+t/2:W?We+t*4:We-t*4],xt=[Pe-t,S?We-t/2:W?We+t*4:We-t*4],Ee=[[W||S?L.left+t:L.right,L.top],[W?S?L.left+t:L.right:L.left+t,L.bottom]];return[dt,xt,...Ee]}}}if(!Gg([A,D],ve)){if(i&&!G)return M();if(!N&&r){const Et=c(O.clientX,O.clientY);if(Et!==null&&Et<.1)return M()}Gg([A,D],Le([f,h]))?!i&&r&&(o.current=window.setTimeout(M,40)):M()}}};return u.__options={blockPointerEvents:n},u}var kd={exports:{}},Td={};var Yg;function $I(){if(Yg)return Td;Yg=1;var e=Ev(),t=Nv();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Td.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function b(A){if(!x){if(x=!0,k=A,A=f(A),h!==void 0&&g.hasValue){var D=g.value;if(h(D,A))return O=D}return O=A}if(D=O,r(k,A))return D;var z=f(A);return h!==void 0&&h(D,z)?(k=A,D):(k=A,O=z)}var x=!1,k,O,M=d===void 0?null:d;return[function(){return b(u())},M===null?void 0:function(){return b(M())}]},[u,d,f,h]);var y=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Td}var Kg;function jI(){return Kg||(Kg=1,kd.exports=$I()),kd.exports}var ox=jI();const ji=new WeakMap,Ml=new WeakMap,ic={current:[]};let wd=!1;const Qa=new Set,Qg=new Map;function ix(e){const t=Array.from(e).sort((n,r)=>n instanceof zi&&n.options.deps.includes(r)?1:r instanceof zi&&r.options.deps.includes(n)?-1:0);for(const n of t){if(ic.current.includes(n))continue;ic.current.push(n),n.recompute();const r=Ml.get(n);if(r)for(const o of r){const i=ji.get(o);i&&ix(i)}}}function zI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function WI(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qI(e){if(Qa.add(e),!wd)try{for(wd=!0;Qa.size>0;){const t=Array.from(Qa);Qa.clear();for(const n of t){const r=Qg.get(n)??n.prevState;n.prevState=r,zI(n)}for(const n of t){const r=ji.get(n);r&&(ic.current.push(n),ix(r))}for(const n of t){const r=ji.get(n);if(r)for(const o of r)WI(o)}}}finally{wd=!1,ic.current=[],Qg.clear()}}function GI(e){return typeof e=="function"}class zf{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):GI(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),qI(this)}}class zi{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),o=new Array(n);for(let i=0;i<n;i++){const s=this.options.deps[i];r[i]=s.prevState,o[i]=s.state}return this.lastSeenDepValues=o,{prevDepVals:r,currDepVals:o,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const o=this.getDepVals();this.state=this.options.fn(o),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof zi&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let i=0;i<o.length;i++)if(o[i]!==r[i]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,o;this.listeners.add(n);const i=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,n,this);return()=>{this.listeners.delete(n),i?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof zf){let r=ji.get(n);r||(r=new Set,ji.set(n,r)),r.add(this);let o=Ml.get(this);o||(o=new Set,Ml.set(this,o)),o.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof zi)this.unregisterFromGraph(n.options.deps);else if(n instanceof zf){const r=ji.get(n);r&&r.delete(this);const o=Ml.get(this);o&&o.delete(n)}}}function YI(e,t=n=>n){return ox.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,KI)}function KI(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Xg(e);if(n.length!==Xg(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Xg(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Wf=Symbol("originalFactory");function Ve(e){if(typeof e=="object"&&"key"in e)return function t(){return e[Wf]=t,e};if(typeof e!="function")throw Error("factory must be a function");return function t(n){return r=>{let o=e({editor:r.editor,options:n});return o[Wf]=t,o}}}function Po(e,t){return new zf(e,t)}function Ft(e){this.content=e}Ft.prototype={constructor:Ft,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ft(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Ft(n)},addToStart:function(e,t){return new Ft([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ft(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new Ft(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Ft.from(e),e.size?new Ft(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ft.from(e),e.size?new Ft(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ft.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};Ft.from=function(e){if(e instanceof Ft)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ft(t)};function sx(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=sx(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function ax(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=ax(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class j{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new j(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new j(r,o)}cutByIndex(t,n){return t==n?j.empty:t==0&&n==this.content.length?this:new j(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new j(o,i)}addToStart(t){return new j([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new j(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return sx(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return ax(this,t,n,r)}findIndex(t){if(t==0)return Xa(0,t);if(t==this.size)return Xa(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t?Xa(n+1,i):Xa(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return j.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new j(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return j.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new j(n||t,r)}static from(t){if(!t)return j.empty;if(t instanceof j)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new j([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}j.empty=new j([],0);const Sd={index:0,offset:0};function Xa(e,t){return Sd.index=e,Sd.offset=t,Sd}function sc(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!sc(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!sc(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let Xe=class qf{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&sc(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return qf.none;if(t instanceof qf)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Xe.none=[];class ac extends Error{}class Z{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=cx(this.content,t+this.openStart,n);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Z(lx(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Z.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(j.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Z(t,r,o)}}Z.empty=new Z(j.empty,0,0);function lx(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(lx(i.content,t-o-1,n-o-1)))}function cx(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=cx(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function QI(e,t,n){if(n.openStart>e.depth)throw new ac("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ac("Inconsistent open depths");return ux(e,t,n,0)}function ux(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ux(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return Jo(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=XI(n,e);return Jo(i,fx(e,s,a,t,r))}else return Jo(i,lc(e,t,r))}function dx(e,t){if(!t.type.compatibleContent(e.type))throw new ac("Cannot join "+t.type.name+" onto "+e.type.name)}function Gf(e,t,n){let r=e.node(n);return dx(r,t.node(n)),r}function Zo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Us(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Zo(e.nodeAfter,r),i++));for(let a=i;a<s;a++)Zo(o.child(a),r);t&&t.depth==n&&t.textOffset&&Zo(t.nodeBefore,r)}function Jo(e,t){return e.type.checkContent(t),e.copy(t)}function fx(e,t,n,r,o){let i=e.depth>o&&Gf(e,t,o+1),s=r.depth>o&&Gf(n,r,o+1),a=[];return Us(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(dx(i,s),Zo(Jo(i,fx(e,t,n,r,o+1)),a)):(i&&Zo(Jo(i,lc(e,t,o+1)),a),Us(t,n,o,a),s&&Zo(Jo(s,lc(n,r,o+1)),a)),Us(r,null,o,a),new j(a)}function lc(e,t,n){let r=[];if(Us(null,e,n,r),e.depth>n){let o=Gf(e,t,n+1);Zo(Jo(o,lc(e,t,n+1)),r)}return Us(t,null,n,r),new j(r)}function XI(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(j.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class la{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Xe.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new ca(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new la(n,r,i)}static resolveCached(t,n){let r=Zg.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Zg.set(t,r=new ZI);let o=r.elts[r.i]=la.resolve(t,n);return r.i=(r.i+1)%JI,o}}class ZI{constructor(){this.elts=[],this.i=0}}const JI=12,Zg=new WeakMap;class ca{constructor(t,n,r){this.$from=t,this.$to=n,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 eM=Object.create(null);let Gr=class Yf{constructor(t,n,r,o=Xe.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||j.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&sc(this.attrs,n||t.defaultAttrs||eM)&&Xe.sameSet(this.marks,r||Xe.none)}copy(t=null){return t==this.content?this:new Yf(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Yf(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Z.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Z(c,o.depth-s,i.depth-s)}replace(t,n,r){return QI(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return la.resolveCached(this,t)}resolveNoCache(t){return la.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),hx(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=j.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!Xe.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=j.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Gr.prototype.text=void 0;class cc extends Gr{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):hx(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new cc(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new cc(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function hx(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class si{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new tM(t,n);if(r.next==null)return si.empty;let o=px(r);r.next&&r.err("Unexpected trailing text");let i=lM(aM(o));return cM(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return j.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
3
+ `)}}si.empty=new si(!0);class tM{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function px(e){let t=[];do t.push(nM(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function nM(e){let t=[];do t.push(rM(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function rM(e){let t=sM(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=oM(e,t);else break;return t}function Jg(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function oM(e,t){let n=Jg(e),r=n;return e.eat(",")&&(e.next!="}"?r=Jg(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function iM(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function sM(e){if(e.eat("(")){let t=px(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=iM(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function aM(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function mx(e,t){return t-e}function e0(e,t){let n=[];return r(t),n.sort(mx);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function lM(e){let t=Object.create(null);return n(e0(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);e0(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new si(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(mx);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function cM(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gx(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function bx(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function yx(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function Ex(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new dM(e,r,t[r]);return n}let t0=class xx{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ex(t,r.attrs),this.defaultAttrs=gx(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==si.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:bx(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gr(this,this.computeAttrs(t),j.from(n),Xe.setFrom(r))}createChecked(t=null,n,r){return n=j.from(n),this.checkContent(n),new Gr(this,this.computeAttrs(t),n,Xe.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=j.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(j.empty,!0);return i?new Gr(this,t,n.append(i),Xe.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){yx(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:Xe.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new xx(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function uM(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class dM{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?uM(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tu{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=Ex(t,o.attrs),this.excluded=null;let i=gx(this.attrs);this.instance=i?new Xe(this,i):null}create(t=null){return!t&&this.instance?this.instance:new Xe(this,bx(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new Tu(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){yx(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}let Cx=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=Ft.from(t.nodes),n.marks=Ft.from(t.marks||{}),this.nodes=t0.compile(this.spec.nodes,this),this.marks=Tu.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=si.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?n0(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:n0(this,s.split(" "))}this.nodeFromJSON=o=>Gr.fromJSON(this,o),this.markFromJSON=o=>Xe.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof t0){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new cc(r,r.defaultAttrs,t,Xe.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function n0(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function fM(e){return e.tag!=null}function hM(e){return e.style!=null}class sn{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(fM(o))this.tags.push(o);else if(hM(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new o0(this,n,!1);return r.addAll(t,Xe.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new o0(this,n,!0);return r.addAll(t,Xe.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(gM(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i0(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i0(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new sn(t,sn.schemaRules(t)))}}const kx={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},pM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tx={ol:!0,ul:!0},ua=1,Kf=2,Vs=4;function r0(e,t,n){return t!=null?(t?ua:0)|(t==="full"?Kf:0):e&&e.whitespace=="pre"?ua|Kf:n&~Vs}class Za{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Xe.none,this.match=i||(s&Vs?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(j.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&ua)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=j.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(j.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!kx.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class o0{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=r0(null,n.preserveWhitespace,0)|(r?Vs:0);o?i=new Za(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Za(null,null,Xe.none,!0,null,s):i=new Za(t.schema.topNodeType,null,Xe.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top,i=o.options&Kf?"full":this.localPreserveWS||(o.options&ua)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
4
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=t.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),a;Tx.hasOwnProperty(s)&&this.parser.normalizeLists&&mM(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(a=this.parser.matchTag(t,this,r));e:if(l?l.ignore:pM.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let c,u=this.needsBlock;if(kx.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=l&&l.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(t,n);c&&this.addElementByRule(t,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
5
+ `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(t);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(t,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let s=Xe.none;for(let a of o.concat(t.marks))(i.type?i.type.allowsMarkType(a.type):s0(a.type,t.type))&&(s=a.addToSet(s));return i.content.push(t.mark(s)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r,!1);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=r0(t,i,s.options);s.options&Vs&&s.content.length==0&&(a|=Vs);let l=Xe.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):s0(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Za(t,n,l,o,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ua)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function mM(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&Tx.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function gM(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function i0(e){let t={};for(let n in e)t[n]=e[n];return t}function s0(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class On{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=vd(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=_l(vd(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&_l(vd(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return _l(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new On(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=a0(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return a0(t.marks)}}function a0(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function vd(e){return e.document||window.document}const l0=new WeakMap;function bM(e){let t=l0.get(e);return t===void 0&&l0.set(e,t=yM(e)),t}function yM(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function _l(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=bM(r))&&i.indexOf(t)>-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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=_l(e,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const wx=65535,Sx=Math.pow(2,16);function EM(e,t){return e+t*Sx}function c0(e){return e&wx}function xM(e){return(e-(e&wx))/Sx}const vx=1,Ax=2,Ol=4,Nx=8;class Qf{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Nx)>0}get deletedBefore(){return(this.delInfo&(vx|Ol))>0}get deletedAfter(){return(this.delInfo&(Ax|Ol))>0}get deletedAcross(){return(this.delInfo&Ol)>0}}class An{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&An.empty)return An.empty}recover(t){let n=0,r=c0(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+xM(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(t<=d){let f=c?t==l?-1:t==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=t==(n<0?l:d)?null:EM(a/3,t-l),g=t==l?Ax:t==d?vx:Ol;return(n<0?t!=l:t!=d)&&(g|=Nx),new Qf(h,g,p)}o+=u-c}return r?t+o:new Qf(t+o,0,null)}touches(t,n){let r=0,o=c0(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new An(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?An.empty:new An(t<0?[0,-t,0]:[0,0,t])}}An.empty=new An([]);class es{constructor(t,n,r=0,o=t?t.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new es(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let o=t.getMirror(n);this.appendMap(t._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new es;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new Qf(t,o,null)}}const Ad=Object.create(null);class Jt{getMap(){return An.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ad[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Ad)throw new RangeError("Duplicate use of step JSON ID "+t);return Ad[t]=n,n.prototype.jsonID=t,n}}class At{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new At(t,null)}static fail(t){return new At(null,t)}static fromReplace(t,n,r,o){try{return At.ok(t.replace(n,r,o))}catch(i){if(i instanceof ac)return At.fail(i.message);throw i}}}function yp(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(yp(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return j.fromArray(r)}class Eo extends Jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new Z(yp(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,i)}invert(){return new nr(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Eo(n.pos,r.pos,this.mark)}merge(t){return t instanceof Eo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Eo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Eo(n.from,n.to,t.markFromJSON(n.mark))}}Jt.jsonID("addMark",Eo);class nr extends Jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Z(yp(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return At.fromReplace(t,this.from,this.to,r)}invert(){return new Eo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new nr(n.pos,r.pos,this.mark)}merge(t){return t instanceof nr&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new nr(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nr(n.from,n.to,t.markFromJSON(n.mark))}}Jt.jsonID("removeMark",nr);class xo extends Jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return At.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return At.fromReplace(t,this.pos,this.pos+1,new Z(j.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new xo(this.pos,n.marks[o]);return new xo(this.pos,this.mark)}}return new ai(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xo(n.pos,t.markFromJSON(n.mark))}}Jt.jsonID("addNodeMark",xo);class ai extends Jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return At.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return At.fromReplace(t,this.pos,this.pos+1,new Z(j.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new xo(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ai(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ai(n.pos,t.markFromJSON(n.mark))}}Jt.jsonID("removeNodeMark",ai);class vt extends Jt{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&Xf(t,this.from,this.to)?At.fail("Structure replace would overwrite content"):At.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new An([this.from,this.to-this.from,this.slice.size])}invert(t){return new vt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new vt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof vt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new vt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Z.empty:new Z(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new vt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new vt(n.from,n.to,Z.fromJSON(t,n.slice),!!n.structure)}}Jt.jsonID("replace",vt);class yt extends Jt{constructor(t,n,r,o,i,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(t){if(this.structure&&(Xf(t,this.from,this.gapFrom)||Xf(t,this.gapTo,this.to)))return At.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return At.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?At.fromReplace(t,this.from,this.to,r):At.fail("Content does not fit in gap")}getMap(){return new An([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new yt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new yt(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new yt(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(t,n.slice),n.insert,!!n.structure)}}Jt.jsonID("replaceAround",yt);function Xf(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function CM(e,t,n,r){let o=[],i=[],s,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,t),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new nr(f,h,d[g])));a&&a.to==f?a.to=h:i.push(a=new Eo(f,h,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function kM(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Tu){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new nr(s.from,s.to,s.style)))}function Ep(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new vt(a,u,Z.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||e.step(new nr(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Z(j.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new vt(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(j.empty,!0);e.replace(a,a,new Z(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function TM(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function yi(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,o=0,i=0;;--r){let s=e.$from.node(r),a=e.$from.index(r)+o,l=e.$to.indexAfter(r)-i;if(r<e.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!TM(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function wM(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=j.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=j.from(r.node(p).copy(u)),d++):l--;let f=j.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=j.from(o.node(p).copy(f)),h++):c++;e.step(new yt(l,c,s,a,new Z(u.append(f),d,h),u.size-d,!0))}function Ix(e,t,n=null,r=e){let o=SM(e,t),i=o&&vM(r,t);return i?o.map(u0).concat({type:t,attrs:n}).concat(i.map(u0)):null}function u0(e){return{type:e,attrs:null}}function SM(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function vM(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function AM(e,t,n){let r=j.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=j.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new yt(o,i,o,i,new Z(r,0,0),n.length,!0))}function NM(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&IM(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&_x(e,s,a,i),Ep(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return e.step(new yt(d,f,d+1,f-1,new Z(j.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Mx(e,s,a,i),!1}})}function Mx(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function _x(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
6
+ `))}})}function IM(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function MM(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new yt(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Z(j.from(s),0,0),1,!0))}function Yr(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function _M(e,t,n=1,r){let o=e.doc.resolve(t),i=j.empty,s=j.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=j.from(o.node(a).copy(i));let u=r&&r[c];s=j.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}e.step(new vt(t,t,new Z(i.append(s),n,n),!0))}function Bo(e,t){let n=e.resolve(t),r=n.index();return Ox(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function OM(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function Ox(e,t){return!!(e&&t&&!e.isLeaf&&OM(e,t))}function wu(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&Ox(i,s)&&r.node(o).canReplace(a,a+1))return t;if(o==0)break;t=n<0?r.before(o):r.after(o)}}function RM(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);_x(e,u.node(),u.before(),a)}s.inlineContent&&Ep(e,t+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new vt(c,l.map(t+n,-1),Z.empty,!0)),r===!0){let u=e.doc.resolve(c);Mx(e,u.node(),u.before(),e.steps.length)}return e}function LM(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Rx(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Su(e,t,n=t,r=Z.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Lx(o,i,r)?new vt(t,n,r):new DM(o,i,r).fit()}function Lx(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class DM{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=j.empty;for(let o=0;o<=t.depth;o++){let i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=j.from(t.node(o).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 t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new Z(i,s,a);return t>-1?new yt(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new vt(r.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Nd(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(j.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=Nd(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new Z(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=Nd(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new Z(Is(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Z(Is(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let h=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let g=a.child(c),y=d.matchType(g.type);if(!y)break;c++,(c>1||l==0||g.content.size)&&(d=y,u.push(Dx(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Ms(this.placed,n,j.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=p?t==0?Z.empty:new Z(Is(s.content,t-1,1),t-1,h<0?s.openEnd:t-1):new Z(Is(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Id(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=Id(t,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Id(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ms(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Ms(this.placed,this.depth,j.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(j.empty,!0);n.childCount&&(this.placed=Ms(this.placed,this.frontier.length,n))}}function Is(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Is(e.firstChild.content,t-1,n)))}function Ms(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ms(e.lastChild.content,t-1,n)))}function Nd(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Dx(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Dx(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(j.empty,!0)))),e.copy(r)}function Id(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!PM(n,i.content,s)?a:null}function PM(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function BM(e){return e.spec.defining||e.spec.definingForContent}function FM(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Lx(o,i,r))return e.step(new vt(t,n,r));let s=Bx(o,i);s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==h&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=BM(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<s.length;g++){let y=s[(g+l)%s.length],b=!0;y<0&&(b=!1,y=-y);let x=o.node(y-1),k=o.index(y-1);if(x.canReplaceWith(k,k,p.type,p.marks))return e.replace(o.before(y),b?i.after(y):n,new Z(Px(r.content,0,r.openStart,h),h,r.openEnd))}}let d=e.steps.length;for(let f=s.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let h=s[f];h<0||(t=o.before(h),n=i.after(h))}}function Px(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Px(i.content,t+1,n,r,i)))}if(t>r){let i=o.contentMatchAt(0),s=i.fillBefore(e).append(e);e=s.append(i.matchFragment(s).fillBefore(j.empty,!0))}return e}function HM(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=LM(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new Z(j.from(r),0,0))}function UM(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Bx(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return e.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}function Bx(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&n.push(o)}return n}class Wi extends Jt{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return At.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return At.fromReplace(t,this.pos,this.pos+1,new Z(j.from(o),0,n.isLeaf?0:1))}getMap(){return An.empty}invert(t){return new Wi(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Wi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wi(n.pos,n.attr,n.value)}}Jt.jsonID("attr",Wi);class da extends Jt{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return At.ok(r)}getMap(){return An.empty}invert(t){return new da(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new da(n.attr,n.value)}}Jt.jsonID("docAttr",da);let ts=class extends Error{};ts=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};ts.prototype=Object.create(Error.prototype);ts.prototype.constructor=ts;ts.prototype.name="TransformError";class xp{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new es}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new ts(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(t=o.map(t,1),n=o.map(n,-1)),o.forEach((i,s,a,l)=>{t=Math.min(t,a),n=Math.max(n,l)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=Z.empty){let o=Su(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new Z(j.from(r),0,0))}delete(t,n){return this.replace(t,n,Z.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return FM(this,t,n,r),this}replaceRangeWith(t,n,r){return HM(this,t,n,r),this}deleteRange(t,n){return UM(this,t,n),this}lift(t,n){return wM(this,t,n),this}join(t,n=1){return RM(this,t,n),this}wrap(t,n){return AM(this,t,n),this}setBlockType(t,n=t,r,o=null){return NM(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return MM(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new Wi(t,n,r)),this}setDocAttribute(t,n){return this.step(new da(t,n)),this}addNodeMark(t,n){return this.step(new xo(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new ai(t,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new ai(t,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(t,n=1,r){return _M(this,t,n,r),this}addMark(t,n,r){return CM(this,t,n,r),this}removeMark(t,n,r){return kM(this,t,n,r),this}clearIncompatible(t,n,r){return Ep(this,t,n,r),this}}const Md=Object.create(null);class ge{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new Fx(t.min(n),t.max(n))]}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 t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=Z.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=t.mapping.slice(i);t.replaceRange(u.map(l.pos),u.map(c.pos),a?Z.empty:n),a==0&&h0(t,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=t.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),h0(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new se(t):Oi(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let i=t.depth-1;i>=0;i--){let s=n<0?Oi(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):Oi(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(s)return s}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new xn(t.node(0))}static atStart(t){return Oi(t,t,0,0,1)||new xn(t)}static atEnd(t){return Oi(t,t,t.content.size,t.childCount,-1)||new xn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Md[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Md)throw new RangeError("Duplicate use of selection JSON ID "+t);return Md[t]=n,n.prototype.jsonID=t,n}getBookmark(){return se.between(this.$anchor,this.$head).getBookmark()}}ge.prototype.visible=!0;class Fx{constructor(t,n){this.$from=t,this.$to=n}}let d0=!1;function f0(e){!d0&&!e.parent.inlineContent&&(d0=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class se extends ge{constructor(t,n=t){f0(t),f0(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return ge.near(r);let o=t.resolve(n.map(this.anchor));return new se(o.parent.inlineContent?o:r,r)}replace(t,n=Z.empty){if(super.replace(t,n),n==Z.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof se&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new vu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new se(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=ge.findFrom(n,r,!0)||ge.findFrom(n,-r,!0);if(i)n=i.$head;else return ge.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(ge.findFrom(t,-r,!0)||ge.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new se(t,n)}}ge.jsonID("text",se);class vu{constructor(t,n){this.anchor=t,this.head=n}map(t){return new vu(t.map(this.anchor),t.map(this.head))}resolve(t){return se.between(t.resolve(this.anchor),t.resolve(this.head))}}class le extends ge{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=t.resolve(o);return r?ge.near(i):new le(i)}content(){return new Z(j.from(this.node),0,0)}eq(t){return t instanceof le&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Cp(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new le(t.resolve(n.anchor))}static create(t,n){return new le(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}le.prototype.visible=!1;ge.jsonID("node",le);class Cp{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new vu(r,r):new Cp(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&le.isSelectable(r)?new le(n):ge.near(n)}}class xn extends ge{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=Z.empty){if(n==Z.empty){t.delete(0,t.doc.content.size);let r=ge.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new xn(t)}map(t){return new xn(t)}eq(t){return t instanceof xn}getBookmark(){return VM}}ge.jsonID("all",xn);const VM={map(){return this},resolve(e){return new xn(e)}};function Oi(e,t,n,r,o,i=!1){if(t.inlineContent)return se.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let a=t.child(s);if(a.isAtom){if(!i&&le.isSelectable(a))return le.create(e,n-(o<0?a.nodeSize:0))}else{let l=Oi(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function h0(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof vt||o instanceof yt))return;let i=e.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),e.setSelection(ge.near(e.doc.resolve(s),n))}const p0=1,Ja=2,m0=4;class $M extends xp{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|p0)&~Ja,this.storedMarks=null,this}get selectionSet(){return(this.updated&p0)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Ja,this}ensureMarks(t){return Xe.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ja)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Ja,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let o=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,i)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(ge.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=m0,this}get scrolledIntoView(){return(this.updated&m0)>0}}function g0(e,t){return!t||!e?e:e.bind(t)}class _s{constructor(t,n,r){this.name=t,this.init=g0(n.init,r),this.apply=g0(n.apply,r)}}const jM=[new _s("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new _s("selection",{init(e,t){return e.selection||ge.atStart(t.doc)},apply(e){return e.selection}}),new _s("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new _s("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class _d{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=jM.slice(),n&&n.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 _s(r.key,r.spec.state,r))})}}class Fi{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Fi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new $M(this)}static create(t){let n=new _d(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Fi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}reconfigure(t){let n=new _d(this.schema,t.plugins),r=n.fields,o=new Fi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new _d(t.schema,t.plugins),i=new Fi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Gr.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=ge.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,t,n[a],i);return}}i[s.name]=s.init(t,i)}}),i}}function Hx(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=Hx(o,t,{})),n[r]=o}return n}class Ae{constructor(t){this.spec=t,this.props={},t.props&&Hx(t.props,this,this.props),this.key=t.key?t.key.key:Ux("plugin")}getState(t){return t[this.key]}}const Od=Object.create(null);function Ux(e){return e in Od?e+"$"+ ++Od[e]:(Od[e]=0,e+"$")}class $e{constructor(t="key"){this.key=Ux(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const kp=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Vx(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const $x=(e,t,n)=>{let r=Vx(e,n);if(!r)return!1;let o=Tp(r);if(!o){let s=r.blockRange(),a=s&&yi(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(Xx(e,o,t,-1))return!0;if(r.parent.content.size==0&&(ns(i,"end")||le.isSelectable(i)))for(let s=r.depth;;s--){let a=Su(e.doc,r.before(s),r.after(s),Z.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(ns(i,"end")?ge.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):le.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},zM=(e,t,n)=>{let r=Vx(e,n);if(!r)return!1;let o=Tp(r);return o?jx(e,o,t):!1},WM=(e,t,n)=>{let r=Wx(e,n);if(!r)return!1;let o=wp(r);return o?jx(e,o,t):!1};function jx(e,t,n){let r=t.nodeBefore,o=r,i=t.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Su(e.doc,i,l,Z.empty);if(!c||c.from!=i||c instanceof vt&&c.slice.size>=l-i)return!1;if(n){let u=e.tr.step(c);u.setSelection(se.create(u.doc,i)),n(u.scrollIntoView())}return!0}function ns(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const zx=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Tp(r)}let s=i&&i.nodeBefore;return!s||!le.isSelectable(s)?!1:(t&&t(e.tr.setSelection(le.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Tp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Wx(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const qx=(e,t,n)=>{let r=Wx(e,n);if(!r)return!1;let o=wp(r);if(!o)return!1;let i=o.nodeAfter;if(Xx(e,o,t,1))return!0;if(r.parent.content.size==0&&(ns(i,"start")||le.isSelectable(i))){let s=Su(e.doc,r.before(),r.after(),Z.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(ns(i,"start")?ge.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):le.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Gx=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=wp(r)}let s=i&&i.nodeAfter;return!s||!le.isSelectable(s)?!1:(t&&t(e.tr.setSelection(le.create(e.doc,i.pos)).scrollIntoView()),!0)};function wp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const qM=(e,t)=>{let n=e.selection,r=n instanceof le,o;if(r){if(n.node.isTextblock||!Bo(e.doc,n.from))return!1;o=n.from}else if(o=wu(e.doc,n.from,-1),o==null)return!1;if(t){let i=e.tr.join(o);r&&i.setSelection(le.create(i.doc,o-e.doc.resolve(o).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},GM=(e,t)=>{let n=e.selection,r;if(n instanceof le){if(n.node.isTextblock||!Bo(e.doc,n.to))return!1;r=n.to}else if(r=wu(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},YM=(e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&yi(o);return i==null?!1:(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},Yx=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
7
+ `).scrollIntoView()),!0)};function Sp(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const KM=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Sp(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(ge.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Kx=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof xn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Sp(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(se.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},Qx=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Yr(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&yi(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function QM(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof le&&t.selection.node.isBlock)return!r.parentOffset||!Yr(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Sp(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof se||t.selection instanceof xn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Yr(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Yr(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const XM=QM(),ZM=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(le.create(e.doc,o))),!0)};function JM(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||Bo(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Xx(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&JM(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let h=t.pos+i.nodeSize,p=j.empty;for(let b=s.length-1;b>=0;b--)p=j.from(s[b].create(null,p));p=j.from(o.copy(p));let g=e.tr.step(new yt(t.pos-1,h,t.pos,h,new Z(p,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Bo(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:ge.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&yi(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(c&&ns(i,"start",!0)&&ns(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let b=j.empty;for(let k=p.length-1;k>=0;k--)b=j.from(p[k].copy(b));let x=e.tr.step(new yt(t.pos-p.length,t.pos+i.nodeSize,t.pos+y,t.pos+i.nodeSize-y,new Z(b,p.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function Zx(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(se.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const e_=Zx(-1),t_=Zx(1);function n_(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Ix(s,e,t);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function b0(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,e)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,e,t)}r(i.scrollIntoView())}return!0}}function vp(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}vp(kp,$x,zx);vp(kp,qx,Gx);vp(Yx,Kx,Qx,XM);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function r_(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return o_(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function o_(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new ca(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new ca(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Ix(i,n,r,t);return a?(e&&i_(e,t,a,o,n),!0):!1}function i_(e,t,n,r,o){let i=j.empty;for(let u=n.length-1;u>=0;u--)i=j.from(n[u].type.create(n[u].attrs,i));e.step(new yt(t.start-(r?2:0),t.end,t.start,t.end,new Z(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,f=!0;u<d;u++,f=!1)!f&&Yr(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function s_(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?a_(t,n,e,i):l_(t,n,i):!0:!1}}function a_(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new yt(i-1,s,i,s,new Z(j.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ca(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=yi(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Bo(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),t(o.scrollIntoView()),!0}function l_(e,t,n){let r=e.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?j.empty:j.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new yt(d-(a?1:0),f+(l?1:0),d+1,f-1,new Z((a?j.empty:j.from(o.copy(j.empty))).append(l?j.empty:j.from(o.copy(j.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}function c_(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==e);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=e)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=j.from(c?e.create():null),d=new Z(j.from(e.create(null,j.from(a.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(t.tr.step(new yt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Ht=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},rs=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Zf=null;const Hr=function(e,t,n){let r=Zf||(Zf=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},u_=function(){Zf=null},li=function(e,t,n,r){return n&&(y0(e,t,n,r,-1)||y0(e,t,n,r,1))},d_=/^(img|br|input|textarea|hr)$/i;function y0(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Vn(e))){let s=e.parentNode;if(!s||s.nodeType!=1||_a(e)||d_.test(e.nodeName)||e.contentEditable=="false")return!1;t=Ht(e)+(o<0?0:1),e=s}else if(e.nodeType==1){let s=e.childNodes[t+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=o;else return!1;else e=s,t=o<0?Vn(e):0}else return!1}}function Vn(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function f_(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Vn(e)}else if(e.parentNode&&!_a(e))t=Ht(e),e=e.parentNode;else return null}}function h_(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!_a(e))t=Ht(e)+1,e=e.parentNode;else return null}}function p_(e,t,n){for(let r=t==0,o=t==Vn(e);r||o;){if(e==n)return!0;let i=Ht(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==Vn(e)}}function _a(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Au=function(e){return e.focusNode&&li(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Wo(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function m_(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function g_(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Vn(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Vn(r.startContainer),r.startOffset)}}}const Cr=typeof navigator<"u"?navigator:null,E0=typeof document<"u"?document:null,Fo=Cr&&Cr.userAgent||"",Jf=/Edge\/(\d+)/.exec(Fo),Jx=/MSIE \d/.exec(Fo),eh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fo),Cn=!!(Jx||eh||Jf),So=Jx?document.documentMode:eh?+eh[1]:Jf?+Jf[1]:0,$n=!Cn&&/gecko\/(\d+)/i.test(Fo);$n&&+(/Firefox\/(\d+)/.exec(Fo)||[0,0])[1];const th=!Cn&&/Chrome\/(\d+)/.exec(Fo),Vt=!!th,eC=th?+th[1]:0,Xt=!Cn&&!!Cr&&/Apple Computer/.test(Cr.vendor),is=Xt&&(/Mobile\/\w+/.test(Fo)||!!Cr&&Cr.maxTouchPoints>2),Fn=is||(Cr?/Mac/.test(Cr.platform):!1),tC=Cr?/Win/.test(Cr.platform):!1,$r=/Android \d/.test(Fo),Oa=!!E0&&"webkitFontSmoothing"in E0.documentElement.style,b_=Oa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y_(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Or(e,t){return typeof e=="number"?e:e[t]}function E_(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function x0(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(s.nodeType!=1){s=rs(s);continue}let a=s,l=a==i.body,c=l?y_(i):E_(a),u=0,d=0;if(t.top<c.top+Or(r,"top")?d=-(c.top-t.top+Or(o,"top")):t.bottom>c.bottom-Or(r,"bottom")&&(d=t.bottom-t.top>c.bottom-c.top?t.top+Or(o,"top")-c.top:t.bottom-c.bottom+Or(o,"bottom")),t.left<c.left+Or(r,"left")?u=-(c.left-t.left+Or(o,"left")):t.right>c.right-Or(r,"right")&&(u=t.right-c.right+Or(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,y=a.scrollTop-p;t={left:t.left-g,top:t.top-y,right:t.right-g,bottom:t.bottom-y}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:rs(s)}}function x_(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let a=e.root.elementFromPoint(i,s);if(!a||a==e.dom||!e.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:nC(e.dom)}}function nC(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=rs(r));return t}function C_({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;rC(n,r==0?0:r-t)}function rC(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let vi=null;function k_(e){if(e.setActive)return e.setActive();if(vi)return e.focus(vi);let t=nC(e);e.focus(vi==null?{get preventScroll(){return vi={preventScroll:!0},!0}}:void 0),vi||(vi=!1,rC(t,0))}function oC(e,t){let n,r=2e8,o,i=0,s=t.top,a=t.top,l,c;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Hr(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);let g=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(g<r){n=u,r=g,o=g&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&g&&(i=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!l&&p.left<=t.left&&p.right>=t.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?T_(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:oC(n,o)}function T_(e,t){let n=e.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let s=so(r,1);if(s.top!=s.bottom&&Ap(t,s)){o={node:e,offset:i+(t.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:e,offset:0}}function Ap(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function w_(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function S_(e,t,n){let{node:r,offset:o}=oC(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function v_(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let a=e.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function iC(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Ap(t,c))return iC(s,t,c)}}if((i=(i+1)%r)==o)break}return e}function A_(e,t){let n=e.dom.ownerDocument,r,o=0,i=g_(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=e.dom.getBoundingClientRect();if(!Ap(t,c)||(s=iC(e.dom,t,c),!s))return null}if(Xt)for(let c=s;r&&c;c=rs(c))c.draggable&&(r=void 0);if(s=w_(s,t),r){if($n&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let c;Oa&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=v_(e,r,o,t))}a==null&&(a=S_(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function C0(e){return e.top<e.bottom||e.left<e.right}function so(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(C0(r))return r}return Array.prototype.find.call(n,C0)||e.getBoundingClientRect()}const N_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sC(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Oa||$n;if(r.nodeType==3)if(s&&(N_.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=so(Hr(r,o,o),n);if($n&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=so(Hr(r,o-1,o-1),-1);if(c.top==l.top){let u=so(Hr(r,o,o+1),-1);if(u.top!=l.top)return bs(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,bs(so(Hr(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Vn(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Rd(l.getBoundingClientRect(),!1)}if(i==null&&o<Vn(r)){let l=r.childNodes[o];if(l.nodeType==1)return Rd(l.getBoundingClientRect(),!0)}return Rd(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Vn(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Hr(l,Vn(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return bs(so(c,1),!1)}if(i==null&&o<Vn(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Hr(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return bs(so(c,-1),!0)}return bs(so(r.nodeType==3?Hr(r):r,-n),n>=0)}function bs(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Rd(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function aC(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function I_(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return aC(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=sC(e,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Hr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const M_=/[\u0590-\u08ac]/;function __(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?!M_.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:aC(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=e.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:p,focusOffset:g}=e.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let k0=null,T0=null,w0=!1;function O_(e,t,n){return k0==t&&T0==n?w0:(k0=t,T0=n,w0=n=="up"||n=="down"?I_(e,t,n):__(e,t,n))}const jn=0,S0=1,qo=2,kr=3;class Ra{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=jn,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>Ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>t||s instanceof cC){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof lC&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ht(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&t<=c){let u=s+l.border;if(t>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,u);t=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ht(f.dom)+1;break}t-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Ht(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],y=p+g.size;if(i>p&&s<y)return g.setSelection(t-p-g.border,n-p-g.border,r,o);p=y}let a=this.domFromPos(t,t?-1:1),l=n==t?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if(($n||Xt)&&t==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
8
+ `),d&&p==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Ht(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if($n&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Xt)&&li(a.node,a.offset,u.anchorNode,u.anchorOffset)&&li(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||t==n)&&!(d&&$n)){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(t>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let a=r+i.border,l=s-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==s?qo:S0,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=kr:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?qo:kr}r=s}this.dirty=qo}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?qo:S0;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class lC extends Ra{constructor(t,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==jn&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 R_ extends Ra{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ci extends Ra{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=On.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ci(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&kr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=kr&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=jn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=jn}}slice(t,n,r){let o=ci.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=rh(i,n,s,r)),t>0&&(i=rh(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vo extends Ra{constructor(t,n,r,o,i,s,a,l,c){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=On.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=fC(u,r,n),c?l=new L_(t,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Nu(t,n,r,o,u,f,i):new vo(t,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>j.empty)}return t}matchesNode(t,n,r){return this.dirty==jn&&t.eq(this.node)&&uc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new P_(this,s&&s.node,t);H_(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Xe.none:this.node.child(u).marks,r,t,u),l.placeWidget(c,t,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,t,f);let h;l.findNodeMatch(c,u,d,f)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,t)||l.updateNextNode(c,u,d,t,f,o)||l.addNode(c,u,d,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==qo)&&(s&&this.protectLocalComposition(t,s),uC(this.contentDOM,this.children,t),is&&U_(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof se)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=V_(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new R_(this,i,n,o);t.input.compositionNodes.push(s),this.children=rh(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==kr||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=jn}updateOuterDeco(t){if(uc(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=dC(this.dom,this.nodeDOM,nh(this.outerDeco,this.node,n),nh(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function v0(e,t,n,r,o){fC(r,t,e);let i=new vo(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Nu extends vo{constructor(t,n,r,o,i,s,a){super(t,n,r,o,i,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==kr||this.dirty!=jn&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=jn||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=jn,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new Nu(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=kr)}get domAtom(){return!1}isText(t){return this.node.text==t}}class cC extends Ra{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==jn&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class L_ extends vo{constructor(t,n,r,o,i,s,a,l,c,u){super(t,n,r,o,i,s,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==kr)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function uC(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=A0(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof ci){let l=r?r.previousSibling:e.lastChild;uC(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=A0(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const $s=function(e){e&&(this.nodeName=e)};$s.prototype=Object.create(null);const Go=[new $s];function nh(e,t,n){if(e.length==0)return Go;let r=n?Go[0]:new $s,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new $s(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new $s(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function dC(e,t,n,r){if(n==Go&&r==Go)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=Go[0]),o=l}D_(o,a||Go[0],s)}return o}function D_(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function fC(e,t,n){return dC(e,e,Go,nh(t,n,e.nodeType!=1))}function uc(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function A0(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class P_{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=B_(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,o){let i=0,s=this.stack.length>>1,a=Math.min(s,t.length);for(;i<a&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=jn,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(t[s])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ci.create(this.top,t[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(t,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==kr&&s.dom==s.contentDOM&&(s.dirty=qo),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof vo){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=kr&&uc(n,l.outerDeco));if(!f&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,t,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=qo,d.updateChildren(o,s+1),d.dirty=jn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!uc(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=vo.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,o,i){let s=vo.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new lC(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ci;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Nu)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Xt||Vt)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new cC(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function B_(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof ci)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function F_(e,t){return e.type.side-t.type.side}function H_(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(F_);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<e.childCount)h=c,f=e.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let y=p;s<o.length&&o[s].from<y&&(y=o[s].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<p&&(l=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let g=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,g,t.forChild(i,f),h),i=p}}function U_(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function V_(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function rh(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Np(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Au(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&le.isSelectable(d)&&o.parent&&!(d.isInline&&p_(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new le(s==f?a:r.resolve(f))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,e.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,s]=f==e.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=Ip(e,u,a,d)}return c}function hC(e){return e.editable?e.hasFocus():mC(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Kr(e,t=!1){let n=e.state.selection;if(pC(e,n),!!hC(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Vt){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&li(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)j_(e);else{let{anchor:r,head:o}=n,i,s;N0&&!(n instanceof se)&&(n.$from.parent.inlineContent||(i=I0(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=I0(e,n.to))),e.docView.setSelection(r,o,e,t),N0&&(i&&M0(i),s&&M0(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$_(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const N0=Xt||Vt&&eC<63;function I0(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Xt&&o&&o.contentEditable=="false")return Ld(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Ld(o);if(i)return Ld(i)}}function Ld(e){return e.contentEditable="true",Xt&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function M0(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function $_(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!hC(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function j_(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,Ht(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Cn&&So<=11&&(n.disabled=!0,n.disabled=!1)}function pC(e,t){if(t instanceof le){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(_0(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else _0(e)}function _0(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ip(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||se.between(t,n,r)}function O0(e){return e.editable&&!e.hasFocus()?!1:mC(e)}function mC(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function z_(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return li(t.node,t.offset,n.anchorNode,n.anchorOffset)}function oh(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&ge.findFrom(i,t)}function co(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function R0(e,t,n){let r=e.state.selection;if(r instanceof se)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return co(e,new se(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=oh(e.state,t);return o&&o instanceof le?co(e,o):!1}else if(!(Fn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?le.isSelectable(i)?co(e,new le(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):Oa?co(e,new se(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof le&&r.node.isInline)return co(e,new se(t>0?r.$to:r.$from));{let o=oh(e.state,t);return o?co(e,o):!1}}}function dc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function js(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Ai(e,t){return t<0?W_(e):q_(e)}function W_(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for($n&&n.nodeType==1&&r<dc(n)&&js(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(js(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(gC(n))break;{let a=n.previousSibling;for(;a&&js(a,-1);)o=n.parentNode,i=Ht(a),a=a.previousSibling;if(a)n=a,r=dc(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?ih(e,n,r):o&&ih(e,o,i)}function q_(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=dc(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(js(a,1))i=n,s=++r;else break}else{if(gC(n))break;{let a=n.nextSibling;for(;a&&js(a,1);)i=a.parentNode,s=Ht(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=dc(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&ih(e,i,s)}function gC(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function G_(e,t){for(;e&&t==e.childNodes.length&&!_a(e);)t=Ht(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function Y_(e,t){for(;e&&!t&&!_a(e);)t=Ht(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function ih(e,t,n){if(t.nodeType!=3){let i,s;(s=G_(t,n))?(t=s,n=0):(i=Y_(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Au(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&Kr(e)},50)}function L0(e,t){let n=e.state.doc.resolve(t);if(!(Vt||tC)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function D0(e,t,n){let r=e.state.selection;if(r instanceof se&&!r.empty||n.indexOf("s")>-1||Fn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=oh(e.state,t);if(s&&s instanceof le)return co(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof xn?ge.near(s,t):ge.findFrom(s,t);return a?co(e,a):!1}return!1}function P0(e,t){if(!(e.state.selection instanceof se))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function B0(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function K_(e){if(!Xt||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;B0(e,r,"true"),setTimeout(()=>B0(e,r,"false"),20)}return!1}function Q_(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function X_(e,t){let n=t.keyCode,r=Q_(t);if(n==8||Fn&&n==72&&r=="c")return P0(e,-1)||Ai(e,-1);if(n==46&&!t.shiftKey||Fn&&n==68&&r=="c")return P0(e,1)||Ai(e,1);if(n==13||n==27)return!0;if(n==37||Fn&&n==66&&r=="c"){let o=n==37?L0(e,e.state.selection.from)=="ltr"?-1:1:-1;return R0(e,o,r)||Ai(e,o)}else if(n==39||Fn&&n==70&&r=="c"){let o=n==39?L0(e,e.state.selection.from)=="ltr"?1:-1:1;return R0(e,o,r)||Ai(e,o)}else{if(n==38||Fn&&n==80&&r=="c")return D0(e,-1,r)||Ai(e,-1);if(n==40||Fn&&n==78&&r=="c")return K_(e)||D0(e,1,r)||Ai(e,1);if(r==(Fn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Mp(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=e.someProp("clipboardSerializer")||On.fromSchema(e.state.schema),a=kC(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=CC[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
9
+
10
+ `);return{dom:l,text:f,slice:t}}function bC(e,t,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!t)return null;let l=!!t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",f=>{t=f(t,i||r,e)}),i)return a=new Z(j.from(e.state.schema.text(t.replace(/\r\n?/g,`
11
+ `))),0,0),e.someProp("transformPasted",f=>{a=f(a,e,!0)}),a;let d=e.someProp("clipboardTextParser",f=>f(t,o,r,e));if(d)a=d;else{let f=o.marks(),{schema:h}=e.state,p=On.fromSchema(h);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(h.text(g,f)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=tO(n),Oa&&nO(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||sn.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Z_.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=rO(F0(a,+u[1],+u[2]),u[4]);else if(a=Z.maxOpen(J_(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=F0(a,d,f)}return e.someProp("transformPasted",d=>{a=d(a,e,l)}),a}const Z_=/^(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 J_(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&EC(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=xC(s[s.length-1],i.length));let u=yC(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return j.from(s)}return e}function yC(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,j.from(e));return e}function EC(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=EC(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(j.from(yC(n,e,o+1))))}}function xC(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,xC(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(j.empty,!0);return e.copy(n.append(r))}function sh(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=sh(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(j.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function F0(e,t,n){return t<e.openStart&&(e=new Z(sh(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Z(sh(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const CC={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 H0=null;function kC(){return H0||(H0=document.implementation.createHTMLDocument("title"))}let Dd=null;function eO(e){let t=window.trustedTypes;return t?(Dd||(Dd=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Dd.createHTML(e)):e}function tO(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=kC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&CC[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eO(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function nO(e){let t=e.querySelectorAll(Vt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function rO(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=j.from(l.create(r[a+1],o)),i++,s++}return new Z(o,i,s)}const an={},ln={},oO={touchstart:!0,touchmove:!0};class iO{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function sO(e){for(let t in an){let n=an[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{lO(e,r)&&!_p(e,r)&&(e.editable||!(r.type in ln))&&n(e,r)},oO[t]?{passive:!0}:void 0)}Xt&&e.dom.addEventListener("input",()=>null),ah(e)}function Co(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function aO(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function ah(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>_p(e,r))})}function _p(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function lO(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function cO(e,t){!_p(e,t)&&an[t.type]&&(e.editable||!(t.type in ln))&&an[t.type](e,t)}ln.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!wC(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!($r&&Vt&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),is&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,Wo(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||X_(e,n)?n.preventDefault():Co(e,"key")};ln.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};ln.keypress=(e,t)=>{let n=t;if(wC(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Fn&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof se)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",s=>s(e,r.$from.pos,r.$to.pos,o,i))&&e.dispatch(i()),n.preventDefault()}};function Iu(e){return{left:e.clientX,top:e.clientY}}function uO(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Op(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function qi(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function dO(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&le.isSelectable(r)?(qi(e,new le(n)),!0):!1}function fO(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof le&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(le.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(qi(e,le.create(e.state.doc,o)),!0):!1}function hO(e,t,n,r,o){return Op(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?fO(e,n):dO(e,n))}function pO(e,t,n,r){return Op(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function mO(e,t,n,r){return Op(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||gO(e,n,r)}function gO(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(qi(e,se.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)qi(e,se.create(r,a+1,a+1+s.content.size));else if(le.isSelectable(s))qi(e,le.create(r,a));else continue;return!0}}function Rp(e){return fc(e)}const TC=Fn?"metaKey":"ctrlKey";an.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Rp(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&uO(n,e.input.lastClick)&&!n[TC]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Iu(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new bO(e,s,n,!!r)):(i=="doubleClick"?pO:mO)(e,s.pos,s.inside,n)?n.preventDefault():Co(e,"pointer"))};class bO{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[TC],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof le&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$n&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Co(t,"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(()=>Kr(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Iu(t))),this.updateAllowDefault(t),this.allowDefault||!n?Co(this.view,"pointer"):hO(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Xt&&this.mightDrag&&!this.mightDrag.node.isAtom||Vt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(qi(this.view,ge.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Co(this.view,"pointer")}move(t){this.updateAllowDefault(t),Co(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}an.touchstart=e=>{e.input.lastTouch=Date.now(),Rp(e),Co(e,"pointer")};an.touchmove=e=>{e.input.lastTouch=Date.now(),Co(e,"pointer")};an.contextmenu=e=>Rp(e);function wC(e,t){return e.composing?!0:Xt&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const yO=$r?5e3:-1;ln.compositionstart=ln.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof se&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Vt&&tC&&EO(e)))e.markCursor=e.state.storedMarks||n.marks(),fc(e,!0),e.markCursor=null;else if(fc(e,!t.selection.empty),$n&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}SC(e,yO)};function EO(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ln.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,SC(e,20))};function SC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>fc(e),t))}function vC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=CO());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function xO(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=f_(t.focusNode,t.focusOffset),r=h_(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function CO(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function fc(e,t=!1){if(!($r&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),vC(e),t||e.docView&&e.docView.dirty){let n=Np(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function kO(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const fa=Cn&&So<15||is&&b_<604;an.copy=ln.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=fa?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Mp(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):kO(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function TO(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function wO(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ha(e,r.value,null,o,t):ha(e,r.textContent,r.innerHTML,o,t)},50)}function ha(e,t,n,r,o){let i=bC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||Z.empty)))return!0;if(!i)return!1;let s=TO(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function AC(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ln.paste=(e,t)=>{let n=t;if(e.composing&&!$r)return;let r=fa?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&ha(e,AC(r),r.getData("text/html"),o,n)?n.preventDefault():wO(e,n)};class NC{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const SO=Fn?"altKey":"ctrlKey";function IC(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[SO]}an.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(Iu(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof le?o.to-1:o.to))){if(r&&r.mightDrag)s=le.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=le.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=Mp(e,a);(!n.dataTransfer.files.length||!Vt||eC>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",fa||n.dataTransfer.setData("text/plain",c),e.dragging=new NC(u,IC(e,n),s)};an.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};ln.dragover=ln.dragenter=(e,t)=>t.preventDefault();ln.drop=(e,t)=>{try{vO(e,t,e.dragging)}finally{e.dragging=null}};function vO(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Iu(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",h=>{i=h(i,e,!1)}):i=bC(e,AC(t.dataTransfer),fa?null:t.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&IC(e,t));if(e.someProp("handleDrop",h=>h(e,t,i||Z.empty,s))){t.preventDefault();return}if(!i)return;t.preventDefault();let a=i?Rx(e.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let l=e.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&le.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new le(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,y,b)=>h=b),l.setSelection(Ip(e,f,l.doc.resolve(h)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}an.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Kr(e)},20))};an.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};an.beforeinput=(e,t)=>{if(Vt&&$r&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,Wo(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in ln)an[e]=ln[e];function pa(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class hc{constructor(t,n){this.toDOM=t,this.spec=n||ei,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new qe(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof hc&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&pa(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Ao{constructor(t,n){this.attrs=t,this.spec=n||ei}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new qe(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Ao&&pa(this.attrs,t.attrs)&&pa(this.spec,t.spec)}static is(t){return t.type instanceof Ao}destroy(){}}class Lp{constructor(t,n){this.attrs=t,this.spec=n||ei}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new qe(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof Lp&&pa(this.attrs,t.attrs)&&pa(this.spec,t.spec)}destroy(){}}class qe{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new qe(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new qe(t,t,new hc(n,r))}static inline(t,n,r,o){return new qe(t,n,new Ao(r,o))}static node(t,n,r,o){return new qe(t,n,new Lp(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ao}get widget(){return this.type instanceof hc}}const Ri=[],ei={};class _e{constructor(t,n){this.local=t.length?t:Ri,this.children=n.length?n:Ri}static create(t,n){return n.length?pc(n,t,0,ei):Gt}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==Gt||t.maps.length==0?this:this.mapInner(t,n,0,0,r||ei)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?AO(this.children,s||[],t,n,r,o,i):s?new _e(s.sort(ti),Ri):Gt}add(t,n){return n.length?this==Gt?_e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=_C(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,pc(u,a,c+1,ei)),i+=3}});let s=MC(i?OC(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new _e(s.length?this.local.concat(s).sort(ti):this.local,o||this.children)}remove(t){return t.length==0||this==Gt?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Gt?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new _e(o,r):Gt}forChild(t,n){if(this==Gt)return this;if(n.isLeaf)return _e.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Ao){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new _e(o.sort(ti),Ri);return r?new po([a,r]):a}return r||Gt}eq(t){if(this==t)return!0;if(!(t instanceof _e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return Dp(this.localsInner(t))}localsInner(t){if(this==Gt)return Ri;if(t.inlineContent||!this.local.some(Ao.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ao||n.push(this.local[r]);return n}forEachSet(t){t(this)}}_e.empty=new _e([],[]);_e.removeOverlap=Dp;const Gt=_e.empty;class po{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,ei));return po.from(r)}forChild(t,n){if(n.isLeaf)return _e.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Gt&&(i instanceof po?r=r.concat(i.members):r.push(i))}return po.from(r)}eq(t){if(!(t instanceof po)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Dp(r?n:n.sort(ti)):Ri}static from(t){switch(t.length){case 0:return Gt;case 1:return t[0];default:return new po(t.every(n=>n instanceof _e)?t:t.reduce((n,r)=>n.concat(r instanceof _e?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function AO(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let y=g-p-(h-f);for(let b=0;b<a.length;b+=3){let x=a[b+1];if(x<0||f>x+u-d)continue;let k=a[b]+u-d;h>=k?a[b+1]=f<=k?-2:-1:f>=u&&y&&(a[b]+=y,a[b+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(e[c+1]+i,-1),h=f-o,{index:p,offset:g}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&g==d&&g+y.nodeSize==h){let b=a[c+2].mapInner(n,y,u+1,e[c]+i+1,s);b!=Gt?(a[c]=d,a[c+1]=h,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=NO(a,e,t,n,o,i,s),u=pc(c,r,0,s);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new _e(t.sort(ti),a)}function MC(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new qe(o.from+t,o.to+t,o.type))}return n}function NO(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function _C(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function OC(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function pc(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=_C(e,a,l+n);if(c){i=!0;let u=pc(c,a,n+l+1,r);u!=Gt&&o.push(l,l+a.nodeSize,u)}});let s=MC(i?OC(e):e,-n).sort(ti);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new _e(s,o):Gt}function ti(e,t){return e.from-t.from||e.to-t.to}function Dp(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),U0(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),U0(t,o,r.copy(i.from,r.to)));break}}}return t}function U0(e,t,n){for(;t<e.length&&ti(n,e[t])>0;)t++;e.splice(t,0,n)}function Pd(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Gt&&t.push(r)}),e.cursorWrapper&&t.push(_e.create(e.state.doc,[e.cursorWrapper.deco])),po.from(t)}const IO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},MO=Cn&&So<=11;class _O{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class OO{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _O,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Cn&&So<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Xt&&t.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),MO&&(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,IO)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);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(O0(this.view)){if(this.suppressingSelectionUpdates)return Kr(this.view);if(Cn&&So<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&li(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=rs(i))n.add(i);for(let i=t.anchorNode;i;i=rs(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&O0(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if($n&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||DO(t,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Au(r)&&(c=Np(t))&&c.eq(ge.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Kr(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),RO(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,PO(t,l)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Kr(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(Cn&&So<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==t.target?Ht(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?Ht(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let V0=new WeakMap,$0=!1;function RO(e){if(!V0.has(e)&&(V0.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=$n,$0)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."),$0=!0}}function j0(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return li(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function LO(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return j0(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?j0(e,n):null}function DO(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function PO(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function BO(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Au(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Vt&&e.input.lastKeyCode===8)for(let y=i;y>o;y--){let b=r.childNodes[y-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){i=y;break}if(!x||x.size)break}let d=e.state.doc,f=e.someProp("domParser")||sn.fromSchema(e.state.schema),h=d.resolve(s),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:FO,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),p={anchor:y+s,head:b+s}}return{doc:g,sel:p,from:s,to:a}}function FO(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Xt&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Xt&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const HO=/^(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 UO(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let D=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,z=Np(e,D);if(z&&!e.state.selection.eq(z)){if(Vt&&$r&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",N=>N(e,Wo(13,"Enter"))))return;let Y=e.state.tr.setSelection(z);D=="pointer"?Y.setMeta("pointer",!0):D=="key"&&Y.scrollIntoView(),i&&Y.setMeta("composition",i),e.dispatch(Y)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=BO(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),f,h;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,h="end"):(f=e.state.selection.from,h="start"),e.input.lastKeyCode=null;let p=jO(d.content,c.doc.content,c.from,f,h);if(p&&e.input.domChangeCount++,(is&&e.input.lastIOSEnter>Date.now()-225||$r)&&o.some(D=>D.nodeType==1&&!HO.test(D.nodeName))&&(!p||p.endA>=p.endB)&&e.someProp("handleKeyDown",D=>D(e,Wo(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof se&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let D=z0(e,e.state.doc,c.sel);if(D&&!D.eq(e.state.selection)){let z=e.state.tr.setSelection(D);i&&z.setMeta("composition",i),e.dispatch(z)}}return}e.state.selection.from<e.state.selection.to&&p.start==p.endB&&e.state.selection instanceof se&&(p.start>e.state.selection.from&&p.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?p.start=e.state.selection.from:p.endA<e.state.selection.to&&p.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(p.endB+=e.state.selection.to-p.endA,p.endA=e.state.selection.to)),Cn&&So<=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 g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),x=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=p.endA;if((is&&e.input.lastIOSEnter>Date.now()-225&&(!x||o.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!x&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",D=>D(e,Wo(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>p.start&&$O(u,p.start,p.endA,g,y)&&e.someProp("handleKeyDown",D=>D(e,Wo(8,"Backspace")))){$r&&Vt&&e.domObserver.suppressSelectionUpdates();return}Vt&&p.endB==p.start&&(e.input.lastChromeDelete=Date.now()),$r&&!x&&g.start()!=y.start()&&y.parentOffset==0&&g.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(()=>{e.someProp("handleKeyDown",function(D){return D(e,Wo(13,"Enter"))})},20));let k=p.start,O=p.endA,M=D=>{let z=D||e.state.tr.replace(k,O,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let Y=z0(e,z.doc,c.sel);Y&&!(Vt&&e.composing&&Y.empty&&(p.start!=p.endB||e.input.lastChromeDelete<Date.now()-100)&&(Y.head==k||Y.head==z.mapping.map(O)-1)||Cn&&Y.empty&&Y.head==k)&&z.setSelection(Y)}return i&&z.setMeta("composition",i),z.scrollIntoView()},A;if(x)if(g.pos==y.pos){Cn&&So<=11&&g.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Kr(e),20));let D=M(e.state.tr.delete(k,O)),z=u.resolve(p.start).marksAcross(u.resolve(p.endA));z&&D.ensureMarks(z),e.dispatch(D)}else if(p.endA==p.endB&&(A=VO(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let D=M(e.state.tr);A.type=="add"?D.addMark(k,O,A.mark):D.removeMark(k,O,A.mark),e.dispatch(D)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let D=g.parent.textBetween(g.parentOffset,y.parentOffset),z=()=>M(e.state.tr.insertText(D,k,O));e.someProp("handleTextInput",Y=>Y(e,k,O,D,z))||e.dispatch(z())}else e.dispatch(M());else e.dispatch(M())}function z0(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ip(e,t.resolve(n.anchor),t.resolve(n.head))}function VO(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(j.from(c).eq(e))return{mark:a,type:s}}function $O(e,t,n,r,o){if(n-t<=o.pos-r.pos||Bd(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Bd(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Bd(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Bd(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function jO(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&W0(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&W0(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function W0(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class RC{constructor(t,n){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 iO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Q0),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Y0(this),G0(this),this.nodeViews=K0(this),this.docView=v0(this.state.doc,q0(this),Pd(this),this.dom,this),this.domObserver=new OO(this,(r,o,i,s)=>UO(this,r,o,i,s)),this.domObserver.start(),sO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ah(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Q0),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(vC(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=K0(this);WO(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ah(this),this.editable=Y0(this),G0(this);let l=Pd(this),c=q0(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&x_(this);if(s){this.domObserver.stop();let h=d&&(Cn||Vt)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&zO(o.selection,t.selection);if(d){let p=Vt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=xO(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=v0(t.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&z_(this))?Kr(this,h):(pC(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&C_(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof le){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&x0(this,n.getBoundingClientRect(),t)}else x0(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new NC(t.slice,t.move,o<0?void 0:le.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Cn){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&k_(this.dom),Kr(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return A_(this,t)}coordsAtPos(t,n=1){return sC(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return O_(this,n||this.state,t)}pasteHTML(t,n){return ha(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return ha(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Mp(this,t)}destroy(){this.docView&&(aO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Pd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,u_())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return cO(this,t)}domSelectionRange(){let t=this.domSelection();return t?Xt&&this.root.nodeType===11&&m_(this.dom.ownerDocument)==this.dom&&LO(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}RC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function q0(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[qe.node(0,e.state.doc.content.size,t)]}function G0(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:qe.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Y0(e){return!e.someProp("editable",t=>t(e.state)===!1)}function zO(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function K0(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function WO(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function Q0(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var No={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:"'"},mc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qO=typeof navigator<"u"&&/Mac/.test(navigator.platform),GO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ut=0;Ut<10;Ut++)No[48+Ut]=No[96+Ut]=String(Ut);for(var Ut=1;Ut<=24;Ut++)No[Ut+111]="F"+Ut;for(var Ut=65;Ut<=90;Ut++)No[Ut]=String.fromCharCode(Ut+32),mc[Ut]=String.fromCharCode(Ut);for(var Fd in No)mc.hasOwnProperty(Fd)||(mc[Fd]=No[Fd]);function YO(e){var t=qO&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||GO&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?mc:No)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const KO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),QO=typeof navigator<"u"&&/Win/.test(navigator.platform);function XO(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))KO?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function ZO(e){let t=Object.create(null);for(let n in e)t[XO(n)]=e[n];return t}function Hd(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function LC(e){return new Ae({props:{handleKeyDown:Pp(e)}})}function Pp(e){let t=ZO(e);return function(n,r){let o=YO(r),i,s=t[Hd(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[Hd(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(QO&&r.ctrlKey&&r.altKey)&&(i=No[r.keyCode])&&i!=o){let a=t[Hd(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var JO=Object.defineProperty,Bp=(e,t)=>{for(var n in t)JO(e,n,{get:t[n],enumerable:!0})};function Mu(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var _u=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([s,a])=>[s,(...c)=>{const u=a(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c=()=>(!a&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(l,t),y=f(...p)(g);return s.push(y),u}])),run:c};return u}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:Mu({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(s)]))}};return s}},DC={};Bp(DC,{blur:()=>e3,clearContent:()=>t3,clearNodes:()=>n3,command:()=>r3,createParagraphNear:()=>o3,cut:()=>i3,deleteCurrentNode:()=>s3,deleteNode:()=>a3,deleteRange:()=>l3,deleteSelection:()=>c3,enter:()=>u3,exitCode:()=>d3,extendMarkRange:()=>f3,first:()=>h3,focus:()=>m3,forEach:()=>g3,insertContent:()=>b3,insertContentAt:()=>E3,joinBackward:()=>k3,joinDown:()=>C3,joinForward:()=>T3,joinItemBackward:()=>w3,joinItemForward:()=>S3,joinTextblockBackward:()=>v3,joinTextblockForward:()=>A3,joinUp:()=>x3,keyboardShortcut:()=>I3,lift:()=>M3,liftEmptyBlock:()=>_3,liftListItem:()=>O3,newlineInCode:()=>R3,resetAttributes:()=>L3,scrollIntoView:()=>D3,selectAll:()=>P3,selectNodeBackward:()=>B3,selectNodeForward:()=>F3,selectParentNode:()=>H3,selectTextblockEnd:()=>U3,selectTextblockStart:()=>V3,setContent:()=>$3,setMark:()=>oR,setMeta:()=>iR,setNode:()=>sR,setNodeSelection:()=>aR,setTextDirection:()=>lR,setTextSelection:()=>cR,sinkListItem:()=>uR,splitBlock:()=>dR,splitListItem:()=>fR,toggleList:()=>hR,toggleMark:()=>pR,toggleNode:()=>mR,toggleWrap:()=>gR,undoInputRule:()=>bR,unsetAllMarks:()=>yR,unsetMark:()=>ER,unsetTextDirection:()=>xR,updateAttributes:()=>CR,wrapIn:()=>kR,wrapInList:()=>TR});var e3=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),t3=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),n3=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{e.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=t,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=yi(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(h.start,g)}(p||p===0)&&t.lift(h,p)})}),!0},r3=e=>t=>e(t),o3=()=>({state:e,dispatch:t})=>Kx(e,t),i3=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new se(r.doc.resolve(Math.max(s-1,0)))),!0},s3=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(t){const a=o.before(i),l=o.after(i);e.delete(a,l).scrollIntoView()}return!0}return!1};function Pt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var a3=e=>({tr:t,state:n,dispatch:r})=>{const o=Pt(e,n.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const l=i.before(s),c=i.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1},l3=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},c3=()=>({state:e,dispatch:t})=>kp(e,t),u3=()=>({commands:e})=>e.keyboardShortcut("Enter"),d3=()=>({state:e,dispatch:t})=>KM(e,t);function Fp(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function gc(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(o=>n.strict?t[o]===e[o]:Fp(t[o])?t[o].test(e[o]):t[o]===e[o]):!0}function PC(e,t,n={}){return e.find(r=>r.type===t&&gc(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function X0(e,t,n={}){return!!PC(e,t,n)}function Ou(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===t)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!PC([...o.node.marks],t,n)))return;let s=o.index,a=e.start()+o.offset,l=s+1,c=a+o.node.nodeSize;for(;s>0&&X0([...e.parent.child(s-1).marks],t,n);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&X0([...e.parent.child(l).marks],t,n);)c+=e.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function eo(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var f3=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=eo(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=Ou(l,i,t);if(d&&d.from<=c&&d.to>=u){const f=se.create(s,d.from,d.to);n.setSelection(f)}}return!0},h3=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function BC(e){return e instanceof se}function jr(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function FC(e,t=null){if(!t)return null;const n=ge.atStart(e),r=ge.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const o=n.from,i=r.to;return t==="all"?se.create(e,jr(0,o,i),jr(e.content.size,o,i)):se.create(e,jr(t,o,i),jr(t,o,i))}function lh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ma(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function p3(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var m3=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(ma()||lh())&&r.dom.focus(),p3()&&!ma()&&!lh()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(i&&e===null&&!BC(n.state.selection))return s(),!0;const a=FC(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},g3=(e,t)=>n=>e.every((r,o)=>t(r,{...n,index:o})),b3=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),HC=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&HC(r)}return e};function el(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return HC(n)}function ga(e,t,n){if(e instanceof Gr||e instanceof j)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,o=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return j.fromArray(e.map(a=>t.nodeFromJSON(a)));const s=t.nodeFromJSON(e);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",i),ga("",t,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Cx({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?sn.fromSchema(l).parseSlice(el(e),n.parseOptions):sn.fromSchema(l).parse(el(e),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=sn.fromSchema(t);return n.slice?i.parseSlice(el(e),n.parseOptions).content:i.parse(el(e),n.parseOptions)}return ga("",t,n)}function UC(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof vt||o instanceof yt))return;const i=e.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),e.setSelection(ge.near(e.doc.resolve(s),n))}var y3=e=>!("type"in e),E3=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ga(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=ga(t,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return l(y),!1}let{from:u,to:d}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},f=!0,h=!0;if((y3(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(t))g=t.map(y=>y.text||"").join("");else if(t instanceof j){let y="";t.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof t=="object"&&t&&t.text?g=t.text:g=t;r.insertText(g,u,d)}else{g=a;const y=r.doc.resolve(u),b=y.node(),x=y.parentOffset===0,k=b.isText||b.isTextblock,O=b.content.size>0;x&&k&&O&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&UC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},x3=()=>({state:e,dispatch:t})=>qM(e,t),C3=()=>({state:e,dispatch:t})=>GM(e,t),k3=()=>({state:e,dispatch:t})=>$x(e,t),T3=()=>({state:e,dispatch:t})=>qx(e,t),w3=()=>({state:e,dispatch:t,tr:n})=>{try{const r=wu(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},S3=()=>({state:e,dispatch:t,tr:n})=>{try{const r=wu(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},v3=()=>({state:e,dispatch:t})=>zM(e,t),A3=()=>({state:e,dispatch:t})=>WM(e,t);function VC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function N3(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a+=1){const l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))ma()||VC()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var I3=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=N3(e).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function ba(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Pt(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=o-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>gc(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var M3=(e,t={})=>({state:n,dispatch:r})=>{const o=Pt(e,n.schema);return ba(n,o,t)?YM(n,r):!1},_3=()=>({state:e,dispatch:t})=>Qx(e,t),O3=e=>({state:t,dispatch:n})=>{const r=Pt(e,t.schema);return s_(r)(t,n)},R3=()=>({state:e,dispatch:t})=>Yx(e,t);function Ru(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Z0(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,o)=>(n.includes(o)||(r[o]=e[o]),r),{})}var L3=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ru(typeof e=="string"?e:e.name,r.schema);if(!a)return!1;a==="node"&&(i=Pt(e,r.schema)),a==="mark"&&(s=eo(e,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(l=!0,o&&n.setNodeMarkup(d,void 0,Z0(u.attrs,t))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(l=!0,o&&n.addMark(d,d+u.nodeSize,s.create(Z0(f.attrs,t))))})})}),l},D3=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),P3=()=>({tr:e,dispatch:t})=>{if(t){const n=new xn(e.doc);e.setSelection(n)}return!0},B3=()=>({state:e,dispatch:t})=>zx(e,t),F3=()=>({state:e,dispatch:t})=>Gx(e,t),H3=()=>({state:e,dispatch:t})=>ZM(e,t),U3=()=>({state:e,dispatch:t})=>t_(e,t),V3=()=>({state:e,dispatch:t})=>e_(e,t);function bc(e,t,n={},r={}){return ga(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $3=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=bc(e,o.schema,r,{errorOnInvalidContent:t??o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:t??o.options.enableContentCheck})};function $C(e,t){const n=eo(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function Lu(e,t){const n=new xp(e);return t.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function j3(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function yc(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function jC(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Du(e){return t=>jC(t.$from,e)}function de(e,t,n){return e.config[t]===void 0&&e.parent?de(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?de(e.parent,t,n):null}):e.config[t]}function Hp(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=de(t,"addExtensions",n);return r?[t,...Hp(r())]:t}).flat(10)}function Up(e,t){const n=On.fromSchema(t).serializeFragment(e),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function zC(e){return typeof e=="function"}function Qe(e,t=void 0,...n){return zC(e)?t?e.bind(t)(...n):e(...n):e}function z3(e={}){return Object.keys(e).length===0&&e.constructor===Object}function ss(e){const t=e.filter(o=>o.type==="extension"),n=e.filter(o=>o.type==="node"),r=e.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function WC(e){const t=[],{nodeExtensions:n,markExtensions:r}=ss(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},l=de(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{t.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=de(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,t.push({type:s.name,name:u,attribute:f})})}),t}function Rn(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],l=r[o]?r[o].split(" "):[],c=a.filter(u=>!l.includes(u));r[o]=[...l,...c].join(" ")}else if(o==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function ya(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Rn(n,r),{})}function W3(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function J0(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const o=t.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):W3(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function e1(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&z3(n)?!1:n!=null))}function t1(e){var t,n;const r={};return!((t=e?.attribute)!=null&&t.isRequired)&&"default"in(e?.attribute||{})&&(r.default=e.attribute.default),((n=e?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function qC(e,t){var n;const r=WC(e),{nodeExtensions:o,markExtensions:i}=ss(e),s=(n=o.find(c=>de(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:t},f=e.reduce((b,x)=>{const k=de(x,"extendNodeSchema",d);return{...b,...k?k(c):{}}},{}),h=e1({...f,content:Qe(de(c,"content",d)),marks:Qe(de(c,"marks",d)),group:Qe(de(c,"group",d)),inline:Qe(de(c,"inline",d)),atom:Qe(de(c,"atom",d)),selectable:Qe(de(c,"selectable",d)),draggable:Qe(de(c,"draggable",d)),code:Qe(de(c,"code",d)),whitespace:Qe(de(c,"whitespace",d)),linebreakReplacement:Qe(de(c,"linebreakReplacement",d)),defining:Qe(de(c,"defining",d)),isolating:Qe(de(c,"isolating",d)),attrs:Object.fromEntries(u.map(t1))}),p=Qe(de(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>J0(b,u)));const g=de(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ya(b,u)}));const y=de(c,"renderText",d);return y&&(h.toText=y),[c.name,h]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:t},f=e.reduce((y,b)=>{const x=de(b,"extendMarkSchema",d);return{...y,...x?x(c):{}}},{}),h=e1({...f,inclusive:Qe(de(c,"inclusive",d)),excludes:Qe(de(c,"excludes",d)),group:Qe(de(c,"group",d)),spanning:Qe(de(c,"spanning",d)),code:Qe(de(c,"code",d)),attrs:Object.fromEntries(u.map(t1))}),p=Qe(de(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>J0(y,u)));const g=de(c,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ya(y,u)})),[c.name,h]}));return new Cx({topNode:s,nodes:a,marks:l})}function q3(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function Ec(e){return e.sort((n,r)=>{const o=de(n,"priority")||100,i=de(r,"priority")||100;return o>i?-1:o<i?1:0})}function Vp(e){const t=Ec(Hp(e)),n=q3(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function G3(e,t){const n=Vp(e);return qC(n,t)}function GC(e,t,n){const{from:r,to:o}=t,{blockSeparator:i=`
12
+
13
+ `,textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const h=s?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:t})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),a}function Y3(e,t){const n={from:0,to:e.content.size};return GC(e,n,t)}function YC(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function K3(e,t){const n=Pt(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function KC(e,t){const n=Ru(typeof t=="string"?t:t.name,e.schema);return n==="node"?K3(e,t):n==="mark"?$C(e,t):{}}function Q3(e,t=JSON.stringify){const n={};return e.filter(r=>{const o=t(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function X3(e){const t=Q3(e);return t.length===1?t:t.filter((n,r)=>!t.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function $p(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=t.slice(i).map(a,-1),u=t.slice(i).map(l),d=t.invert().map(c,-1),f=t.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),X3(r)}function jp(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(o=>{const i=n.resolve(e),s=Ou(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(e,t,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function tl(e,t){return t.nodes[e]||t.marks[e]||null}function Rl(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=e.find(i=>i.type===t&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var Z3=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(o,i,s,a)=>{var l,c;const u=((c=(l=o.type.spec).toText)==null?void 0:c.call(l,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function ch(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?eo(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>gc(d.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;e.doc.nodesBetween(h,p,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),x=Math.min(p,y+g.nodeSize),k=x-b;s+=k,a.push(...g.marks.map(O=>({mark:O,from:b,to:x})))})}),s===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>gc(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function J3(e,t,n={}){if(!t)return ba(e,null,n)||ch(e,null,n);const r=Ru(t,e.schema);return r==="node"?ba(e,t,n):r==="mark"?ch(e,t,n):!1}function n1(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function r1(e,t){const{nodeExtensions:n}=ss(t),r=n.find(s=>s.name===e);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Qe(de(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function zp(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let o=!0;return e.content.forEach(i=>{o!==!1&&(zp(i,{ignoreWhitespace:n,checkChildren:t})||(o=!1))}),o}return!1}function eR(e){return e instanceof le}var QC=class XC{constructor(t){this.position=t}static fromJSON(t){return new XC(t.position)}toJSON(){return{position:this.position}}};function tR(e,t){const n=t.mapping.mapResult(e.position);return{position:new QC(n.pos),mapResult:n}}function nR(e){return new QC(e)}function Wp(e,t,n){const o=e.state.doc.content.size,i=jr(t,0,o),s=jr(n,0,o),a=e.coordsAtPos(i),l=e.coordsAtPos(s,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,p=u-c,b={top:c,bottom:u,left:d,right:f,width:h,height:p,x:d,y:c};return{...b,toJSON:()=>b}}function rR(e,t,n){var r;const{selection:o}=t;let i=null;if(BC(o)&&(i=o.$cursor),i){const a=(r=e.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}var oR=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=eo(e,r.schema);if(o)if(s){const c=$C(r,l);n.addStoredMark(l.create({...c,...t}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(p,g,l.create({...b.attrs,...t}))}):n.addMark(p,g,l.create(t))})});return rR(r,n,l)},iR=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sR=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Pt(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>b0(i,{...s,...t})(n)?!0:a.clearNodes()).command(({state:a})=>b0(i,{...s,...t})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},aR=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,o=jr(e,0,r.content.size),i=le.create(r,o);t.setSelection(i)}return!0},lR=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return typeof t=="number"?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:e})}),!0},cR=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:o,to:i}=typeof e=="number"?{from:e,to:e}:e,s=se.atStart(r).from,a=se.atEnd(r).to,l=jr(o,s,a),c=jr(i,s,a),u=se.create(r,l,c);t.setSelection(u)}return!0},uR=e=>({state:t,dispatch:n})=>{const r=Pt(e,t.schema);return c_(r)(t,n)};function o1(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(o=>t?.includes(o.type.name));e.tr.ensureMarks(r)}}var dR=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=o.extensionManager.attributes,u=Rl(c,a.node().type.name,a.node().attrs);if(i instanceof le&&i.node.isBlock)return!a.parentOffset||!Yr(s,a.pos)?!1:(r&&(e&&o1(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:j3(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Yr(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!p&&Yr(t.doc,t.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof se&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=t.mapping.map(a.before()),y=t.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&t.setNodeMarkup(t.mapping.map(a.before()),f)}e&&o1(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},fR=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=Pt(e,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let b=j.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let z=l.depth-x;z>=l.depth-3;z-=1)b=j.from(l.node(z).copy(b));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,O={...Rl(f,l.node().type.name,l.node().attrs),...t},M=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(O))||void 0;b=b.append(j.from(a.createAndFill(null,M)||void 0));const A=l.before(l.depth-(x-1));n.replace(A,l.after(-k),new Z(b,4-x,0));let D=-1;n.doc.nodesBetween(A,n.doc.content.size,(z,Y)=>{if(D>-1)return!1;z.isTextblock&&z.content.size===0&&(D=Y+1)}),D>-1&&n.setSelection(se.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Rl(f,d.type.name,d.attrs),...t},g={...Rl(f,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const y=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!Yr(n.doc,l.pos,2))return!1;if(o){const{selection:b,storedMarks:x}=r,{splittableMarks:k}=i.extensionManager,O=x||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,y).scrollIntoView(),!O||!o)return!0;const M=O.filter(A=>k.includes(A.type.name));n.ensureMarks(M)}return!0},Ud=(e,t)=>{const n=Du(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===o?.type&&Bo(e.doc,n.pos)&&e.join(n.pos),!0},Vd=(e,t)=>{const n=Du(s=>s.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===o?.type&&Bo(e.doc,r)&&e.join(r),!0},hR=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=Pt(e,s.schema),p=Pt(t,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:x}=g,k=b.blockRange(x),O=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const M=Du(A=>r1(A.type.name,d))(g);if(k.depth>=1&&M&&k.depth-M.depth<=1){if(M.node.type===h)return c.liftListItem(p);if(r1(M.node.type.name,d)&&h.validContent(M.node.content)&&a)return l().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ud(i,h)).command(()=>Vd(i,h)).run()}return!n||!O||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Ud(i,h)).command(()=>Vd(i,h)).run():l().command(()=>{const A=u().wrapInList(h,r),D=O.filter(z=>f.includes(z.type.name));return i.ensureMarks(D),A?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Ud(i,h)).command(()=>Vd(i,h)).run()},pR=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=eo(e,r.schema);return ch(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},mR=(e,t,n={})=>({state:r,commands:o})=>{const i=Pt(e,r.schema),s=Pt(t,r.schema),a=ba(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},gR=(e,t={})=>({state:n,commands:r})=>{const o=Pt(e,n.schema);return ba(n,o,t)?r.lift(o):r.wrapIn(o,t)},bR=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const s=e.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1},yR=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(i=>{e.removeMark(i.$from.pos,i.$to.pos)}),!0},ER=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=eo(e,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:f,to:h}=a;const p=(i=c.marks().find(y=>y.type===l))==null?void 0:i.attrs,g=Ou(c,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},xR=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return typeof e=="number"?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,t.setNodeMarkup(l,void 0,c)}),!0},CR=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ru(typeof e=="string"?e:e.name,r.schema);if(!a)return!1;a==="node"&&(i=Pt(e,r.schema)),a==="mark"&&(s=eo(e,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(y,b)=>{i&&i===y.type&&(l=!0,p=Math.max(b,u),g=Math.min(b+y.nodeSize,d),f=b,h=y)}):r.doc.nodesBetween(u,d,(y,b)=>{b<u&&i&&i===y.type&&(l=!0,p=Math.max(b,u),g=Math.min(b+y.nodeSize,d),f=b,h=y),b>=u&&b<=d&&(i&&i===y.type&&(l=!0,o&&n.setNodeMarkup(b,void 0,{...y.attrs,...t})),s&&y.marks.length&&y.marks.forEach(x=>{if(s===x.type&&(l=!0,o)){const k=Math.max(b,u),O=Math.min(b+y.nodeSize,d);n.addMark(k,O,s.create({...x.attrs,...t}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...t}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&o&&n.addMark(p,g,s.create({...y.attrs,...t}))}))}),l},kR=(e,t={})=>({state:n,dispatch:r})=>{const o=Pt(e,n.schema);return n_(o,t)(n,r)},TR=(e,t={})=>({state:n,dispatch:r})=>{const o=Pt(e,n.schema);return r_(o,t)(n,r)},wR=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},SR=class{constructor(t){var n;this.find=t.find,this.handler=t.handler,this.undoable=(n=t.undoable)!=null?n:!0}},vR=(e,t)=>{if(Fp(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function nl(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(t=c.nodeBefore||c.nodeAfter)!=null&&t.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Z3(c)+i;return s.forEach(f=>{if(u)return;const h=vR(d,f.find);if(!h)return;const p=l.state.tr,g=Mu({state:l.state,transaction:p}),y={from:r-(h[0].length-i.length),to:o},{commands:b,chain:x,can:k}=new _u({editor:n,state:g});f.handler({state:g,range:y,match:h,commands:b,chain:x,can:k})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:o,text:i}),l.dispatch(p),u=!0)}),u}function AR(e){const{editor:t,rules:n}=e,r=new Ae({state:{init(){return null},apply(o,i,s){const a=o.getMeta(r);if(a)return a;const l=o.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Up(j.from(u),s.schema);const{from:d}=l,f=d+u.length;nl({editor:t,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return nl({editor:t,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&nl({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?nl({editor:t,from:s.pos,to:s.pos,text:`
14
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function NR(e){return Object.prototype.toString.call(e).slice(8,-1)}function rl(e){return NR(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ZC(e,t){const n={...e};return rl(e)&&rl(t)&&Object.keys(t).forEach(r=>{rl(t[r])&&rl(e[r])?n[r]=ZC(e[r],t[r]):n[r]=t[r]}),n}var qp=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Qe(de(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Qe(de(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ZC(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Gn=class JC extends qp{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new JC(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function IR(e){return typeof e=="number"}var MR=class{constructor(e){this.find=e.find,this.handler=e.handler}},_R=(e,t,n)=>{if(Fp(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=e,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function OR(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new _u({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var g,y,b,x,k;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const O=(k=(x=(b=h.content)==null?void 0:b.size)!=null?x:h.nodeSize)!=null?k:0,M=Math.max(r,p),A=Math.min(o,p+O);if(M>=A)return;const D=h.isText?h.text||"":h.textBetween(M-p,A-p,void 0,"");_R(D,i.find,s).forEach(Y=>{if(Y.index===void 0)return;const N=M+Y.index+1,K=N+Y[0].length,F={from:n.tr.mapping.map(N),to:n.tr.mapping.map(K)},q=i.handler({state:n,range:F,match:Y,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(q)})}),d.every(h=>h!==null)}var ol=null,RR=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function LR(e){const{editor:t,rules:n}=e;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,y=Mu({state:u,transaction:g});if(!(!OR({editor:t,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new Ae({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(ol=t)},h=()=>{ol&&(ol=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const h=ol;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!o,y=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),x=!!b;if(!g&&!y&&!x)return;if(x){let{text:M}=b;typeof M=="string"?M=M:M=Up(j.from(M),h.schema);const{from:A}=b,D=A+M.length,z=RR(M);return l({rule:u,state:h,from:A,to:{b:D},pasteEvt:z})}const k=f.doc.content.findDiffStart(h.doc.content),O=f.doc.content.findDiffEnd(h.doc.content);if(!(!IR(k)||!O||k===O.b))return l({rule:u,state:h,from:k,to:O,pasteEvt:s})}}))}var Pu=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Vp(e),this.schema=qC(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:tl(t.name,this.schema)},r=de(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return Ec([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:tl(r.name,this.schema)},i=[],s=de(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&de(r,"exitable",o)&&(a.ArrowRight=()=>Gn.handleExit({editor:e,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:e})]));a={...a,...f}}const l=LC(a);i.push(l);const c=de(r,"addInputRules",o);if(n1(r,e.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=AR({editor:e,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=de(r,"addPasteRules",o);if(n1(r,e.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=LR({editor:e,rules:f});i.push(...h)}}const d=de(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return WC(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=ss(this.extensions);return Object.fromEntries(t.filter(n=>!!de(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Pt(n.name,this.schema)},i=de(n,"addNodeView",o);if(!i)return[];const s=i();if(!s)return[];const a=(l,c,u,d,f)=>{const h=ya(l,r);return s({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:n,HTMLAttributes:h})};return[n.name,a]}))}dispatchTransaction(e){const{editor:t}=this;return Ec([...this.extensions].reverse()).reduceRight((r,o)=>{const i={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:tl(o.name,this.schema)},s=de(o,"dispatchTransaction",i);return s?a=>{s.call(i,{transaction:a,next:r})}:r},e)}get markViews(){const{editor:e}=this,{markExtensions:t}=ss(this.extensions);return Object.fromEntries(t.filter(n=>!!de(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:eo(n.name,this.schema)},i=de(n,"addMarkView",o);if(!i)return[];const s=(a,l,c)=>{const u=ya(a,r);return i()({mark:a,view:l,inline:c,editor:e,extension:n,HTMLAttributes:u,updateAttributes:d=>{GR(a,e,d)}})};return[n.name,s]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:tl(t.name,this.schema)};t.type==="mark"&&((n=Qe(de(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const o=de(t,"onBeforeCreate",r),i=de(t,"onCreate",r),s=de(t,"onUpdate",r),a=de(t,"onSelectionUpdate",r),l=de(t,"onTransaction",r),c=de(t,"onFocus",r),u=de(t,"onBlur",r),d=de(t,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Pu.resolve=Vp;Pu.sort=Ec;Pu.flatten=Hp;var Li={};Bp(Li,{ClipboardTextSerializer:()=>tk,Commands:()=>nk,Delete:()=>rk,Drop:()=>ok,Editable:()=>ik,FocusEvents:()=>ak,Keymap:()=>lk,Paste:()=>ck,Tabindex:()=>uk,TextDirection:()=>dk,focusEventsPluginKey:()=>sk});var mt=class ek extends qp{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new ek(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},tk=mt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ae({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=YC(n);return GC(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),nk=mt.create({name:"commands",addCommands(){return{...DC}}}),rk=mt.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,e))!=null?c:e.getMeta("y-sync$"))return;const u=Lu(e.before,[e,...t]);$p(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const y=g+p.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:e,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,y;if(h instanceof nr){const b=f.slice(p).map(h.from,-1),x=f.slice(p).map(h.to),k=f.invert().map(b,-1),O=f.invert().map(x),M=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(D=>D.eq(h.mark)),A=(y=u.doc.nodeAt(x))==null?void 0:y.marks.some(D=>D.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:k,to:O},newRange:{from:b,to:x},partial:!!(A||M),editor:this.editor,transaction:e,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),ok=mt.create({name:"drop",addProseMirrorPlugins(){return[new Ae({key:new $e("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ik=mt.create({name:"editable",addProseMirrorPlugins(){return[new Ae({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),sk=new $e("focusEvents"),ak=mt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Ae({key:sk,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),lk=mt.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,b=g&&p.parent.childCount===1?y===d.pos:ge.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ma()||VC()?i:o},addProseMirrorPlugins(){return[new Ae({key:new $e("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(g=>g.getMeta("composition")))return;const r=e.some(g=>g.docChanged)&&!t.doc.eq(n.doc),o=e.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=ge.atStart(t.doc).from,c=ge.atEnd(t.doc).to;if(i||!(s===l&&a===c)||!zp(n.doc))return;const f=n.tr,h=Mu({state:n,transaction:f}),{commands:p}=new _u({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),ck=mt.create({name:"paste",addProseMirrorPlugins(){return[new Ae({key:new $e("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),uk=mt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ae({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),dk=mt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=ss(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ae({key:new $e("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),DR=class Os{constructor(t,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Os(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Os(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Os(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new Os(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===t)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(i[l]!==n[l])break}}else r=o;o=o.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===t&&i.every(l=>n[l]===s.node.attrs[l])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(t,n,r))))}),o}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},PR=`.ProseMirror {
15
+ position: relative;
16
+ }
17
+
18
+ .ProseMirror {
19
+ word-wrap: break-word;
20
+ white-space: pre-wrap;
21
+ white-space: break-spaces;
22
+ -webkit-font-variant-ligatures: none;
23
+ font-variant-ligatures: none;
24
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
25
+ }
26
+
27
+ .ProseMirror [contenteditable="false"] {
28
+ white-space: normal;
29
+ }
30
+
31
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
32
+ white-space: pre-wrap;
33
+ }
34
+
35
+ .ProseMirror pre {
36
+ white-space: pre-wrap;
37
+ }
38
+
39
+ img.ProseMirror-separator {
40
+ display: inline !important;
41
+ border: none !important;
42
+ margin: 0 !important;
43
+ width: 0 !important;
44
+ height: 0 !important;
45
+ }
46
+
47
+ .ProseMirror-gapcursor {
48
+ display: none;
49
+ pointer-events: none;
50
+ position: absolute;
51
+ margin: 0;
52
+ }
53
+
54
+ .ProseMirror-gapcursor:after {
55
+ content: "";
56
+ display: block;
57
+ position: absolute;
58
+ top: -2px;
59
+ width: 20px;
60
+ border-top: 1px solid black;
61
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
62
+ }
63
+
64
+ @keyframes ProseMirror-cursor-blink {
65
+ to {
66
+ visibility: hidden;
67
+ }
68
+ }
69
+
70
+ .ProseMirror-hideselection *::selection {
71
+ background: transparent;
72
+ }
73
+
74
+ .ProseMirror-hideselection *::-moz-selection {
75
+ background: transparent;
76
+ }
77
+
78
+ .ProseMirror-hideselection * {
79
+ caret-color: transparent;
80
+ }
81
+
82
+ .ProseMirror-focused .ProseMirror-gapcursor {
83
+ display: block;
84
+ }`;function BR(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return t&&o.setAttribute("nonce",t),o.setAttribute("data-tiptap-style",""),o.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(o),o}var FR=class extends wR{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:tR,createMappablePosition:nR},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=FC(t,this.options.autofocus);this.editorState=Fi.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=BR(PR,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=zC(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[ik,tk.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),nk,ak,lk,uk,ok,ck,rk,dk.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Pu(r,this)}createCommandManager(){this.commandManager=new _u({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=bc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=bc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new RC(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(e.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return KC(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return J3(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Up(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
85
+
86
+ `,textSerializers:n={}}=e||{};return Y3(this.state.doc,{blockSeparator:t,textSerializers:{...YC(this.schema),...n}})}get isEmpty(){return zp(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new DR(t,this)}get $doc(){return this.$pos(0)}};function as(e){return new SR({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Qe(e.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=n.from+a.indexOf(s),u=c+s.length;if(jp(n.from,n.to,t.doc).filter(h=>h.mark.type.excluded.find(g=>g===e.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const f=n.from+l+s.length;i.addMark(n.from+l,f,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}var HR={};Bp(HR,{createAtomBlockMarkdownSpec:()=>UR,createBlockMarkdownSpec:()=>VR,createInlineMarkdownSpec:()=>zR,parseAttributes:()=>Gp,parseIndentedBlocks:()=>WR,renderNestedMarkdownContent:()=>qR,serializeAttributes:()=>Yp});function Gp(e){if(!e?.trim())return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));t.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(t[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(t[u]=!0)}),t}function Yp(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function UR(e){const{nodeName:t,name:n,parseAttributes:r=Gp,serializeAttributes:o=Yp,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(t,f,[])},markdownTokenizer:{name:t,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",y=r(g);if(!s.find(x=>!(x in y)))return{type:t,raw:p[0],attributes:y}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function VR(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Gp,serializeAttributes:i=Yp,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(t,p,h)},markdownTokenizer:{name:t,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(g);if(!y)return;const[b,x=""]=y,k=o(x);let O=1;const M=b.length;let A="";const D=/^:::([\w-]*)(\s.*)?/gm,z=d.slice(M);for(D.lastIndex=0;;){const Y=D.exec(z);if(Y===null)break;const N=Y.index,K=Y[1];if(!((p=Y[2])!=null&&p.endsWith(":::"))){if(K)O+=1;else if(O-=1,O===0){const F=z.slice(0,N);A=F.trim();const q=d.slice(0,M+N+Y[0].length);let L=[];if(A)if(a==="block")for(L=h.blockTokens(F),L.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=h.inlineTokens(H.text))});L.length>0;){const H=L[L.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))L.pop();else break}else L=h.inlineTokens(A);return{type:t,raw:q,attributes:k,content:A,tokens:L}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),g=p?` {${p}}`:"",y=f.renderChildren(d.content||[],`
87
+
88
+ `);return`:::${c}${g}
89
+
90
+ ${y}
91
+
92
+ :::`}}}function $R(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function jR(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function zR(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=$R,serializeAttributes:i=jR,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const b=f[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...s,...f.attributes};if(a)return h.createNode(t,p);const g=r?r(f):f.content||"";return g?h.createNode(t,p,[h.createTextNode(g)]):h.createNode(t,p,[])},markdownTokenizer:{name:t,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(g);if(!y)return;let b="",x="";if(a){const[,O]=y;x=O}else{const[,O,M]=y;x=O,b=M||""}const k=o(x.trim());return{type:t,raw:y[0],content:b.trim(),attributes:k}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=u(f.attrs||{}),g=i(p),y=g?` ${g}`:"";return a?`[${c}${y}]`:`[${c}${y}]${h}[/${c}]`}}}function WR(e,t,n){var r,o,i,s;const a=e.split(`
93
+ `),l=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(t.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
94
+ `;continue}else return}const p=t.extractItemData(h),{indentLevel:g,mainContent:y}=p;c=`${c}${f}
95
+ `;const b=[y];for(u+=1;u<a.length;){const M=a[u];if(M.trim()===""){const D=a.slice(u+1).findIndex(N=>N.trim()!=="");if(D===-1)break;if((((o=(r=a[u+1+D].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){b.push(M),c=`${c}${M}
96
+ `,u+=1;continue}else break}if((((s=(i=M.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(M),c=`${c}${M}
97
+ `,u+=1;else break}let x;const k=b.slice(1);if(k.length>0){const M=k.map(A=>A.slice(g+d)).join(`
98
+ `);M.trim()&&(t.customNestedParser?x=t.customNestedParser(M):x=n.blockTokens(M))}const O=t.createToken(p,x);l.push(O)}if(l.length!==0)return{items:l,raw:c}}function qR(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=e.content,a=t.renderChildren([i]),l=[`${o}${a}`];return s&&s.length>0&&s.forEach(c=>{const u=t.renderChildren([c]);if(u){const d=u.split(`
99
+ `).map(f=>f?t.indent(f):"").join(`
100
+ `);l.push(d)}}),l.join(`
101
+ `)}function GR(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=e.type.create({...e.attrs,...n});i.removeMark(c,u,e.type),i.addMark(c,u,h)}}),i.docChanged&&t.view.dispatch(i)}var sr=class fk extends qp{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new fk(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},YR=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,o,i,s,a;const{view:l}=this.editor,c=e.target,u=c.nodeType===3?(t=c.parentElement)==null?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const x=this.dom.getBoundingClientRect(),k=u.getBoundingClientRect(),O=(o=e.offsetX)!=null?o:(r=e.nativeEvent)==null?void 0:r.offsetX,M=(s=e.offsetY)!=null?s:(i=e.nativeEvent)==null?void 0:i.offsetY;d=k.x-x.x+O,f=k.y-x.y+M}const h=this.dom.cloneNode(!0);try{const x=this.dom.getBoundingClientRect();h.style.width=`${Math.round(x.width)}px`,h.style.height=`${Math.round(x.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(a=e.dataTransfer)==null||a.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=le.create(l.state.doc,g),b=l.state.tr.setSelection(y);l.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const n=e.target;if(!(this.dom.contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type.startsWith("drag"),i=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=le.isSelectable(this.node),d=e.type==="copy",f=e.type==="paste",h=e.type==="cut",p=e.type==="mousedown";if(!c&&u&&o&&e.target===this.dom&&e.preventDefault(),c&&o&&!l&&e.target===this.dom)return e.preventDefault(),!1;if(c&&a&&!l&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||i||d||f||h||p&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(ma()||lh())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const n=this.getPos();return typeof n!="number"?!1:(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function ui(e){return new MR({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Qe(e.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(jp(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(y=>y===e.type&&y!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+a.length,s.addMark(n.from+u,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}var il,KR=new Uint8Array(16);function QR(){if(!il&&(il=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!il))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return il(KR)}const XR=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ZR(e){return typeof e=="string"&&XR.test(e)}var Bt=[];for(var $d=0;$d<256;++$d)Bt.push(($d+256).toString(16).substr(1));function JR(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Bt[e[t+0]]+Bt[e[t+1]]+Bt[e[t+2]]+Bt[e[t+3]]+"-"+Bt[e[t+4]]+Bt[e[t+5]]+"-"+Bt[e[t+6]]+Bt[e[t+7]]+"-"+Bt[e[t+8]]+Bt[e[t+9]]+"-"+Bt[e[t+10]]+Bt[e[t+11]]+Bt[e[t+12]]+Bt[e[t+13]]+Bt[e[t+14]]+Bt[e[t+15]]).toLowerCase();if(!ZR(n))throw TypeError("Stringified UUID is invalid");return n}function hk(e,t,n){e=e||{};var r=e.random||(e.rng||QR)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,JR(r)}let uh,dh;if(typeof WeakMap<"u"){let e=new WeakMap;uh=t=>e.get(t),dh=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;uh=r=>{for(let o=0;o<e.length;o+=2)if(e[o]==r)return e[o+1]},dh=(r,o)=>(n==10&&(n=0),e[n++]=r,e[n++]=o)}var nt=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let a=1;i<this.width&&this.map[t+a]==n;a++)i++;for(let a=1;s<this.height&&this.map[t+this.width*a]==n;a++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return t=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s)&&t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let s=t+e*this.width;const a=(e+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}}static get(e){return uh(e)||dh(e,e4(e))}};function e4(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=t4(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let c=0,u=t*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;const g=d.child(p),{colspan:y,rowspan:b,colwidth:x}=g.attrs;for(let k=0;k<b;k++){if(k+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-k});break}const O=o+k*t;for(let M=0;M<y;M++){r[O+M]==0?r[O+M]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-M});const A=x&&x[M];if(A){const D=(O+M)%t*2,z=s[D];z==null||z!=A&&s[D+1]==1?(s[D]=A,s[D+1]=1):z==A&&s[D+1]++}}}o+=y,u+=g.nodeSize}const f=(c+1)*t;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new nt(t,n,r,i);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&n4(a,s,e),a}function t4(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let s=0;s<r;s++){const a=e.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function n4(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const u=t[(o+c)%e.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=r4(l)))[c]=u)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function r4(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Zt(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const mo=new $e("selectingCells");function di(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function o4(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function Sr(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Kp(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=di(t.$head)||i4(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function i4(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function fh(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function s4(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Qp(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function pk(e,t,n){const r=e.node(-1),o=nt.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return s==null?null:e.node(0).resolve(i+s)}function fi(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function mk(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(t,0,0)}return r}function a4(e,t,n){const r=Zt(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0}var Ge=class Br extends ge{constructor(t,n=t){const r=t.node(-1),o=nt.get(r),i=t.start(-1),s=o.rectBetween(t.pos-i,n.pos-i),a=t.node(0),l=o.cellsInRect(s).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new Fx(a.resolve(f),a.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(fh(r)&&fh(o)&&Qp(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Br.rowSelection(r,o):i&&this.isColSelection()?Br.colSelection(r,o):new Br(r,o)}return se.between(r,o)}content(){const t=this.$anchorCell.node(-1),n=nt.get(t),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let p=t.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=p.attrs;if(g>0&&(b=fi(b,0,g)),y>0&&(b=fi(b,b.colspan-y,y)),h.left<o.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}s.push(t.child(l).copy(j.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?t:s;return new Z(j.from(a),1,1)}replace(t,n=Z.empty){const r=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:a,$to:l}=o[s],c=t.mapping.slice(r);t.replace(c.map(a.pos),c.map(l.pos),s?Z.empty:n)}const i=ge.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new Z(j.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=nt.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)t(n.nodeAt(i[s]),o+i[s])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=nt.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Br(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=nt.get(t),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(t){return t instanceof Br&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=nt.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(n=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(t=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new Br(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new Br(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new Br(t.resolve(n),t.resolve(r))}getBookmark(){return new l4(this.$anchorCell.pos,this.$headCell.pos)}};Ge.prototype.visible=!1;ge.jsonID("cell",Ge);var l4=class gk{constructor(t,n){this.anchor=t,this.head=n}map(t){return new gk(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Qp(n,r)?new Ge(n,r):ge.near(r,1)}};function c4(e){if(!(e.selection instanceof Ge))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(qe.node(r,r+n.nodeSize,{class:"selectedCell"}))}),_e.create(e.doc,t)}function u4({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}function d4({$from:e,$to:t}){let n,r;for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&t.parentOffset===0}function f4(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,s;if(r instanceof le&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ge.create(o,r.from);else if(s=="row"){const a=o.resolve(r.from+1);i=Ge.rowSelection(a,a)}else if(!n){const a=nt.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=Ge.create(o,l+1,c)}}else r instanceof se&&u4(r)?i=se.create(o,r.from):r instanceof se&&d4(r)&&(i=se.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}const h4=new $e("fix-tables");function bk(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const l=t.child(s);for(let c=a,u=Math.min(o,s+3);c<u;c++)if(e.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<o&&e.child(a).sameMarkup(l)?bk(e.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function p4(e,t){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=m4(e,o,i,n))};return t?t.doc!=e.doc&&bk(t.doc,e.doc,0,r):e.doc.descendants(r),n}function m4(e,t,n,r){const o=nt.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,fi(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+t.nodeSize)}}let s,a;for(let l=0;l<i.length;l++)i[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<o.height;l++){const u=t.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<f;y++){const b=Zt(e.schema)[h].createAndFill();b&&p.push(b)}const g=(l==0||s==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),p)}c=d}return r.setMeta(h4,{fixTables:!0})}function vr(e){const t=e.selection,n=Kp(e),r=n.node(-1),o=n.start(-1),i=nt.get(r);return{...t instanceof Ge?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function yk(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;a4(t,r,o+i)&&(i=o==0||o==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){const l=t.map[a],c=r.nodeAt(l);e.setNodeMarkup(e.mapping.map(n+l),null,mk(c.attrs,o-t.colCount(l))),s+=c.attrs.rowspan-1}else{const l=i==null?Zt(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function g4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e);t(yk(e.tr,n,n.left))}return!0}function b4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e);t(yk(e.tr,n,n.right))}return!0}function y4(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+o,l=t.map[a],c=n.nodeAt(l),u=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,fi(u,o-t.colCount(l)));else{const d=e.mapping.slice(i).map(r+l);e.delete(d,d+c.nodeSize)}s+=u.rowspan}}function E4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;y4(r,n,o),o!=n.left;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=nt.get(i)}t(r)}return!0}function x4(e,t,n){var r;const o=Zt(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(((r=t.nodeAt(e.map[i+n*e.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function Ek(e,{map:t,tableStart:n,table:r},o){let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const s=[];let a=o>0?-1:0;x4(t,r,o+a)&&(a=o==0||o==t.height?null:0);for(let c=0,u=t.width*o;c<t.width;c++,u++)if(o>0&&o<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],f=r.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var l;const d=a==null?Zt(r.type.schema).cell:(l=r.nodeAt(t.map[u+a*t.width]))===null||l===void 0?void 0:l.type,f=d?.createAndFill();f&&s.push(f)}return e.insert(i,Zt(r.type.schema).row.create(null,s)),e}function C4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e);t(Ek(e.tr,n,n.top))}return!0}function k4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e);t(Ek(e.tr,n,n.bottom))}return!0}function T4(e,{map:t,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;const s=i+n.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+r,s+r);const l=new Set;for(let c=0,u=o*t.width;c<t.width;c++,u++){const d=t.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==t.map[u-t.width]){const f=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<t.height&&d==t.map[u+t.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=t.positionAt(o+1,c,n);e.insert(e.mapping.slice(a).map(r+g),p),c+=h.colspan-1}}}}function w4(e,t){if(!Sr(e))return!1;if(t){const n=vr(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;T4(r,n,o),o!=n.top;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=nt.get(n.table)}t(r)}return!0}function i1(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function S4({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,s=(r.bottom-1)*e+r.left,a=o+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[a]==n[a+1])return!0;i+=e,a+=e}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[s]==n[s+e])return!0;o++,s++}return!1}function v4(e,t){const n=e.selection;if(!(n instanceof Ge)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=vr(e),{map:o}=r;if(S4(o,r))return!1;if(t){const i=e.tr,s={};let a=j.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,l==null)l=f,c=h;else{i1(h)||(a=a.append(h.content));const p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...mk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const u=l+1+c.content.size,d=i1(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,a)}i.setSelection(new Ge(i.doc.resolve(l+r.tableStart))),t(i)}return!0}function A4(e,t){const n=Zt(e.schema);return N4(({node:r})=>n[r.type.spec.tableRole])(e,t)}function N4(e){return(t,n)=>{const r=t.selection;let o,i;if(r instanceof Ge){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=o4(r.$from),!o)return!1;i=(s=di(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let a=o.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=vr(t),d=t.tr;for(let h=0;h<u.right-u.left;h++)l.push(c?{...a,colwidth:c&&c[h]?[c[h]]:null}:a);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),e({node:o,row:h,col:g}).createAndFill(l[y]))}d.setNodeMarkup(i,e({node:o,row:u.top,col:u.left}),l[0]),r instanceof Ge&&d.setSelection(new Ge(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function I4(e){return function(t,n){if(!Sr(t))return!1;if(n){const r=Zt(t.schema),o=vr(t),i=t.tr,s=o.map.cellsInRect(e=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:e=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(l=>o.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[l],r.cell,a[l].attrs);if(i.steps.length===0)for(let l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],r.header_cell,a[l].attrs);n(i)}return!0}}function s1(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let o=0;o<r.length;o++){const i=t.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Xp(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?I4(e):function(n,r){if(!Sr(n))return!1;if(r){const o=Zt(n.schema),i=vr(n),s=n.tr,a=s1("row",i,o),l=s1("column",i,o),c=(e==="column"?a:e==="row"&&l)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:i.map.height}:e=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=e=="column"?l?o.cell:o.header_cell:e=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{const h=f+i.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,d,p.attrs)}),r(s)}return!0}}Xp("row",{useDeprecatedLogic:!0});Xp("column",{useDeprecatedLogic:!0});Xp("cell",{useDeprecatedLogic:!0});function M4(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,o=e.before();r>=0;r--){const i=e.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),o=e.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function a1(e){return function(t,n){if(!Sr(t))return!1;const r=M4(Kp(t),e);if(r==null)return!1;if(n){const o=t.doc.resolve(r);n(t.tr.setSelection(se.between(o,s4(o))).scrollIntoView())}return!0}}function sl(e,t){const n=e.selection;if(!(n instanceof Ge))return!1;if(t){const r=e.tr,o=Zt(e.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new Z(o,0,0))}),r.docChanged&&t(r)}return!0}function _4(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if(i=="row")for(let l=0;l<t.childCount;l++){let c=t.child(l).content;const u=l?0:Math.max(0,n-1),d=l<t.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=hh(Zt(s).row,new Z(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?hh(Zt(s).row,new Z(t,n,r)).content:t);else return null;return O4(s,a)}function O4(e,t){const n=[];for(let o=0;o<t.length;o++){const i=t[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=i.child(s).attrs;for(let c=o;c<o+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(j.empty),n[o]<r){const i=Zt(e).cell.createAndFill(),s=[];for(let a=n[o];a<r;a++)s.push(i);t[o]=t[o].append(j.from(s))}return{height:t.length,width:r,rows:t}}function hh(e,t){const n=e.createAndFill();return new xp(n).replace(0,n.content.size,t).doc}function R4({width:e,height:t,rows:n},r,o){if(e!=r){const i=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=i[a]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(fi(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+f.attrs.colspan}s.push(j.from(c))}n=s,e=r}if(t!=o){const i=[];for(let s=0,a=0;s<o;s++,a++){const l=[],c=n[a%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(j.from(l))}n=i,t=o}return{width:e,height:t,rows:n}}function L4(e,t,n,r,o,i,s){const a=e.doc.type.schema,l=Zt(a);let c,u;if(o>t.width)for(let d=0,f=0;d<t.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let y=t.width;y<o;y++)p.push(g);e.insert(e.mapping.slice(s).map(f-1+r),p)}if(i>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,o);p++){const y=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==l.header_cell;d.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,j.from(d)),h=[];for(let p=t.height;p<i;p++)h.push(f);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),h)}return!!(c||u)}function l1(e,t,n,r,o,i,s,a){if(s==0||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=s*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){l=!0;const f=n.nodeAt(d),{top:h,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(a).map(d+r),null,{...f.attrs,rowspan:s-h}),e.insert(e.mapping.slice(a).map(t.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return l}function c1(e,t,n,r,o,i,s,a){if(s==0||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*t.width+s,d=t.map[u];if(t.map[u-1]==d){l=!0;const f=n.nodeAt(d),h=t.colCount(d),p=e.mapping.slice(a).map(d+r);e.setNodeMarkup(p,null,fi(f.attrs,s-h,f.attrs.colspan-(s-h))),e.insert(p+f.nodeSize,f.type.createAndFill(fi(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return l}function u1(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let s=nt.get(i);const{top:a,left:l}=r,c=l+o.width,u=a+o.height,d=e.tr;let f=0;function h(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=nt.get(i),f=d.mapping.maps.length}L4(d,s,i,n,c,u,f)&&h(),l1(d,s,i,n,l,c,a,f)&&h(),l1(d,s,i,n,l,c,u,f)&&h(),c1(d,s,i,n,a,u,l,f)&&h(),c1(d,s,i,n,a,u,c,f)&&h();for(let p=a;p<u;p++){const g=s.positionAt(p,l,i),y=s.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(y+n),new Z(o.rows[p-a],0,0))}h(),d.setSelection(new Ge(d.doc.resolve(n+s.positionAt(a,l,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),t(d)}const D4=Pp({ArrowLeft:al("horiz",-1),ArrowRight:al("horiz",1),ArrowUp:al("vert",-1),ArrowDown:al("vert",1),"Shift-ArrowLeft":ll("horiz",-1),"Shift-ArrowRight":ll("horiz",1),"Shift-ArrowUp":ll("vert",-1),"Shift-ArrowDown":ll("vert",1),Backspace:sl,"Mod-Backspace":sl,Delete:sl,"Mod-Delete":sl});function Ll(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function al(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Ge)return Ll(n,r,ge.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;const s=xk(o,e,t);if(s==null)return!1;if(e=="horiz")return Ll(n,r,ge.near(n.doc.resolve(i.head+t),t));{const a=n.doc.resolve(s),l=pk(a,e,t);let c;return l?c=ge.near(l,1):t<0?c=ge.near(n.doc.resolve(a.before(-1)),-1):c=ge.near(n.doc.resolve(a.after(-1)),1),Ll(n,r,c)}}}function ll(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof Ge)s=i;else{const l=xk(o,e,t);if(l==null)return!1;s=new Ge(n.doc.resolve(l))}const a=pk(s.$headCell,e,t);return a?Ll(n,r,new Ge(s.$anchorCell,a)):!1}}function P4(e,t){const n=e.state.doc,r=di(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new Ge(r))),!0):!1}function B4(e,t,n){if(!Sr(e.state))return!1;let r=_4(n);const o=e.state.selection;if(o instanceof Ge){r||(r={width:1,height:1,rows:[j.from(hh(Zt(e.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=nt.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=R4(r,a.right-a.left,a.bottom-a.top),u1(e.state,e.dispatch,s,a,r),!0}else if(r){const i=Kp(e.state),s=i.start(-1);return u1(e.state,e.dispatch,s,nt.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function F4(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const r=d1(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof Ge)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(o=di(e.state.selection.$anchor))!=null&&((n=jd(e,t))===null||n===void 0?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(l,c){let u=jd(e,c);const d=mo.getState(e.state)==null;if(!u||!Qp(l,u))if(d)u=l;else return;const f=new Ge(l,u);if(d||!e.state.selection.eq(f)){const h=e.state.tr.setSelection(f);d&&h.setMeta(mo,l.pos),e.dispatch(h)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),mo.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(mo,-1))}function a(l){const c=l,u=mo.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(d1(e,c.target)!=r&&(d=jd(e,t),!d))return s();d&&i(d,c)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function xk(e,t,n){if(!(e.state.selection instanceof se))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=r.before(o),a=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(a)?s:null}}return null}function d1(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function jd(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&di(e.state.doc.resolve(r))||di(e.state.doc.resolve(o))}var Ck=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,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",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ph(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ph(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ph(e,t,n,r,o,i){let s=0,a=!0,l=t.firstChild;const c=e.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let g=0;g<h;g++,f++){const y=o==f?i:p&&p[g],b=y?y+"px":"";if(s+=y||r,y||(a=!1),l)l.style.width!=b&&(l.style.width=b),l=l.nextSibling;else{const x=document.createElement("col");x.style.width=b,t.appendChild(x)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const Nn=new $e("tableColumnResizing");function H4({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Ck,lastColumnResizable:o=!0}={}){const i=new Ae({key:Nn,state:{init(s,a){var l;const c=(l=i.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=Zt(a.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new U4(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Nn.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{V4(s,a,e,o)},mouseleave:s=>{$4(s)},mousedown:(s,a)=>{j4(s,a,t,n)}},decorations:s=>{const a=Nn.getState(s);if(a&&a.activeHandle>-1)return Y4(s,a.activeHandle)},nodeViews:{}}});return i}var U4=class Dl{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(Nn);if(r&&r.setHandle!=null)return new Dl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Dl(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let o=t.mapping.map(n.activeHandle,-1);return fh(t.doc.resolve(o))||(o=-1),new Dl(o,n.dragging)}return n}};function V4(e,t,n,r){if(!e.editable)return;const o=Nn.getState(e.state);if(o&&!o.dragging){const i=W4(t.target);let s=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();t.clientX-a<=n?s=f1(e,t,"left",n):l-t.clientX<=n&&(s=f1(e,t,"right",n))}if(s!=o.activeHandle){if(!r&&s!==-1){const a=e.state.doc.resolve(s),l=a.node(-1),c=nt.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}kk(e,s)}}}function $4(e){if(!e.editable)return;const t=Nn.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&kk(e,-1)}function j4(e,t,n,r){var o;if(!e.editable)return!1;const i=(o=e.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=Nn.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=z4(e,s.activeHandle,a.attrs);e.dispatch(e.state.tr.setMeta(Nn,{setDragging:{startX:t.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=Nn.getState(e.state);f?.dragging&&(q4(e,f.activeHandle,h1(f.dragging,d,n)),e.dispatch(e.state.tr.setMeta(Nn,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Nn.getState(e.state);if(f&&f.dragging){const h=h1(f.dragging,d,n);p1(e,f.activeHandle,h,r)}}return p1(e,s.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),t.preventDefault(),!0}function z4(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(s-=r[l],a--);return s/a}function W4(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function f1(e,t,n,r){const o=n=="right"?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:s}=i,a=di(e.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=nt.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function h1(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function kk(e,t){e.dispatch(e.state.tr.setMeta(Nn,{setHandle:t}))}function q4(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=nt.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:a-i.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():G4(f.colspan);p[h]=n,l.setNodeMarkup(s+d,null,{...f,colwidth:p})}l.docChanged&&e.dispatch(l)}function p1(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=nt.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&ph(i,l.firstChild,l,r,a,n)}function G4(e){return Array(e).fill(0)}function Y4(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return _e.empty;const i=nt.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=a+c*i.width;if((a==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var l;const d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((l=Nn.getState(e))===null||l===void 0)&&l.dragging&&n.push(qe.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(qe.widget(f,h))}}return _e.create(e.doc,n)}function K4({allowTableNodeSelection:e=!1}={}){return new Ae({key:mo,state:{init(){return null},apply(t,n){const r=t.getMeta(mo);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:o,pos:i}=t.mapping.mapResult(n);return o?null:i}},props:{decorations:c4,handleDOMEvents:{mousedown:F4},createSelectionBetween(t){return mo.getState(t.state)!=null?t.state.selection:null},handleTripleClick:P4,handleKeyDown:D4,handlePaste:B4},appendTransaction(t,n,r){return f4(r,p4(r,n),e)}})}var Q4=class Tk{constructor(t){this.cache=new Map(t)}get(t){return this.cache.get(t)}set(t,n,r){t<0||this.cache.set(t,[n,r])}replace(t,n,r,o){this.remove(t),this.set(n,r,o)}remove(t){this.cache.delete(t)}invalidate(t){const n=new Tk(this.cache),r=t.mapping;return this.cache.forEach(([o,i],s)=>{if(s<0)return;const a=r.mapResult(s),l=t.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(o))n.remove(s);else if(s!==a.pos){const c=i.map(u=>u.map(r,0,0)).filter(u=>u!=null);n.replace(s,a.pos,l,c)}}),n}};function X4({parser:e,nodeTypes:t=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new $e("prosemirror-highlight");return new Ae({key:r,state:{init(o,i){const s=new Q4,[a,l]=m1(i.doc,e,t,n,s);return{cache:s,decorations:a,promises:l}},apply:(o,i)=>{const s=i.cache.invalidate(o),a=!!o.getMeta("prosemirror-highlight-refresh");if(!o.docChanged&&!a)return{cache:s,decorations:i.decorations?.map(o.mapping,o.doc),promises:i.promises};const[l,c]=m1(o.doc,e,t,n,s);return{cache:s,decorations:l,promises:c}}},view:o=>{const i=new Set,s=()=>{if(i.size>0)return;const l=o.state.tr.setMeta("prosemirror-highlight-refresh",!0);o.dispatch(l)},a=()=>{const l=r.getState(o.state);for(const c of l?.promises??[])i.add(c),c.then(()=>{i.delete(c),s()}).catch(u=>{console.error("[prosemirror-highlight] Error resolving parser:",u),i.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(o){return this.getState(o)?.decorations}}})}function m1(e,t,n,r,o){const i=[],s=[],a=Z4(e,n);try{for(const[l,c]of a){const u=r(l),d=o.get(c);if(d){const[f,h]=d;h.length>0&&i.push(h)}else{const f=t({content:l.textContent,language:u||void 0,pos:c,size:l.nodeSize});f&&Array.isArray(f)?(o.set(c,l,f),f.length>0&&i.push(f)):f instanceof Promise?(o.remove(c),s.push(f)):console.error("[prosemirror-highlight] Invalid parser result:",f)}}}catch(l){console.error("[prosemirror-highlight] Error parsing code blocks:",l)}return[i.length>0?_e.create(e,i.flat()):void 0,s]}function Z4(e,t){const n=[];return e.descendants((r,o)=>{if(r.type.isTextblock&&t.includes(r.type.name))return n.push([r,o]),!1}),n}function J4(e,t){return function({content:r,language:o,pos:i,size:s}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=e.codeToTokens(r,{lang:o,theme:e.getLoadedThemes()[0]}),f=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(f){const p=qe.node(i,i+s,{style:f});a.push(p)}let h=i+1;for(const p of l){for(const g of p){const y=h+g.content.length,b=qe.inline(h,y,{style:eL(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(b),h=y}h+=1}return a}}function eL(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const tL=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},nL=/[\uD800-\uDBFF]/,rL=/[\uDC00-\uDFFF]/,oL=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&nL.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&rL.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},iL=oL,tt=new $e("y-sync"),yr=new $e("y-undo"),cl=new $e("yjs-cursor"),Er=(e,t)=>e>>>t|e<<32-t,sL=e=>Er(e,2)^Er(e,13)^Er(e,22),aL=e=>Er(e,6)^Er(e,11)^Er(e,25),lL=e=>Er(e,7)^Er(e,18)^e>>>3,cL=e=>Er(e,17)^Er(e,19)^e>>>10,uL=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dL=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class fL{constructor(){const t=new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(dL),this._W=new Uint32Array(t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=cL(n[d-2])+n[d-7]+lL(n[d-15])+n[d-16];let r=t[0],o=t[1],i=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7];for(let d=0,f,h;d<64;d++)f=u+aL(a)+(a&l^~a&c)+uL[d]+n[d]>>>0,h=sL(r)+(r&o^r&i^o&i)>>>0,u=c,c=l,l=a,a=s+f>>>0,s=i,i=o,o=r,r=f+h>>>0;t[0]+=r,t[1]+=o,t[2]+=i,t[3]+=s,t[4]+=a,t[5]+=l,t[6]+=c,t[7]+=u}digest(t){let n=0;for(;n+56<=t.length;){let s=0;for(;s<16&&n+3<t.length;s++)this._W[s]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<t.length;)this._W[s]|=t[n]<<(3-n%4)*8,n++;this._W[s]|=ug<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<t.length;o++)for(let s=3;s>=0&&n<t.length;s--)this._W[o]|=t[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=ug<<(3-n%4)*8),this._W[14]=t.byteLength/pA,this._W[15]=t.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)i[s*4+a]=this._H[s]>>>(3-a)*8;return i}}const hL=e=>new fL().digest(e),pL=e=>{for(let n=6;n<e.length;n++)e[n%6]=e[n%6]^e[n];return e.slice(0,6)},mL=e=>mA(pL(hL(gA(e)))),xc=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!xA(t.ds,e.id),gL=[{light:"#ecd44433",dark:"#ecd444"}],bL=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){const r=AA();e.forEach(o=>r.add(o)),t=t.filter(o=>!r.has(o))}e.set(n,wA(t))}return e.get(n)},yL=(e,{colors:t=gL,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new xL(e,i),l=new Ae({props:{editable:c=>{const u=tt.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:tt,state:{init:(c,u)=>({type:e,doc:e.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(tt);if(d!==void 0){u=Object.assign({},u);for(const f in d)u[f]=d[f]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&dp(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),i==null&&a._forceRerender(),o(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=yr.getState(c.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},tt)})}},destroy:()=>{a.destroy()}})});return l},EL=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type==="all")e.setSelection(new xn(e.doc));else if(t.type==="node"){const r=ni(n.doc,n.type,t.anchor,n.mapping);e.setSelection(le.create(e.doc,r))}else{const r=ni(n.doc,n.type,t.anchor,n.mapping),o=ni(n.doc,n.type,t.head,n.mapping);if(r!==null&&o!==null){const i=se.between(e.doc.resolve(r),e.doc.resolve(o));e.setSelection(i)}}},Cc=(e,t)=>({type:t.selection.jsonID,anchor:xa(t.selection.anchor,e.type,e.mapping),head:xa(t.selection.head,e.type,e.mapping)});class xL{constructor(t,n=new Map){this.type=t,this.prosemirrorView=null,this.mux=tL(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=t.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Cc(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(bA&&this._domSelectionInView===null&&(dp(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const t=this.prosemirrorView._root.getSelection();if(t==null||t.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(t.anchorNode,t.anchorOffset),n.setEnd(t.focusNode,t.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const o=n.getBoundingClientRect(),i=yA.documentElement;return o.bottom>=0&&o.right>=0&&o.left<=(window.innerWidth||i.clientWidth||0)&&o.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(t,n){n||(n=EA(NA(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(tt,{snapshot:t,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const t=this.type.toArray().map(r=>Pl(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Z(j.from(t),0,0));n.setMeta(tt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const t=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(o=>Pl(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Z(j.from(n),0,0));if(t){const o=Xo(Gl(t.anchor,0),r.doc.content.size),i=Xo(Gl(t.head,0),r.doc.content.size);r.setSelection(se.create(r.doc,o,i))}this.prosemirrorView.dispatch(r.setMeta(tt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(t,n,r){let o=this.doc,i=this.type;if(t||(t=cd(this.doc)),t instanceof Uint8Array||n instanceof Uint8Array)if((!(t instanceof Uint8Array)||!(n instanceof Uint8Array))&&bE(),o=new yE({gc:!1}),dg(o,n),n=cd(o),dg(o,t),t=cd(o),i._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);i=o.getXmlFragment(s)}else{const s=o.store.clients.get(i._item.id.client)??[],a=EE(s,i._item.id.clock);i=s[a].content.type}this.mapping.clear(),this.mux(()=>{o.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{fg(s,d,f=>{})});const l=(d,f)=>{const h=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:h,type:d,color:bL(r.colorMapping,r.colors,h)}},c=xE(i,new CE(n.ds,t.sv)).map(d=>!d._item.deleted||xc(d._item,t)||xc(d._item,n)?Pl(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},t,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Z(j.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(tt,{isChangeOrigin:!0}))},tt)})}_typeChanged(t,n){if(this.prosemirrorView==null)return;const r=tt.getState(this.prosemirrorView.state);if(t.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const o=(a,l)=>this.mapping.delete(l);fg(n,n.deleteSet,a=>{if(a.constructor===SE){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(o),n.changedParentTypes.forEach(o);const i=this.type.toArray().map(a=>wk(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Z(j.from(i),0,0));EL(s,this.beforeTransactionSelection,this),s=s.setMeta(tt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof kE}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(t){this.doc.transact(()=>{gh(this.doc,this.type,t,this),this.beforeTransactionSelection=Cc(this,this.prosemirrorView.state)},tt)}initView(t){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=t,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const wk=(e,t,n,r,o,i)=>{const s=n.mapping.get(e);if(s===void 0){if(e instanceof er)return Pl(e,t,n,r,o,i);throw CA()}return s},Pl=(e,t,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof er){const c=wk(l,t,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof TE&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=CL(l,t,n,r,o,i);u!==null&&u.forEach(d=>{d!==null&&s.push(d)})}};r===void 0||o===void 0?e.toArray().forEach(a):xE(e,new CE(o.ds,r.sv)).forEach(a);try{const l=e.getAttributes(r);r!==void 0&&(xc(e._item,r)?xc(e._item,o)||(l.ychange=i?i("added",e._item.id):{type:"added"}):l.ychange=i?i("removed",e._item.id):{type:"removed"});const c=t.node(e.nodeName,l,s);return n.mapping.set(e,c),c}catch{return e.doc.transact(c=>{e._item.delete(c)},tt),n.mapping.delete(e),null}},CL=(e,t,n,r,o,i)=>{const s=[],a=e.toDelta(r,o,i);try{for(let l=0;l<a.length;l++){const c=a[l];s.push(t.text(c.insert,AL(c.attributes,t)))}}catch{return e.doc.transact(c=>{e._item.delete(c)},tt),null}return s},kL=(e,t)=>{const n=new zr,r=e.map(o=>({insert:o.text,attributes:Ak(o.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},TL=(e,t)=>{const n=new er(e.type.name);for(const r in e.attrs){const o=e.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,Bu(e).map(r=>mh(r,t))),t.mapping.set(n,e),n},mh=(e,t)=>e instanceof Array?kL(e,t):TL(e,t),g1=e=>typeof e=="object"&&e!==null,Zp=(e,t)=>{const n=Object.keys(e).filter(o=>e[o]!==null);let r=n.length===(t==null?0:Object.keys(t).filter(o=>t[o]!==null).length);for(let o=0;o<n.length&&r;o++){const i=n[o],s=e[i],a=t[i];r=i==="ychange"||s===a||g1(s)&&g1(a)&&Zp(s,a)}return r},Bu=e=>{const t=e.content.content,n=[];for(let r=0;r<t.length;r++){const o=t[r];if(o.isText){const i=[];for(let s=t[r];r<t.length&&s.isText;s=t[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},Sk=(e,t)=>{const n=e.toDelta();return n.length===t.length&&n.every((r,o)=>r.insert===t[o].text&&kA(r.attributes||{}).length===t[o].marks.length&&TA(r.attributes,(i,s)=>{const a=vk(s),l=t[o].marks;return Zp(i,l.find(c=>c.type.name===a)?.attrs)}))},Ea=(e,t)=>{if(e instanceof er&&!(t instanceof Array)&&bh(e,t)){const n=Bu(t);return e._length===n.length&&Zp(e.getAttributes(),t.attrs)&&e.toArray().every((r,o)=>Ea(r,n[o]))}return e instanceof zr&&t instanceof Array&&Sk(e,t)},kc=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((n,r)=>t[r]===n),b1=(e,t,n)=>{const r=e.toArray(),o=Bu(t),i=o.length,s=r.length,a=Xo(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],f=o[l];if(kc(n.mapping.get(d),f))u=!0;else if(!Ea(d,f))break}for(;l+c<a;c++){const d=r[s-c-1],f=o[i-c-1];if(kc(n.mapping.get(d),f))u=!0;else if(!Ea(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},wL=e=>{let t="",n=e._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof SA?t+=n.content.str:n.content instanceof vA&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},SL=(e,t,n)=>{n.mapping.set(e,t);const{nAttrs:r,str:o}=wL(e),i=t.map(c=>({insert:c.text,attributes:Object.assign({},r,Ak(c.marks,n))})),{insert:s,remove:a,index:l}=iL(o,i.map(c=>c.insert).join(""));e.delete(l,a),e.insert(l,s),e.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},vL=/(.*)(--[a-zA-Z0-9+/=]{8})$/,vk=e=>vL.exec(e)?.[1]??e,AL=(e,t)=>{const n=[];for(const r in e)n.push(t.mark(vk(r),e[r]));return n},Ak=(e,t)=>{const n={};return e.forEach(r=>{if(r.type.name!=="ychange"){const o=wE(t.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${mL(r.toJSON())}`:r.type.name]=r.attrs}}),n},gh=(e,t,n,r)=>{if(t instanceof er&&t.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(t,n),t instanceof er){const d=t.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&t.setAttribute(h,f[h]):t.removeAttribute(h);for(const h in d)f[h]===void 0&&t.removeAttribute(h)}const o=Bu(n),i=o.length,s=t.toArray(),a=s.length,l=Xo(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],f=o[c];if(!kc(r.mapping.get(d),f))if(Ea(d,f))r.mapping.set(d,f);else break}for(;u+c<l;u++){const d=s[a-u-1],f=o[i-u-1];if(!kc(r.mapping.get(d),f))if(Ea(d,f))r.mapping.set(d,f);else break}e.transact(()=>{for(;a-c-u>0&&i-c-u>0;){const f=s[c],h=o[c],p=s[a-u-1],g=o[i-u-1];if(f instanceof zr&&h instanceof Array)Sk(f,h)||SL(f,h,r),c+=1;else{let y=f instanceof er&&bh(f,h),b=p instanceof er&&bh(p,g);if(y&&b){const x=b1(f,h,r),k=b1(p,g,r);x.foundMappedChild&&!k.foundMappedChild?b=!1:!x.foundMappedChild&&k.foundMappedChild||x.equalityFactor<k.equalityFactor?y=!1:b=!1}y?(gh(e,f,h,r),c+=1):b?(gh(e,p,g,r),u+=1):(r.mapping.delete(t.get(c)),t.delete(c,1),t.insert(c,[mh(h,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof zr?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(t.slice(c,c+d).forEach(f=>r.mapping.delete(f)),t.delete(c,d)),c+u<i){const f=[];for(let h=c;h<i-u;h++)f.push(mh(o[h],r));t.insert(c,f)}},tt)},bh=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name;let zs=null;const NL=()=>{const e=zs;zs=null,e.forEach((t,n)=>{const r=n.state.tr,o=tt.getState(n.state);o&&o.binding&&!o.binding.isDestroyed&&(t.forEach((i,s)=>{r.setMeta(s,i)}),n.dispatch(r))})},IL=(e,t,n)=>{zs||(zs=new Map,dp(0,NL)),wE(zs,e,IA).set(t,n)},xa=(e,t,n)=>{if(e===0)return ud(t,0,t.length===0?-1:0);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof zr){if(r._length>=e)return ud(r,e,t.length===0?-1:0);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{const o=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<o)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&o>1)return new Pf(r._item===null?null:r._item.id,r._item===null?Bf(r):null,null);if(e-=o,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new Pf(r._item===null?null:r._item.id,r._item===null?Bf(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw bE();if(e===0&&r.constructor!==zr&&r!==t)return ML(r._item.parent,r._item)}return ud(t,t._length,t.length===0?-1:0)},ML=(e,t)=>{let n=null,r=null;return e._item===null?r=Bf(e):n=OA(e._item.id.client,e._item.id.clock),new Pf(n,r,t.id)},ni=(e,t,n,r)=>{const o=MA(n,e);if(o===null||o.type!==t&&!_A(t,o.type._item))return null;let i=o.type,s=0;if(i.constructor===zr)s=o.index;else if(i._item===null||!i._item.deleted){let a=i._first,l=0;for(;l<i._length&&l<o.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof zr?s+=c._length:s+=r.get(c).nodeSize}a=a.right}s+=1}for(;i!==t&&i._item!==null;){const a=i._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===i)break;l.deleted||(c instanceof zr?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},_L=(e,t,n)=>e!==t,OL=e=>{const t=document.createElement("span");t.classList.add("ProseMirror-yjs-cursor"),t.setAttribute("style",`border-color: ${e.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);const r=document.createTextNode("⁠"),o=document.createTextNode("⁠");return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(o,null),t},Nk=e=>({style:`background-color: ${e.color}70`,class:"ProseMirror-yjs-selection"}),RL=/^#[0-9a-fA-F]{6}$/,y1=(e,t,n,r,o)=>{const i=tt.getState(e),s=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?_e.create(e.doc,[]):(t.getStates().forEach((l,c)=>{if(n(s.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":RL.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=ni(s,i.type,Fs(l.cursor.anchor),i.binding.mapping),f=ni(s,i.type,Fs(l.cursor.head),i.binding.mapping);if(d!==null&&f!==null){const h=Gl(e.doc.content.size-1,0);d=Xo(d,h),f=Xo(f,h),a.push(qe.widget(f,()=>r(u,c),{key:c+"",side:10}));const p=Xo(d,f),g=Gl(d,f);a.push(qe.inline(p,g,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),_e.create(e.doc,a))},LL=(e,{awarenessStateFilter:t=_L,cursorBuilder:n=OL,selectionBuilder:r=Nk,getSelection:o=s=>s.selection}={},i="cursor")=>new Ae({key:cl,state:{init(s,a){return y1(a,e,t,n,r)},apply(s,a,l,c){const u=tt.getState(c),d=s.getMeta(cl);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?y1(c,e,t,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>cl.getState(s)},view:s=>{const a=()=>{s.docView&&IL(s,cl,{awarenessUpdated:!0})},l=()=>{const c=tt.getState(s.state),u=e.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),f=xa(d.anchor,c.type,c.binding.mapping),h=xa(d.head,c.type,c.binding.mapping);(u.cursor==null||!hg(Fs(u.cursor.anchor),f)||!hg(Fs(u.cursor.head),h))&&e.setLocalStateField(i,{anchor:f,head:h})}else u.cursor!=null&&ni(c.doc,c.type,Fs(u.cursor.anchor),c.binding.mapping)!==null&&e.setLocalStateField(i,null)};return e.on("change",a),s.dom.addEventListener("focusin",l),s.dom.addEventListener("focusout",l),{update:l,destroy:()=>{s.dom.removeEventListener("focusin",l),s.dom.removeEventListener("focusout",l),e.off("change",a),e.setLocalStateField(i,null)}}}}),DL=e=>yr.getState(e)?.undoManager?.undo()!=null,PL=e=>yr.getState(e)?.undoManager?.redo()!=null,BL=(e,t)=>t==null?yr.getState(e)?.undoManager?.canUndo():DL(e),FL=(e,t)=>t==null?yr.getState(e)?.undoManager?.canRedo():PL(e),HL=new Set(["paragraph"]),UL=(e,t)=>!(e instanceof SE)||!(e.content instanceof RA)||!(e.content.type instanceof TE||e.content.type instanceof er&&t.has(e.content.type.nodeName))||e.content.type._length===0,VL=({protectedNodes:e=HL,trackedOrigins:t=[],undoManager:n=null}={})=>new Ae({key:yr,state:{init:(r,o)=>{const i=tt.getState(o),s=n||new kE(i.type,{trackedOrigins:new Set([tt].concat(t)),deleteFilter:a=>UL(a,e),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,o,i,s)=>{const a=tt.getState(s).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Cc(a,i),hasUndoOps:c,hasRedoOps:u}:c!==o.hasUndoOps||u!==o.hasRedoOps?Object.assign({},o,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):o}},view:r=>{const o=tt.getState(r.state),i=yr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,yr.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const a=o.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});var E1=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},$L=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,zL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,WL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,qL=Gn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return E1("strong",{...Rn(this.options.HTMLAttributes,e),children:E1("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[as({find:$L,type:this.type}),as({find:zL,type:this.type})]},addPasteRules(){return[ui({find:jL,type:this.type}),ui({find:WL,type:this.type})]}}),GL=qL,YL=/(^|[^`])`([^`]+)`(?!`)$/,KL=/(^|[^`])`([^`]+)`(?!`)/g,QL=Gn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Rn(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[as({find:YL,type:this.type})]},addPasteRules(){return[ui({find:KL,type:this.type})]}}),XL=QL,ZL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,JL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,eD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,tD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,nD=Gn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Rn(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[as({find:ZL,type:this.type}),as({find:eD,type:this.type})]},addPasteRules(){return[ui({find:JL,type:this.type}),ui({find:tD,type:this.type})]}}),rD=nD,oD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,iD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sD=Gn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Rn(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[as({find:oD,type:this.type})]},addPasteRules(){return[ui({find:iD,type:this.type})]}}),aD=sD,lD=Gn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Rn(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cD=lD;function uD(e,t=JSON.stringify){let n={};return e.filter(r=>{let o=t(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function dD(e){return uD(e.filter((t,n)=>e.indexOf(t)!==n))}var Fu=mt.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,isWithinEditor:void 0,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){let e=window.__TEST_OPTIONS;return e.mockID===void 0?e.mockID=0:e.mockID++,e.mockID.toString()}return hk()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:e=>e.getAttribute(`data-${this.options.attributeName}`),renderHTML:e=>{let t={[`data-${this.options.attributeName}`]:e[this.options.attributeName]};return this.options.setIdAttribute?{...t,id:e[this.options.attributeName]}:t}}}}]},addProseMirrorPlugins(){let{isWithinEditor:e}=this.options,t=null,n=!1;return[new Ae({key:new $e("uniqueID"),appendTransaction:(r,o,i)=>{let s=r.some(p=>p.docChanged)&&!o.doc.eq(i.doc),a=this.options.filterTransaction&&r.some(p=>!this.options.filterTransaction?.(p));if(!s||a)return;let{tr:l}=i,{types:c,attributeName:u,generateID:d}=this.options,f=Lu(o.doc,r),{mapping:h}=f;if($p(f).forEach(({newRange:p})=>{let g=yc(i.doc,p,b=>c.includes(b.type.name)),y=dD(g.map(({node:b})=>b.attrs[u]).filter(b=>b!==null));g.forEach(({node:b,pos:x})=>{let k=l.doc.nodeAt(x)?.attrs[u];if(k===null){let M=o.doc.type.createAndFill().content;if(o.doc.content.findDiffStart(M)===null){let A=JSON.parse(JSON.stringify(i.doc.toJSON()));if(A.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(A.content)===JSON.stringify(M.toJSON())){l.setNodeMarkup(x,void 0,{...b.attrs,[u]:"initialBlockId"});return}}l.setNodeMarkup(x,void 0,{...b.attrs,[u]:d()});return}let{deleted:O}=h.invert().mapResult(x);O&&y.includes(k)&&l.setNodeMarkup(x,void 0,{...b.attrs,[u]:d()})})}),l.steps.length)return l.setMeta("uniqueID",!0),l},view(r){let o=i=>{let s=r.dom.parentElement;t=s?.contains(i.target)||e?.(i.target)?s:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(r,o)=>(n=t!==r.dom.parentElement||o.dataTransfer?.effectAllowed==="copy",t=null,!1),paste:()=>(n=!0,!1)},transformPasted:r=>{if(!n)return r;let{types:o,attributeName:i}=this.options,s=a=>{let l=[];return a.forEach(c=>{if(c.isText){l.push(c);return}if(!o.includes(c.type.name)){l.push(c.copy(s(c.content)));return}let u=c.type.create({...c.attrs,[i]:null},s(c.content),c.marks);l.push(u)}),j.from(l)};return n=!1,new Z(s(r.content),r.openStart,r.openEnd)}}})]}});function x1(e){return e.type==="link"}function Ik(e){return typeof e!="string"&&e.type==="link"}function hi(e){return typeof e!="string"&&e.type==="text"}function Io(e){return Mo(e)?{...e}:Ca(e)?{type:"tableCell",content:[].concat(e.content),props:{backgroundColor:e.props?.backgroundColor??"default",textColor:e.props?.textColor??"default",textAlignment:e.props?.textAlignment??"left",colspan:e.props?.colspan??1,rowspan:e.props?.rowspan??1}}:{type:"tableCell",content:[].concat(e),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function Ca(e){return e!=null&&typeof e!="string"&&!Array.isArray(e)&&e.type==="tableCell"}function Mo(e){return Ca(e)&&e.props!==void 0&&e.content!==void 0}function pi(e){return Mo(e)?e.props.colspan??1:1}function ka(e){return Mo(e)?e.props.rowspan??1:1}var Tr=class extends Error{constructor(e){super(`Unreachable case: ${e}`)}};function Te(e,t=!0){let{"data-test":n,...r}=e;if(Object.keys(r).length>0&&t)throw Error("Object must be empty "+JSON.stringify(e))}var fD=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function Bn(e,t="Ctrl"){return fD()?e.replace("Mod","⌘"):e.replace("Mod",t)}function ut(...e){return[...new Set(e.filter(t=>t).join(" ").split(" "))].join(" ")}function hD(e,t,n,r){let o=document.createElement("div");o.className=ut("bn-block-content",n.class),o.setAttribute("data-content-type",e);for(let[s,a]of Object.entries(n))s!=="class"&&o.setAttribute(s,a);let i=document.createElement(t);i.className=ut("bn-inline-content",r.class);for(let[s,a]of Object.entries(r))s!=="class"&&i.setAttribute(s,a);return o.appendChild(i),{dom:o,contentDOM:i}}var C1=(e,t)=>{let n=Ei(e,t.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);let r=t.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r(n);if(typeof o!="object"||!("dom"in o))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return o};function Mk(e,t="<br>"){let n=e.querySelectorAll("p");if(n.length>1){let r=n[0];for(let o=1;o<n.length;o++){let i=n[o];r.innerHTML+=t+i.innerHTML,i.remove()}}}function Tc(e){return"data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function k1(e){let t=e.split("/");return!t.length||t[t.length-1]===""?e:t[t.length-1]}function pD(e){let t=["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"];try{let n=new URL(e).pathname.split(".").pop()?.toLowerCase()||"";return t.includes(n)}catch{return!1}}function mD(e){let t={};return Object.entries(e).forEach(([n,r])=>{t[n]={default:r.default,keepOnSplit:!0,parseHTML:o=>{let i=o.getAttribute(Tc(n));if(i===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return i==="true"?!0:i==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){let s=parseFloat(i);return!Number.isNaN(s)&&Number.isFinite(s)?s:null}return i},renderHTML:o=>o[n]===r.default?{}:{[Tc(n)]:o[n]}}}),t}function _k(e,t,n,r){let o=e();if(o===void 0)throw Error("Cannot find node position");let i=n.state.doc.resolve(o).node().attrs.id;if(!i)throw Error("Block doesn't have id");let s=t.getBlock(i);if(s.type!==r)throw Error("Block type does not match");return s}function yh(e,t,n,r,o=!1,i){let s=document.createElement("div");if(i!==void 0)for(let[a,l]of Object.entries(i))a!=="class"&&s.setAttribute(a,l);s.className=ut("bn-block-content",i?.class||""),s.setAttribute("data-content-type",t);for(let[a,l]of Object.entries(n))l!==r[a].default&&s.setAttribute(Tc(a),l);return o&&s.setAttribute("data-file-block",""),s.appendChild(e.dom),e.contentDOM&&(e.contentDOM.className=ut("bn-inline-content",e.contentDOM.className)),{...e,dom:s}}function gD(e,t,n){return{config:{type:e.type,content:e.content,propSchema:t},implementation:{node:e.node,render:C1,toExternalHTML:C1},extensions:n}}function bD(e,t){e.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{t.view.dom.blur()},10),!0)}function yD(e,t){let n=[{tag:"[data-content-type="+e.type+"]",contentElement:".bn-inline-content"}];return t.parse&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;let o=t.parse?.(r);return o===void 0?!1:o},preserveWhitespace:!0,getContent:e.content==="inline"||e.content==="none"?(r,o)=>{if(t.parseContent){let i=t.parseContent({el:r,schema:o});if(i!==void 0)return i}if(e.content==="inline"){let i=r.cloneNode(!0);return Mk(i,t.meta?.code?`
102
+ `:"<br>"),sn.fromSchema(o).parse(i,{topNode:o.nodes.paragraph.create(),preserveWhitespace:!0}).content}return j.empty}:void 0}),n}function ED(e,t,n,r){let o=t.node||sr.create({name:e.type,content:e.content==="inline"?"inline*":e.content==="none"?"":e.content,group:"blockContent",selectable:t.meta?.selectable??!0,isolating:t.meta?.isolating??!0,code:t.meta?.code??!1,defining:t.meta?.defining??!0,priority:r,addAttributes(){return mD(e.propSchema)},parseHTML(){return yD(e,t)},renderHTML({HTMLAttributes:i}){let s=document.createElement("div");return yh({dom:s,contentDOM:e.content==="inline"?s:void 0},e.type,{},e.propSchema,t.meta?.fileBlockAccept!==void 0,i)},addNodeView(){return i=>{let s=this.options.editor,a=_k(i.getPos,s,this.editor,e.type),l=this.options.domAttributes?.blockContent||{},c=t.render.call({blockContentDOMAttributes:l,props:i,renderType:"nodeView"},a,s);return t.meta?.selectable===!1&&bD(c,this.editor),c}}});if(o.name!==e.type)throw Error("Node name does not match block type. This is a bug in BlockNote.");return{config:e,implementation:{...t,node:o,render(i,s){let a=o.options.domAttributes?.blockContent||{};return t.render.call({blockContentDOMAttributes:a,props:void 0,renderType:"dom"},i,s)},toExternalHTML:(i,s,a)=>{let l=o.options.domAttributes?.blockContent||{};return t.toExternalHTML?.call({blockContentDOMAttributes:l},i,s,a)??t.render.call({blockContentDOMAttributes:l,renderType:"dom",props:void 0},i,s)}},extensions:n}}function Ln(e,t,n){return(r={})=>{let o=typeof e=="function"?e(r):e,i=typeof t=="function"?t(r):t,s=n?typeof n=="function"?n(r):n:void 0;return{config:o,implementation:{...i,toExternalHTML(a,l,c){let u=i.toExternalHTML?.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l,c);if(u!==void 0)return yh(u,a.type,a.props,o.propSchema,i.meta?.fileBlockAccept!==void 0)},render(a,l){return yh(i.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l),a.type,a.props,o.propSchema,i.meta?.fileBlockAccept!==void 0,this.blockContentDOMAttributes)}},extensions:s}}}function _o(e,t){let n=e.resolve(t);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,o=n.node(r);for(;r>0;){if(o.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:o};r--,o=n.node(r)}let i=[];e.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&i.push(l)}),console.warn(`Position ${t} is not within a blockContainer node.`);let s=e.resolve(i.find(a=>a>=t)||i[i.length-1]);return{posBeforeNode:s.pos,node:s.nodeAfter}}function Jp(e,t){if(!e.type.isInGroup("bnBlock"))throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);let n=e,r=t,o={node:n,beforePos:r,afterPos:r+n.nodeSize};if(n.type.name==="blockContainer"){let i,s;if(n.forEach((a,l)=>{if(a.type.spec.group==="blockContent"){let c=a,u=r+l+1;i={node:c,beforePos:u,afterPos:u+a.nodeSize}}else if(a.type.name==="blockGroup"){let c=a,u=r+l+1;s={node:c,beforePos:u,afterPos:u+a.nodeSize}}}),!i)throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:o,blockContent:i,childContainer:s,blockNoteType:i.node.type.name}}else{if(!o.node.type.isInGroup("childContainer"))throw Error(`bnBlock node is not in the childContainer group: ${o.node}`);return{isBlockContainer:!1,bnBlock:o,childContainer:o,blockNoteType:o.node.type.name}}}function Qr(e){return Jp(e.node,e.posBeforeNode)}function Oo(e){if(!e.nodeAfter)throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);return Jp(e.nodeAfter,e.pos)}function Ct(e){return Qr(_o(e.doc,e.selection.anchor))}function La(e){return Qr(_o(e.doc,e.selection.anchor))}function kt(e){return"doc"in e?e.doc.type.schema:e.type.schema}function Ok(e){return e.cached.blockNoteEditor}function Da(e){return Ok(e).schema}function em(e){return Da(e).blockSchema}function tm(e){return Da(e).inlineContentSchema}function fs(e){return Da(e).styleSchema}function nm(e){return Ok(e).blockCache}function Rk(e,t,n){let r={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},o=[];e.content.forEach((i,s,a)=>{let l={cells:[]};a===0&&i.content.forEach(c=>{let u=c.attrs.colwidth;u??=Array(c.attrs.colspan??1).fill(void 0),r.columnWidths.push(...u)}),l.cells=i.content.content.map((c,u)=>(o[a]||(o[a]=[]),o[a][u]=c.type.name==="tableHeader",{type:"tableCell",content:c.content.content.map(d=>Hu(d,t,n)).reduce((d,f)=>{if(!d.length)return f;let h=d[d.length-1],p=f[0];return p&&hi(h)&&hi(p)&&JSON.stringify(h.styles)===JSON.stringify(p.styles)?(h.text+=`
103
+ `+p.text,d.push(...f.slice(1)),d):(d.push(...f),d)},[]),props:{colspan:c.attrs.colspan,rowspan:c.attrs.rowspan,backgroundColor:c.attrs.backgroundColor,textColor:c.attrs.textColor,textAlignment:c.attrs.textAlignment}})),r.rows.push(l)});for(let i=0;i<o.length;i++)o[i]?.every(s=>s)&&(r.headerRows=(r.headerRows??0)+1);for(let i=0;i<o[0]?.length;i++)o?.every(s=>s[i])&&(r.headerCols=(r.headerCols??0)+1);return r}function Hu(e,t,n){let r=[],o;return e.content.forEach(i=>{if(i.type.name==="hardBreak"){if(o)if(hi(o))o.text+=`
104
+ `;else if(x1(o))o.content[o.content.length-1].text+=`
105
+ `;else throw Error("unexpected");else o={type:"text",text:`
106
+ `,styles:{}};return}if(i.type.name!=="link"&&i.type.name!=="text"){if(!t[i.type.name]){console.warn("unrecognized inline content type",i.type.name);return}o&&=(r.push(o),void 0),r.push(rm(i,t,n));return}let s={},a;for(let l of i.marks)if(l.type.name==="link")a=l;else{let c=n[l.type.name];if(!c){if(l.type.spec.blocknoteIgnore)continue;throw Error(`style ${l.type.name} not found in styleSchema`)}if(c.propSchema==="boolean")s[c.type]=!0;else if(c.propSchema==="string")s[c.type]=l.attrs.stringValue;else throw new Tr(c.propSchema)}o?hi(o)?a?(r.push(o),o={type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}):JSON.stringify(o.styles)===JSON.stringify(s)?o.text+=i.textContent:(r.push(o),o={type:"text",text:i.textContent,styles:s}):x1(o)&&(a?o.href===a.attrs.href?JSON.stringify(o.content[o.content.length-1].styles)===JSON.stringify(s)?o.content[o.content.length-1].text+=i.textContent:o.content.push({type:"text",text:i.textContent,styles:s}):(r.push(o),o={type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}):(r.push(o),o={type:"text",text:i.textContent,styles:s})):o=a?{type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}:{type:"text",text:i.textContent,styles:s}}),o&&r.push(o),r}function rm(e,t,n){if(e.type.name==="text"||e.type.name==="link")throw Error("unexpected");let r={},o=t[e.type.name];for(let[s,a]of Object.entries(e.attrs)){if(!o)throw Error("ic node is of an unrecognized type: "+e.type.name);s in o.propSchema&&(r[s]=a)}let i;return i=o.content==="styled"?Hu(e,t,n):void 0,{type:e.type.name,props:r,content:i}}function pt(e,t,n=em(t),r=tm(t),o=fs(t),i=nm(t)){if(!e.type.isInGroup("bnBlock"))throw Error("Node should be a bnBlock, but is instead: "+e.type.name);let s=i?.get(e);if(s)return s;let a=Jp(e,0),l=a.bnBlock.node.attrs.id;l===null&&(l=Fu.options.generateID());let c=n[a.blockNoteType];if(!c)throw Error("Block is of an unrecognized type: "+a.blockNoteType);let u={};for(let[g,y]of Object.entries({...e.attrs,...a.isBlockContainer?a.blockContent.node.attrs:{}})){let b=c.propSchema;g in b&&!(b[g].default===void 0&&y===void 0)&&(u[g]=y)}let d=n[a.blockNoteType],f=[];a.childContainer?.node.forEach(g=>{f.push(pt(g,t,n,r,o,i))});let h;if(d.content==="inline"){if(!a.isBlockContainer)throw Error("impossible");h=Hu(a.blockContent.node,r,o)}else if(d.content==="table"){if(!a.isBlockContainer)throw Error("impossible");h=Rk(a.blockContent.node,r,o)}else if(d.content==="none")h=void 0;else throw new Tr(d.content);let p={id:l,type:d.type,props:u,content:h,children:f};return i?.set(e,p),p}function xD(e,t=kt(e),n=em(t),r=tm(t),o=fs(t),i=nm(t)){let s=[];return e.firstChild&&e.firstChild.descendants(a=>(s.push(pt(a,t,n,r,o,i)),!1)),s}function CD(e,t,n=em(t),r=tm(t),o=fs(t),i=nm(t)){function s(a,l,c){if(a.type.name!=="blockGroup")throw Error("unexpected");let u=[],d,f;return a.forEach((h,p,g)=>{if(h.type.name!=="blockContainer")throw Error("unexpected");if(h.childCount===0)return;if(h.childCount===0||h.childCount>2)throw Error("unexpected, blockContainer.childCount: "+h.childCount);let y=g===0,b=g===a.childCount-1;if(h.firstChild.type.name==="blockGroup"){if(!y)throw Error("unexpected");let M=s(h.firstChild,Math.max(0,l-1),b?Math.max(0,c-1):0);d=M.blockCutAtStart,b&&(f=M.blockCutAtEnd),u.push(...M.blocks);return}let x=pt(h,t,n,r,o,i),k=h.childCount>1?h.child(1):void 0,O=[];if(k){let M=s(k,0,b?Math.max(0,c-1):0);O=M.blocks,b&&(f=M.blockCutAtEnd)}b&&!k&&c>1&&(f=x.id),y&&l>1&&(d=x.id),u.push({...x,children:O})}),{blocks:u,blockCutAtStart:d,blockCutAtEnd:f}}if(e.content.childCount===0)return{blocks:[],blockCutAtStart:void 0,blockCutAtEnd:void 0};if(e.content.childCount!==1)throw Error("slice must be a single block, did you forget includeParents=true?");return s(e.content.firstChild,Math.max(e.openStart-1,0),Math.max(e.openEnd-1,0))}function Lk(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.config]))}function kD(e){return e==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:t=>t.getAttribute("data-value"),renderHTML:t=>t.stringValue===void 0?{}:{"data-value":t.stringValue}}}}function ul(e,t,n,r){return e.dom.setAttribute("data-style-type",t),r==="string"&&e.dom.setAttribute("data-value",n),e.contentDOM&&e.contentDOM.setAttribute("data-editable",""),e}function Dk(e,t){return{config:e,implementation:t}}function ys(e,t){return Dk({type:e.name,propSchema:t},{mark:e,render(n,r){let o=r.pmSchema.marks[e.name].spec.toDOM;if(o===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let i=r.pmSchema.mark(e.name,{stringValue:n}),s=On.renderSpec(document,o(i,!0));if(typeof s!="object"||!("dom"in s))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return s},toExternalHTML(n,r){let o=r.pmSchema.marks[e.name].spec.toDOM;if(o===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let i=r.pmSchema.mark(e.name,{stringValue:n}),s=On.renderSpec(document,o(i,!0));if(typeof s!="object"||!("dom"in s))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return s}})}function Pk(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.config]))}function TD(e,t){let n=[{tag:`[data-style-type="${e.type}"]`,contentElement:r=>{let o=r;return o.matches("[data-editable]")?o:o.querySelector("[data-editable]")||o}}];return t&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;let o=t?.(r);return o===void 0?!1:{stringValue:o}}}),n}function Bk(e,t){let n=Gn.create({name:e.type,addAttributes(){return kD(e.propSchema)},parseHTML(){return TD(e,t.parse)},renderHTML({mark:r}){return ul((t.toExternalHTML||t.render)(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema)},addMarkView(){return({mark:r})=>ul(t.render(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema)}});return Dk(e,{...t,mark:n,render:r=>ul(t.render(r),e.type,r,e.propSchema),toExternalHTML:r=>ul((t.toExternalHTML||t.render)(r),e.type,r,e.propSchema)})}function wD(e){let t=vD(e),{roots:n,nonRoots:r}=T1(t),o=[];for(;n.size;){o.push(n);let i=new Set;for(let s of n){let a=e.get(s);if(a)for(let l of a){let c=t.get(l);if(c===void 0)continue;let u=c-1;t.set(l,u),u===0&&i.add(l)}}n=i}if(r=T1(t).nonRoots,r.size)throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);return o}function SD(e){return wD(AD(e))}function vD(e){let t=new Map;for(let[n,r]of e.entries()){t.has(n)||t.set(n,0);for(let o of r){let i=t.get(o)??0;t.set(o,i+1)}}return t}function T1(e){let t=new Set,n=new Set;for(let[r,o]of e.entries())o===0?t.add(r):n.add(r);return{roots:t,nonRoots:n}}function AD(e){let t=new Map;for(let[n,r]of e.entries()){t.has(n)||t.set(n,new Set);for(let o of r)t.has(o)||t.set(o,new Set),t.get(o).add(n)}return t}function ND(){return new Map}function w1(e,t,n){return e.has(t)||e.set(t,new Set),e.get(t).add(n),e}function Fk(e){let t=ND();for(let o of e)Array.isArray(o.runsBefore)&&o.runsBefore.length>0?o.runsBefore.forEach(i=>{w1(t,o.key,i)}):w1(t,"default",o.key);let n=SD(t),r=n.findIndex(o=>o.has("default"));return o=>91+(n.findIndex(i=>i.has(o))+r)*10}function S1(e){return e&&Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}var ID=class{BlockNoteEditor="only for types";Block="only for types";PartialBlock="only for types";inlineContentSpecs;styleSpecs;blockSpecs;blockSchema;inlineContentSchema;styleSchema;constructor(t){this.opts=t;let{blockSpecs:n,inlineContentSpecs:r,styleSpecs:o,blockSchema:i,inlineContentSchema:s,styleSchema:a}=this.init();this.blockSpecs=n,this.styleSpecs=o,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=i,this.inlineContentSchema=s}init(){let t=Fk(Object.entries({...this.opts.blockSpecs,...this.opts.inlineContentSpecs,...this.opts.styleSpecs}).map(([i,s])=>({key:i,runsBefore:s.implementation?.runsBefore??[]}))),n=Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([i,s])=>[i,ED(s.config,s.implementation,s.extensions,t(i))])),r=Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([i,s])=>typeof s.config=="object"?[i,{...s,implementation:{...s.implementation,node:s.implementation?.node.extend({priority:t(i)})}}]:[i,s])),o=Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([i,s])=>[i,{...s,implementation:{...s.implementation,mark:s.implementation?.mark.extend({priority:t(i)})}}]));return{blockSpecs:n,blockSchema:Object.fromEntries(Object.entries(n).map(([i,s])=>[i,s.config])),inlineContentSpecs:S1(r),styleSpecs:S1(o),inlineContentSchema:Lk(r),styleSchema:Pk(o)}}extend(t){Object.assign(this.opts.blockSpecs,t.blockSpecs),Object.assign(this.opts.inlineContentSpecs,t.inlineContentSpecs),Object.assign(this.opts.styleSpecs,t.styleSpecs);let{blockSpecs:n,inlineContentSpecs:r,styleSpecs:o,blockSchema:i,inlineContentSchema:s,styleSchema:a}=this.init();return this.blockSpecs=n,this.styleSpecs=o,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=i,this.inlineContentSchema=s,this}};function Ho(e){let{height:t,width:n}=om(e),r=Array(t).fill(!1).map(()=>Array(n).fill(null)),o=(i,s)=>{for(let a=i;a<t;a++)for(let l=s;l<n;l++)if(!r[a][l])return{row:a,col:l};throw Error("Unable to create occupancy grid for table, no more available cells")};for(let i=0;i<e.content.rows.length;i++)for(let s=0;s<e.content.rows[i].cells.length;s++){let a=Io(e.content.rows[i].cells[s]),l=ka(a),c=pi(a),{row:u,col:d}=o(i,s);for(let f=u;f<u+l;f++)for(let h=d;h<d+c;h++){if(r[f][h])throw Error(`Unable to create occupancy grid for table, cell at ${f},${h} is already occupied`);r[f][h]={row:i,col:s,rowspan:l,colspan:c,cell:a}}}return r}function Ta(e){let t=new Set;return e.map(n=>({cells:n.map(r=>t.has(r.row+":"+r.col)?!1:(t.add(r.row+":"+r.col),r.cell)).filter(r=>r!==!1)}))}function mi(e,t,n=Ho(t)){for(let r=0;r<n.length;r++)for(let o=0;o<n[r].length;o++){let i=n[r][o];if(i&&i.row===e.row&&i.col===e.col)return{row:r,col:o,cell:i.cell}}throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`)}function om(e){let t=e.content.rows.length,n=0;return e.content.rows.forEach(r=>{let o=0;r.cells.forEach(i=>{o+=pi(i)}),n=Math.max(n,o)}),{height:t,width:n}}function Hk(e,t,n=Ho(t)){let r=n[e.row]?.[e.col];if(r)return{row:r.row,col:r.col,cell:r.cell}}function Eh(e,t){let n=Ho(e);if(t<0||t>=n.length)return[];let r=0;for(let i=0;i<t;i++){let s=n[r]?.[0];if(!s)return[];r+=s.rowspan}let o=Array(n[0].length).fill(!1).map((i,s)=>Hk({row:r,col:s},e,n)).filter(i=>i!==void 0);return o.filter((i,s)=>o.findIndex(a=>a.row===i.row&&a.col===i.col)===s)}function xh(e,t){let n=Ho(e);if(t<0||t>=n[0].length)return[];let r=0;for(let i=0;i<t;i++){let s=n[0]?.[r];if(!s)return[];r+=s.colspan}let o=Array(n.length).fill(!1).map((i,s)=>Hk({row:s,col:r},e,n)).filter(i=>i!==void 0);return o.filter((i,s)=>o.findIndex(a=>a.row===i.row&&a.col===i.col)===s)}function MD(e,t,n,r=Ho(e)){let{col:o}=mi({row:0,col:t},e,r),{col:i}=mi({row:0,col:n},e,r);return r.forEach(s=>{let[a]=s.splice(o,1);s.splice(i,0,a)}),Ta(r)}function _D(e,t,n,r=Ho(e)){let{row:o}=mi({row:t,col:0},e,r),{row:i}=mi({row:n,col:0},e,r),[s]=r.splice(o,1);return r.splice(i,0,s),Ta(r)}function Ch(e){return e?Ca(e)?Ch(e.content):typeof e=="string"?e.length===0:Array.isArray(e)?e.every(t=>typeof t=="string"?t.length===0:hi(t)?t.text.length===0:Ik(t)?typeof t.content=="string"?t.content.length===0:t.content.every(n=>n.text.length===0):!1):!1:!0}function OD(e,t,n=Ho(e)){if(t==="columns"){let i=0;for(let s=n[0].length-1;s>=0&&n.every(a=>Ch(a[s].cell)&&a[s].colspan===1);s--)i++;for(let s=n.length-1;s>=0;s--){let a=Math.max(n[s].length-i,1);n[s]=n[s].slice(0,a)}return Ta(n)}let r=0;for(let i=n.length-1;i>=0&&n[i].every(s=>Ch(s.cell)&&s.rowspan===1);i--)r++;let o=Math.min(r,n.length-1);return n.splice(n.length-o,o),Ta(n)}function RD(e,t,n,r=Ho(e)){let{width:o,height:i}=om(e);if(t==="columns")r.forEach((s,a)=>{if(n>=0)for(let l=0;l<n;l++)s.push({row:a,col:Math.max(...s.map(c=>c.col))+1,rowspan:1,colspan:1,cell:Io("")});else s.splice(o+n,-1*n)});else if(n>0)for(let s=0;s<n;s++){let a=Array(o).fill(null).map((l,c)=>({row:i+s,col:c,rowspan:1,colspan:1,cell:Io("")}));r.push(a)}else n<0&&r.splice(i+n,-1*n);return Ta(r)}function Uk(e,t,n){let r=Eh(e,n);if(!r.some(s=>ka(s.cell)>1))return!0;let o=n,i=n;return r.forEach(s=>{let a=ka(s.cell);o=Math.max(o,s.row+a-1),i=Math.min(i,s.row)}),t<n?n===o:n===i}function Vk(e,t,n){let r=xh(e,n);if(!r.some(s=>pi(s.cell)>1))return!0;let o=n,i=n;return r.forEach(s=>{let a=pi(s.cell);o=Math.max(o,s.col+a-1),i=Math.min(i,s.col)}),t<n?n===o:n===i}function LD(e,t,n){let r=mi(e,n),o=mi(t,n);return r.col===o.col}function v1(e,t,n,r){let o=[];for(let[i,s]of Object.entries(e.styles||{})){let a=n[i];if(!a)throw Error(`style ${i} not found in styleSchema`);if(a.propSchema==="boolean")s&&o.push(t.mark(i));else if(a.propSchema==="string")s&&o.push(t.mark(i,{stringValue:s}));else throw new Tr(a.propSchema)}return!r||!t.nodes[r].spec.code?e.text.split(/(\n)/g).filter(i=>i.length>0).map(i=>i===`
107
+ `?t.nodes.hardBreak.createChecked():t.text(i,o)):e.text.length>0?[t.text(e.text,o)]:[]}function DD(e,t,n){let r=t.marks.link.create({href:e.href});return kh(e.content,t,n).map(o=>{if(o.type.name==="text")return o.mark([...o.marks,r]);if(o.type.name==="hardBreak")return o;throw Error("unexpected node type")})}function kh(e,t,n,r){let o=[];if(typeof e=="string")return o.push(...v1({text:e,styles:{}},t,n,r)),o;for(let i of e)o.push(...v1(i,t,n,r));return o}function ir(e,t,n,r=fs(t)){let o=[];for(let i of e)typeof i=="string"?o.push(...kh(i,t,r,n)):Ik(i)?o.push(...DD(i,t,r)):hi(i)?o.push(...kh([i],t,r,n)):o.push($k(i,t,r));return o}function Uu(e,t,n=fs(t)){let r=[],o=Array(e.headerRows??0).fill(!0),i=Array(e.headerCols??0).fill(!0),s=e.columnWidths??[];for(let a=0;a<e.rows.length;a++){let l=e.rows[a],c=[],u=o[a];for(let f=0;f<l.cells.length;f++){let h=l.cells[f],p=i[f],g=null,y=mi({row:a,col:f},{content:e}),b=s[y.col]?[s[y.col]]:null;if(h)if(typeof h=="string")g=t.text(h);else if(Ca(h)){h.content&&(g=ir(h.content,t,"tableParagraph",n));let k=pi(h);k>1&&(b=Array(k).fill(!1).map((O,M)=>s[y.col+M]??void 0))}else g=ir(h,t,"tableParagraph",n);let x=t.nodes[p||u?"tableHeader":"tableCell"].createChecked({...Ca(h)?h.props:{},colwidth:b},t.nodes.tableParagraph.createChecked(void 0,g));c.push(x)}let d=t.nodes.tableRow.createChecked({},c);r.push(d)}return r}function $k(e,t,n){let r,o=e.type;if(o===void 0&&(o="paragraph"),!t.nodes[o])throw Error(`node type ${o} not found in schema`);if(!e.content)r=t.nodes[o].createChecked(e.props);else if(typeof e.content=="string"){let i=ir([e.content],t,o,n);r=t.nodes[o].createChecked(e.props,i)}else if(Array.isArray(e.content)){let i=ir(e.content,t,o,n);r=t.nodes[o].createChecked(e.props,i)}else if(e.content.type==="tableContent"){let i=Uu(e.content,t,n);r=t.nodes[o].createChecked(e.props,i)}else throw new Tr(e.content.type);return r}function Ei(e,t,n=fs(t)){let r=e.id;r===void 0&&(r=Fu.options.generateID());let o=[];if(e.children)for(let i of e.children)o.push(Ei(i,t,n));if(!e.type||t.nodes[e.type].isInGroup("blockContent")){let i=$k(e,t,n),s=o.length>0?t.nodes.blockGroup.createChecked({},o):void 0;return t.nodes.blockContainer.createChecked({id:r,...e.props},s?[i,s]:i)}else{if(t.nodes[e.type].isInGroup("bnBlock"))return t.nodes[e.type].createChecked({id:r,...e.props},o);throw Error(`block type ${e.type} doesn't match blockContent or bnBlock group`)}}function cn(e,t){let n,r;if(t.firstChild.descendants((o,i)=>n?!1:!im(o)||o.attrs.id!==e?!0:(n=o,r=i+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function im(e){return e.type.isInGroup("bnBlock")}var PD=(e,t)=>({tr:n,dispatch:r})=>(r&&Vu(n,e,t),!0);function Vu(e,t,n,r,o){let i=Oo(e.doc.resolve(t)),s=null;i.blockNoteType==="table"&&(s=HD(e));let a=kt(e),l=a.nodes[i.blockNoteType],c=a.nodes[n.type||i.blockNoteType],u=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(i.isBlockContainer&&c.isInGroup("blockContent"))A1(n,e,i),BD(n,e,l,c,i);else if(!i.isBlockContainer&&c.isInGroup("bnBlock"))A1(n,e,i);else{let d=pt(i.bnBlock.node,a);e.replaceWith(i.bnBlock.beforePos,i.bnBlock.afterPos,Ei({children:d.children,...n},a));return}e.setNodeMarkup(i.bnBlock.beforePos,u,{...i.bnBlock.node.attrs,...n.props}),s&&UD(e,i,s)}function BD(e,t,n,r,o,i,s){let a=kt(t),l="keep";if(e.content)if(typeof e.content=="string")l=ir([e.content],a,r.name);else if(Array.isArray(e.content))l=ir(e.content,a,r.name);else if(e.content.type==="tableContent")l=Uu(e.content,a);else throw new Tr(e.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?t.setNodeMarkup(o.blockContent.beforePos,r,{...o.blockContent.node.attrs,...e.props}):t.replaceWith(o.blockContent.beforePos,o.blockContent.afterPos,r.createChecked({...o.blockContent.node.attrs,...e.props},l))}function A1(e,t,n){let r=kt(t);if(e.children!==void 0&&e.children.length>0){let o=e.children.map(i=>Ei(i,r));if(n.childContainer)t.step(new vt(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new Z(j.from(o),0,0)));else{if(!n.isBlockContainer)throw Error("impossible");t.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},o))}}}function FD(e,t,n,r,o){let i=typeof t=="string"?t:t.id,s=cn(i,e.doc);if(!s)throw Error(`Block with ID ${i} not found`);return Vu(e,s.posBeforeNode,n),pt(e.doc.resolve(s.posBeforeNode+1).node(),kt(e))}function HD(e){let t="selection"in e?e.selection:null;if(!(t instanceof se))return null;let n=e.doc.resolve(t.head),r=-1,o=-1;for(let p=n.depth;p>=0;p--){let g=n.node(p).type.name;if(r<0&&(g==="tableCell"||g==="tableHeader")&&(r=p),g==="table"){o=p;break}}if(r<0||o<0)return null;let i=n.before(r),s=n.before(o),a=e.doc.nodeAt(s);if(!a||a.type.name!=="table")return null;let l=nt.get(a),c=i-(s+1),u=l.map.indexOf(c);if(u<0)return null;let d=Math.floor(u/l.width),f=u%l.width,h=i+1+1;return{row:d,col:f,offset:Math.max(0,t.head-h)}}function UD(e,t,n){if(t.blockNoteType!=="table")return!1;let r=-1;if(t.isBlockContainer)r=e.mapping.map(t.blockContent.beforePos);else{let g=e.mapping.map(t.bnBlock.beforePos),y=g+(e.doc.nodeAt(g)?.nodeSize||0);e.doc.nodesBetween(g,y,(b,x)=>b.type.name==="table"?(r=x,!1):!0)}let o=r>=0?e.doc.nodeAt(r):null;if(!o||o.type.name!=="table")return!1;let i=nt.get(o),s=Math.max(0,Math.min(n.row,i.height-1)),a=Math.max(0,Math.min(n.col,i.width-1)),l=s*i.width+a,c=i.map[l];if(c==null)return!1;let u=r+1+c+1,d=e.doc.nodeAt(u),f=u+1,h=d?d.content.size:0,p=f+Math.max(0,Math.min(n.offset,h));return"selection"in e&&e.setSelection(se.create(e.doc,p)),!0}var ko={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},Ue={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},$t=e=>{let t={};return e.hasAttribute("data-background-color")?t.backgroundColor=e.getAttribute("data-background-color"):e.style.backgroundColor&&(t.backgroundColor=e.style.backgroundColor),e.hasAttribute("data-text-color")?t.textColor=e.getAttribute("data-text-color"):e.style.color&&(t.textColor=e.style.color),t.textAlignment=Ue.textAlignment.values.includes(e.style.textAlign)?e.style.textAlign:void 0,t},xi=(e,t)=>{e.backgroundColor&&e.backgroundColor!==Ue.backgroundColor.default&&(t.style.backgroundColor=e.backgroundColor in ko?ko[e.backgroundColor].background:e.backgroundColor),e.textColor&&e.textColor!==Ue.textColor.default&&(t.style.color=e.textColor in ko?ko[e.textColor].text:e.textColor),e.textAlignment&&e.textAlignment!==Ue.textAlignment.default&&(t.style.textAlign=e.textAlignment)},VD=(e="backgroundColor")=>({default:Ue.backgroundColor.default,parseHTML:t=>t.hasAttribute("data-background-color")?t.getAttribute("data-background-color"):t.style.backgroundColor?t.style.backgroundColor:Ue.backgroundColor.default,renderHTML:t=>t[e]===Ue.backgroundColor.default?{}:{"data-background-color":t[e]}}),$D=(e="textColor")=>({default:Ue.textColor.default,parseHTML:t=>t.hasAttribute("data-text-color")?t.getAttribute("data-text-color"):t.style.color?t.style.color:Ue.textColor.default,renderHTML:t=>t[e]===Ue.textColor.default?{}:{"data-text-color":t[e]}}),$u=(e,t)=>{let n=e.querySelector(t);if(n)return{targetElement:n,caption:e.querySelector("figcaption")?.textContent??void 0}},rr=Ve(({editor:e})=>{let t=Po(void 0);function n(){t.setState(void 0)}return{key:"filePanel",store:t,mount({signal:r}){let o=e.onChange(n,!1),i=e.onSelectionChange(n,!1);r.addEventListener("abort",()=>{o(),i()})},closeMenu:n,showMenu(r){t.setState(r)}}}),jD=(e,t,n)=>{let r=document.createElement("div");r.className="bn-add-file-button";let o=document.createElement("div");o.className="bn-add-file-button-icon",n?o.appendChild(n):o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(o);let i=document.createElement("p");i.className="bn-add-file-button-text",i.innerHTML=e.type in t.dictionary.file_blocks.add_button_text?t.dictionary.file_blocks.add_button_text[e.type]:t.dictionary.file_blocks.add_button_text.file,r.appendChild(i);let s=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{t.isEditable&&t.getExtension(rr)?.showMenu(e.id)};return r.addEventListener("mousedown",s,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",s,!0),r.removeEventListener("click",a,!0)}}},zD='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',WD=e=>{let t=document.createElement("div");t.className="bn-file-name-with-icon";let n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=zD,t.appendChild(n);let r=document.createElement("p");return r.className="bn-file-name",r.textContent=e.props.name,t.appendChild(r),{dom:t}},sm=(e,t,n,r)=>{let o=document.createElement("div");if(o.className="bn-file-block-content-wrapper",e.props.url===""){let s=jD(e,t,r);o.appendChild(s.dom);let a=t.onUploadStart(l=>{if(l===e.id){o.removeChild(s.dom);let c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",o.appendChild(c)}});return{dom:o,destroy:()=>{a(),s.destroy()}}}let i={dom:o};if(e.props.showPreview===!1||!n){let s=WD(e);o.appendChild(s.dom),i.destroy=()=>{s.destroy?.()}}else o.appendChild(n.dom);if(e.props.caption){let s=document.createElement("p");s.className="bn-file-caption",s.textContent=e.props.caption,o.appendChild(s)}return i},am=(e,t)=>{let n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=t,n.appendChild(e),n.appendChild(r),{dom:n}},ju=(e,t)=>{let n=document.createElement("div"),r=document.createElement("p");return r.textContent=t,n.appendChild(e),n.appendChild(r),{dom:n}},N1=e=>({url:e.src||void 0}),qD=e=>({type:"audio",propSchema:{backgroundColor:Ue.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),GD=(e={})=>t=>{if(t.tagName==="AUDIO"){if(t.closest("figure"))return;let{backgroundColor:n}=$t(t);return{...N1(t),backgroundColor:n}}if(t.tagName==="FIGURE"){let n=$u(t,"audio");if(!n)return;let{targetElement:r,caption:o}=n,{backgroundColor:i}=$t(t);return{...N1(r),backgroundColor:i,caption:o}}},YD=(e={})=>(t,n)=>{let r=document.createElement("div");r.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';let o=document.createElement("audio");return o.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(t.props.url).then(i=>{o.src=i}):o.src=t.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,sm(t,n,{dom:o},r.firstElementChild)},KD=(e={})=>(t,n)=>{if(!t.props.url){let o=document.createElement("p");return o.textContent="Add audio",{dom:o}}let r;return t.props.showPreview?(r=document.createElement("audio"),r.src=t.props.url):(r=document.createElement("a"),r.href=t.props.url,r.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?am(r,t.props.caption):ju(r,t.props.caption):{dom:r}},QD=Ln(qD,e=>({meta:{fileBlockAccept:["audio/*"]},parse:GD(e),render:YD(e),toExternalHTML:KD(e),runsBefore:["file"]})),I1=Symbol.for("blocknote.shikiParser"),zd=Symbol.for("blocknote.shikiHighlighterPromise");function XD(e){let t=globalThis,n,r;return X4({parser:o=>{if(!e.createHighlighter)return[];if(!n)return t[zd]=t[zd]||e.createHighlighter(),t[zd].then(s=>{n=s});let i=jk(e,o.language);return!i||i==="text"||i==="none"||i==="plaintext"||i==="txt"?[]:n.getLoadedLanguages().includes(i)?(r||(r=t[I1]||J4(n),t[I1]=r),r(o)):n.loadLanguage(i)},languageExtractor:o=>o.attrs.language,nodeTypes:["codeBlock"]})}var ZD=({defaultLanguage:e="text"})=>({type:"codeBlock",propSchema:{language:{default:e}},content:"inline"}),JD=Ln(ZD,e=>({meta:{code:!0,defining:!0,isolating:!1},parse:t=>{if(t.tagName!=="PRE"||t.childElementCount!==1||t.firstElementChild?.tagName!=="CODE")return;let n=t.firstElementChild;return{language:n.getAttribute("data-language")||n.className.split(" ").find(r=>r.includes("language-"))?.replace("language-","")}},parseContent:({el:t,schema:n})=>{let r=sn.fromSchema(n),o=t.firstElementChild;return r.parse(o,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(t,n){let r=document.createDocumentFragment(),o=document.createElement("pre"),i=document.createElement("code");o.appendChild(i);let s;if(e.supportedLanguages){let a=document.createElement("select");if(Object.entries(e.supportedLanguages??{}).forEach(([c,{name:u}])=>{let d=document.createElement("option");d.value=c,d.text=u,a.appendChild(d)}),a.value=t.props.language||e.defaultLanguage||"text",n.isEditable){let c=u=>{let d=u.target.value;n.updateBlock(t.id,{props:{language:d}})};a.addEventListener("change",c),s=()=>a.removeEventListener("change",c)}else a.disabled=!0;let l=document.createElement("div");l.contentEditable="false",l.appendChild(a),r.appendChild(l)}return r.appendChild(o),{dom:r,contentDOM:i,destroy:()=>{s?.()}}},toExternalHTML(t){let n=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${t.props.language}`,r.dataset.language=t.props.language,n.appendChild(r),{dom:n,contentDOM:r}}}),e=>[Ve({key:"code-block-highlighter",prosemirrorPlugins:[XD(e)]}),Ve({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:t})=>t.transact(n=>{let{block:r}=t.getTextCursorPosition();if(r.type!=="codeBlock")return!1;let{$from:o}=n.selection;return o.parent.textContent?!1:(t.removeBlocks([r]),!0)}),Tab:({editor:t})=>e.indentLineWithTab===!1?!1:t.transact(n=>{let{block:r}=t.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:t})=>t.transact(n=>{let{block:r,nextBlock:o}=t.getTextCursorPosition();if(r.type!=="codeBlock")return!1;let{$from:i}=n.selection,s=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith(`
108
+
109
+ `);if(s&&a){if(n.delete(i.pos-2,i.pos),o)return t.setTextCursorPosition(o,"start"),!0;let[l]=t.insertBlocks([{type:"paragraph"}],r,"after");return t.setTextCursorPosition(l,"start"),!0}return n.insertText(`
110
+ `),!0}),"Shift-Enter":({editor:t})=>t.transact(()=>{let{block:n}=t.getTextCursorPosition();if(n.type!=="codeBlock")return!1;let[r]=t.insertBlocks([{type:"paragraph"}],n,"after");return t.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:t})=>{let n=t[1].trim();return{type:"codeBlock",props:{language:{language:jk(e,n)??n}.language},content:[]}}}]})]);function jk(e,t){return Object.entries(e.supportedLanguages??{}).find(([n,{aliases:r}])=>r?.includes(t)||n===t)?.[0]}var e6=()=>({type:"divider",propSchema:{},content:"none"}),t6=Ln(e6,{meta:{isolating:!1},parse(e){if(e.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[Ve({key:"divider-block-shortcuts",inputRules:[{find:RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),M1=e=>({url:e.src||void 0}),n6=()=>({type:"file",propSchema:{backgroundColor:Ue.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),r6=()=>e=>{if(e.tagName==="EMBED"){if(e.closest("figure"))return;let{backgroundColor:t}=$t(e);return{...M1(e),backgroundColor:t}}if(e.tagName==="FIGURE"){let t=$u(e,"embed");if(!t)return;let{targetElement:n,caption:r}=t,{backgroundColor:o}=$t(e);return{...M1(n),backgroundColor:o,caption:r}}},o6=Ln(n6,{meta:{fileBlockAccept:["*/*"]},parse:r6(),render(e,t){return sm(e,t)},toExternalHTML(e){if(!e.props.url){let n=document.createElement("p");return n.textContent="Add file",{dom:n}}let t=document.createElement("a");return t.href=e.props.url,t.textContent=e.props.name||e.props.url,e.props.caption?ju(t,e.props.caption):{dom:t}}});function zk(e,t,n){let r=sn.fromSchema(t),o=e.querySelector(":scope > summary"),i;if(o){let u=o.cloneNode(!0);Mk(u),i=r.parse(u,{topNode:t.nodes.paragraph.create(),preserveWhitespace:!0}).content}else i=j.empty;let s=document.createElement("div");s.setAttribute("data-node-type","blockGroup");let a=!1;for(let u of Array.from(e.childNodes))u.tagName!=="SUMMARY"&&(u.nodeType===3&&!u.textContent?.trim()||(a=!0,s.appendChild(u.cloneNode(!0))));let l=t.nodes[n].create({},i);if(!a)return l.content;let c=r.parse(s,{topNode:t.nodes.blockGroup.create()});return c.content.size>0?l.content.addToEnd(c):l.content}var i6={set:(e,t)=>window.localStorage.setItem(`toggle-${e.id}`,t?"true":"false"),get:e=>window.localStorage.getItem(`toggle-${e.id}`)==="true"},Wk=(e,t,n,r=i6)=>{if("isToggleable"in e.props&&!e.props.isToggleable)return{dom:n};let o=document.createElement("div"),i=document.createElement("div");i.className="bn-toggle-wrapper";let s=document.createElement("button");s.className="bn-toggle-button",s.type="button",s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';let a=p=>p.preventDefault();s.addEventListener("mousedown",a);let l=()=>{i.getAttribute("data-show-children")==="true"?(i.setAttribute("data-show-children","false"),r.set(t.getBlock(e),!1),o.contains(c)&&o.removeChild(c)):(i.setAttribute("data-show-children","true"),r.set(t.getBlock(e),!0),t.isEditable&&t.getBlock(e)?.children.length===0&&!o.contains(c)&&o.appendChild(c))};s.addEventListener("click",l),i.appendChild(s),i.appendChild(n);let c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=t.dictionary.toggle_blocks.add_block_button;let u=p=>p.preventDefault();c.addEventListener("mousedown",u);let d=()=>{t.transact(()=>{let p=t.updateBlock(e,{children:[{}]});t.setTextCursorPosition(p.children[0].id,"end"),t.focus()})};c.addEventListener("click",d),o.appendChild(i);let f=e.children.length,h=t.onChange(()=>{let p=t.getBlock(e)?.children.length??0;p>f?(i.getAttribute("data-show-children")==="false"&&(i.setAttribute("data-show-children","true"),r.set(t.getBlock(e),!0)),o.contains(c)&&o.removeChild(c)):p===0&&p<f&&(i.getAttribute("data-show-children")==="true"&&(i.setAttribute("data-show-children","false"),r.set(t.getBlock(e),!1)),o.contains(c)&&o.removeChild(c)),f=p});return r.get(e)?(i.setAttribute("data-show-children","true"),t.isEditable&&e.children.length===0&&o.appendChild(c)):i.setAttribute("data-show-children","false"),{dom:o,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===i&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===c||p.removedNodes[0]===c)),destroy:()=>{s.removeEventListener("mousedown",a),s.removeEventListener("click",l),c.removeEventListener("mousedown",u),c.removeEventListener("click",d),h?.()}}},qk=[1,2,3,4,5,6],s6=e=>({editor:t})=>{let n=t.getTextCursorPosition();return t.schema.blockSchema[n.block.type].content==="inline"?(t.updateBlock(n.block,{type:"heading",props:{level:e}}),!0):!1},a6=({defaultLevel:e=1,levels:t=qk,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...Ue,level:{default:e,values:t},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),l6=Ln(a6,({allowToggleHeadings:e=!0}={})=>({meta:{isolating:!1},parse(t){if(e&&t.tagName==="DETAILS"){let r=t.querySelector(":scope > summary");if(!r)return;let o=r.querySelector("h1, h2, h3, h4, h5, h6");return o?{...$t(o),level:parseInt(o.tagName[1]),isToggleable:!0}:void 0}let n;switch(t.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6;break;default:return}return{...$t(t),level:n}},...e?{parseContent:({el:t,schema:n})=>{if(t.tagName==="DETAILS")return zk(t,n,"heading")}}:{},runsBefore:["toggleListItem"],render(t,n){let r=document.createElement(`h${t.props.level}`);return e?{...Wk(t,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(t){let n=document.createElement(`h${t.props.level}`);if(xi(t.props,n),e&&t.props.isToggleable){let r=document.createElement("details");r.setAttribute("open","");let o=document.createElement("summary");return o.appendChild(n),r.appendChild(o),{dom:r,contentDOM:n,childrenDOM:r}}return{dom:n,contentDOM:n}}}),({levels:e=qk}={})=>[Ve({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(e.map(t=>[`Mod-Alt-${t}`,s6(t)])??[]),inputRules:e.map(t=>({find:RegExp(`^(#{${t}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),Gk=(e,t,n,r,o)=>{let{dom:i,destroy:s}=sm(e,t,n,o),a=i;a.style.position="relative",e.props.url&&e.props.showPreview&&(e.props.previewWidth?a.style.width=`${e.props.previewWidth}px`:a.style.width="fit-content");let l=document.createElement("div");l.className="bn-resize-handle",l.style.left="4px",l.style.display="none",r.appendChild(l);let c=document.createElement("div");c.className="bn-resize-handle",c.style.right="4px",c.style.display="none",r.appendChild(c);let u=document.createElement("div");u.style.position="absolute",u.style.height="100%",u.style.width="100%";let d,f=e.props.previewWidth,h=k=>{if(!d){t.isEditable||(l.style.display="none",c.style.display="none");return}let O,M="touches"in k?k.touches[0].clientX:k.clientX;O=e.props.textAlignment==="center"?d.handleUsed==="left"?d.initialWidth+(d.initialClientX-M)*2:d.initialWidth+(M-d.initialClientX)*2:d.handleUsed==="left"?d.initialWidth+d.initialClientX-M:d.initialWidth+M-d.initialClientX,f=Math.min(Math.max(O,64),t.domElement?.firstElementChild?.clientWidth||Number.MAX_VALUE),a.style.width=`${f}px`},p=k=>{(!k.target||!a.contains(k.target)||!t.isEditable)&&(l.style.display="none",c.style.display="none"),d&&(d=void 0,a.contains(u)&&a.removeChild(u),t.updateBlock(e,{props:{previewWidth:f}}))},g=()=>{t.isEditable&&(l.style.display="",c.style.display="")},y=k=>{k.relatedTarget===l||k.relatedTarget===c||d||t.isEditable&&(l.style.display="none",c.style.display="none")},b=k=>{k.preventDefault(),a.contains(u)||a.appendChild(u);let O="touches"in k?k.touches[0].clientX:k.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:O}},x=k=>{k.preventDefault(),a.contains(u)||a.appendChild(u);let O="touches"in k?k.touches[0].clientX:k.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:O}};return window.addEventListener("mousemove",h),window.addEventListener("touchmove",h),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",y),l.addEventListener("mousedown",b),l.addEventListener("touchstart",b),c.addEventListener("mousedown",x),c.addEventListener("touchstart",x),{dom:a,destroy:()=>{s?.(),window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",y),l.removeEventListener("mousedown",b),l.removeEventListener("touchstart",b),c.removeEventListener("mousedown",x),c.removeEventListener("touchstart",x)}}},_1=e=>({url:e.src||void 0,previewWidth:e.width||void 0,name:e.alt||void 0}),c6=(e={})=>({type:"image",propSchema:{textAlignment:Ue.textAlignment,backgroundColor:Ue.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),u6=(e={})=>t=>{if(t.tagName==="IMG"){if(t.closest("figure"))return;let{backgroundColor:n}=$t(t);return{..._1(t),backgroundColor:n}}if(t.tagName==="FIGURE"){let n=$u(t,"img");if(!n)return;let{targetElement:r,caption:o}=n,{backgroundColor:i}=$t(t);return{..._1(r),backgroundColor:i,caption:o}}},d6=(e={})=>(t,n)=>{let r=document.createElement("div");r.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';let o=document.createElement("div");o.className="bn-visual-media-wrapper";let i=document.createElement("img");return i.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(t.props.url).then(s=>{i.src=s}):i.src=t.props.url,i.alt=t.props.name||t.props.caption||"BlockNote image",i.contentEditable="false",i.draggable=!1,o.appendChild(i),Gk(t,n,{dom:o},o,r.firstElementChild)},f6=(e={})=>(t,n)=>{if(!t.props.url){let o=document.createElement("p");return o.textContent="Add image",{dom:o}}let r;return t.props.showPreview?(r=document.createElement("img"),r.src=t.props.url,r.alt=t.props.name||t.props.caption||"BlockNote image",t.props.previewWidth&&(r.width=t.props.previewWidth)):(r=document.createElement("a"),r.href=t.props.url,r.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?am(r,t.props.caption):ju(r,t.props.caption):{dom:r}},h6=Ln(c6,e=>({meta:{fileBlockAccept:["image/*"]},parse:u6(e),render:d6(e),toExternalHTML:f6(e),runsBefore:["file"]})),p6=(e,t,n)=>({state:r,dispatch:o})=>o?Yk(r.tr,e,t,n):!0,Yk=(e,t,n,r)=>{let o=Qr(_o(e.doc,t));if(!o.isBlockContainer)return!1;let i=kt(e),s=[{type:o.bnBlock.node.type,attrs:r?{...o.bnBlock.node.attrs,id:void 0}:{}},{type:n?o.blockContent.node.type:i.nodes.paragraph,attrs:r?{...o.blockContent.node.attrs}:{}}];return e.split(t,2,s),!0},zu=(e,t)=>{let{blockInfo:n,selectionEmpty:r}=e.transact(s=>({blockInfo:La(s),selectionEmpty:s.selection.anchor===s.selection.head}));if(!n.isBlockContainer)return!1;let{bnBlock:o,blockContent:i}=n;return i.node.type.name!==t||!r?!1:i.node.childCount===0?(e.transact(s=>{Vu(s,o.beforePos,{type:"paragraph",props:{}})}),!0):i.node.childCount>0?e.transact(s=>(s.deleteSelection(),Yk(s,s.selection.from,!0))):!1};function lm(e,t,n){let r=sn.fromSchema(t),o=e,i=document.createElement("div");i.setAttribute("data-node-type","blockGroup");for(let u of Array.from(o.childNodes))i.appendChild(u.cloneNode(!0));let s=r.parse(i,{topNode:t.nodes.blockGroup.create()});s.firstChild?.firstChild?.type.name==="checkListItem"&&(s=s.copy(s.content.cut(s.firstChild.firstChild.nodeSize+2)));let a=s.firstChild?.firstChild;if(!a?.isTextblock)return j.from(s);let l=t.nodes[n].create({},a.content),c=s.content.cut(a.nodeSize+2);if(c.size>0){let u=s.copy(c);return l.content.addToEnd(u)}return l.content}var m6=()=>({type:"bulletListItem",propSchema:{...Ue},content:"inline"}),g6=Ln(m6,{meta:{isolating:!1},parse(e){if(e.tagName!=="LI")return;let t=e.parentElement;if(t!==null&&(t.tagName==="UL"||t.tagName==="DIV"&&t.parentElement?.tagName==="UL"))return $t(e)},parseContent:({el:e,schema:t})=>lm(e,t,"bulletListItem"),render(){let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("li"),n=document.createElement("p");return xi(e.props,t),t.appendChild(n),{dom:t,contentDOM:n}}},[Ve({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>zu(e,"bulletListItem"),"Mod-Shift-8":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"bulletListItem",props:{}}),!0):!1}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:e}){if(Ct(e.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),b6=()=>({type:"checkListItem",propSchema:{...Ue,checked:{default:!1,type:"boolean"}},content:"inline"}),y6=Ln(b6,{meta:{isolating:!1},parse(e){if(e.tagName==="input")return e.closest("[data-content-type]")||e.closest("li")?void 0:e.type==="checkbox"?{checked:e.checked}:void 0;if(e.tagName!=="LI")return;let t=e.parentElement;if(t!==null&&(t.tagName==="UL"||t.tagName==="DIV"&&t.parentElement?.tagName==="UL")){let n=e.querySelector("input[type=checkbox]")||null;return n===null?void 0:{...$t(e),checked:n.checked}}},parseContent:({el:e,schema:t})=>lm(e,t,"checkListItem"),render(e,t){let n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=e.props.checked,e.props.checked&&r.setAttribute("checked",""),r.disabled=!t.isEditable,r.addEventListener("change",()=>{t.isEditable&&t.updateBlock(e,{props:{checked:!e.props.checked}})});let o=document.createElement("p"),i=document.createElement("div");return i.contentEditable="false",i.appendChild(r),n.appendChild(i),n.appendChild(o),{dom:n,contentDOM:o}},toExternalHTML(e){let t=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=e.props.checked,e.props.checked&&n.setAttribute("checked","");let r=document.createElement("p");return xi(e.props,t),t.appendChild(n),t.appendChild(r),{dom:t,contentDOM:r}},runsBefore:["bulletListItem"]},[Ve({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>zu(e,"checkListItem"),"Mod-Shift-9":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"checkListItem",props:{}}),!0):!1}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace(){return{type:"checkListItem",props:{checked:!1}}}},{find:/^\s?\[[Xx]\]\s$/,replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function E6(e,t,n,r){let o=!!e.firstChild.attrs.start,i=Qr({posBeforeNode:t,node:e});if(!i.isBlockContainer)throw Error("impossible");let s=n.doc.resolve(i.bnBlock.beforePos).nodeBefore,a=s?r.get(s):void 0;if(a!==void 0){let b=a+1;return r.set(e,b),{index:b,isFirst:!1,hasStart:o}}let l=[{node:e,pos:t}],c=s,u=i.bnBlock.beforePos;for(;c&&r.get(c)===void 0;){let b=Qr({posBeforeNode:u-c.nodeSize,node:c});if(b.blockNoteType!=="numberedListItem")break;l.push({node:c,pos:u-c.nodeSize});let x=n.doc.resolve(b.bnBlock.beforePos).nodeBefore;u=b.bnBlock.beforePos,c=x}let d,f,h=l[l.length-1],p=Qr({posBeforeNode:h.pos,node:h.node});if(!p.isBlockContainer)throw Error("impossible");let g=n.doc.resolve(p.bnBlock.beforePos).nodeBefore,y=g?r.get(g):void 0;y===void 0?(d=(h.node.firstChild.attrs.start||1)-1,f=!0):(d=y,f=!1);for(let b=l.length-1;b>=0;b--){let x=l[b];f&&b<l.length-1&&(f=!1),d++,r.set(x.node,d)}return{index:d,isFirst:l.length===1?f||y===void 0:!1,hasStart:o}}function O1(e,t){let n=new Map,r=t.decorations.map(e.mapping,e.doc),o=e.changedRange();if(!o)return{decorations:r};let i=[],s=new Set;e.doc.nodesBetween(o.from,e.doc.nodeSize-2,(l,c,u)=>{if(u&&s.has(u))return!1;if(l.type.name==="blockContainer"&&l.firstChild.type.name==="numberedListItem"){let{index:d,isFirst:f,hasStart:h}=E6(l,c,e,n),p=e.doc.nodeAt(c+1);if(r.find(c+1,c+1+p.nodeSize,g=>g.index===d&&g.isFirst===f&&g.hasStart===h).length===0)i.push(qe.node(c+1,c+1+p.nodeSize,{"data-index":d.toString()},{index:d,isFirst:f,hasStart:h}));else if(c>=o.to&&u)return s.add(u),!1}});let a=i.flatMap(l=>r.find(l.from,l.to));return{decorations:r.remove(a).add(e.doc,i)}}var x6=()=>new Ae({key:new $e("numbered-list-indexing-decorations"),state:{init(e,t){return O1(t.tr,{decorations:_e.empty})},apply(e,t){return!e.docChanged&&t.decorations?t:O1(e,t)}},props:{decorations(e){return this.getState(e)?.decorations??_e.empty}}}),C6=()=>({type:"numberedListItem",propSchema:{...Ue,start:{default:void 0,type:"number"}},content:"inline"}),k6=Ln(C6,{meta:{isolating:!1},parse(e){if(e.tagName!=="LI")return;let t=e.parentElement;if(t!==null&&(t.tagName==="OL"||t.tagName==="DIV"&&t.parentElement?.tagName==="OL")){let n=parseInt(t.getAttribute("start")||"1"),r=$t(e);return e.previousElementSibling||n===1?r:{...r,start:n}}},parseContent:({el:e,schema:t})=>lm(e,t,"numberedListItem"),render(){let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("li"),n=document.createElement("p");return xi(e.props,t),t.appendChild(n),{dom:t,contentDOM:n}}},[Ve({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:e,editor:t}){if(Ct(t.prosemirrorState).blockNoteType==="heading")return;let n=parseInt(e[1]);return{type:"numberedListItem",props:{start:n===1?void 0:n}}}}],keyboardShortcuts:{Enter:({editor:e})=>zu(e,"numberedListItem"),"Mod-Shift-7":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"numberedListItem",props:{}}),!0):!1}},prosemirrorPlugins:[x6()]})]),T6=()=>({type:"toggleListItem",propSchema:{...Ue},content:"inline"}),w6=Ln(T6,{meta:{isolating:!1},parse(e){if(e.tagName==="DETAILS")return $t(e);if(e.tagName==="LI"){let t=e.parentElement;if(t&&(t.tagName==="UL"||t.tagName==="DIV"&&t.parentElement?.tagName==="UL")&&e.querySelector(":scope > details"))return $t(e)}},parseContent:({el:e,schema:t})=>{let n=e.tagName==="DETAILS"?e:e.querySelector(":scope > details");if(!n)throw Error("No details found in toggleListItem parseContent");return zk(n,t,"toggleListItem")},runsBefore:["bulletListItem"],render(e,t){let n=document.createElement("p");return{...Wk(e,t,n),contentDOM:n}},toExternalHTML(e){let t=document.createElement("li"),n=document.createElement("details");n.setAttribute("open","");let r=document.createElement("summary"),o=document.createElement("p");return r.appendChild(o),n.appendChild(r),xi(e.props,t),t.appendChild(n),{dom:t,contentDOM:o,childrenDOM:n}}},[Ve({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>zu(e,"toggleListItem"),"Mod-Shift-6":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"toggleListItem",props:{}}),!0):!1}}})]),S6=()=>({type:"paragraph",propSchema:Ue,content:"inline"}),Kk=Ln(S6,{meta:{isolating:!1},parse:e=>{if(e.tagName==="P"&&e.textContent?.trim())return $t(e)},render:()=>{let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("p");return xi(e.props,t),{dom:t,contentDOM:t}},runsBefore:["default","heading"]},[Ve({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"paragraph",props:{}}),!0):!1}}})]),v6=()=>({type:"quote",propSchema:{backgroundColor:Ue.backgroundColor,textColor:Ue.textColor},content:"inline"}),A6=Ln(v6,{meta:{isolating:!1},parse(e){if(e.tagName==="BLOCKQUOTE"){let{backgroundColor:t,textColor:n}=$t(e);return{backgroundColor:t,textColor:n}}},render(){let e=document.createElement("blockquote");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("blockquote");return xi(e.props,t),{dom:t,contentDOM:t}}},[Ve({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:e})=>{let t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content==="inline"?(e.updateBlock(t.block,{type:"quote",props:{}}),!0):!1}},inputRules:[{find:RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}}]})]),N6=120,I6=31,M6=mt.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[H4({cellMinWidth:35,defaultCellMinWidth:120,View:null}),K4()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.insertContent({type:"hardBreak"}),!0):!1,Backspace:()=>{let e=this.editor.state.selection,t=e.empty,n=e.$head.parentOffset===0,r=e.$head.node().type.name==="tableParagraph";return t&&n&&r},Tab:()=>this.editor.commands.command(({state:e,dispatch:t,view:n})=>a1(1)(e,t,n)),"Shift-Tab":()=>this.editor.commands.command(({state:e,dispatch:t,view:n})=>a1(-1)(e,t,n))}},extendNodeSchema(e){return{tableRole:Qe(de(e,"tableRole",{name:e.name,options:e.options,storage:e.storage}))}}}),_6={textColor:Ue.textColor},O6=sr.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getContent:(e,t)=>Qk(e,t)}]},renderHTML({HTMLAttributes:e}){return["th",Rn(this.options.HTMLAttributes,e),0]}}),R6=sr.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getContent:(e,t)=>Qk(e,t)}]},renderHTML({HTMLAttributes:e}){return["td",Rn(this.options.HTMLAttributes,e),0]}}),L6=sr.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){let n=hD(this.name,"table",{...this.options.domAttributes?.blockContent||{},...t},this.options.domAttributes?.inlineContent||{}),r=document.createElement("colgroup");for(let o of e.children[0].children)if(o.attrs.colwidth)for(let i of o.attrs.colwidth){let s=document.createElement("col");i&&(s.style=`width: ${i}px`),r.appendChild(s)}else r.appendChild(document.createElement("col"));return n.dom.firstChild?.appendChild(r),n},addNodeView(){return({node:e,HTMLAttributes:t})=>{class n extends Ck{constructor(o,i,s){super(o,i),this.node=o,this.cellMinWidth=i,this.blockContentHTMLAttributes=s;let a=document.createElement("div");a.className=ut("bn-block-content",s.class),a.setAttribute("data-content-type","table");for(let[d,f]of Object.entries(s))d!=="class"&&a.setAttribute(d,f);let l=this.dom,c=document.createElement("div");c.className="tableWrapper-inner",c.appendChild(l.firstChild),l.appendChild(c),a.appendChild(l);let u=document.createElement("div");u.className="table-widgets-container",u.style.position="relative",l.appendChild(u),this.dom=a}ignoreMutation(o){return!o.target.closest(".tableWrapper-inner")||super.ignoreMutation(o)}}return new n(e,120,{...this.options.domAttributes?.blockContent||{},...t})}}}),D6=sr.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p",getAttrs:e=>{if(typeof e=="string"||!e.textContent||!e.closest("[data-content-type]"))return!1;let t=e.parentElement;return t===null?!1:t.tagName==="TD"||t.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:e}){return["p",e,0]}}),P6=sr.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Rn(this.options.HTMLAttributes,e),0]}});function Qk(e,t){let n=sn.fromSchema(t).parse(e,{topNode:t.nodes.blockGroup.create()}),r=[];return n.content.descendants(o=>{if(o.isInline)return r.push(o),!1}),j.fromArray(r)}var B6=()=>gD({node:L6,type:"table",content:"table"},_6,[Ve({key:"table-extensions",tiptapExtensions:[M6,D6,O6,R6,P6]}),Ve({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:e})=>{if(!(e.prosemirrorState.selection instanceof Ge))return!1;let t=e.getTextCursorPosition().block,n=t.content,r=0;for(let i of n.rows)for(let s of i.cells){if("type"in s&&s.content.length>0||!("type"in s)&&s.length>0)return!1;r++}let o=0;return e.prosemirrorState.selection.forEachCell(()=>{o++}),o<r?!1:(e.transact(()=>{(e.getPrevBlock(t)||e.getNextBlock(t))&&e.setTextCursorPosition(t),e.removeBlocks([t])}),!0)}}})]),R1=e=>({url:e.src||void 0,previewWidth:e.width||void 0}),F6=e=>({type:"video",propSchema:{textAlignment:Ue.textAlignment,backgroundColor:Ue.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),H6=e=>t=>{if(t.tagName==="VIDEO"){if(t.closest("figure"))return;let{backgroundColor:n}=$t(t);return{...R1(t),backgroundColor:n}}if(t.tagName==="FIGURE"){let n=$u(t,"video");if(!n)return;let{targetElement:r,caption:o}=n,{backgroundColor:i}=$t(t);return{...R1(r),backgroundColor:i,caption:o}}},U6=Ln(F6,e=>({meta:{fileBlockAccept:["video/*"]},parse:H6(),render(t,n){let r=document.createElement("div");r.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';let o=document.createElement("div");o.className="bn-visual-media-wrapper";let i=document.createElement("video");return i.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(t.props.url).then(s=>{i.src=s}):i.src=t.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,i.width=t.props.previewWidth,o.appendChild(i),Gk(t,n,{dom:o},o,r.firstElementChild)},toExternalHTML(t){if(!t.props.url){let r=document.createElement("p");return r.textContent="Add video",{dom:r}}let n;return t.props.showPreview?(n=document.createElement("video"),n.src=t.props.url,t.props.previewWidth&&(n.width=t.props.previewWidth)):(n=document.createElement("a"),n.href=t.props.url,n.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?am(n,t.props.caption):ju(n,t.props.caption):{dom:n}},runsBefore:["file"]}));function it(e,t,n){if(!(t in e.schema.blockSpecs))return!1;if(!n)return!0;for(let[r,o]of Object.entries(n)){if(!(r in e.schema.blockSpecs[t].config.propSchema))return!1;if(typeof o=="string"){if(e.schema.blockSpecs[t].config.propSchema[r].default!==void 0&&typeof e.schema.blockSpecs[t].config.propSchema[r].default!==o||e.schema.blockSpecs[t].config.propSchema[r].type!==void 0&&e.schema.blockSpecs[t].config.propSchema[r].type!==o)return!1}else{if(e.schema.blockSpecs[t].config.propSchema[r].default!==o.default||e.schema.blockSpecs[t].config.propSchema[r].default===void 0&&o.default===void 0&&e.schema.blockSpecs[t].config.propSchema[r].type!==o.type||typeof e.schema.blockSpecs[t].config.propSchema[r].values!=typeof o.values)return!1;if(typeof e.schema.blockSpecs[t].config.propSchema[r].values=="object"&&typeof o.values=="object"){for(let i of o.values)if(!e.schema.blockSpecs[t].config.propSchema[r].values.includes(i))return!1}}}return!0}function En(e,t,n,r){return it(t,n,r)&&e.type===n}function Th(e){return e instanceof Ge}var dl=new Map;function V6(e){if(dl.has(e))return dl.get(e);let t=new es;return e._tiptapEditor.on("transaction",({transaction:n})=>{t.appendMapping(n.mapping)}),e._tiptapEditor.on("destroy",()=>{dl.delete(e)}),dl.set(e,t),t}function $6(e,t,n="left"){let r=tt.getState(e.prosemirrorState);if(!r){let i=V6(e),s=i.maps.length;return()=>i.slice(s).map(t,n==="left"?-1:1)}let o=xa(t+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{let i=tt.getState(e.prosemirrorState),s=ni(i.doc,i.binding.type,o,i.binding.mapping);if(s===null)throw Error("Position not found, cannot track positions");return s+(n==="right"?-1:1)}}var j6=Du(e=>e.type.name==="blockContainer"),z6=class{state;emitUpdate;rootEl;pluginState;constructor(t,n,r){this.editor=t,this.pluginState=void 0,this.emitUpdate=o=>{if(!this.state)throw Error("Attempting to update uninitialized suggestions menu");n(o,{...this.state,ignoreQueryLength:this.pluginState?.ignoreQueryLength})},this.rootEl=r.root,this.rootEl?.addEventListener("scroll",this.handleScroll,!0)}handleScroll=()=>{if(this.state?.show){let t=this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!t)return;this.state.referencePos=t.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}};update(t,n){let r=Yo.getState(n),o=Yo.getState(t.state),i=r===void 0&&o!==void 0,s=r!==void 0&&o===void 0;if(!i&&!(r!==void 0&&o!==void 0)&&!s)return;if(this.pluginState=s?r:o,s||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}let a=this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&a&&(this.state={show:!0,referencePos:a.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){this.rootEl?.removeEventListener("scroll",this.handleScroll,!0)}closeMenu=()=>{this.editor.transact(t=>t.setMeta(Yo,null))};clearQuery=()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(t=>t.selection.from)}).run()}},Yo=new $e("SuggestionMenuPlugin"),zn=Ve(({editor:e})=>{let t=new Map,n,r=Po(void 0);return{key:"suggestionMenu",store:r,addSuggestionMenu:o=>{t.set(o.triggerCharacter,o)},removeSuggestionMenu:o=>{t.delete(o)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>n?.state?.show||!1,openSuggestionMenu:(o,i)=>{e.headless||(e.focus(),e.transact(s=>{i?.deleteTriggerCharacter&&s.insertText(o),s.scrollIntoView().setMeta(Yo,{triggerCharacter:o,deleteTriggerCharacter:i?.deleteTriggerCharacter||!1,ignoreQueryLength:i?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new Ae({key:Yo,view:o=>(n=new z6(e,(i,s)=>{r.setState({...s,triggerCharacter:i})},o),n),state:{init(){},apply:(o,i,s,a)=>{if(o.selection.$from.parent.type.spec.code)return i;let l=o.getMeta(Yo);if(typeof l=="object"&&l){i&&n?.closeMenu();let u=$6(e,a.selection.from-l.triggerCharacter.length);return{triggerCharacter:l.triggerCharacter,deleteTriggerCharacter:l.deleteTriggerCharacter!==!1,queryStartPos:()=>u()+l.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:l?.ignoreQueryLength}}if(i===void 0)return i;if(a.selection.from!==a.selection.to||l===null||o.getMeta("focus")||o.getMeta("blur")||o.getMeta("pointer")||i.triggerCharacter!==void 0&&a.selection.from<i.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(i.queryStartPos())))return;let c={...i};return c.query=a.doc.textBetween(i.queryStartPos(),a.selection.from),c}},props:{handleTextInput(o,i,s,a){if(i===s){let l=o.state.doc;for(let[c,u]of t){let d=c.length>1?l.textBetween(i-c.length,i)+a:a;if(c===d){if(u.shouldOpen&&!u.shouldOpen(o.state.tr))continue;return o.dispatch(o.state.tr.insertText(a)),o.dispatch(o.state.tr.setMeta(Yo,{triggerCharacter:d}).scrollIntoView()),!0}}}return!1},decorations(o){let i=this.getState(o);if(i===void 0)return null;if(!i.deleteTriggerCharacter){let s=j6(o.selection);if(s)return _e.create(o.doc,[qe.node(s.pos,s.pos+s.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":i.decorationId})])}return _e.create(o.doc,[qe.inline(i.queryStartPos()-i.triggerCharacter.length,i.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":i.decorationId})])}}})]}});function W6(e){let t=e.getTextCursorPosition().block,n=e.schema.blockSchema[t.type].content;for(;n==="none";){if(t=e.getTextCursorPosition().nextBlock,t===void 0)return;n=e.schema.blockSchema[t.type].content,e.setTextCursorPosition(t,"end")}}function qt(e,t){let n=e.getTextCursorPosition().block;if(n.content===void 0)throw Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&hi(n.content[0])&&n.content[0].type==="text"&&n.content[0].text==="/"||n.content.length===0)?(r=e.updateBlock(n,t),e.setTextCursorPosition(r)):(r=e.insertBlocks([t],n,"after")[0],e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),W6(e),r}function q6(e){let t=[];return it(e,"heading",{level:"number"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{t.push({onItemClick:()=>{qt(e,{type:"heading",props:{level:n}})},badge:Bn(`Mod-Alt-${n}`),key:n===1?"heading":`heading_${n}`,...e.dictionary.slash_menu[n===1?"heading":`heading_${n}`]})}),it(e,"quote")&&t.push({onItemClick:()=>{qt(e,{type:"quote"})},key:"quote",...e.dictionary.slash_menu.quote}),it(e,"toggleListItem")&&t.push({onItemClick:()=>{qt(e,{type:"toggleListItem"})},badge:Bn("Mod-Shift-6"),key:"toggle_list",...e.dictionary.slash_menu.toggle_list}),it(e,"numberedListItem")&&t.push({onItemClick:()=>{qt(e,{type:"numberedListItem"})},badge:Bn("Mod-Shift-7"),key:"numbered_list",...e.dictionary.slash_menu.numbered_list}),it(e,"bulletListItem")&&t.push({onItemClick:()=>{qt(e,{type:"bulletListItem"})},badge:Bn("Mod-Shift-8"),key:"bullet_list",...e.dictionary.slash_menu.bullet_list}),it(e,"checkListItem")&&t.push({onItemClick:()=>{qt(e,{type:"checkListItem"})},badge:Bn("Mod-Shift-9"),key:"check_list",...e.dictionary.slash_menu.check_list}),it(e,"paragraph")&&t.push({onItemClick:()=>{qt(e,{type:"paragraph"})},badge:Bn("Mod-Alt-0"),key:"paragraph",...e.dictionary.slash_menu.paragraph}),it(e,"codeBlock")&&t.push({onItemClick:()=>{qt(e,{type:"codeBlock"})},badge:Bn("Mod-Alt-c"),key:"code_block",...e.dictionary.slash_menu.code_block}),it(e,"divider")&&t.push({onItemClick:()=>{qt(e,{type:"divider"})},key:"divider",...e.dictionary.slash_menu.divider}),it(e,"table")&&t.push({onItemClick:()=>{qt(e,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...e.dictionary.slash_menu.table}),it(e,"image",{url:"string"})&&t.push({onItemClick:()=>{let n=qt(e,{type:"image"});e.getExtension(rr)?.showMenu(n.id)},key:"image",...e.dictionary.slash_menu.image}),it(e,"video",{url:"string"})&&t.push({onItemClick:()=>{let n=qt(e,{type:"video"});e.getExtension(rr)?.showMenu(n.id)},key:"video",...e.dictionary.slash_menu.video}),it(e,"audio",{url:"string"})&&t.push({onItemClick:()=>{let n=qt(e,{type:"audio"});e.getExtension(rr)?.showMenu(n.id)},key:"audio",...e.dictionary.slash_menu.audio}),it(e,"file",{url:"string"})&&t.push({onItemClick:()=>{let n=qt(e,{type:"file"});e.getExtension(rr)?.showMenu(n.id)},key:"file",...e.dictionary.slash_menu.file}),it(e,"heading",{level:"number",isToggleable:"boolean"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{t.push({onItemClick:()=>{qt(e,{type:"heading",props:{level:n,isToggleable:!0}})},key:n===1?"toggle_heading":`toggle_heading_${n}`,...e.dictionary.slash_menu[n===1?"toggle_heading":`toggle_heading_${n}`]})}),it(e,"heading",{level:"number"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{t.push({onItemClick:()=>{qt(e,{type:"heading",props:{level:n}})},badge:Bn(`Mod-Alt-${n}`),key:`heading_${n}`,...e.dictionary.slash_menu[`heading_${n}`]})}),t.push({onItemClick:()=>{e.getExtension(zn)?.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...e.dictionary.slash_menu.emoji}),t}function G6(e,t){return e.filter(({title:n,aliases:r})=>n.toLowerCase().includes(t.toLowerCase())||r&&r.filter(o=>o.toLowerCase().includes(t.toLowerCase())).length!==0)}var Xk={audio:QD(),bulletListItem:g6(),checkListItem:y6(),codeBlock:JD(),divider:t6(),file:o6(),heading:l6(),image:h6(),numberedListItem:k6(),paragraph:Kk(),quote:A6(),table:B6(),toggleListItem:w6(),video:U6()},Y6=Bk({type:"textColor",propSchema:"string"},{render:()=>{let e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("span");return e!==Ue.textColor.default&&(t.style.color=e in ko?ko[e].text:e),{dom:t,contentDOM:t}},parse:e=>{if(e.tagName==="SPAN"&&e.style.color)return e.style.color}}),K6=Bk({type:"backgroundColor",propSchema:"string"},{render:()=>{let e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("span");return e!==Ue.backgroundColor.default&&(t.style.backgroundColor=e in ko?ko[e].background:e),{dom:t,contentDOM:t}},parse:e=>{if(e.tagName==="SPAN"&&e.style.backgroundColor)return e.style.backgroundColor}}),cm={bold:ys(GL,"boolean"),italic:ys(rD,"boolean"),underline:ys(cD,"boolean"),strike:ys(aD,"boolean"),code:ys(XL,"boolean"),textColor:Y6,backgroundColor:K6};Pk(cm);var Zk={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},Q6=Lk(Zk),um=class Jk extends ID{static create(t){return new Jk({blockSpecs:t?.blockSpecs??Xk,inlineContentSpecs:t?.inlineContentSpecs??Zk,styleSpecs:t?.styleSpecs??cm})}},Wd,L1;function X6(){return L1||(L1=1,Wd=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),Wd}var Z6=X6();const J6=cp(Z6);var wc=200,Dt=function(){};Dt.prototype.append=function(t){return t.length?(t=Dt.from(t),!this.length&&t||t.length<wc&&this.leafAppend(t)||this.length<wc&&t.leafPrepend(this)||this.appendInner(t)):this};Dt.prototype.prepend=function(t){return t.length?Dt.from(t).append(this):this};Dt.prototype.appendInner=function(t){return new eP(this,t)};Dt.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Dt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Dt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Dt.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};Dt.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};Dt.from=function(t){return t instanceof Dt?t:t&&t.length?new eT(t):Dt.empty};var eT=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=wc)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=wc)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(Dt);Dt.empty=new eT([]);var eP=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(Dt);const tP=500;class Xn{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new cr(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new cr(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new Xn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),f=new cr(t.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>rP&&(a=nP(a,c),s-=c),new Xn(a.append(i),s)}remapping(t,n){let r=new es;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new Xn(this.items.append(t.map(n=>new cr(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let g=t.steps[h].invert(t.docs[h]),y=f.selection&&f.selection.map(i.slice(l+1,h));y&&a++,r.push(new cr(p,g,y))}else r.push(new cr(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new cr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Xn(u,a);return d.emptyItemCount()>tP&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new cr(c.invert(),l,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Xn(Dt.from(o.reverse()),i)}}Xn.empty=new Xn(Dt.empty,0);function nP(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}class cr{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new cr(n.getMap().invert(),n,this.selection)}}}class uo{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const rP=20;function oP(e,t,n,r){let o=n.getMeta(ri),i;if(o)return o.historyState;n.getMeta(tT)&&(e=new uo(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(ri))return s.getMeta(ri).redo?new uo(e.done.addTransform(n,void 0,r,Bl(t)),e.undone,D1(n.mapping.maps),e.prevTime,e.prevComposition):new uo(e.done,e.undone.addTransform(n,void 0,r,Bl(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!iP(n,e.prevRanges)),c=s?qd(e.prevRanges,n.mapping):D1(n.mapping.maps);return new uo(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Bl(t)),Xn.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new uo(e.done.rebased(n,i),e.undone.rebased(n,i),qd(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new uo(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),qd(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function iP(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function D1(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function qd(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function sP(e,t,n){let r=Bl(t),o=ri.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new uo(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(ri,{redo:n,historyState:l})}let Gd=!1,P1=null;function Bl(e){let t=e.plugins;if(P1!=t){Gd=!1,P1=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Gd=!0;break}}return Gd}function aP(e){return e.setMeta(tT,!0)}const ri=new $e("history"),tT=new $e("closeHistory");function lP(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ae({key:ri,state:{init(){return new uo(Xn.empty,Xn.empty,null,0,-1)},apply(t,n,r){return oP(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?rT:r=="historyRedo"?oT:null;return!o||!t.editable?!1:(n.preventDefault(),o(t.state,t.dispatch))}}}})}function nT(e,t){return(n,r)=>{let o=ri.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=sP(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const rT=nT(!1,!0),oT=nT(!0,!0);class Pa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Pa.prototype.normal={};Pa.prototype.property={};Pa.prototype.space=void 0;function iT(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Pa(n,r,t)}function wa(e){return e.toLowerCase()}class kn{constructor(t,n){this.attribute=n,this.property=t}}kn.prototype.attribute="";kn.prototype.booleanish=!1;kn.prototype.boolean=!1;kn.prototype.commaOrSpaceSeparated=!1;kn.prototype.commaSeparated=!1;kn.prototype.defined=!1;kn.prototype.mustUseProperty=!1;kn.prototype.number=!1;kn.prototype.overloadedBoolean=!1;kn.prototype.property="";kn.prototype.spaceSeparated=!1;kn.prototype.space=void 0;let cP=0;const ke=Ci(),St=Ci(),wh=Ci(),ee=Ci(),et=Ci(),Gi=Ci(),wn=Ci();function Ci(){return 2**++cP}const Sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:ke,booleanish:St,commaOrSpaceSeparated:wn,commaSeparated:Gi,number:ee,overloadedBoolean:wh,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),Yd=Object.keys(Sh);class dm extends kn{constructor(t,n,r,o){let i=-1;if(super(t,n),B1(this,"space",o),typeof r=="number")for(;++i<Yd.length;){const s=Yd[i];B1(this,Yd[i],(r&Sh[s])===Sh[s])}}}dm.prototype.defined=!0;function B1(e,t,n){n&&(e[t]=n)}function hs(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new dm(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[wa(r)]=r,n[wa(i.attribute)]=r}return new Pa(t,n,e.space)}const sT=hs({properties:{ariaActiveDescendant:null,ariaAtomic:St,ariaAutoComplete:null,ariaBusy:St,ariaChecked:St,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:St,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:St,ariaFlowTo:et,ariaGrabbed:St,ariaHasPopup:null,ariaHidden:St,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:ee,ariaLive:null,ariaModal:St,ariaMultiLine:St,ariaMultiSelectable:St,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:St,ariaReadOnly:St,ariaRelevant:null,ariaRequired:St,ariaRoleDescription:et,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:St,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function aT(e,t){return t in e?e[t]:t}function lT(e,t){return aT(e,t.toLowerCase())}const uP=hs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Gi,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:ke,allowPaymentRequest:ke,allowUserMedia:ke,alt:null,as:null,async:ke,autoCapitalize:null,autoComplete:et,autoFocus:ke,autoPlay:ke,blocking:et,capture:null,charSet:null,checked:ke,cite:null,className:et,cols:ee,colSpan:null,content:null,contentEditable:St,controls:ke,controlsList:et,coords:ee|Gi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ke,defer:ke,dir:null,dirName:null,disabled:ke,download:wh,draggable:St,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ke,formTarget:null,headers:et,height:ee,hidden:wh,high:ee,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:ke,inputMode:null,integrity:null,is:null,isMap:ke,itemId:null,itemProp:et,itemRef:et,itemScope:ke,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ke,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:ke,muted:ke,name:null,nonce:null,noModule:ke,noValidate:ke,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ke,optimum:ee,pattern:null,ping:et,placeholder:null,playsInline:ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ke,referrerPolicy:null,rel:et,required:ke,reversed:ke,rows:ee,rowSpan:ee,sandbox:et,scope:null,scoped:ke,seamless:ke,selected:ke,shadowRootClonable:ke,shadowRootDelegatesFocus:ke,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:St,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:ke,useMap:null,value:St,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ke,declare:ke,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:ke,noHref:ke,noShade:ke,noWrap:ke,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:St,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ke,disableRemotePlayback:ke,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:lT}),dP=hs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:wn,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Gi,g2:Gi,glyphName:Gi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wn,rev:wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wn,requiredFeatures:wn,requiredFonts:wn,requiredFormats:wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wn,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:aT}),cT=hs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),uT=hs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lT}),dT=hs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),fP=/[A-Z]/g,F1=/-[a-z]/g,hP=/^data[-\w.:]+$/i;function fm(e,t){const n=wa(t);let r=t,o=kn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hP.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(F1,mP);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!F1.test(i)){let s=i.replace(fP,pP);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=dm}return new o(r,t)}function pP(e){return"-"+e.toLowerCase()}function mP(e){return e.charAt(1).toUpperCase()}const Wu=iT([sT,uP,cT,uT,dT],"html"),Ba=iT([sT,dP,cT,uT,dT],"svg");function H1(e){const t=[],n=String(e||"");let r=n.indexOf(","),o=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const s=n.slice(o,r).trim();(s||!i)&&t.push(s),o=r+1,r=n.indexOf(",",o)}return t}function gP(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U1=/[#.]/g;function bP(e,t){const n=e||"",r={};let o=0,i,s;for(;o<n.length;){U1.lastIndex=o;const a=U1.exec(n),l=n.slice(o,a?a.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:s=l,o+=l.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||t||"div",properties:r,children:[]}}function V1(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function yP(e){return e.join(" ").trim()}function fT(e,t,n){const r=n?kP(n):void 0;function o(i,s,...a){let l;if(i==null){l={type:"root",children:[]};const c=s;a.unshift(c)}else{l=bP(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,EP(s))a.unshift(s);else for(const[d,f]of Object.entries(s))xP(e,l.properties,d,f)}for(const c of a)vh(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return o}function EP(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const o=t[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function xP(e,t,n,r){const o=fm(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=V1(r):o.commaSeparated?i=H1(r):o.commaOrSpaceSeparated?i=V1(H1(r).join(" ")):i=$1(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?CP(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push($1(o,o.property,a));i=s}o.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}function vh(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)vh(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?vh(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function $1(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||wa(n)===wa(t)))return!0}return n}function CP(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function kP(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const TP=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","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","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],hT=fT(Wu,"div"),pT=fT(Ba,"g",TP);function wP(e){const t=String(e),n=[];return{toOffset:o,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=t.length){let s=0;for(;;){let a=n[s];if(a===void 0){const l=j1(t,n[s-1]);a=l===-1?t.length+1:l+1,n[s]=a}if(a>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function o(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const a=n[n.length-1],l=j1(t,a),c=l===-1?t.length+1:l+1;if(a===c)break;n.push(c)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function j1(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
111
+ `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Fl={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},mT={}.hasOwnProperty,SP=Object.prototype;function vP(e,t){const n=t||{};return hm({file:n.file||void 0,location:!1,schema:n.space==="svg"?Ba:Wu,verbose:n.verbose||!1},e)}function hm(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Hl(e,r,n),n}case"#document":case"#document-fragment":{const r=t,o="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:gT(e,t.childNodes),data:{quirksMode:o}},e.file&&e.location){const i=String(e.file),s=wP(i),a=s.toPoint(0),l=s.toPoint(i.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Hl(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Hl(e,r,n),n}default:return n=AP(e,t),n}}function gT(e,t){let n=-1;const r=[];for(;++n<t.length;){const o=hm(e,t[n]);r.push(o)}return r}function AP(e,t){const n=e.schema;e.schema=t.namespaceURI===Fl.svg?Ba:Wu;let r=-1;const o={};for(;++r<t.attrs.length;){const a=t.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;mT.call(SP,l)||(o[l]=a.value)}const s=(e.schema.space==="svg"?pT:hT)(t.tagName,o,gT(e,t.childNodes));if(Hl(e,t,s),s.tagName==="template"){const a=t,l=a.sourceCodeLocation,c=l&&l.startTag&&Hi(l.startTag),u=l&&l.endTag&&Hi(l.endTag),d=hm(e,a.content);c&&u&&e.file&&(d.position={start:c.end,end:u.start}),s.content=d}return e.schema=n,s}function Hl(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=NP(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function NP(e,t,n){const r=Hi(n);if(t.type==="element"){const o=t.children[t.children.length-1];if(r&&!n.endTag&&o&&o.position&&o.position.end&&(r.end=Object.assign({},o.position.end)),e.verbose){const i={};let s;if(n.attrs)for(s in n.attrs)mT.call(n.attrs,s)&&(i[fm(e.schema,s).property]=Hi(n.attrs[s]));n.startTag;const a=Hi(n.startTag),l=n.endTag?Hi(n.endTag):void 0,c={opening:a};l&&(c.closing=l),c.properties=i,t.data={position:c}}}return r}function Hi(e){const t=z1({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=z1({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function z1(e){return e.line&&e.column?e:void 0}const IP=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),at="�";var T;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(T||(T={}));const dn={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function bT(e){return e>=55296&&e<=57343}function MP(e){return e>=56320&&e<=57343}function _P(e,t){return(e-55296)*1024+9216+t}function yT(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ET(e){return e>=64976&&e<=65007||IP.has(e)}var $;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})($||($={}));const OP=65536;class RP{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=OP,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:o,offset:i}=this,s=o+n,a=i+n;return{code:t,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:a,endOffset:a}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(MP(n))return this.pos++,this._addGap(),_P(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,T.EOF;return this._err($.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,T.EOF;const r=this.html.charCodeAt(n);return r===T.CARRIAGE_RETURN?T.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,T.EOF;let t=this.html.charCodeAt(this.pos);return t===T.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,T.LINE_FEED):t===T.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,bT(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===T.LINE_FEED||t===T.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){yT(t)?this._err($.controlCharacterInInputStream):ET(t)&&this._err($.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var He;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(He||(He={}));function xT(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const LP=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),DP=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function PP(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=DP.get(e))!==null&&t!==void 0?t:e}var Lt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Lt||(Lt={}));const BP=32;var To;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(To||(To={}));function Ah(e){return e>=Lt.ZERO&&e<=Lt.NINE}function FP(e){return e>=Lt.UPPER_A&&e<=Lt.UPPER_F||e>=Lt.LOWER_A&&e<=Lt.LOWER_F}function HP(e){return e>=Lt.UPPER_A&&e<=Lt.UPPER_Z||e>=Lt.LOWER_A&&e<=Lt.LOWER_Z||Ah(e)}function UP(e){return e===Lt.EQUALS||HP(e)}var Rt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Rt||(Rt={}));var Ur;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ur||(Ur={}));class VP{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Rt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ur.Strict}startEntity(t){this.decodeMode=t,this.state=Rt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Rt.EntityStart:return t.charCodeAt(n)===Lt.NUM?(this.state=Rt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Rt.NamedEntity,this.stateNamedEntity(t,n));case Rt.NumericStart:return this.stateNumericStart(t,n);case Rt.NumericDecimal:return this.stateNumericDecimal(t,n);case Rt.NumericHex:return this.stateNumericHex(t,n);case Rt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|BP)===Lt.LOWER_X?(this.state=Rt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Rt.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,o){if(n!==r){const i=r-n;this.result=this.result*Math.pow(o,i)+Number.parseInt(t.substr(n,i),o),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const o=t.charCodeAt(n);if(Ah(o)||FP(o))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(o,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const o=t.charCodeAt(n);if(Ah(o))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(o,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Lt.SEMI)this.consumed+=1;else if(this.decodeMode===Ur.Strict)return 0;return this.emitCodePoint(PP(this.result),this.consumed),this.errors&&(t!==Lt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let o=r[this.treeIndex],i=(o&To.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const s=t.charCodeAt(n);if(this.treeIndex=$P(r,o,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===Ur.Attribute&&(i===0||UP(s))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],i=(o&To.VALUE_LENGTH)>>14,i!==0){if(s===Lt.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Ur.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,o=(r[n]&To.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,o,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[t]&~To.VALUE_LENGTH:o[t+1],r),n===3&&this.emitCodePoint(o[t+2],r),r}end(){var t;switch(this.state){case Rt.NamedEntity:return this.result!==0&&(this.decodeMode!==Ur.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Rt.NumericDecimal:return this.emitNumericEntity(0,2);case Rt.NumericHex:return this.emitNumericEntity(0,3);case Rt.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Rt.EntityStart:return 0}}}function $P(e,t,n,r){const o=(t&To.BRANCH_LENGTH)>>7,i=t&To.JUMP_TABLE;if(o===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=o?-1:e[n+l]-1}let s=n,a=s+o-1;for(;s<=a;){const l=s+a>>>1,c=e[l];if(c<r)s=l+1;else if(c>r)a=l-1;else return e[l+o]}return-1}var Q;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(Q||(Q={}));var oi;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(oi||(oi={}));var Hn;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Hn||(Hn={}));var B;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(B||(B={}));var m;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(m||(m={}));const jP=new Map([[B.A,m.A],[B.ADDRESS,m.ADDRESS],[B.ANNOTATION_XML,m.ANNOTATION_XML],[B.APPLET,m.APPLET],[B.AREA,m.AREA],[B.ARTICLE,m.ARTICLE],[B.ASIDE,m.ASIDE],[B.B,m.B],[B.BASE,m.BASE],[B.BASEFONT,m.BASEFONT],[B.BGSOUND,m.BGSOUND],[B.BIG,m.BIG],[B.BLOCKQUOTE,m.BLOCKQUOTE],[B.BODY,m.BODY],[B.BR,m.BR],[B.BUTTON,m.BUTTON],[B.CAPTION,m.CAPTION],[B.CENTER,m.CENTER],[B.CODE,m.CODE],[B.COL,m.COL],[B.COLGROUP,m.COLGROUP],[B.DD,m.DD],[B.DESC,m.DESC],[B.DETAILS,m.DETAILS],[B.DIALOG,m.DIALOG],[B.DIR,m.DIR],[B.DIV,m.DIV],[B.DL,m.DL],[B.DT,m.DT],[B.EM,m.EM],[B.EMBED,m.EMBED],[B.FIELDSET,m.FIELDSET],[B.FIGCAPTION,m.FIGCAPTION],[B.FIGURE,m.FIGURE],[B.FONT,m.FONT],[B.FOOTER,m.FOOTER],[B.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[B.FORM,m.FORM],[B.FRAME,m.FRAME],[B.FRAMESET,m.FRAMESET],[B.H1,m.H1],[B.H2,m.H2],[B.H3,m.H3],[B.H4,m.H4],[B.H5,m.H5],[B.H6,m.H6],[B.HEAD,m.HEAD],[B.HEADER,m.HEADER],[B.HGROUP,m.HGROUP],[B.HR,m.HR],[B.HTML,m.HTML],[B.I,m.I],[B.IMG,m.IMG],[B.IMAGE,m.IMAGE],[B.INPUT,m.INPUT],[B.IFRAME,m.IFRAME],[B.KEYGEN,m.KEYGEN],[B.LABEL,m.LABEL],[B.LI,m.LI],[B.LINK,m.LINK],[B.LISTING,m.LISTING],[B.MAIN,m.MAIN],[B.MALIGNMARK,m.MALIGNMARK],[B.MARQUEE,m.MARQUEE],[B.MATH,m.MATH],[B.MENU,m.MENU],[B.META,m.META],[B.MGLYPH,m.MGLYPH],[B.MI,m.MI],[B.MO,m.MO],[B.MN,m.MN],[B.MS,m.MS],[B.MTEXT,m.MTEXT],[B.NAV,m.NAV],[B.NOBR,m.NOBR],[B.NOFRAMES,m.NOFRAMES],[B.NOEMBED,m.NOEMBED],[B.NOSCRIPT,m.NOSCRIPT],[B.OBJECT,m.OBJECT],[B.OL,m.OL],[B.OPTGROUP,m.OPTGROUP],[B.OPTION,m.OPTION],[B.P,m.P],[B.PARAM,m.PARAM],[B.PLAINTEXT,m.PLAINTEXT],[B.PRE,m.PRE],[B.RB,m.RB],[B.RP,m.RP],[B.RT,m.RT],[B.RTC,m.RTC],[B.RUBY,m.RUBY],[B.S,m.S],[B.SCRIPT,m.SCRIPT],[B.SEARCH,m.SEARCH],[B.SECTION,m.SECTION],[B.SELECT,m.SELECT],[B.SOURCE,m.SOURCE],[B.SMALL,m.SMALL],[B.SPAN,m.SPAN],[B.STRIKE,m.STRIKE],[B.STRONG,m.STRONG],[B.STYLE,m.STYLE],[B.SUB,m.SUB],[B.SUMMARY,m.SUMMARY],[B.SUP,m.SUP],[B.TABLE,m.TABLE],[B.TBODY,m.TBODY],[B.TEMPLATE,m.TEMPLATE],[B.TEXTAREA,m.TEXTAREA],[B.TFOOT,m.TFOOT],[B.TD,m.TD],[B.TH,m.TH],[B.THEAD,m.THEAD],[B.TITLE,m.TITLE],[B.TR,m.TR],[B.TRACK,m.TRACK],[B.TT,m.TT],[B.U,m.U],[B.UL,m.UL],[B.SVG,m.SVG],[B.VAR,m.VAR],[B.WBR,m.WBR],[B.XMP,m.XMP]]);function qu(e){var t;return(t=jP.get(e))!==null&&t!==void 0?t:m.UNKNOWN}const X=m,zP={[Q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[Q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[Q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[Q.XLINK]:new Set,[Q.XML]:new Set,[Q.XMLNS]:new Set},Nh=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]);B.STYLE,B.SCRIPT,B.XMP,B.IFRAME,B.NOEMBED,B.NOFRAMES,B.PLAINTEXT;var w;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(w||(w={}));const yn={DATA:w.DATA,RCDATA:w.RCDATA,RAWTEXT:w.RAWTEXT,SCRIPT_DATA:w.SCRIPT_DATA,PLAINTEXT:w.PLAINTEXT,CDATA_SECTION:w.CDATA_SECTION};function WP(e){return e>=T.DIGIT_0&&e<=T.DIGIT_9}function Rs(e){return e>=T.LATIN_CAPITAL_A&&e<=T.LATIN_CAPITAL_Z}function qP(e){return e>=T.LATIN_SMALL_A&&e<=T.LATIN_SMALL_Z}function ao(e){return qP(e)||Rs(e)}function W1(e){return ao(e)||WP(e)}function fl(e){return e+32}function CT(e){return e===T.SPACE||e===T.LINE_FEED||e===T.TABULATION||e===T.FORM_FEED}function q1(e){return CT(e)||e===T.SOLIDUS||e===T.GREATER_THAN_SIGN}function GP(e){return e===T.NULL?$.nullCharacterReference:e>1114111?$.characterReferenceOutsideUnicodeRange:bT(e)?$.surrogateCharacterReference:ET(e)?$.noncharacterCharacterReference:yT(e)||e===T.CARRIAGE_RETURN?$.controlCharacterReference:null}class YP{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=w.DATA,this.returnState=w.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new RP(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new VP(LP,(r,o)=>{this.preprocessor.pos=this.entityStartPos+o-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err($.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err($.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const o=GP(r);o&&this._err(o,1)}}:void 0)}_err(t,n=0){var r,o;(o=(r=this.handler).onParseError)===null||o===void 0||o.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:He.START_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:He.END_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:He.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:He.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(xT(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const o=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);o[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err($.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=qu(t.tagName),t.type===He.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err($.endTagWithAttributes),t.selfClosing&&this._err($.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case He.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case He.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case He.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:He.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=CT(t)?He.WHITESPACE_CHARACTER:t===T.NULL?He.NULL_CHARACTER:He.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(He.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=w.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ur.Attribute:Ur.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===w.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===w.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===w.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case w.DATA:{this._stateData(t);break}case w.RCDATA:{this._stateRcdata(t);break}case w.RAWTEXT:{this._stateRawtext(t);break}case w.SCRIPT_DATA:{this._stateScriptData(t);break}case w.PLAINTEXT:{this._statePlaintext(t);break}case w.TAG_OPEN:{this._stateTagOpen(t);break}case w.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case w.TAG_NAME:{this._stateTagName(t);break}case w.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case w.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case w.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case w.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case w.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case w.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case w.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case w.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case w.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case w.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case w.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case w.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case w.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case w.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case w.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case w.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case w.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case w.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case w.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case w.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case w.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case w.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case w.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case w.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case w.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case w.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case w.BOGUS_COMMENT:{this._stateBogusComment(t);break}case w.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case w.COMMENT_START:{this._stateCommentStart(t);break}case w.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case w.COMMENT:{this._stateComment(t);break}case w.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case w.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case w.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case w.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case w.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case w.COMMENT_END:{this._stateCommentEnd(t);break}case w.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case w.DOCTYPE:{this._stateDoctype(t);break}case w.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case w.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case w.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case w.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case w.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case w.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case w.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case w.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case w.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case w.CDATA_SECTION:{this._stateCdataSection(t);break}case w.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case w.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case w.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case w.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case T.LESS_THAN_SIGN:{this.state=w.TAG_OPEN;break}case T.AMPERSAND:{this._startCharacterReference();break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitCodePoint(t);break}case T.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case T.AMPERSAND:{this._startCharacterReference();break}case T.LESS_THAN_SIGN:{this.state=w.RCDATA_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case T.LESS_THAN_SIGN:{this.state=w.RAWTEXT_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(ao(t))this._createStartTagToken(),this.state=w.TAG_NAME,this._stateTagName(t);else switch(t){case T.EXCLAMATION_MARK:{this.state=w.MARKUP_DECLARATION_OPEN;break}case T.SOLIDUS:{this.state=w.END_TAG_OPEN;break}case T.QUESTION_MARK:{this._err($.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=w.BOGUS_COMMENT,this._stateBogusComment(t);break}case T.EOF:{this._err($.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err($.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=w.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(ao(t))this._createEndTagToken(),this.state=w.TAG_NAME,this._stateTagName(t);else switch(t){case T.GREATER_THAN_SIGN:{this._err($.missingEndTagName),this.state=w.DATA;break}case T.EOF:{this._err($.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err($.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=w.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.BEFORE_ATTRIBUTE_NAME;break}case T.SOLIDUS:{this.state=w.SELF_CLOSING_START_TAG;break}case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentTagToken();break}case T.NULL:{this._err($.unexpectedNullCharacter),n.tagName+=at;break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Rs(t)?fl(t):t)}}_stateRcdataLessThanSign(t){t===T.SOLIDUS?this.state=w.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=w.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){ao(t)?(this.state=w.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=w.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=w.BEFORE_ATTRIBUTE_NAME,!1;case T.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=w.SELF_CLOSING_START_TAG,!1;case T.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=w.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=w.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===T.SOLIDUS?this.state=w.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=w.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){ao(t)?(this.state=w.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=w.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=w.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case T.SOLIDUS:{this.state=w.SCRIPT_DATA_END_TAG_OPEN;break}case T.EXCLAMATION_MARK:{this.state=w.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=w.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){ao(t)?(this.state=w.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=w.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=w.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===T.HYPHEN_MINUS?(this.state=w.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=w.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===T.HYPHEN_MINUS?(this.state=w.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=w.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case T.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case T.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_ESCAPED,this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case T.HYPHEN_MINUS:{this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case T.GREATER_THAN_SIGN:{this.state=w.SCRIPT_DATA,this._emitChars(">");break}case T.NULL:{this._err($.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_ESCAPED,this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===T.SOLIDUS?this.state=w.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:ao(t)?(this._emitChars("<"),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){ao(t)?(this.state=w.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(dn.SCRIPT,!1)&&q1(this.preprocessor.peek(dn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<dn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case T.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case T.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case T.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case T.NULL:{this._err($.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case T.HYPHEN_MINUS:{this._emitChars("-");break}case T.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case T.GREATER_THAN_SIGN:{this.state=w.SCRIPT_DATA,this._emitChars(">");break}case T.NULL:{this._err($.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(at);break}case T.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===T.SOLIDUS?(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(dn.SCRIPT,!1)&&q1(this.preprocessor.peek(dn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<dn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=w.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.SOLIDUS:case T.GREATER_THAN_SIGN:case T.EOF:{this.state=w.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case T.EQUALS_SIGN:{this._err($.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=w.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=w.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:case T.SOLIDUS:case T.GREATER_THAN_SIGN:case T.EOF:{this._leaveAttrName(),this.state=w.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case T.EQUALS_SIGN:{this._leaveAttrName(),this.state=w.BEFORE_ATTRIBUTE_VALUE;break}case T.QUOTATION_MARK:case T.APOSTROPHE:case T.LESS_THAN_SIGN:{this._err($.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case T.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.name+=at;break}default:this.currentAttr.name+=String.fromCodePoint(Rs(t)?fl(t):t)}}_stateAfterAttributeName(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.SOLIDUS:{this.state=w.SELF_CLOSING_START_TAG;break}case T.EQUALS_SIGN:{this.state=w.BEFORE_ATTRIBUTE_VALUE;break}case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentTagToken();break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=w.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.QUOTATION_MARK:{this.state=w.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case T.APOSTROPHE:{this.state=w.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case T.GREATER_THAN_SIGN:{this._err($.missingAttributeValue),this.state=w.DATA,this.emitCurrentTagToken();break}default:this.state=w.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case T.QUOTATION_MARK:{this.state=w.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case T.AMPERSAND:{this._startCharacterReference();break}case T.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=at;break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case T.APOSTROPHE:{this.state=w.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case T.AMPERSAND:{this._startCharacterReference();break}case T.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=at;break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this._leaveAttrValue(),this.state=w.BEFORE_ATTRIBUTE_NAME;break}case T.AMPERSAND:{this._startCharacterReference();break}case T.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=w.DATA,this.emitCurrentTagToken();break}case T.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=at;break}case T.QUOTATION_MARK:case T.APOSTROPHE:case T.LESS_THAN_SIGN:case T.EQUALS_SIGN:case T.GRAVE_ACCENT:{this._err($.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this._leaveAttrValue(),this.state=w.BEFORE_ATTRIBUTE_NAME;break}case T.SOLIDUS:{this._leaveAttrValue(),this.state=w.SELF_CLOSING_START_TAG;break}case T.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=w.DATA,this.emitCurrentTagToken();break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._err($.missingWhitespaceBetweenAttributes),this.state=w.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case T.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=w.DATA,this.emitCurrentTagToken();break}case T.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._err($.unexpectedSolidusInTag),this.state=w.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentComment(n);break}case T.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case T.NULL:{this._err($.unexpectedNullCharacter),n.data+=at;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(dn.DASH_DASH,!0)?(this._createCommentToken(dn.DASH_DASH.length+1),this.state=w.COMMENT_START):this._consumeSequenceIfMatch(dn.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(dn.DOCTYPE.length+1),this.state=w.DOCTYPE):this._consumeSequenceIfMatch(dn.CDATA_START,!0)?this.inForeignNode?this.state=w.CDATA_SECTION:(this._err($.cdataInHtmlContent),this._createCommentToken(dn.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=w.BOGUS_COMMENT):this._ensureHibernation()||(this._err($.incorrectlyOpenedComment),this._createCommentToken(2),this.state=w.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case T.HYPHEN_MINUS:{this.state=w.COMMENT_START_DASH;break}case T.GREATER_THAN_SIGN:{this._err($.abruptClosingOfEmptyComment),this.state=w.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=w.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case T.HYPHEN_MINUS:{this.state=w.COMMENT_END;break}case T.GREATER_THAN_SIGN:{this._err($.abruptClosingOfEmptyComment),this.state=w.DATA,this.emitCurrentComment(n);break}case T.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=w.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case T.HYPHEN_MINUS:{this.state=w.COMMENT_END_DASH;break}case T.LESS_THAN_SIGN:{n.data+="<",this.state=w.COMMENT_LESS_THAN_SIGN;break}case T.NULL:{this._err($.unexpectedNullCharacter),n.data+=at;break}case T.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case T.EXCLAMATION_MARK:{n.data+="!",this.state=w.COMMENT_LESS_THAN_SIGN_BANG;break}case T.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=w.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===T.HYPHEN_MINUS?this.state=w.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=w.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===T.HYPHEN_MINUS?this.state=w.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=w.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==T.GREATER_THAN_SIGN&&t!==T.EOF&&this._err($.nestedComment),this.state=w.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case T.HYPHEN_MINUS:{this.state=w.COMMENT_END;break}case T.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=w.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentComment(n);break}case T.EXCLAMATION_MARK:{this.state=w.COMMENT_END_BANG;break}case T.HYPHEN_MINUS:{n.data+="-";break}case T.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=w.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case T.HYPHEN_MINUS:{n.data+="--!",this.state=w.COMMENT_END_DASH;break}case T.GREATER_THAN_SIGN:{this._err($.incorrectlyClosedComment),this.state=w.DATA,this.emitCurrentComment(n);break}case T.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=w.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_NAME;break}case T.GREATER_THAN_SIGN:{this.state=w.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case T.EOF:{this._err($.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingWhitespaceBeforeDoctypeName),this.state=w.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Rs(t))this._createDoctypeToken(String.fromCharCode(fl(t))),this.state=w.DOCTYPE_NAME;else switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.NULL:{this._err($.unexpectedNullCharacter),this._createDoctypeToken(at),this.state=w.DOCTYPE_NAME;break}case T.GREATER_THAN_SIGN:{this._err($.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=w.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.AFTER_DOCTYPE_NAME;break}case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.NULL:{this._err($.unexpectedNullCharacter),n.name+=at;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Rs(t)?fl(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(dn.PUBLIC,!1)?this.state=w.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(dn.SYSTEM,!1)?this.state=w.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err($.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case T.QUOTATION_MARK:{this._err($.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{this._err($.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case T.GREATER_THAN_SIGN:{this._err($.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.QUOTATION_MARK:{n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case T.GREATER_THAN_SIGN:{this._err($.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case T.QUOTATION_MARK:{this.state=w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case T.NULL:{this._err($.unexpectedNullCharacter),n.publicId+=at;break}case T.GREATER_THAN_SIGN:{this._err($.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case T.APOSTROPHE:{this.state=w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case T.NULL:{this._err($.unexpectedNullCharacter),n.publicId+=at;break}case T.GREATER_THAN_SIGN:{this._err($.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case T.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.QUOTATION_MARK:{this._err($.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{this._err($.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.QUOTATION_MARK:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case T.QUOTATION_MARK:{this._err($.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{this._err($.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case T.GREATER_THAN_SIGN:{this._err($.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.QUOTATION_MARK:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case T.APOSTROPHE:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case T.GREATER_THAN_SIGN:{this._err($.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case T.QUOTATION_MARK:{this.state=w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case T.NULL:{this._err($.unexpectedNullCharacter),n.systemId+=at;break}case T.GREATER_THAN_SIGN:{this._err($.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case T.APOSTROPHE:{this.state=w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case T.NULL:{this._err($.unexpectedNullCharacter),n.systemId+=at;break}case T.GREATER_THAN_SIGN:{this._err($.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case T.SPACE:case T.LINE_FEED:case T.TABULATION:case T.FORM_FEED:break;case T.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case T.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case T.NULL:{this._err($.unexpectedNullCharacter);break}case T.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case T.RIGHT_SQUARE_BRACKET:{this.state=w.CDATA_SECTION_BRACKET;break}case T.EOF:{this._err($.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===T.RIGHT_SQUARE_BRACKET?this.state=w.CDATA_SECTION_END:(this._emitChars("]"),this.state=w.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case T.GREATER_THAN_SIGN:{this.state=w.DATA;break}case T.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=w.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(T.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&W1(this.preprocessor.peek(1))?w.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){W1(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===T.SEMICOLON&&this._err($.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const kT=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),G1=new Set([...kT,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),Sc=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),KP=new Set([...Sc,m.OL,m.UL]),QP=new Set([...Sc,m.BUTTON]),Y1=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),K1=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),XP=new Set([m.TR,m.TEMPLATE,m.HTML]),ZP=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),JP=new Set([m.TABLE,m.TEMPLATE,m.HTML]),e5=new Set([m.TD,m.TH]);class t5{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=m.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===m.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const o=this._indexOf(t)+1;this.items.splice(o,0,n),this.tagIDs.splice(o,0,r),this.stackTop++,o===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,o===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==Q.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Nh,Q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(e5,Q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(JP,Q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(ZP,Q.HTML)}clearBackToTableRowContext(){this.clearBackTo(XP,Q.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===m.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===m.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const o=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case Q.HTML:{if(o===t)return!0;if(n.has(o))return!1;break}case Q.SVG:{if(K1.has(o))return!1;break}case Q.MATHML:{if(Y1.has(o))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Sc)}hasInListItemScope(t){return this.hasInDynamicScope(t,KP)}hasInButtonScope(t){return this.hasInDynamicScope(t,QP)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Q.HTML:{if(Nh.has(n))return!0;if(Sc.has(n))return!1;break}case Q.SVG:{if(K1.has(n))return!1;break}case Q.MATHML:{if(Y1.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Q.HTML)switch(this.tagIDs[n]){case t:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Q.HTML)switch(this.tagIDs[t]){case m.TBODY:case m.THEAD:case m.TFOOT:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Q.HTML)switch(this.tagIDs[n]){case t:return!0;case m.OPTION:case m.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&kT.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&G1.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&G1.has(this.currentTagId);)this.pop()}}const Kd=3;var pr;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(pr||(pr={}));const Q1={type:pr.Marker};class n5{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],o=n.length,i=this.treeAdapter.getTagName(t),s=this.treeAdapter.getNamespaceURI(t);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===pr.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===i&&this.treeAdapter.getNamespaceURI(c)===s){const u=this.treeAdapter.getAttrList(c);u.length===o&&r.push({idx:a,attrs:u})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<Kd)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<Kd)return;const o=new Map(n.map(s=>[s.name,s.value]));let i=0;for(let s=0;s<r.length;s++){const a=r[s];a.attrs.every(l=>o.get(l.name)===l.value)&&(i+=1,i>=Kd&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(Q1)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:pr.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:pr.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Q1);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===pr.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===pr.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===pr.Element&&n.element===t)}}const lo={createDocument(){return{nodeName:"#document",mode:Hn.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const o=e.childNodes.find(i=>i.nodeName==="#documentType");if(o)o.name=t,o.publicId=n,o.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};lo.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(lo.isTextNode(n)){n.value+=t;return}}lo.appendChild(e,lo.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&lo.isTextNode(r)?r.value+=t:lo.insertBefore(e,lo.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},TT="html",r5="about:legacy-compat",o5="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",wT=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],i5=[...wT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],s5=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ST=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],a5=[...ST,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function X1(e,t){return t.some(n=>e.startsWith(n))}function l5(e){return e.name===TT&&e.publicId===null&&(e.systemId===null||e.systemId===r5)}function c5(e){if(e.name!==TT)return Hn.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===o5)return Hn.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),s5.has(n))return Hn.QUIRKS;let r=t===null?i5:wT;if(X1(n,r))return Hn.QUIRKS;if(r=t===null?ST:a5,X1(n,r))return Hn.LIMITED_QUIRKS}return Hn.NO_QUIRKS}const Z1={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},u5="definitionurl",d5="definitionURL",f5=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),h5=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Q.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Q.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Q.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Q.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Q.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Q.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Q.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Q.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Q.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Q.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Q.XMLNS}]]),p5=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),m5=new Set([m.B,m.BIG,m.BLOCKQUOTE,m.BODY,m.BR,m.CENTER,m.CODE,m.DD,m.DIV,m.DL,m.DT,m.EM,m.EMBED,m.H1,m.H2,m.H3,m.H4,m.H5,m.H6,m.HEAD,m.HR,m.I,m.IMG,m.LI,m.LISTING,m.MENU,m.META,m.NOBR,m.OL,m.P,m.PRE,m.RUBY,m.S,m.SMALL,m.SPAN,m.STRONG,m.STRIKE,m.SUB,m.SUP,m.TABLE,m.TT,m.U,m.UL,m.VAR]);function g5(e){const t=e.tagID;return t===m.FONT&&e.attrs.some(({name:r})=>r===oi.COLOR||r===oi.SIZE||r===oi.FACE)||m5.has(t)}function vT(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===u5){e.attrs[t].name=d5;break}}function AT(e){for(let t=0;t<e.attrs.length;t++){const n=f5.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function pm(e){for(let t=0;t<e.attrs.length;t++){const n=h5.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function b5(e){const t=p5.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=qu(e.tagName))}function y5(e,t){return t===Q.MATHML&&(e===m.MI||e===m.MO||e===m.MN||e===m.MS||e===m.MTEXT)}function E5(e,t,n){if(t===Q.MATHML&&e===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===oi.ENCODING){const o=n[r].value.toLowerCase();return o===Z1.TEXT_HTML||o===Z1.APPLICATION_XML}}return t===Q.SVG&&(e===m.FOREIGN_OBJECT||e===m.DESC||e===m.TITLE)}function x5(e,t,n,r){return(!r||r===Q.HTML)&&E5(e,t,n)||(!r||r===Q.MATHML)&&y5(e,t)}const C5="hidden",k5=8,T5=3;var I;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(I||(I={}));const w5={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},NT=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),J1={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:lo,onParseError:null};class IT{constructor(t,n,r=null,o=null){this.fragmentContext=r,this.scriptHandler=o,this.currentToken=null,this.stopped=!1,this.insertionMode=I.INITIAL,this.originalInsertionMode=I.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...J1,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new YP(this.options,this),this.activeFormattingElements=new n5(this.treeAdapter),this.fragmentContextID=r?qu(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new t5(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...J1,...n};t??(t=r.treeAdapter.createElement(B.TEMPLATE,Q.HTML,[]));const o=r.treeAdapter.createElement("documentmock",Q.HTML,[]),i=new this(r,o,t);return i.fragmentContextID===m.TEMPLATE&&i.tmplInsertionModeStack.unshift(I.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var o;if(!this.onParseError)return;const i=(o=t.location)!==null&&o!==void 0?o:w5,s={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(s)}onItemPush(t,n,r){var o,i;(i=(o=this.treeAdapter).onItemPush)===null||i===void 0||i.call(o,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,o;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(o=(r=this.treeAdapter).onItemPop)===null||o===void 0||o.call(r,t,this.openElements.current),n){let i,s;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,s=this.fragmentContextID):{current:i,currentTagId:s}=this.openElements,this._setContextModes(i,s)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Q.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,Q.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=I.TEXT}switchToPlaintextParsing(){this.insertionMode=I.TEXT,this.originalInsertionMode=I.IN_BODY,this.tokenizer.state=yn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===B.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Q.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=yn.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=yn.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=yn.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=yn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",o=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,o),t.location){const s=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));s&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,Q.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,Q.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(B.HTML,Q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,m.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const o=this.treeAdapter.getChildNodes(n),i=r?o.lastIndexOf(r):o.length,s=o[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:l,endCol:c,endOffset:u}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:l,endCol:c,endOffset:u})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,o=this.treeAdapter.getTagName(t),i=n.type===He.END_TAG&&o===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===m.SVG&&this.treeAdapter.getTagName(n)===B.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===Q.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===m.MGLYPH||t.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,Q.HTML)}_processToken(t){switch(t.type){case He.CHARACTER:{this.onCharacter(t);break}case He.NULL_CHARACTER:{this.onNullCharacter(t);break}case He.COMMENT:{this.onComment(t);break}case He.DOCTYPE:{this.onDoctype(t);break}case He.START_TAG:{this._processStartTag(t);break}case He.END_TAG:{this.onEndTag(t);break}case He.EOF:{this.onEof(t);break}case He.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const o=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return x5(t,o,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(o=>o.type===pr.Marker||this.openElements.contains(o.element)),r=n===-1?t-1:n-1;for(let o=r;o>=0;o--){const i=this.activeFormattingElements.entries[o];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=I.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(m.P),this.openElements.popUntilTagNamePopped(m.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case m.TR:{this.insertionMode=I.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=I.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=I.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=I.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=I.IN_TABLE;return}case m.BODY:{this.insertionMode=I.IN_BODY;return}case m.FRAMESET:{this.insertionMode=I.IN_FRAMESET;return}case m.SELECT:{this._resetInsertionModeForSelect(t);return}case m.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case m.HTML:{this.insertionMode=this.headElement?I.AFTER_HEAD:I.BEFORE_HEAD;return}case m.TD:case m.TH:{if(t>0){this.insertionMode=I.IN_CELL;return}break}case m.HEAD:{if(t>0){this.insertionMode=I.IN_HEAD;return}break}}this.insertionMode=I.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===m.TEMPLATE)break;if(r===m.TABLE){this.insertionMode=I.IN_SELECT_IN_TABLE;return}}this.insertionMode=I.IN_SELECT}_isElementCausesFosterParenting(t){return NT.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case m.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===Q.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case m.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return zP[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){e8(this,t);return}switch(this.insertionMode){case I.INITIAL:{Es(this,t);break}case I.BEFORE_HTML:{Ws(this,t);break}case I.BEFORE_HEAD:{qs(this,t);break}case I.IN_HEAD:{Gs(this,t);break}case I.IN_HEAD_NO_SCRIPT:{Ys(this,t);break}case I.AFTER_HEAD:{Ks(this,t);break}case I.IN_BODY:case I.IN_CAPTION:case I.IN_CELL:case I.IN_TEMPLATE:{_T(this,t);break}case I.TEXT:case I.IN_SELECT:case I.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case I.IN_TABLE:case I.IN_TABLE_BODY:case I.IN_ROW:{Qd(this,t);break}case I.IN_TABLE_TEXT:{BT(this,t);break}case I.IN_COLUMN_GROUP:{vc(this,t);break}case I.AFTER_BODY:{Ac(this,t);break}case I.AFTER_AFTER_BODY:{Ul(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){JB(this,t);return}switch(this.insertionMode){case I.INITIAL:{Es(this,t);break}case I.BEFORE_HTML:{Ws(this,t);break}case I.BEFORE_HEAD:{qs(this,t);break}case I.IN_HEAD:{Gs(this,t);break}case I.IN_HEAD_NO_SCRIPT:{Ys(this,t);break}case I.AFTER_HEAD:{Ks(this,t);break}case I.TEXT:{this._insertCharacters(t);break}case I.IN_TABLE:case I.IN_TABLE_BODY:case I.IN_ROW:{Qd(this,t);break}case I.IN_COLUMN_GROUP:{vc(this,t);break}case I.AFTER_BODY:{Ac(this,t);break}case I.AFTER_AFTER_BODY:{Ul(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Ih(this,t);return}switch(this.insertionMode){case I.INITIAL:case I.BEFORE_HTML:case I.BEFORE_HEAD:case I.IN_HEAD:case I.IN_HEAD_NO_SCRIPT:case I.AFTER_HEAD:case I.IN_BODY:case I.IN_TABLE:case I.IN_CAPTION:case I.IN_COLUMN_GROUP:case I.IN_TABLE_BODY:case I.IN_ROW:case I.IN_CELL:case I.IN_SELECT:case I.IN_SELECT_IN_TABLE:case I.IN_TEMPLATE:case I.IN_FRAMESET:case I.AFTER_FRAMESET:{Ih(this,t);break}case I.IN_TABLE_TEXT:{xs(this,t);break}case I.AFTER_BODY:{_5(this,t);break}case I.AFTER_AFTER_BODY:case I.AFTER_AFTER_FRAMESET:{O5(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case I.INITIAL:{R5(this,t);break}case I.BEFORE_HEAD:case I.IN_HEAD:case I.IN_HEAD_NO_SCRIPT:case I.AFTER_HEAD:{this._err(t,$.misplacedDoctype);break}case I.IN_TABLE_TEXT:{xs(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,$.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?t8(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case I.INITIAL:{Es(this,t);break}case I.BEFORE_HTML:{L5(this,t);break}case I.BEFORE_HEAD:{P5(this,t);break}case I.IN_HEAD:{ar(this,t);break}case I.IN_HEAD_NO_SCRIPT:{H5(this,t);break}case I.AFTER_HEAD:{V5(this,t);break}case I.IN_BODY:{en(this,t);break}case I.IN_TABLE:{ls(this,t);break}case I.IN_TABLE_TEXT:{xs(this,t);break}case I.IN_CAPTION:{BB(this,t);break}case I.IN_COLUMN_GROUP:{bm(this,t);break}case I.IN_TABLE_BODY:{Ku(this,t);break}case I.IN_ROW:{Qu(this,t);break}case I.IN_CELL:{UB(this,t);break}case I.IN_SELECT:{UT(this,t);break}case I.IN_SELECT_IN_TABLE:{$B(this,t);break}case I.IN_TEMPLATE:{zB(this,t);break}case I.AFTER_BODY:{qB(this,t);break}case I.IN_FRAMESET:{GB(this,t);break}case I.AFTER_FRAMESET:{KB(this,t);break}case I.AFTER_AFTER_BODY:{XB(this,t);break}case I.AFTER_AFTER_FRAMESET:{ZB(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?n8(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case I.INITIAL:{Es(this,t);break}case I.BEFORE_HTML:{D5(this,t);break}case I.BEFORE_HEAD:{B5(this,t);break}case I.IN_HEAD:{F5(this,t);break}case I.IN_HEAD_NO_SCRIPT:{U5(this,t);break}case I.AFTER_HEAD:{$5(this,t);break}case I.IN_BODY:{Yu(this,t);break}case I.TEXT:{AB(this,t);break}case I.IN_TABLE:{Sa(this,t);break}case I.IN_TABLE_TEXT:{xs(this,t);break}case I.IN_CAPTION:{FB(this,t);break}case I.IN_COLUMN_GROUP:{HB(this,t);break}case I.IN_TABLE_BODY:{Mh(this,t);break}case I.IN_ROW:{HT(this,t);break}case I.IN_CELL:{VB(this,t);break}case I.IN_SELECT:{VT(this,t);break}case I.IN_SELECT_IN_TABLE:{jB(this,t);break}case I.IN_TEMPLATE:{WB(this,t);break}case I.AFTER_BODY:{jT(this,t);break}case I.IN_FRAMESET:{YB(this,t);break}case I.AFTER_FRAMESET:{QB(this,t);break}case I.AFTER_AFTER_BODY:{Ul(this,t);break}}}onEof(t){switch(this.insertionMode){case I.INITIAL:{Es(this,t);break}case I.BEFORE_HTML:{Ws(this,t);break}case I.BEFORE_HEAD:{qs(this,t);break}case I.IN_HEAD:{Gs(this,t);break}case I.IN_HEAD_NO_SCRIPT:{Ys(this,t);break}case I.AFTER_HEAD:{Ks(this,t);break}case I.IN_BODY:case I.IN_TABLE:case I.IN_CAPTION:case I.IN_COLUMN_GROUP:case I.IN_TABLE_BODY:case I.IN_ROW:case I.IN_CELL:case I.IN_SELECT:case I.IN_SELECT_IN_TABLE:{DT(this,t);break}case I.TEXT:{NB(this,t);break}case I.IN_TABLE_TEXT:{xs(this,t);break}case I.IN_TEMPLATE:{$T(this,t);break}case I.AFTER_BODY:case I.IN_FRAMESET:case I.AFTER_FRAMESET:case I.AFTER_AFTER_BODY:case I.AFTER_AFTER_FRAMESET:{gm(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===T.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case I.IN_HEAD:case I.IN_HEAD_NO_SCRIPT:case I.AFTER_HEAD:case I.TEXT:case I.IN_COLUMN_GROUP:case I.IN_SELECT:case I.IN_SELECT_IN_TABLE:case I.IN_FRAMESET:case I.AFTER_FRAMESET:{this._insertCharacters(t);break}case I.IN_BODY:case I.IN_CAPTION:case I.IN_CELL:case I.IN_TEMPLATE:case I.AFTER_BODY:case I.AFTER_AFTER_BODY:case I.AFTER_AFTER_FRAMESET:{MT(this,t);break}case I.IN_TABLE:case I.IN_TABLE_BODY:case I.IN_ROW:{Qd(this,t);break}case I.IN_TABLE_TEXT:{PT(this,t);break}}}}function S5(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):LT(e,t),n}function v5(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const o=e.openElements.items[r];if(o===t.element)break;e._isSpecialElement(o,e.openElements.tagIDs[r])&&(n=o)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function A5(e,t,n){let r=t,o=e.openElements.getCommonAncestor(t);for(let i=0,s=o;s!==n;i++,s=o){o=e.openElements.getCommonAncestor(s);const a=e.activeFormattingElements.getElementEntry(s),l=a&&i>=T5;!a||l?(l&&e.activeFormattingElements.removeEntry(a),e.openElements.remove(s)):(s=N5(e,a),r===t&&(e.activeFormattingElements.bookmark=a),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(s,r),r=s)}return r}function N5(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function I5(e,t,n){const r=e.treeAdapter.getTagName(t),o=qu(r);if(e._isElementCausesFosterParenting(o))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);o===m.TEMPLATE&&i===Q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function M5(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:o}=n,i=e.treeAdapter.createElement(o.tagName,r,o.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,o),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,o.tagID)}function mm(e,t){for(let n=0;n<k5;n++){const r=S5(e,t);if(!r)break;const o=v5(e,r);if(!o)break;e.activeFormattingElements.bookmark=r;const i=A5(e,o,r.element),s=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(i),s&&I5(e,s,i),M5(e,o,r)}}function Ih(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function _5(e,t){e._appendCommentNode(t,e.openElements.items[0])}function O5(e,t){e._appendCommentNode(t,e.document)}function gm(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],o=e.treeAdapter.getNodeSourceCodeLocation(r);if(o&&!o.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],s=e.treeAdapter.getNodeSourceCodeLocation(i);s&&!s.endTag&&e._setEndLocation(i,t)}}}}function R5(e,t){e._setDocumentType(t);const n=t.forceQuirks?Hn.QUIRKS:c5(t);l5(t)||e._err(t,$.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=I.BEFORE_HTML}function Es(e,t){e._err(t,$.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Hn.QUIRKS),e.insertionMode=I.BEFORE_HTML,e._processToken(t)}function L5(e,t){t.tagID===m.HTML?(e._insertElement(t,Q.HTML),e.insertionMode=I.BEFORE_HEAD):Ws(e,t)}function D5(e,t){const n=t.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&Ws(e,t)}function Ws(e,t){e._insertFakeRootElement(),e.insertionMode=I.BEFORE_HEAD,e._processToken(t)}function P5(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.HEAD:{e._insertElement(t,Q.HTML),e.headElement=e.openElements.current,e.insertionMode=I.IN_HEAD;break}default:qs(e,t)}}function B5(e,t){const n=t.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?qs(e,t):e._err(t,$.endTagWithoutMatchingOpenElement)}function qs(e,t){e._insertFakeElement(B.HEAD,m.HEAD),e.headElement=e.openElements.current,e.insertionMode=I.IN_HEAD,e._processToken(t)}function ar(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{e._appendElement(t,Q.HTML),t.ackSelfClosing=!0;break}case m.TITLE:{e._switchToTextParsing(t,yn.RCDATA);break}case m.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,yn.RAWTEXT):(e._insertElement(t,Q.HTML),e.insertionMode=I.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{e._switchToTextParsing(t,yn.RAWTEXT);break}case m.SCRIPT:{e._switchToTextParsing(t,yn.SCRIPT_DATA);break}case m.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=I.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(I.IN_TEMPLATE);break}case m.HEAD:{e._err(t,$.misplacedStartTagForHeadElement);break}default:Gs(e,t)}}function F5(e,t){switch(t.tagID){case m.HEAD:{e.openElements.pop(),e.insertionMode=I.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{Gs(e,t);break}case m.TEMPLATE:{ki(e,t);break}default:e._err(t,$.endTagWithoutMatchingOpenElement)}}function ki(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==m.TEMPLATE&&e._err(t,$.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(m.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,$.endTagWithoutMatchingOpenElement)}function Gs(e,t){e.openElements.pop(),e.insertionMode=I.AFTER_HEAD,e._processToken(t)}function H5(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{ar(e,t);break}case m.NOSCRIPT:{e._err(t,$.nestedNoscriptInHead);break}default:Ys(e,t)}}function U5(e,t){switch(t.tagID){case m.NOSCRIPT:{e.openElements.pop(),e.insertionMode=I.IN_HEAD;break}case m.BR:{Ys(e,t);break}default:e._err(t,$.endTagWithoutMatchingOpenElement)}}function Ys(e,t){const n=t.type===He.EOF?$.openElementsLeftAfterEof:$.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=I.IN_HEAD,e._processToken(t)}function V5(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.BODY:{e._insertElement(t,Q.HTML),e.framesetOk=!1,e.insertionMode=I.IN_BODY;break}case m.FRAMESET:{e._insertElement(t,Q.HTML),e.insertionMode=I.IN_FRAMESET;break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{e._err(t,$.abandonedHeadElementChild),e.openElements.push(e.headElement,m.HEAD),ar(e,t),e.openElements.remove(e.headElement);break}case m.HEAD:{e._err(t,$.misplacedStartTagForHeadElement);break}default:Ks(e,t)}}function $5(e,t){switch(t.tagID){case m.BODY:case m.HTML:case m.BR:{Ks(e,t);break}case m.TEMPLATE:{ki(e,t);break}default:e._err(t,$.endTagWithoutMatchingOpenElement)}}function Ks(e,t){e._insertFakeElement(B.BODY,m.BODY),e.insertionMode=I.IN_BODY,Gu(e,t)}function Gu(e,t){switch(t.type){case He.CHARACTER:{_T(e,t);break}case He.WHITESPACE_CHARACTER:{MT(e,t);break}case He.COMMENT:{Ih(e,t);break}case He.START_TAG:{en(e,t);break}case He.END_TAG:{Yu(e,t);break}case He.EOF:{DT(e,t);break}}}function MT(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function _T(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function j5(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function z5(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function W5(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_FRAMESET)}function q5(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML)}function G5(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Nh.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Q.HTML)}function Y5(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function K5(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML),n||(e.formElement=e.openElements.current))}function Q5(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const o=e.openElements.tagIDs[r];if(n===m.LI&&o===m.LI||(n===m.DD||n===m.DT)&&(o===m.DD||o===m.DT)){e.openElements.generateImpliedEndTagsWithExclusion(o),e.openElements.popUntilTagNamePopped(o);break}if(o!==m.ADDRESS&&o!==m.DIV&&o!==m.P&&e._isSpecialElement(e.openElements.items[r],o))break}e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML)}function X5(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML),e.tokenizer.state=yn.PLAINTEXT}function Z5(e,t){e.openElements.hasInScope(m.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(m.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML),e.framesetOk=!1}function J5(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(B.A);n&&(mm(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function eB(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function tB(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(m.NOBR)&&(mm(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function nB(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function rB(e,t){e.treeAdapter.getDocumentMode(e.document)!==Hn.QUIRKS&&e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._insertElement(t,Q.HTML),e.framesetOk=!1,e.insertionMode=I.IN_TABLE}function OT(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function RT(e){const t=xT(e,oi.TYPE);return t!=null&&t.toLowerCase()===C5}function oB(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Q.HTML),RT(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function iB(e,t){e._appendElement(t,Q.HTML),t.ackSelfClosing=!0}function sB(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._appendElement(t,Q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function aB(e,t){t.tagName=B.IMG,t.tagID=m.IMG,OT(e,t)}function lB(e,t){e._insertElement(t,Q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=yn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=I.TEXT}function cB(e,t){e.openElements.hasInButtonScope(m.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,yn.RAWTEXT)}function uB(e,t){e.framesetOk=!1,e._switchToTextParsing(t,yn.RAWTEXT)}function eb(e,t){e._switchToTextParsing(t,yn.RAWTEXT)}function dB(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===I.IN_TABLE||e.insertionMode===I.IN_CAPTION||e.insertionMode===I.IN_TABLE_BODY||e.insertionMode===I.IN_ROW||e.insertionMode===I.IN_CELL?I.IN_SELECT_IN_TABLE:I.IN_SELECT}function fB(e,t){e.openElements.currentTagId===m.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML)}function hB(e,t){e.openElements.hasInScope(m.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Q.HTML)}function pB(e,t){e.openElements.hasInScope(m.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(m.RTC),e._insertElement(t,Q.HTML)}function mB(e,t){e._reconstructActiveFormattingElements(),vT(t),pm(t),t.selfClosing?e._appendElement(t,Q.MATHML):e._insertElement(t,Q.MATHML),t.ackSelfClosing=!0}function gB(e,t){e._reconstructActiveFormattingElements(),AT(t),pm(t),t.selfClosing?e._appendElement(t,Q.SVG):e._insertElement(t,Q.SVG),t.ackSelfClosing=!0}function tb(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Q.HTML)}function en(e,t){switch(t.tagID){case m.I:case m.S:case m.B:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.SMALL:case m.STRIKE:case m.STRONG:{eB(e,t);break}case m.A:{J5(e,t);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{G5(e,t);break}case m.P:case m.DL:case m.OL:case m.UL:case m.DIV:case m.DIR:case m.NAV:case m.MAIN:case m.MENU:case m.ASIDE:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.DETAILS:case m.ADDRESS:case m.ARTICLE:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{q5(e,t);break}case m.LI:case m.DD:case m.DT:{Q5(e,t);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{OT(e,t);break}case m.HR:{sB(e,t);break}case m.RB:case m.RTC:{hB(e,t);break}case m.RT:case m.RP:{pB(e,t);break}case m.PRE:case m.LISTING:{Y5(e,t);break}case m.XMP:{cB(e,t);break}case m.SVG:{gB(e,t);break}case m.HTML:{j5(e,t);break}case m.BASE:case m.LINK:case m.META:case m.STYLE:case m.TITLE:case m.SCRIPT:case m.BGSOUND:case m.BASEFONT:case m.TEMPLATE:{ar(e,t);break}case m.BODY:{z5(e,t);break}case m.FORM:{K5(e,t);break}case m.NOBR:{tB(e,t);break}case m.MATH:{mB(e,t);break}case m.TABLE:{rB(e,t);break}case m.INPUT:{oB(e,t);break}case m.PARAM:case m.TRACK:case m.SOURCE:{iB(e,t);break}case m.IMAGE:{aB(e,t);break}case m.BUTTON:{Z5(e,t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{nB(e,t);break}case m.IFRAME:{uB(e,t);break}case m.SELECT:{dB(e,t);break}case m.OPTION:case m.OPTGROUP:{fB(e,t);break}case m.NOEMBED:case m.NOFRAMES:{eb(e,t);break}case m.FRAMESET:{W5(e,t);break}case m.TEXTAREA:{lB(e,t);break}case m.NOSCRIPT:{e.options.scriptingEnabled?eb(e,t):tb(e,t);break}case m.PLAINTEXT:{X5(e,t);break}case m.COL:case m.TH:case m.TD:case m.TR:case m.HEAD:case m.FRAME:case m.TBODY:case m.TFOOT:case m.THEAD:case m.CAPTION:case m.COLGROUP:break;default:tb(e,t)}}function bB(e,t){if(e.openElements.hasInScope(m.BODY)&&(e.insertionMode=I.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function yB(e,t){e.openElements.hasInScope(m.BODY)&&(e.insertionMode=I.AFTER_BODY,jT(e,t))}function EB(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function xB(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(m.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(m.FORM):n&&e.openElements.remove(n))}function CB(e){e.openElements.hasInButtonScope(m.P)||e._insertFakeElement(B.P,m.P),e._closePElement()}function kB(e){e.openElements.hasInListItemScope(m.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(m.LI),e.openElements.popUntilTagNamePopped(m.LI))}function TB(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function wB(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function SB(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function vB(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(B.BR,m.BR),e.openElements.pop(),e.framesetOk=!1}function LT(e,t){const n=t.tagName,r=t.tagID;for(let o=e.openElements.stackTop;o>0;o--){const i=e.openElements.items[o],s=e.openElements.tagIDs[o];if(r===s&&(r!==m.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=o&&e.openElements.shortenToLength(o);break}if(e._isSpecialElement(i,s))break}}function Yu(e,t){switch(t.tagID){case m.A:case m.B:case m.I:case m.S:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.NOBR:case m.SMALL:case m.STRIKE:case m.STRONG:{mm(e,t);break}case m.P:{CB(e);break}case m.DL:case m.UL:case m.OL:case m.DIR:case m.DIV:case m.NAV:case m.PRE:case m.MAIN:case m.MENU:case m.ASIDE:case m.BUTTON:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.ADDRESS:case m.ARTICLE:case m.DETAILS:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.LISTING:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{EB(e,t);break}case m.LI:{kB(e);break}case m.DD:case m.DT:{TB(e,t);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{wB(e);break}case m.BR:{vB(e);break}case m.BODY:{bB(e,t);break}case m.HTML:{yB(e,t);break}case m.FORM:{xB(e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{SB(e,t);break}case m.TEMPLATE:{ki(e,t);break}default:LT(e,t)}}function DT(e,t){e.tmplInsertionModeStack.length>0?$T(e,t):gm(e,t)}function AB(e,t){var n;t.tagID===m.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function NB(e,t){e._err(t,$.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Qd(e,t){if(e.openElements.currentTagId!==void 0&&NT.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=I.IN_TABLE_TEXT,t.type){case He.CHARACTER:{BT(e,t);break}case He.WHITESPACE_CHARACTER:{PT(e,t);break}}else Fa(e,t)}function IB(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_CAPTION}function MB(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_COLUMN_GROUP}function _B(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(B.COLGROUP,m.COLGROUP),e.insertionMode=I.IN_COLUMN_GROUP,bm(e,t)}function OB(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_TABLE_BODY}function RB(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(B.TBODY,m.TBODY),e.insertionMode=I.IN_TABLE_BODY,Ku(e,t)}function LB(e,t){e.openElements.hasInTableScope(m.TABLE)&&(e.openElements.popUntilTagNamePopped(m.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function DB(e,t){RT(t)?e._appendElement(t,Q.HTML):Fa(e,t),t.ackSelfClosing=!0}function PB(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function ls(e,t){switch(t.tagID){case m.TD:case m.TH:case m.TR:{RB(e,t);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{ar(e,t);break}case m.COL:{_B(e,t);break}case m.FORM:{PB(e,t);break}case m.TABLE:{LB(e,t);break}case m.TBODY:case m.TFOOT:case m.THEAD:{OB(e,t);break}case m.INPUT:{DB(e,t);break}case m.CAPTION:{IB(e,t);break}case m.COLGROUP:{MB(e,t);break}default:Fa(e,t)}}function Sa(e,t){switch(t.tagID){case m.TABLE:{e.openElements.hasInTableScope(m.TABLE)&&(e.openElements.popUntilTagNamePopped(m.TABLE),e._resetInsertionMode());break}case m.TEMPLATE:{ki(e,t);break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:Fa(e,t)}}function Fa(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Gu(e,t),e.fosterParentingEnabled=n}function PT(e,t){e.pendingCharacterTokens.push(t)}function BT(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function xs(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Fa(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const FT=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function BB(e,t){const n=t.tagID;FT.has(n)?e.openElements.hasInTableScope(m.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(m.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=I.IN_TABLE,ls(e,t)):en(e,t)}function FB(e,t){const n=t.tagID;switch(n){case m.CAPTION:case m.TABLE:{e.openElements.hasInTableScope(m.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(m.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=I.IN_TABLE,n===m.TABLE&&Sa(e,t));break}case m.BODY:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:Yu(e,t)}}function bm(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.COL:{e._appendElement(t,Q.HTML),t.ackSelfClosing=!0;break}case m.TEMPLATE:{ar(e,t);break}default:vc(e,t)}}function HB(e,t){switch(t.tagID){case m.COLGROUP:{e.openElements.currentTagId===m.COLGROUP&&(e.openElements.pop(),e.insertionMode=I.IN_TABLE);break}case m.TEMPLATE:{ki(e,t);break}case m.COL:break;default:vc(e,t)}}function vc(e,t){e.openElements.currentTagId===m.COLGROUP&&(e.openElements.pop(),e.insertionMode=I.IN_TABLE,e._processToken(t))}function Ku(e,t){switch(t.tagID){case m.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_ROW;break}case m.TH:case m.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(B.TR,m.TR),e.insertionMode=I.IN_ROW,Qu(e,t);break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE,ls(e,t));break}default:ls(e,t)}}function Mh(e,t){const n=t.tagID;switch(t.tagID){case m.TBODY:case m.TFOOT:case m.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE);break}case m.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE,Sa(e,t));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:case m.TR:break;default:Sa(e,t)}}function Qu(e,t){switch(t.tagID){case m.TH:case m.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,Q.HTML),e.insertionMode=I.IN_CELL,e.activeFormattingElements.insertMarker();break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{e.openElements.hasInTableScope(m.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE_BODY,Ku(e,t));break}default:ls(e,t)}}function HT(e,t){switch(t.tagID){case m.TR:{e.openElements.hasInTableScope(m.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE_BODY);break}case m.TABLE:{e.openElements.hasInTableScope(m.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE_BODY,Mh(e,t));break}case m.TBODY:case m.TFOOT:case m.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(m.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=I.IN_TABLE_BODY,Mh(e,t));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:break;default:Sa(e,t)}}function UB(e,t){const n=t.tagID;FT.has(n)?(e.openElements.hasInTableScope(m.TD)||e.openElements.hasInTableScope(m.TH))&&(e._closeTableCell(),Qu(e,t)):en(e,t)}function VB(e,t){const n=t.tagID;switch(n){case m.TD:case m.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=I.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),HT(e,t));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:Yu(e,t)}}function UT(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.OPTION:{e.openElements.currentTagId===m.OPTION&&e.openElements.pop(),e._insertElement(t,Q.HTML);break}case m.OPTGROUP:{e.openElements.currentTagId===m.OPTION&&e.openElements.pop(),e.openElements.currentTagId===m.OPTGROUP&&e.openElements.pop(),e._insertElement(t,Q.HTML);break}case m.HR:{e.openElements.currentTagId===m.OPTION&&e.openElements.pop(),e.openElements.currentTagId===m.OPTGROUP&&e.openElements.pop(),e._appendElement(t,Q.HTML),t.ackSelfClosing=!0;break}case m.INPUT:case m.KEYGEN:case m.TEXTAREA:case m.SELECT:{e.openElements.hasInSelectScope(m.SELECT)&&(e.openElements.popUntilTagNamePopped(m.SELECT),e._resetInsertionMode(),t.tagID!==m.SELECT&&e._processStartTag(t));break}case m.SCRIPT:case m.TEMPLATE:{ar(e,t);break}}}function VT(e,t){switch(t.tagID){case m.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===m.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===m.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===m.OPTGROUP&&e.openElements.pop();break}case m.OPTION:{e.openElements.currentTagId===m.OPTION&&e.openElements.pop();break}case m.SELECT:{e.openElements.hasInSelectScope(m.SELECT)&&(e.openElements.popUntilTagNamePopped(m.SELECT),e._resetInsertionMode());break}case m.TEMPLATE:{ki(e,t);break}}}function $B(e,t){const n=t.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?(e.openElements.popUntilTagNamePopped(m.SELECT),e._resetInsertionMode(),e._processStartTag(t)):UT(e,t)}function jB(e,t){const n=t.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(m.SELECT),e._resetInsertionMode(),e.onEndTag(t)):VT(e,t)}function zB(e,t){switch(t.tagID){case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{ar(e,t);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{e.tmplInsertionModeStack[0]=I.IN_TABLE,e.insertionMode=I.IN_TABLE,ls(e,t);break}case m.COL:{e.tmplInsertionModeStack[0]=I.IN_COLUMN_GROUP,e.insertionMode=I.IN_COLUMN_GROUP,bm(e,t);break}case m.TR:{e.tmplInsertionModeStack[0]=I.IN_TABLE_BODY,e.insertionMode=I.IN_TABLE_BODY,Ku(e,t);break}case m.TD:case m.TH:{e.tmplInsertionModeStack[0]=I.IN_ROW,e.insertionMode=I.IN_ROW,Qu(e,t);break}default:e.tmplInsertionModeStack[0]=I.IN_BODY,e.insertionMode=I.IN_BODY,en(e,t)}}function WB(e,t){t.tagID===m.TEMPLATE&&ki(e,t)}function $T(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(m.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):gm(e,t)}function qB(e,t){t.tagID===m.HTML?en(e,t):Ac(e,t)}function jT(e,t){var n;if(t.tagID===m.HTML){if(e.fragmentContext||(e.insertionMode=I.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===m.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Ac(e,t)}function Ac(e,t){e.insertionMode=I.IN_BODY,Gu(e,t)}function GB(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.FRAMESET:{e._insertElement(t,Q.HTML);break}case m.FRAME:{e._appendElement(t,Q.HTML),t.ackSelfClosing=!0;break}case m.NOFRAMES:{ar(e,t);break}}}function YB(e,t){t.tagID===m.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==m.FRAMESET&&(e.insertionMode=I.AFTER_FRAMESET))}function KB(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.NOFRAMES:{ar(e,t);break}}}function QB(e,t){t.tagID===m.HTML&&(e.insertionMode=I.AFTER_AFTER_FRAMESET)}function XB(e,t){t.tagID===m.HTML?en(e,t):Ul(e,t)}function Ul(e,t){e.insertionMode=I.IN_BODY,Gu(e,t)}function ZB(e,t){switch(t.tagID){case m.HTML:{en(e,t);break}case m.NOFRAMES:{ar(e,t);break}}}function JB(e,t){t.chars=at,e._insertCharacters(t)}function e8(e,t){e._insertCharacters(t),e.framesetOk=!1}function zT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function t8(e,t){if(g5(t))zT(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===Q.MATHML?vT(t):r===Q.SVG&&(b5(t),AT(t)),pm(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function n8(e,t){if(t.tagID===m.P||t.tagID===m.BR){zT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===Q.HTML){e._endTagOutsideForeignContent(t);break}const o=e.treeAdapter.getTagName(r);if(o.toLowerCase()===t.tagName){t.tagName=o,e.openElements.shortenToLength(n);break}}}B.AREA,B.BASE,B.BASEFONT,B.BGSOUND,B.BR,B.COL,B.EMBED,B.FRAME,B.HR,B.IMG,B.INPUT,B.KEYGEN,B.LINK,B.META,B.PARAM,B.SOURCE,B.TRACK,B.WBR;function r8(e,t){return IT.parse(e,t)}function o8(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);const r=IT.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}function Qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nb(e.position):"start"in e||"end"in e?nb(e):"line"in e||"column"in e?_h(e):""}function _h(e){return rb(e&&e.line)+":"+rb(e&&e.column)}function nb(e){return _h(e&&e.start)+"-"+_h(e&&e.end)}function rb(e){return e&&typeof e=="number"?e:1}class un extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=Qs(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}un.prototype.file="";un.prototype.name="";un.prototype.reason="";un.prototype.message="";un.prototype.stack="";un.prototype.column=void 0;un.prototype.line=void 0;un.prototype.ancestors=void 0;un.prototype.cause=void 0;un.prototype.fatal=void 0;un.prototype.place=void 0;un.prototype.ruleId=void 0;un.prototype.source=void 0;const ur={basename:i8,dirname:s8,extname:a8,join:l8,sep:"/"};function i8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ha(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function s8(e){if(Ha(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function a8(e){Ha(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function l8(...e){let t=-1,n;for(;++t<e.length;)Ha(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":c8(n)}function c8(e){Ha(e);const t=e.codePointAt(0)===47;let n=u8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function u8(e,t){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Ha(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const d8={cwd:f8};function f8(){return"/"}function Oh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function h8(e){if(typeof e=="string")e=new URL(e);else if(!Oh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return p8(e)}function p8(e){if(e.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 t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Xd=["history","path","basename","stem","extname","dirname"];class Rh{constructor(t){let n;t?Oh(t)?n={path:t}:typeof t=="string"||m8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":d8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Xd.length;){const i=Xd[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Xd.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ur.basename(this.path):void 0}set basename(t){Jd(t,"basename"),Zd(t,"basename"),this.path=ur.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ur.dirname(this.path):void 0}set dirname(t){ob(this.basename,"dirname"),this.path=ur.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ur.extname(this.path):void 0}set extname(t){if(Zd(t,"extname"),ob(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ur.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Oh(t)&&(t=h8(t)),Jd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ur.basename(this.path,this.extname):void 0}set stem(t){Jd(t,"stem"),Zd(t,"stem"),this.path=ur.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new un(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Zd(e,t){if(e&&e.includes(ur.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ur.sep+"`")}function Jd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ob(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function m8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const g8={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},b8="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",y8=/-[a-z]/g,E8=/%c(?:([-+])(\d+))?/g,x8=/%x/g,C8={2:!0,1:!1,0:null},k8={};function T8(e,t){const n=t||k8,r=n.onerror,o=e instanceof Rh?e:new Rh(e),i=n.fragment?o8:r8,s=String(o),a=i(s,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return vP(a,{file:o,space:n.space,verbose:n.verbose});function l(c){const u=c.code,d=w8(u),f=n[d],h=f??!0,p=typeof h=="number"?h:h?1:0;if(p){const y=g8[d],b=new un(g(y.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:u,source:"hast-util-from-html"});o.path&&(b.file=o.path,b.name=o.path+":"+b.name),b.fatal=C8[p],b.note=g(y.description),b.url=y.url===!1?void 0:b8+u,r(b)}function g(y){return y.replace(E8,b).replace(x8,x);function b(k,O,M){const A=(M?Number.parseInt(M,10):0)*(O==="-"?-1:1),D=s.charAt(c.startOffset+A);return v8(D)}function x(){return A8(s.charCodeAt(c.startOffset))}}}}function w8(e){return e.replace(y8,S8)}function S8(e){return e.charAt(1).toUpperCase()}function v8(e){return e==="`"?"` ` `":e}function A8(e){return"0x"+e.toString(16).toUpperCase()}function N8(e){const t=this,{emitParseErrors:n,...r}={...t.data("settings"),...e};t.parser=o;function o(i,s){return T8(i,{...r,onerror:n?function(a){s.path&&(a.name=s.path+":"+a.name,a.file=s.path),s.messages.push(a)}:void 0})}}const WT=-1,Xu=0,Xs=1,Nc=2,ym=3,Em=4,xm=5,Cm=6,qT=7,GT=8,ib=typeof self=="object"?self:globalThis,I8=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case Xu:case WT:return n(s,o);case Xs:{const a=n([],o);for(const l of s)a.push(r(l));return a}case Nc:{const a=n({},o);for(const[l,c]of s)a[r(l)]=r(c);return a}case ym:return n(new Date(s),o);case Em:{const{source:a,flags:l}=s;return n(new RegExp(a,l),o)}case xm:{const a=n(new Map,o);for(const[l,c]of s)a.set(r(l),r(c));return a}case Cm:{const a=n(new Set,o);for(const l of s)a.add(r(l));return a}case qT:{const{name:a,message:l}=s;return n(new ib[a](l),o)}case GT:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new ib[i](s),o)};return r},sb=e=>I8(new Map,e)(0),Ni="",{toString:M8}={},{keys:_8}=Object,Cs=e=>{const t=typeof e;if(t!=="object"||!e)return[Xu,t];const n=M8.call(e).slice(8,-1);switch(n){case"Array":return[Xs,Ni];case"Object":return[Nc,Ni];case"Date":return[ym,Ni];case"RegExp":return[Em,Ni];case"Map":return[xm,Ni];case"Set":return[Cm,Ni];case"DataView":return[Xs,n]}return n.includes("Array")?[Xs,n]:n.includes("Error")?[qT,n]:[Nc,n]},hl=([e,t])=>e===Xu&&(t==="function"||t==="symbol"),O8=(e,t,n,r)=>{const o=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},i=s=>{if(n.has(s))return n.get(s);let[a,l]=Cs(s);switch(a){case Xu:{let u=s;switch(l){case"bigint":a=GT,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return o([WT],s)}return o([a,u],s)}case Xs:{if(l){let f=s;return l==="DataView"?f=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(s)),o([l,[...f]],s)}const u=[],d=o([a,u],s);for(const f of s)u.push(i(f));return d}case Nc:{if(l)switch(l){case"BigInt":return o([l,s.toString()],s);case"Boolean":case"Number":case"String":return o([l,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const u=[],d=o([a,u],s);for(const f of _8(s))(e||!hl(Cs(s[f])))&&u.push([i(f),i(s[f])]);return d}case ym:return o([a,s.toISOString()],s);case Em:{const{source:u,flags:d}=s;return o([a,{source:u,flags:d}],s)}case xm:{const u=[],d=o([a,u],s);for(const[f,h]of s)(e||!(hl(Cs(f))||hl(Cs(h))))&&u.push([i(f),i(h)]);return d}case Cm:{const u=[],d=o([a,u],s);for(const f of s)(e||!hl(Cs(f)))&&u.push(i(f));return d}}const{message:c}=s;return o([a,{name:l,message:c}],s)};return i},ab=(e,{json:t,lossy:n}={})=>{const r=[];return O8(!(t||n),!!t,new Map,r)(e),r},cs=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?sb(ab(e,t)):structuredClone(e):(e,t)=>sb(ab(e,t)),km=(function(e,t,n,r,o){const i=lr(t);return YT(e)?i.call(o,e,n,r):!1}),lr=(function(e){if(e==null)return D8;if(typeof e=="string")return L8(e);if(typeof e=="object")return R8(e);if(typeof e=="function")return Tm(e);throw new Error("Expected function, string, or array as `test`")});function R8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lr(e[n]);return Tm(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function L8(e){return Tm(t);function t(n){return n.tagName===e}}function Tm(e){return t;function t(n,r,o){return!!(YT(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function D8(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function YT(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const KT=lr(function(e){return e.tagName==="audio"||e.tagName==="canvas"||e.tagName==="embed"||e.tagName==="iframe"||e.tagName==="img"||e.tagName==="math"||e.tagName==="object"||e.tagName==="picture"||e.tagName==="svg"||e.tagName==="video"}),P8=/[ \t\n\f\r]/g;function Ua(e){return typeof e=="object"?e.type==="text"?lb(e.value):!1:lb(e)}function lb(e){return e.replace(P8,"")===""}const ps=(function(e){if(e==null)return U8;if(typeof e=="function")return Zu(e);if(typeof e=="object")return Array.isArray(e)?B8(e):F8(e);if(typeof e=="string")return H8(e);throw new Error("Expected function, string, or object as test")});function B8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ps(e[n]);return Zu(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function F8(e){const t=e;return Zu(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function H8(e){return Zu(t);function t(n){return n&&n.type===e}}function Zu(e){return t;function t(n,r,o){return!!(V8(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function U8(){return!0}function V8(e){return e!==null&&typeof e=="object"&&"type"in e}const $8=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],j8=["button","input","select","textarea"],z8=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],W8={},wm=ps(["comment","doctype"]);function q8(e,t){QT(e,{collapse:J8((t||W8).newlines?X8:Z8),whitespace:"normal"})}function QT(e,t){if("children"in e){const n={...t};return(e.type==="root"||JT(e))&&(n.before=!0,n.after=!0),n.whitespace=e9(e,t),Y8(e,n)}if(e.type==="text"){if(t.whitespace==="normal")return G8(e,t);t.whitespace==="nowrap"&&(e.value=t.collapse(e.value))}return{ignore:wm(e),stripAtStart:!1,remove:!1}}function G8(e,t){const n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1};let o=0,i=n.length;return t.before&&cb(n.charAt(0))&&o++,o!==i&&cb(n.charAt(i-1))&&(t.after?i--:r.stripAtStart=!0),o===i?r.remove=!0:e.value=n.slice(o,i),r}function Y8(e,t){let n=t.before;const r=t.after,o=e.children;let i=o.length,s=-1;for(;++s<i;){const a=QT(o[s],{...t,after:XT(o,s,r),before:n});a.remove?(o.splice(s,1),s--,i--):a.ignore||(n=a.stripAtStart),ZT(o[s])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function XT(e,t,n){for(;++t<e.length;){const r=e[t];let o=K8(r);if(o===void 0&&"children"in r&&!Q8(r)&&(o=XT(r.children,-1)),typeof o=="boolean")return o}return n}function K8(e){if(e.type==="element"){if(ZT(e))return!1;if(JT(e))return!0}else if(e.type==="text"){if(!Ua(e))return!1}else if(!wm(e))return!1}function ZT(e){return KT(e)||km(e,j8)}function JT(e){return km(e,$8)}function Q8(e){return!!(e.type==="element"&&e.properties.hidden)||wm(e)||km(e,z8)}function cb(e){return e===" "||e===`
112
+ `}function X8(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function Z8(){return" "}function J8(e){return t;function t(n){return String(n).replace(/[\t\n\v\f\r ]+/g,e)}}function e9(e,t){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}function t9(e){return function(t){q8(t,e)}}const e2=[],n9=!0,Ic=!1,t2="skip";function n2(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=ps(o),s=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=e2,p,g,y;if((!t||i(l,c,u[u.length-1]||void 0))&&(h=r9(n(l,u)),h[0]===Ic))return h;if("children"in l&&l.children){const b=l;if(b.children&&h[0]!==t2)for(g=(r?b.children.length:-1)+s,y=u.concat(b);g>-1&&g<b.children.length;){const x=b.children[g];if(p=a(x,g,y)(),p[0]===Ic)return p;g=typeof p[1]=="number"?p[1]:g+s}}return h}}}function r9(e){return Array.isArray(e)?e:typeof e=="number"?[n9,e]:e==null?e2:[e]}function gi(e,t,n,r){let o,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,o=n):(i=t,s=n,o=r),n2(e,i,a,o);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return s(l,d,u)}}const r2=i2("end"),o2=i2("start");function i2(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function s2(e){const t=o2(e),n=r2(e);if(t&&n)return{start:t,end:n}}function o9(e,t){const n=t.properties||{},r=e.all(t),o={type:"link",url:e.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return e.patch(t,o),o}function i9(e,t){e.baseFound||(e.frozenBaseUrl=String(t.properties&&t.properties.href||"")||void 0,e.baseFound=!0)}function s9(e,t){const n={type:"blockquote",children:e.toFlow(e.all(t))};return e.patch(t,n),n}function a9(e,t){const n={type:"break"};return e.patch(t,n),n}const ub=(function(e,t,n){const r=ps(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),db=/\n/g,fb=/[\t ]+/g,Lh=lr("br"),hb=lr(p9),l9=lr("p"),pb=lr("tr"),c9=lr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",h9,m9]),a2=lr(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Va(e,t){const n={},r="children"in e?e.children:[],o=a2(e),i=u2(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(...c2(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...l2(r[a],e,{whitespace:i,breakBefore:a?void 0:o,breakAfter:a<r.length-1?Lh(r[a+1]):o}));const l=[];let c;for(a=-1;++a<s.length;){const u=s[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
113
+ `.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function l2(e,t,n){return e.type==="element"?u9(e,t,n):e.type==="text"?n.whitespace==="normal"?c2(e,n):d9(e):[]}function u9(e,t,n){const r=u2(e,n),o=e.children||[];let i=-1,s=[];if(c9(e))return s;let a,l;for(Lh(e)||pb(e)&&ub(t,e,pb)?l=`
114
+ `:l9(e)?(a=2,l=2):a2(e)&&(a=1,l=1);++i<o.length;)s=s.concat(l2(o[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<o.length-1?Lh(o[i+1]):l}));return hb(e)&&ub(t,e,hb)&&s.push(" "),a&&s.unshift(a),l&&s.push(l),s}function c2(e,t){const n=String(e.value),r=[],o=[];let i=0;for(;i<=n.length;){db.lastIndex=i;const l=db.exec(n),c=l&&"index"in l?l.index:n.length;r.push(f9(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),i=c+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(o.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&o.push(a),o.push(r[s]),a=0):(s===0||s===r.length-1)&&o.push(0);return o}function d9(e){return[String(e.value)]}function f9(e,t,n){const r=[];let o=0,i;for(;o<e.length;){fb.lastIndex=o;const s=fb.exec(e);i=s?s.index:e.length,!o&&!i&&s&&!t&&r.push(""),o!==i&&r.push(e.slice(o,i)),o=s?i+s[0].length:i}return o!==i&&!n&&r.push(""),r.join(" ")}function u2(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function h9(e){return!!(e.properties||{}).hidden}function p9(e){return e.tagName==="td"||e.tagName==="th"}function m9(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function g9(e){const t=String(e);let n=t.length;for(;n>0;){const r=t.codePointAt(n-1);if(r!==void 0&&(r===10||r===13))n--;else break}return t.slice(0,n)}const ef="language-";function pl(e,t){const n=t.children;let r=-1,o,i;if(t.tagName==="pre")for(;++r<n.length;){const a=n[r];if(a.type==="element"&&a.tagName==="code"&&a.properties&&a.properties.className&&Array.isArray(a.properties.className)){o=a.properties.className;break}}if(o){for(r=-1;++r<o.length;)if(String(o[r]).slice(0,ef.length)===ef){i=String(o[r]).slice(ef.length);break}}const s={type:"code",lang:i||null,meta:null,value:g9(Va(t))};return e.patch(t,s),s}function b9(e,t){const n={type:"html",value:"<!--"+t.value+"-->"};return e.patch(t,n),n}function tf(e,t){const r={type:"delete",children:e.all(t)};return e.patch(t,r),r}function Sm(e){let t=-1;if(e.length>1){for(;++t<e.length;)if(e[t].spread)return!0}return!1}function y9(e,t){const n=[],r=[];let o=-1;for(;++o<t.children.length;){const a=t.children[o];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let i={definitions:[],titles:[]};for(o=-1;++o<n.length;){const a=n[o];if(a.type==="element"&&a.tagName==="dt"){const l=n[o-1];l&&l.type==="element"&&l.tagName==="dd"&&(r.push(i),i={definitions:[],titles:[]}),i.titles.push(a)}else i.definitions.push(a)}r.push(i),o=-1;const s=[];for(;++o<r.length;){const a=[...mb(e,r[o].titles),...mb(e,r[o].definitions)];a.length>0&&s.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(s.length>0){const a={type:"list",ordered:!1,start:null,spread:Sm(s),children:s};return e.patch(t,a),a}}function mb(e,t){const n=e.all({type:"root",children:t}),r=e.toSpecificContent(n,E9);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:Sm(r),children:r}]}function E9(){return{type:"listItem",spread:!1,checked:null,children:[]}}function ml(e,t){const r={type:"emphasis",children:e.all(t)};return e.patch(t,r),r}function vm(e){let t=0,n=e.length;for(;t<n&&e[t].type==="break";)t++;for(;n>t&&e[n-1].type==="break";)n--;return t===0&&n===e.length?e:e.slice(t,n)}function Ii(e,t){const n=Number(t.tagName.charAt(1))||1,r=vm(e.all(t)),o={type:"heading",depth:n,children:r};return e.patch(t,o),o}function x9(e,t){const n={type:"thematicBreak"};return e.patch(t,n),n}function C9(e,t){const n=t.properties||{},r=String(n.src||""),o=String(n.title||"");if(r&&o){const i={type:"link",title:null,url:e.resolve(r),children:[{type:"text",value:o}]};return e.patch(t,i),i}}function gb(e,t){const n=t.properties||{},r={type:"image",url:e.resolve(String(n.src||"")||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):""};return e.patch(t,r),r}function ks(e,t){const n={type:"inlineCode",value:Va(t)};return e.patch(t,n),n}function d2(e,t){const n=[],r=[],o=t||e.properties||{},i=f2(e),s=Math.min(Number.parseInt(String(o.size),10),0)||(o.multiple?4:1);let a=-1;for(;++a<i.length;){const u=i[a];u&&u.properties&&u.properties.selected&&n.push(u)}const l=n.length>0?n:i,c=Math.min(l.length,s);for(a=-1;++a<c;){const u=l[a],d=u.properties||{},f=Va(u),h=f||String(d.label||""),p=String(d.value||"")||f;r.push([p,h===p?void 0:h])}return r}function f2(e){const t=[];let n=-1;for(;++n<e.children.length;){const r=e.children[n];"children"in r&&Array.isArray(r.children)&&t.push(...f2(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&t.push(r)}return t}const k9="[x]",T9="[ ]";function w9(e,t){const n=t.properties||{},r=String(n.value||n.placeholder||"");if(n.disabled||n.type==="hidden"||n.type==="file")return;if(n.type==="checkbox"||n.type==="radio"){const l={type:"text",value:n.checked?e.options.checked||k9:e.options.unchecked||T9};return e.patch(t,l),l}if(n.type==="image"){const l=n.alt||r;if(l){const c={type:"image",url:e.resolve(String(n.src||"")||null),title:String(n.title||"")||null,alt:String(l)};return e.patch(t,c),c}return}let o=[];if(r)o=[[r,void 0]];else if(n.type!=="button"&&n.type!=="file"&&n.type!=="password"&&n.type!=="reset"&&n.type!=="submit"&&n.list){const l=String(n.list),c=e.elementById.get(l);c&&c.tagName==="datalist"&&(o=d2(c,n))}if(o.length===0)return;if(n.type==="password"&&(o[0]=["•".repeat(o[0][0].length),void 0]),n.type==="email"||n.type==="url"){const l=[];let c=-1;for(;++c<o.length;){const u=e.resolve(o[c][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+u:u,children:[{type:"text",value:o[c][1]||u}]};l.push(d),c!==o.length-1&&l.push({type:"text",value:", "})}return l}const i=[];let s=-1;for(;++s<o.length;)i.push(o[s][1]?o[s][1]+" ("+o[s][0]+")":o[s][0]);const a={type:"text",value:i.join(", ")};return e.patch(t,a),a}const S9={}.hasOwnProperty;function v9(e,t){const n=e.type==="element"&&S9.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const A9=new Set(["pingback","prefetch","stylesheet"]);function N9(e){if(e.type!=="element"||e.tagName!=="link")return!1;if(e.properties.itemProp)return!0;const t=e.properties.rel;let n=-1;if(!Array.isArray(t)||t.length===0)return!1;for(;++n<t.length;)if(!A9.has(String(t[n])))return!1;return!0}const I9=lr(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),M9=lr("meta");function h2(e){return!!(e.type==="text"||I9(e)||KT(e)||N9(e)||M9(e)&&v9(e,"itemProp"))}function nf(e,t){const{rest:n,checkbox:r}=m2(t),o=r?!!r.properties.checked:null,i=p2(n),s=e.toFlow(e.all(n)),a={type:"listItem",spread:i,checked:o,children:s};return e.patch(t,a),a}function p2(e){let t=-1,n=!1;for(;++t<e.children.length;){const r=e.children[t];if(r.type==="element"){if(h2(r))continue;if(r.tagName==="p"||n||p2(r))return!0;n=!0}}return!1}function m2(e){const t=e.children[0];if(t&&t.type==="element"&&t.tagName==="input"&&t.properties&&(t.properties.type==="checkbox"||t.properties.type==="radio")){const n={...e,children:e.children.slice(1)};return{checkbox:t,rest:n}}if(t&&t.type==="element"&&t.tagName==="p"){const{checkbox:n,rest:r}=m2(t);if(n){const o={...e,children:[r,...e.children.slice(1)]};return{checkbox:n,rest:o}}}return{checkbox:void 0,rest:e}}function rf(e,t){const n=t.tagName==="ol",r=e.toSpecificContent(e.all(t),_9);let o=null;n&&(o=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);const i={type:"list",ordered:n,start:o,spread:Sm(r),children:r};return e.patch(t,i),i}function _9(){return{type:"listItem",spread:!1,checked:null,children:[]}}const O9={};function Ju(e,t){const n=O9,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return g2(e,r,o)}function g2(e,t,n){if(R9(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bb(e.children,t,n)}return Array.isArray(e)?bb(e,t,n):""}function bb(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=g2(e[o],t,n);return r.join("")}function R9(e){return!!(e&&typeof e=="object")}const b2=ps(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ed(e){let t=-1;for(;++t<e.length;){const n=e[t];if(!x2(n)||"children"in n&&ed(n.children))return!0}return!1}function y2(e){return E2(e,t,function(n){return n});function t(n){return n.every(function(r){return r.type==="text"?Ua(r.value):!1})?[]:[{type:"paragraph",children:vm(n)}]}}function L9(e){return E2(e.children,t,n);function t(r){const o=of(e);return o.children=r,[o]}function n(r){if("children"in r&&"children"in e){const o=of(e),i=of(r);return o.children=r.children,i.children.push(o),i}return{...r}}}function E2(e,t,n){const r=D9(e),o=[];let i=[],s=-1;for(;++s<r.length;){const a=r[s];x2(a)?i.push(a):(i.length>0&&(o.push(...t(i)),i=[]),o.push(n(a)))}return i.length>0&&(o.push(...t(i)),i=[]),o}function D9(e){const t=[];let n=-1;for(;++n<e.length;){const r=e[n];(r.type==="delete"||r.type==="link")&&ed(r.children)?t.push(...L9(r)):t.push(r)}return t}function x2(e){const t=e.data&&e.data.hName;return t?h2({type:"element",tagName:t,properties:{},children:[]}):b2(e)}function of(e){return cs({...e,children:[]})}function yb(e,t){const n=t.properties||{},r=t.tagName==="video"?String(n.poster||""):"";let o=String(n.src||""),i=-1,s=!1,a=e.all(t);if(gi({type:"root",children:a},function(d){if(d.type==="link")return s=!0,Ic}),s||ed(a))return a;for(;!o&&++i<t.children.length;){const d=t.children[i];d.type==="element"&&d.tagName==="source"&&d.properties&&(o=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:e.resolve(r),alt:Ju(a)};e.patch(t,d),a=[d]}const c=a,u={type:"link",title:n.title?String(n.title):null,url:e.resolve(o),children:c};return e.patch(t,u),u}function Eb(e,t){const n=vm(e.all(t));if(n.length>0){const r={type:"paragraph",children:n};return e.patch(t,r),r}}const P9=['"'];function B9(e,t){const n=e.options.quotes||P9;e.qNesting++;const r=e.all(t);e.qNesting--;const o=n[e.qNesting%n.length],i=r[0],s=r[r.length-1],a=o.charAt(0),l=o.length>1?o.charAt(1):o;return i&&i.type==="text"?i.value=a+i.value:r.unshift({type:"text",value:a}),s&&s.type==="text"?s.value+=l:r.push({type:"text",value:l}),r}function F9(e,t){let n=e.all(t);(e.options.document||ed(n))&&(n=y2(n));const r={type:"root",children:n};return e.patch(t,r),r}function H9(e,t){const n=d2(t);let r=-1;const o=[];for(;++r<n.length;){const i=n[r];o.push(i[1]?i[1]+" ("+i[0]+")":i[0])}if(o.length>0){const i={type:"text",value:o.join(", ")};return e.patch(t,i),i}}function xb(e,t){const r={type:"strong",children:e.all(t)};return e.patch(t,r),r}function Cb(e,t){const r={type:"tableCell",children:e.all(t)};if(e.patch(t,r),t.properties){const o=t.properties.rowSpan,i=t.properties.colSpan;if(o||i){const s=r.data||(r.data={});o&&(s.hastUtilToMdastTemporaryRowSpan=o),i&&(s.hastUtilToMdastTemporaryColSpan=i)}}return r}function U9(e,t){const r={type:"tableRow",children:e.toSpecificContent(e.all(t),V9)};return e.patch(t,r),r}function V9(){return{type:"tableCell",children:[]}}function $9(e,t){if(e.inTable){const c={type:"text",value:Va(t)};return e.patch(t,c),c}e.inTable=!0;const{align:n,headless:r}=j9(t),o=e.toSpecificContent(e.all(t),kb);r&&o.unshift(kb());let i=-1;for(;++i<o.length;){const c=o[i],u=e.toSpecificContent(c.children,z9);c.children=u}let s=1;for(i=-1;++i<o.length;){const c=o[i].children;let u=-1;for(;++u<c.length;){const d=c[u];if(d.data){const f=d.data,h=Number.parseInt(String(f.hastUtilToMdastTemporaryColSpan),10)||1,p=Number.parseInt(String(f.hastUtilToMdastTemporaryRowSpan),10)||1;if(h>1||p>1){let g=i-1;for(;++g<i+p;){let y=u-1;for(;++y<u+h&&o[g];){const b=[];(g!==i||y!==u)&&b.push({type:"tableCell",children:[]}),o[g].children.splice(y,0,...b)}}}"hastUtilToMdastTemporaryColSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryRowSpan,Object.keys(d.data).length===0&&delete d.data}}c.length>s&&(s=c.length)}for(i=-1;++i<o.length;){const c=o[i].children;let u=c.length-1;for(;++u<s;)c.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<s;)n.push(null);e.inTable=!1;const l={type:"table",align:n,children:o};return e.patch(t,l),l}function j9(e){const t={align:[null],headless:!0};let n=0,r=0;return gi(e,function(o){if(o.type==="element"){if(o.tagName==="table"&&e!==o)return t2;if((o.tagName==="th"||o.tagName==="td")&&o.properties){if(!t.align[r]){const i=String(o.properties.align||"")||null;(i==="center"||i==="left"||i==="right"||i===null)&&(t.align[r]=i)}t.headless&&n<2&&o.tagName==="th"&&(t.headless=!1),r++}else o.tagName==="thead"?t.headless=!1:o.tagName==="tr"&&(n++,r=0)}}),t}function z9(){return{type:"tableCell",children:[]}}function kb(){return{type:"tableRow",children:[]}}function W9(e,t){const n={type:"text",value:t.value};return e.patch(t,n),n}function q9(e,t){const n={type:"text",value:Va(t)};return e.patch(t,n),n}function G9(e,t){const n={type:"text",value:"​"};return e.patch(t,n),n}const Y9={comment:b9,doctype:Me,root:F9,text:W9},K9={applet:Me,area:Me,basefont:Me,bgsound:Me,caption:Me,col:Me,colgroup:Me,command:Me,content:Me,datalist:Me,dialog:Me,element:Me,embed:Me,frame:Me,frameset:Me,isindex:Me,keygen:Me,link:Me,math:Me,menu:Me,menuitem:Me,meta:Me,nextid:Me,noembed:Me,noframes:Me,optgroup:Me,option:Me,param:Me,script:Me,shadow:Me,source:Me,spacer:Me,style:Me,svg:Me,template:Me,title:Me,track:Me,abbr:Ie,acronym:Ie,bdi:Ie,bdo:Ie,big:Ie,blink:Ie,button:Ie,canvas:Ie,cite:Ie,data:Ie,details:Ie,dfn:Ie,font:Ie,ins:Ie,label:Ie,map:Ie,marquee:Ie,meter:Ie,nobr:Ie,noscript:Ie,object:Ie,output:Ie,progress:Ie,rb:Ie,rbc:Ie,rp:Ie,rt:Ie,rtc:Ie,ruby:Ie,slot:Ie,small:Ie,span:Ie,sup:Ie,sub:Ie,tbody:Ie,tfoot:Ie,thead:Ie,time:Ie,address:Tt,article:Tt,aside:Tt,body:Tt,center:Tt,div:Tt,fieldset:Tt,figcaption:Tt,figure:Tt,form:Tt,footer:Tt,header:Tt,hgroup:Tt,html:Tt,legend:Tt,main:Tt,multicol:Tt,nav:Tt,picture:Tt,section:Tt,a:o9,audio:yb,b:xb,base:i9,blockquote:s9,br:a9,code:ks,dir:rf,dl:y9,dt:nf,dd:nf,del:tf,em:ml,h1:Ii,h2:Ii,h3:Ii,h4:Ii,h5:Ii,h6:Ii,hr:x9,i:ml,iframe:C9,img:gb,image:gb,input:w9,kbd:ks,li:nf,listing:pl,mark:ml,ol:rf,p:Eb,plaintext:pl,pre:pl,q:B9,s:tf,samp:ks,select:H9,strike:tf,strong:xb,summary:Eb,table:$9,td:Cb,textarea:q9,th:Cb,tr:U9,tt:ks,u:ml,ul:rf,var:ks,video:yb,wbr:G9,xmp:pl};function Ie(e,t){return e.all(t)}function Tt(e,t){return e.toFlow(e.all(t))}function Me(){}const Tb={}.hasOwnProperty;function Q9(e){return{all:X9,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...K9,...e.handlers},inTable:!1,nodeHandlers:{...Y9,...e.nodeHandlers},one:Z9,options:e,patch:J9,qNesting:0,resolve:e7,toFlow:t7,toSpecificContent:n7}}function X9(e){const t=e.children||[],n=[];let r=-1;for(;++r<t.length;){const o=t[r],i=this.one(o,e);Array.isArray(i)?n.push(...i):i&&n.push(i)}return n}function Z9(e,t){if(e.type==="element"){if(e.properties&&e.properties.dataMdast==="ignore")return;if(Tb.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(Tb.call(this.nodeHandlers,e.type))return this.nodeHandlers[e.type](this,e,t)||void 0;if("value"in e&&typeof e.value=="string"){const n={type:"text",value:e.value};return this.patch(e,n),n}if("children"in e)return this.all(e)}function J9(e,t){e.position&&(t.position=s2(e))}function e7(e){const t=this.frozenBaseUrl;return e==null?"":t?String(new URL(e,t)):e}function t7(e){return y2(e)}function n7(e,t){const n=t(),r=[];let o=[],i=-1;for(;++i<e.length;){const a=e[i];if(s(a))o.length>0&&(a.children.unshift(...o),o=[]),r.push(a);else{const l=a;o.push(l)}}if(o.length>0){let a=r[r.length-1];a||(a=t(),r.push(a)),a.children.push(...o),o=[]}return r;function s(a){return a.type===n.type}}const r7={};function wb(e,t){const n=cs(e),r=t||r7,o=t9({newlines:r.newlines===!0}),i=Q9(r);let s;o(n),gi(n,function(l){if(l&&l.type==="element"&&l.properties){const c=String(l.properties.id||"")||void 0;c&&!i.elementById.has(c)&&i.elementById.set(c,l)}});const a=i.one(n,void 0);return a?Array.isArray(a)?s={type:"root",children:a}:s=a:s={type:"root",children:[]},gi(s,function(l,c,u){if(l.type==="text"&&c!==void 0&&u){const d=u.children[c-1];if(d&&d.type===l.type)return d.value+=l.value,u.children.splice(c,1),d.position&&l.position&&(d.position.end=l.position.end),c-1;if(l.value=l.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),u&&(u.type==="heading"||u.type==="paragraph"||u.type==="root")&&(c||(l.value=l.value.replace(/^[\t ]+/,"")),c===u.children.length-1&&(l.value=l.value.replace(/[\t ]+$/,""))),!l.value)return u.children.splice(c,1),c}}),s}const Sb={document:!0};function o7(e,t){return e&&"run"in e?async function(n,r){const o=wb(n,{...Sb,...t});await e.run(o,r)}:function(n){return wb(n,{...Sb,...e})}}function Mc(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}const on=Uo(/[A-Za-z]/),Qt=Uo(/[\dA-Za-z]/),i7=Uo(/[#-'*+\--9=?A-Z^-~]/);function _c(e){return e!==null&&(e<32||e===127)}const Dh=Uo(/\d/),s7=Uo(/[\dA-Fa-f]/),a7=Uo(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const td=Uo(new RegExp("\\p{P}|\\p{S}","u")),bi=Uo(/\s/);function Uo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function l7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function c7(e,t,n){const o=ps((n||{}).ignore||[]),i=u7(t);let s=-1;for(;++s<i.length;)n2(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const h=u[d],p=f?f.children:void 0;if(o(h,p?p.indexOf(h):void 0,f))return;f=h}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[s][0],h=i[s][1];let p=0;const y=d.children.indexOf(c);let b=!1,x=[];f.lastIndex=0;let k=f.exec(c.value);for(;k;){const O=k.index,M={index:k.index,input:k.input,stack:[...u,c]};let A=h(...k,M);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?f.lastIndex=O+1:(p!==O&&x.push({type:"text",value:c.value.slice(p,O)}),Array.isArray(A)?x.push(...A):A&&x.push(A),p=O+k[0].length,b=!0),!f.global)break;k=f.exec(c.value)}return b?(p<c.value.length&&x.push({type:"text",value:c.value.slice(p)}),d.children.splice(y,1,...x)):x=[c],y+x.length}}function u7(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([d7(o[0]),f7(o[1])])}return t}function d7(e){return typeof e=="string"?new RegExp(l7(e),"g"):e}function f7(e){return typeof e=="function"?e:function(){return e}}const sf="phrasing",af=["autolink","link","image","label"];function h7(){return{transforms:[x7],enter:{literalAutolink:m7,literalAutolinkEmail:lf,literalAutolinkHttp:lf,literalAutolinkWww:lf},exit:{literalAutolink:E7,literalAutolinkEmail:y7,literalAutolinkHttp:g7,literalAutolinkWww:b7}}}function p7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sf,notInConstruct:af},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sf,notInConstruct:af},{character:":",before:"[ps]",after:"\\/",inConstruct:sf,notInConstruct:af}]}}function m7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function lf(e){this.config.enter.autolinkProtocol.call(this,e)}function g7(e){this.config.exit.autolinkProtocol.call(this,e)}function b7(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function y7(e){this.config.exit.autolinkEmail.call(this,e)}function E7(e){this.exit(e)}function x7(e){c7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,C7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),k7]],{ignore:["link","linkReference"]})}function C7(e,t,n,r,o){let i="";if(!C2(o)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!T7(n)))return!1;const s=w7(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function k7(e,t,n,r){return!C2(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function T7(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function w7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=Mc(e,"(");let i=Mc(e,")");for(;r!==-1&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function C2(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||bi(n)||td(n))&&(!t||n!==47)}function or(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}k2.peek=R7;function S7(){this.buffer()}function v7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function A7(){this.buffer()}function N7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function I7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=or(this.sliceSerialize(e)).toLowerCase(),n.label=t}function M7(e){this.exit(e)}function _7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=or(this.sliceSerialize(e)).toLowerCase(),n.label=t}function O7(e){this.exit(e)}function R7(){return"["}function k2(e,t,n,r){const o=n.createTracker(r);let i=o.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return i+=o.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),s(),i+=o.move("]"),i}function L7(){return{enter:{gfmFootnoteCallString:S7,gfmFootnoteCall:v7,gfmFootnoteDefinitionLabelString:A7,gfmFootnoteDefinition:N7},exit:{gfmFootnoteCallString:I7,gfmFootnoteCall:M7,gfmFootnoteDefinitionLabelString:_7,gfmFootnoteDefinition:O7}}}function D7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:k2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,s){const a=i.createTracker(s);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
115
+ `:" ")+i.indentLines(i.containerFlow(r,a.current()),t?T2:P7))),c(),l}}function P7(e,t,n){return t===0?e:T2(e,t,n)}function T2(e,t,n){return(n?"":" ")+e}const B7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];w2.peek=$7;function F7(){return{canContainEols:["delete"],enter:{strikethrough:U7},exit:{strikethrough:V7}}}function H7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:B7}],handlers:{delete:w2}}}function U7(e){this.enter({type:"delete",children:[]},e)}function V7(e){this.exit(e)}function w2(e,t,n,r){const o=n.createTracker(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=n.containerPhrasing(e,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function $7(){return"~"}function j7(e){return e.length}function z7(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||j7,i=[],s=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const g=[],y=[];let b=-1;for(e[u].length>c&&(c=e[u].length);++b<e[u].length;){const x=W7(e[u][b]);if(n.alignDelimiters!==!1){const k=o(x);y[b]=k,(l[b]===void 0||k>l[b])&&(l[b]=k)}g.push(x)}s[u]=g,a[u]=y}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=vb(r[d]);else{const g=vb(r);for(;++d<c;)i[d]=g}d=-1;const f=[],h=[];for(;++d<c;){const g=i[d];let y="",b="";g===99?(y=":",b=":"):g===108?y=":":g===114&&(b=":");let x=n.alignDelimiters===!1?1:Math.max(1,l[d]-y.length-b.length);const k=y+"-".repeat(x)+b;n.alignDelimiters!==!1&&(x=y.length+x+b.length,x>l[d]&&(l[d]=x),h[d]=x),f[d]=k}s.splice(1,0,f),a.splice(1,0,h),u=-1;const p=[];for(;++u<s.length;){const g=s[u],y=a[u];d=-1;const b=[];for(;++d<c;){const x=g[d]||"";let k="",O="";if(n.alignDelimiters!==!1){const M=l[d]-(y[d]||0),A=i[d];A===114?k=" ".repeat(M):A===99?M%2?(k=" ".repeat(M/2+.5),O=" ".repeat(M/2-.5)):(k=" ".repeat(M/2),O=k):O=" ".repeat(M)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(k),b.push(x),n.alignDelimiters!==!1&&b.push(O),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
116
+ `)}function W7(e){return e==null?"":String(e)}function vb(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const Ab={}.hasOwnProperty;function S2(e,t){const n=t||{};function r(o,...i){let s=r.invalid;const a=r.handlers;if(o&&Ab.call(o,e)){const l=String(o[e]);s=Ab.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const q7={}.hasOwnProperty;function v2(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)v2(e,t.extensions[n]);for(r in t)if(q7.call(t,r))switch(r){case"extensions":break;case"unsafe":{Nb(e[r],t[r]);break}case"join":{Nb(e[r],t[r]);break}case"handlers":{G7(e[r],t[r]);break}default:e.options[r]=t[r]}return e}function Nb(e,t){t&&e.push(...t)}function G7(e,t){t&&Object.assign(e,t)}function Y7(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),K7);return o(),s}function K7(e,t,n){return">"+(n?"":" ")+e}function A2(e,t){return Ib(e,t.inConstruct,!0)&&!Ib(e,t.notInConstruct,!1)}function Ib(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Mb(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
117
+ `&&A2(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
118
+ `}function Q7(e,t){const n=String(e);let r=n.indexOf(t),o=r,i=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++i>s&&(s=i):i=1,o=r+t.length,r=n.indexOf(t,o);return s}function Ph(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function X7(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Z7(e,t,n,r){const o=X7(n),i=e.value||"",s=o==="`"?"GraveAccent":"Tilde";if(Ph(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,J7);return d(),f}const a=n.createTracker(r),l=o.repeat(Math.max(Q7(i,o)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${s}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
119
+ `,encode:["`"],...a.current()})),d()}return u+=a.move(`
120
+ `),i&&(u+=a.move(i+`
121
+ `)),u+=a.move(l),c(),u}function J7(e,t,n){return(n?"":" ")+e}function Am(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function eF(e,t,n,r){const o=Am(n),i=o==='"'?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
122
+ `,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),s(),c}function tF(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ro(e){return"&#x"+e.toString(16).toUpperCase()+";"}function us(e){if(e===null||Ze(e)||bi(e))return 1;if(td(e))return 2}function Oc(e,t,n){const r=us(e),o=us(t);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}N2.peek=nF;function N2(e,t,n,r){const o=tF(n),i=n.enter("emphasis"),s=n.createTracker(r),a=s.move(o);let l=s.move(n.containerPhrasing(e,{after:o,before:a,...s.current()}));const c=l.charCodeAt(0),u=Oc(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(l=Ro(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Oc(r.after.charCodeAt(0),d,o);f.inside&&(l=l.slice(0,-1)+Ro(d));const h=s.move(o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+h}function nF(e,t,n){return n.options.emphasis||"*"}function I2(e,t){let n=!1;return gi(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ic}),!!((!e.depth||e.depth<3)&&Ju(e)&&(t.options.setext||n))}function rF(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(I2(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
123
+ `,after:`
124
+ `});return d(),u(),f+`
125
+ `+(o===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
126
+ `))+1))}const s="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
127
+ `,...i.current()});return/^[\t ]/.test(c)&&(c=Ro(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c}M2.peek=oF;function M2(e){return e.value||""}function oF(){return"<"}_2.peek=iF;function _2(e,t,n,r){const o=Am(n),i=o==='"'?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),c+=l.move(")"),s(),c}function iF(){return"!"}O2.peek=sF;function O2(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),o==="full"||!c||c!==d?l+=a.move(d+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function sF(){return"!"}R2.peek=aF;function R2(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const s=n.unsafe[i],a=n.compilePattern(s);let l;if(s.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return o+r+o}function aF(){return"`"}function L2(e,t){const n=Ju(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}D2.peek=lF;function D2(e,t,n,r){const o=Am(n),i=o==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(L2(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=s.move("<");return d+=s.move(n.containerPhrasing(e,{before:d,after:">",...s.current()})),d+=s.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),c+=s.move(")"),a(),c}function lF(e,t,n){return L2(e,n)?"<":"["}P2.peek=cF;function P2(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),o==="full"||!c||c!==d?l+=a.move(d+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function cF(){return"["}function Nm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function uF(e){const t=Nm(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function dF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function B2(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function fF(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?dF(n):Nm(n);const a=e.ordered?s==="."?")":".":uF(n);let l=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),B2(n)===s&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const c=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),c}function hF(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function pF(e,t,n,r){const o=hF(n);let i=n.bulletCurrent||Nm(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let s=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,h){return f?(h?"":" ".repeat(s))+d:(h?i:i+" ".repeat(s-i.length))+d}}function mF(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),o(),s}function gF(e,t,n,r){return(e.children.some(function(s){return b2(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function bF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}F2.peek=yF;function F2(e,t,n,r){const o=bF(n),i=n.enter("strong"),s=n.createTracker(r),a=s.move(o+o);let l=s.move(n.containerPhrasing(e,{after:o,before:a,...s.current()}));const c=l.charCodeAt(0),u=Oc(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(l=Ro(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Oc(r.after.charCodeAt(0),d,o);f.inside&&(l=l.slice(0,-1)+Ro(d));const h=s.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+h}function yF(e,t,n){return n.options.strong||"*"}function EF(e,t,n,r){return n.safe(e.value,r)}function xF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function CF(e,t,n){const r=(B2(n)+(n.options.ruleSpaces?" ":"")).repeat(xF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Im={blockquote:Y7,break:Mb,code:Z7,definition:eF,emphasis:N2,hardBreak:Mb,heading:rF,html:M2,image:_2,imageReference:O2,inlineCode:R2,link:D2,linkReference:P2,list:fF,listItem:pF,paragraph:mF,root:gF,strong:F2,text:EF,thematicBreak:CF},kF=[TF];function TF(e,t,n,r){if(t.type==="code"&&Ph(t,r)&&(e.type==="list"||e.type===t.type&&Ph(e,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return e.type==="paragraph"&&(e.type===t.type||t.type==="definition"||t.type==="heading"&&I2(t,r))?void 0:n.spread?1:0}const $o=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],wF=[{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:`
128
+ `,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:$o},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
129
+ ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:$o},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
130
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:$o},{atBreak:!0,character:"+",after:`(?:[ \r
131
+ ])`},{atBreak:!0,character:"-",after:`(?:[ \r
132
+ -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
133
+ ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:$o},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:$o},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:$o},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:$o},{atBreak:!0,character:"~"}],_b=document.createElement("i");function Mm(e){const t="&"+e+";";_b.innerHTML=t;const n=_b.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function H2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const SF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function U2(e){return e.replace(SF,vF)}function vF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return H2(n.slice(i?2:1),i?16:10)}return Mm(n)||e}function AF(e){return e.label||!e.identifier?e.label||"":U2(e.identifier)}function NF(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function IF(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s=-1,a=n.before,l;r.push(-1);let c=t.createTracker(n);for(;++s<o.length;){const u=o[s];let d;if(r[r.length-1]=s,s+1<o.length){let p=t.handle.handlers[o[s+1].type];p&&p.peek&&(p=p.peek),d=p?p(o[s+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;i.length>0&&(a==="\r"||a===`
134
+ `)&&u.type==="html"&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=t.createTracker(n),c.move(i.join("")));let f=t.handle(u,e,t,{...c.current(),after:d,before:a});l&&l===f.slice(0,1)&&(f=Ro(l.charCodeAt(0))+f.slice(1));const h=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,l=void 0,h&&(i.length>0&&h.before&&a===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+Ro(a.charCodeAt(0))),h.after&&(l=d)),c.move(f),i.push(f),a=f.slice(-1)}return r.pop(),i.join("")}function MF(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const l=o[a];r[r.length-1]=a,s.push(i.move(t.handle(l,e,t,{before:`
135
+ `,after:`
136
+ `,...i.current()}))),l.type!=="list"&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(_F(l,o[a+1],e,t)))}return r.pop(),s.join("")}function _F(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(i===!0||i===1)break;if(typeof i=="number")return`
137
+ `.repeat(1+i);if(i===!1)return`
138
+
139
+ <!---->
140
+
141
+ `}return`
142
+
143
+ `}const OF=/\r?\n|\r/g;function RF(e,t){const n=[];let r=0,o=0,i;for(;i=OF.exec(e);)s(e.slice(r,i.index)),n.push(i[0]),r=i.index+i[0].length,o++;return s(e.slice(r)),n.join("");function s(a){n.push(t(a,o,!a))}}function LF(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const u=e.unsafe[a];if(!A2(e.stack,u))continue;const d=e.compilePattern(u);let f;for(;f=d.exec(r);){const h="before"in u||!!u.atBreak,p="after"in u,g=f.index+(h?f[1].length:0);o.includes(g)?(s[g].before&&!h&&(s[g].before=!1),s[g].after&&!p&&(s[g].after=!1)):(o.push(g),s[g]={before:h,after:p})}}o.sort(DF);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const u=o[a];u<l||u>=c||u+1<c&&o[a+1]===u+1&&s[u].after&&!s[u+1].before&&!s[u+1].after||o[a-1]===u-1&&s[u].before&&!s[u-1].before&&!s[u-1].after||(l!==u&&i.push(Ob(r.slice(l,u),"\\")),l=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?i.push("\\"):(i.push(Ro(r.charCodeAt(u))),l++))}return i.push(Ob(r.slice(l,c),n.after)),i.join("")}function DF(e,t){return e-t}function Ob(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s=-1,a=0,l;for(;l=n.exec(i);)r.push(l.index);for(;++s<r.length;)a!==r[s]&&o.push(e.slice(a,r[s])),o.push("\\"),a=r[s];return o.push(e.slice(a)),o.join("")}function PF(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:l,current:s,shift:a};function s(){return{now:{line:o,column:i},lineShift:r}}function a(c){r+=c}function l(c){const u=c||"",d=u.split(/\r?\n|\r/g),f=d[d.length-1];return o+=d.length-1,i=d.length===1?i+f.length:1+f.length+r,u}}function BF(e,t){const n=t||{},r={associationId:AF,containerPhrasing:VF,containerFlow:$F,createTracker:PF,compilePattern:NF,enter:i,handlers:{...Im},handle:void 0,indentLines:RF,indexStack:[],join:[...kF],options:{},safe:jF,stack:[],unsafe:[...wF]};v2(r,n),r.options.tightDefinitions&&r.join.push(UF),r.handle=S2("type",{invalid:FF,unknown:HF,handlers:r.handlers});let o=r.handle(e,void 0,r,{before:`
144
+ `,after:`
145
+ `,now:{line:1,column:1},lineShift:0});return o&&o.charCodeAt(o.length-1)!==10&&o.charCodeAt(o.length-1)!==13&&(o+=`
146
+ `),o;function i(s){return r.stack.push(s),a;function a(){r.stack.pop()}}}function FF(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function HF(e){const t=e;throw new Error("Cannot handle unknown node `"+t.type+"`")}function UF(e,t){if(e.type==="definition"&&e.type===t.type)return 0}function VF(e,t){return IF(e,this,t)}function $F(e,t){return MF(e,this,t)}function jF(e,t){return LF(this,e,t)}function zF(){return{enter:{table:WF,tableData:Rb,tableHeader:Rb,tableRow:GF},exit:{codeText:YF,table:qF,tableData:cf,tableHeader:cf,tableRow:cf}}}function WF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function qF(e){this.exit(e),this.data.inTable=void 0}function GF(e){this.enter({type:"tableRow",children:[]},e)}function cf(e){this.exit(e)}function Rb(e){this.enter({type:"tableCell",children:[]},e)}function YF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KF(e,t){return t==="|"?t:e}function QF(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
147
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:s,tableCell:l,tableRow:a}};function s(h,p,g,y){return c(u(h,g,y),h.align)}function a(h,p,g,y){const b=d(h,g,y),x=c([b]);return x.slice(0,x.indexOf(`
148
+ `))}function l(h,p,g,y){const b=g.enter("tableCell"),x=g.enter("phrasing"),k=g.containerPhrasing(h,{...y,before:i,after:i});return x(),b(),k}function c(h,p){return z7(h,{align:p,alignDelimiters:r,padding:n,stringLength:o})}function u(h,p,g){const y=h.children;let b=-1;const x=[],k=p.enter("table");for(;++b<y.length;)x[b]=d(y[b],p,g);return k(),x}function d(h,p,g){const y=h.children;let b=-1;const x=[],k=p.enter("tableRow");for(;++b<y.length;)x[b]=l(y[b],h,p,g);return k(),x}function f(h,p,g){let y=Im.inlineCode(h,p,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function XF(){return{exit:{taskListCheckValueChecked:Lb,taskListCheckValueUnchecked:Lb,paragraph:JF}}}function ZF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:eH}}}function Lb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function JF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,s;for(;++i<o.length;){const a=o[i];if(a.type==="paragraph"){s=a;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function eH(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(s);let l=Im.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+s}}function tH(){return[h7(),L7(),F7(),zF(),XF()]}function nH(e){return{extensions:[p7(),D7(e),H7(),QF(e),ZF()]}}function _n(e,t,n,r){const o=e.length;let i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Un(e,t){return e.length>0?(_n(e,e.length,0,t),e):t}const Db={}.hasOwnProperty;function V2(e){const t={};let n=-1;for(;++n<e.length;)rH(t,e[n]);return t}function rH(e,t){let n;for(n in t){const o=(Db.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Db.call(o,s)||(o[s]=[]);const a=i[s];oH(o[s],Array.isArray(a)?a:a?[a]:[])}}}function oH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);_n(e,0,0,r)}const iH={tokenize:dH,partial:!0},$2={tokenize:fH,partial:!0},j2={tokenize:hH,partial:!0},z2={tokenize:pH,partial:!0},sH={tokenize:mH,partial:!0},W2={name:"wwwAutolink",tokenize:cH,previous:G2},q2={name:"protocolAutolink",tokenize:uH,previous:Y2},to={name:"emailAutolink",tokenize:lH,previous:K2},Ar={};function aH(){return{text:Ar}}let jo=48;for(;jo<123;)Ar[jo]=to,jo++,jo===58?jo=65:jo===91&&(jo=97);Ar[43]=to;Ar[45]=to;Ar[46]=to;Ar[95]=to;Ar[72]=[to,q2];Ar[104]=[to,q2];Ar[87]=[to,W2];Ar[119]=[to,W2];function lH(e,t,n){const r=this;let o,i;return s;function s(d){return!Bh(d)||!K2.call(r,r.previous)||_m(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Bh(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(sH,u,c)(d):d===45||d===95||Qt(d)?(i=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),o=!0,l}function u(d){return i&&o&&on(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function cH(e,t,n){const r=this;return o;function o(s){return s!==87&&s!==119||!G2.call(r,r.previous)||_m(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(iH,e.attempt($2,e.attempt(j2,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function uH(e,t,n){const r=this;let o="",i=!1;return s;function s(d){return(d===72||d===104)&&Y2.call(r,r.previous)&&!_m(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(on(d)&&o.length<5)return o+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||_c(d)||Ze(d)||bi(d)||td(d)?n(d):e.attempt($2,e.attempt(j2,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function dH(e,t,n){let r=0;return o;function o(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),o):s===46&&r===3?(e.consume(s),i):n(s)}function i(s){return s===null?n(s):t(s)}}function fH(e,t,n){let r,o,i;return s;function s(c){return c===46||c===95?e.check(z2,l,a)(c):c===null||Ze(c)||bi(c)||c!==45&&td(c)?l(c):(i=!0,e.consume(c),s)}function a(c){return c===95?r=!0:(o=r,r=void 0),e.consume(c),s}function l(c){return o||r||!i?n(c):t(c)}}function hH(e,t){let n=0,r=0;return o;function o(s){return s===40?(n++,e.consume(s),o):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(z2,t,i)(s):s===null||Ze(s)||bi(s)?t(s):(e.consume(s),o)}function i(s){return s===41&&r++,e.consume(s),o}}function pH(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),i):a===93?(e.consume(a),o):a===60||a===null||Ze(a)||bi(a)?t(a):n(a)}function o(a){return a===null||a===40||a===91||Ze(a)||bi(a)?t(a):r(a)}function i(a){return on(a)?s(a):n(a)}function s(a){return a===59?(e.consume(a),r):on(a)?(e.consume(a),s):n(a)}}function mH(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Qt(i)?n(i):t(i)}}function G2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function Y2(e){return!on(e)}function K2(e){return!(e===47||Bh(e))}function Bh(e){return e===43||e===45||e===46||e===95||Qt(e)}function _m(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function ms(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&Qt(e.charCodeAt(n+1))&&Qt(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function nd(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Fh={name:"attention",resolveAll:gH,tokenize:bH};function gH(e,t){let n=-1,r,o,i,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};Pb(d,-l),Pb(f,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Un(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Un(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=Un(c,nd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Un(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Un(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,_n(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bH(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=us(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=us(l),d=!u||u===2&&o||n.includes(l),f=!o||o===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(o||!f)),c._close=!!(i===42?f:f&&(u||!d)),t(l)}}function Pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const yH={name:"autolink",tokenize:EH};function EH(e,t,n){let r=0;return o;function o(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return on(h)?(e.consume(h),s):h===64?n(h):c(h)}function s(h){return h===43||h===45||h===46||Qt(h)?(r=1,a(h)):c(h)}function a(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||Qt(h))&&r++<32?(e.consume(h),a):(r=0,c(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||_c(h)?n(h):(e.consume(h),l)}function c(h){return h===64?(e.consume(h),u):i7(h)?(e.consume(h),c):n(h)}function u(h){return Qt(h)?d(h):n(h)}function d(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||Qt(h))&&r++<63){const p=h===45?f:d;return e.consume(h),p}return n(h)}}function Be(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),a(l)):t(l)}function a(l){return Oe(l)&&i++<o?(e.consume(l),a):(e.exit(n),t(l))}}const $a={partial:!0,tokenize:xH};function xH(e,t,n){return r;function r(i){return Oe(i)?Be(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||me(i)?t(i):n(i)}}const Q2={continuation:{tokenize:kH},exit:TH,name:"blockQuote",tokenize:CH};function CH(e,t,n){const r=this;return o;function o(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function kH(e,t,n){const r=this;return o;function o(s){return Oe(s)?Be(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Q2,t,n)(s)}}function TH(e){e.exit("blockQuote")}const X2={name:"characterEscape",tokenize:wH};function wH(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return a7(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Z2={name:"characterReference",tokenize:SH};function SH(e,t,n){const r=this;let o=0,i,s;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=Qt,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=s7,u):(e.enter("characterReferenceValue"),i=7,s=Dh,u(d))}function u(d){if(d===59&&o){const f=e.exit("characterReferenceValue");return s===Qt&&!Mm(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(d)&&o++<i?(e.consume(d),u):n(d)}}const Bb={partial:!0,tokenize:AH},Fb={concrete:!0,name:"codeFenced",tokenize:vH};function vH(e,t,n){const r=this,o={partial:!0,tokenize:M};let i=0,s=0,a;return l;function l(A){return c(A)}function c(A){const D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(A)}function u(A){return A===a?(s++,e.consume(A),u):s<3?n(A):(e.exit("codeFencedFenceSequence"),Oe(A)?Be(e,d,"whitespace")(A):d(A))}function d(A){return A===null||me(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Bb,g,O)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(A))}function f(A){return A===null||me(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(A)):Oe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(e,h,"whitespace")(A)):A===96&&A===a?n(A):(e.consume(A),f)}function h(A){return A===null||me(A)?d(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(A))}function p(A){return A===null||me(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(A)):A===96&&A===a?n(A):(e.consume(A),p)}function g(A){return e.attempt(o,O,y)(A)}function y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),b}function b(A){return i>0&&Oe(A)?Be(e,x,"linePrefix",i+1)(A):x(A)}function x(A){return A===null||me(A)?e.check(Bb,g,O)(A):(e.enter("codeFlowValue"),k(A))}function k(A){return A===null||me(A)?(e.exit("codeFlowValue"),x(A)):(e.consume(A),k)}function O(A){return e.exit("codeFenced"),t(A)}function M(A,D,z){let Y=0;return N;function N(H){return A.enter("lineEnding"),A.consume(H),A.exit("lineEnding"),K}function K(H){return A.enter("codeFencedFence"),Oe(H)?Be(A,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):F(H)}function F(H){return H===a?(A.enter("codeFencedFenceSequence"),q(H)):z(H)}function q(H){return H===a?(Y++,A.consume(H),q):Y>=s?(A.exit("codeFencedFenceSequence"),Oe(H)?Be(A,L,"whitespace")(H):L(H)):z(H)}function L(H){return H===null||me(H)?(A.exit("codeFencedFence"),D(H)):z(H)}}}function AH(e,t,n){const r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const uf={name:"codeIndented",tokenize:IH},NH={partial:!0,tokenize:MH};function IH(e,t,n){const r=this;return o;function o(c){return e.enter("codeIndented"),Be(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):me(c)?e.attempt(NH,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||me(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function MH(e,t,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):Be(e,i,"linePrefix",5)(s)}function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):me(s)?o(s):n(s)}}const _H={name:"codeText",previous:RH,resolve:OH,tokenize:LH};function OH(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function RH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function LH(e,t,n){let r=0,o,i;return s;function s(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),o=0,u(d)):me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||me(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),o++,u):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class DH{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Ts(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ts(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ts(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ts(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ts(this.left,n.reverse())}}}function Ts(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function J2(e){const t={};let n=-1,r,o,i,s,a,l,c;const u=new DH(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,PH(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=u.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(r[1].end={...u.get(o)[1].start},a=u.slice(o,n),a.unshift(r),u.splice(o,n-o+1,a))}}return _n(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function PH(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,d,f=-1,h=n,p=0,g=0;const y=[g];for(;h;){for(;e.get(++o)[1]!==h;);i.push(o),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),d&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,y.push(g),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):y.pop(),f=y.length;f--;){const b=a.slice(y[f],y[f+1]),x=i.pop();l.push([x,x+b.length-1]),e.splice(x,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const BH={resolve:HH,tokenize:UH},FH={partial:!0,tokenize:VH};function HH(e){return J2(e),e}function UH(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):me(a)?e.check(FH,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function VH(e,t,n){const r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Be(e,i,"linePrefix")}function i(s){if(s===null||me(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function ew(e,t,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||_c(b)?n(b):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===62?(e.exit("chunkString"),e.exit(a),f(b)):b===null||b===60||me(b)?n(b):(e.consume(b),b===92?p:h)}function p(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function g(b){return!u&&(b===null||b===41||Ze(b))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,g):b===41?(e.consume(b),u--,g):b===null||b===32||b===40||_c(b)?n(b):(e.consume(b),b===92?y:g)}function y(b){return b===40||b===41||b===92?(e.consume(b),g):g(b)}}function tw(e,t,n,r,o,i){const s=this;let a=0,l;return c;function c(h){return e.enter(r),e.enter(o),e.consume(h),e.exit(o),e.enter(i),u}function u(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):me(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||me(h)||a++>999?(e.exit("chunkString"),u(h)):(e.consume(h),l||(l=!Oe(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}}function nw(e,t,n,r,o,i){let s;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(o),e.consume(f),e.exit(o),s=f===40?41:f,l):n(f)}function l(f){return f===s?(e.enter(o),e.consume(f),e.exit(o),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===s?(e.exit(i),l(s)):f===null?n(f):me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Be(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===s||f===null||me(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===s||f===92?(e.consume(f),u):u(f)}}function Zs(e,t){let n;return r;function r(o){return me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Oe(o)?Be(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const $H={name:"definition",tokenize:zH},jH={partial:!0,tokenize:WH};function zH(e,t,n){const r=this;let o;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return tw.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return o=or(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return Ze(h)?Zs(e,c)(h):c(h)}function c(h){return ew(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(jH,d,d)(h)}function d(h){return Oe(h)?Be(e,f,"whitespace")(h):f(h)}function f(h){return h===null||me(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):n(h)}}function WH(e,t,n){return r;function r(a){return Ze(a)?Zs(e,o)(a):n(a)}function o(a){return nw(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Oe(a)?Be(e,s,"whitespace")(a):s(a)}function s(a){return a===null||me(a)?t(a):n(a)}}const qH={name:"hardBreakEscape",tokenize:GH};function GH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return me(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const YH={name:"headingAtx",resolve:KH,tokenize:QH};function KH(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},_n(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function QH(e,t,n){let r=0;return o;function o(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||Ze(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||me(u)?(e.exit("atxHeading"),t(u)):Oe(u)?Be(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ze(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const XH=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hb=["pre","script","style","textarea"],ZH={concrete:!0,name:"htmlFlow",resolveTo:tU,tokenize:nU},JH={partial:!0,tokenize:oU},eU={partial:!0,tokenize:rU};function tU(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function nU(e,t,n){const r=this;let o,i,s,a,l;return c;function c(v){return u(v)}function u(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),d}function d(v){return v===33?(e.consume(v),f):v===47?(e.consume(v),i=!0,g):v===63?(e.consume(v),o=3,r.interrupt?t:S):on(v)?(e.consume(v),s=String.fromCharCode(v),y):n(v)}function f(v){return v===45?(e.consume(v),o=2,h):v===91?(e.consume(v),o=5,a=0,p):on(v)?(e.consume(v),o=4,r.interrupt?t:S):n(v)}function h(v){return v===45?(e.consume(v),r.interrupt?t:S):n(v)}function p(v){const ze="CDATA[";return v===ze.charCodeAt(a++)?(e.consume(v),a===ze.length?r.interrupt?t:F:p):n(v)}function g(v){return on(v)?(e.consume(v),s=String.fromCharCode(v),y):n(v)}function y(v){if(v===null||v===47||v===62||Ze(v)){const ze=v===47,ve=s.toLowerCase();return!ze&&!i&&Hb.includes(ve)?(o=1,r.interrupt?t(v):F(v)):XH.includes(s.toLowerCase())?(o=6,ze?(e.consume(v),b):r.interrupt?t(v):F(v)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(v):i?x(v):k(v))}return v===45||Qt(v)?(e.consume(v),s+=String.fromCharCode(v),y):n(v)}function b(v){return v===62?(e.consume(v),r.interrupt?t:F):n(v)}function x(v){return Oe(v)?(e.consume(v),x):N(v)}function k(v){return v===47?(e.consume(v),N):v===58||v===95||on(v)?(e.consume(v),O):Oe(v)?(e.consume(v),k):N(v)}function O(v){return v===45||v===46||v===58||v===95||Qt(v)?(e.consume(v),O):M(v)}function M(v){return v===61?(e.consume(v),A):Oe(v)?(e.consume(v),M):k(v)}function A(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),l=v,D):Oe(v)?(e.consume(v),A):z(v)}function D(v){return v===l?(e.consume(v),l=null,Y):v===null||me(v)?n(v):(e.consume(v),D)}function z(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||Ze(v)?M(v):(e.consume(v),z)}function Y(v){return v===47||v===62||Oe(v)?k(v):n(v)}function N(v){return v===62?(e.consume(v),K):n(v)}function K(v){return v===null||me(v)?F(v):Oe(v)?(e.consume(v),K):n(v)}function F(v){return v===45&&o===2?(e.consume(v),re):v===60&&o===1?(e.consume(v),W):v===62&&o===4?(e.consume(v),ye):v===63&&o===3?(e.consume(v),S):v===93&&o===5?(e.consume(v),te):me(v)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(JH,pe,q)(v)):v===null||me(v)?(e.exit("htmlFlowData"),q(v)):(e.consume(v),F)}function q(v){return e.check(eU,L,pe)(v)}function L(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),H}function H(v){return v===null||me(v)?q(v):(e.enter("htmlFlowData"),F(v))}function re(v){return v===45?(e.consume(v),S):F(v)}function W(v){return v===47?(e.consume(v),s="",G):F(v)}function G(v){if(v===62){const ze=s.toLowerCase();return Hb.includes(ze)?(e.consume(v),ye):F(v)}return on(v)&&s.length<8?(e.consume(v),s+=String.fromCharCode(v),G):F(v)}function te(v){return v===93?(e.consume(v),S):F(v)}function S(v){return v===62?(e.consume(v),ye):v===45&&o===2?(e.consume(v),S):F(v)}function ye(v){return v===null||me(v)?(e.exit("htmlFlowData"),pe(v)):(e.consume(v),ye)}function pe(v){return e.exit("htmlFlow"),t(v)}}function rU(e,t,n){const r=this;return o;function o(s){return me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function oU(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt($a,t,n)}}const iU={name:"htmlText",tokenize:sU};function sU(e,t,n){const r=this;let o,i,s;return a;function a(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),l}function l(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),M):S===63?(e.consume(S),k):on(S)?(e.consume(S),z):n(S)}function c(S){return S===45?(e.consume(S),u):S===91?(e.consume(S),i=0,p):on(S)?(e.consume(S),x):n(S)}function u(S){return S===45?(e.consume(S),h):n(S)}function d(S){return S===null?n(S):S===45?(e.consume(S),f):me(S)?(s=d,W(S)):(e.consume(S),d)}function f(S){return S===45?(e.consume(S),h):d(S)}function h(S){return S===62?re(S):S===45?f(S):d(S)}function p(S){const ye="CDATA[";return S===ye.charCodeAt(i++)?(e.consume(S),i===ye.length?g:p):n(S)}function g(S){return S===null?n(S):S===93?(e.consume(S),y):me(S)?(s=g,W(S)):(e.consume(S),g)}function y(S){return S===93?(e.consume(S),b):g(S)}function b(S){return S===62?re(S):S===93?(e.consume(S),b):g(S)}function x(S){return S===null||S===62?re(S):me(S)?(s=x,W(S)):(e.consume(S),x)}function k(S){return S===null?n(S):S===63?(e.consume(S),O):me(S)?(s=k,W(S)):(e.consume(S),k)}function O(S){return S===62?re(S):k(S)}function M(S){return on(S)?(e.consume(S),A):n(S)}function A(S){return S===45||Qt(S)?(e.consume(S),A):D(S)}function D(S){return me(S)?(s=D,W(S)):Oe(S)?(e.consume(S),D):re(S)}function z(S){return S===45||Qt(S)?(e.consume(S),z):S===47||S===62||Ze(S)?Y(S):n(S)}function Y(S){return S===47?(e.consume(S),re):S===58||S===95||on(S)?(e.consume(S),N):me(S)?(s=Y,W(S)):Oe(S)?(e.consume(S),Y):re(S)}function N(S){return S===45||S===46||S===58||S===95||Qt(S)?(e.consume(S),N):K(S)}function K(S){return S===61?(e.consume(S),F):me(S)?(s=K,W(S)):Oe(S)?(e.consume(S),K):Y(S)}function F(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),o=S,q):me(S)?(s=F,W(S)):Oe(S)?(e.consume(S),F):(e.consume(S),L)}function q(S){return S===o?(e.consume(S),o=void 0,H):S===null?n(S):me(S)?(s=q,W(S)):(e.consume(S),q)}function L(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Ze(S)?Y(S):(e.consume(S),L)}function H(S){return S===47||S===62||Ze(S)?Y(S):n(S)}function re(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function W(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),G}function G(S){return Oe(S)?Be(e,te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):te(S)}function te(S){return e.enter("htmlTextData"),s(S)}}const Om={name:"labelEnd",resolveAll:uU,resolveTo:dU,tokenize:fU},aU={tokenize:hU},lU={tokenize:pU},cU={tokenize:mU};function uU(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&_n(e,0,e.length,n),e}function dU(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Un(a,e.slice(i+1,i+r+3)),a=Un(a,[["enter",u,t]]),a=Un(a,nd(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=Un(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Un(a,e.slice(s+1)),a=Un(a,[["exit",l,t]]),_n(e,i,e.length,a),e}function fU(e,t,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(f){return i?i._inactive?d(f):(s=r.parser.defined.includes(or(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(aU,u,s?u:d)(f):f===91?e.attempt(lU,u,s?c:d)(f):s?u(f):d(f)}function c(f){return e.attempt(cU,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function hU(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),o}function o(d){return Ze(d)?Zs(e,i)(d):i(d)}function i(d){return d===41?u(d):ew(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Ze(d)?Zs(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?nw(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Ze(d)?Zs(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function pU(e,t,n){const r=this;return o;function o(a){return tw.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(or(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function mU(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const gU={name:"labelStartImage",resolveAll:Om.resolveAll,tokenize:bU};function bU(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const yU={name:"labelStartLink",resolveAll:Om.resolveAll,tokenize:EU};function EU(e,t,n){const r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const df={name:"lineEnding",tokenize:xU};function xU(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const Vl={name:"thematicBreak",tokenize:CU};function CU(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||me(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===o?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Oe(c)?Be(e,a,"whitespace")(c):a(c))}}const fn={continuation:{tokenize:SU},exit:AU,name:"list",tokenize:wU},kU={partial:!0,tokenize:NU},TU={partial:!0,tokenize:vU};function wU(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(h){const p=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Dh(h)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Vl,n,c)(h):c(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Dh(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),c(h)):n(h)}function c(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check($a,r.interrupt?n:u,e.attempt(kU,f,d))}function u(h){return r.containerState.initialBlankLine=!0,i++,f(h)}function d(h){return Oe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function SU(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check($a,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Be(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Oe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(TU,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Be(e,e.attempt(fn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function vU(e,t,n){const r=this;return Be(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function AU(e){e.exit(this.containerState.type)}function NU(e,t,n){const r=this;return Be(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Ub={name:"setextUnderline",resolveTo:IU,tokenize:MU};function IU(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function MU(e,t,n){const r=this;let o;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),o=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Oe(c)?Be(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||me(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const _U={tokenize:HU,partial:!0};function OU(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:PU,continuation:{tokenize:BU},exit:FU}},text:{91:{name:"gfmFootnoteCall",tokenize:DU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:RU,resolveTo:LU}}}}function RU(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!s||!s._balanced)return n(l);const c=or(r.sliceSerialize({start:s.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function LU(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function DU(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!s||d===null||d===91||Ze(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(or(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Ze(d)||(s=!0),i++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),i++,c):c(d)}}function PU(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(p)}function u(p){if(s>999||p===93&&!a||p===null||p===91||Ze(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=or(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ze(p)||(a=!0),s++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),o.includes(i)||o.push(i),Be(e,h,"gfmFootnoteDefinitionWhitespace")):n(p)}function h(p){return t(p)}}function BU(e,t,n){return e.check($a,t,e.attempt(_U,t,n))}function FU(e){e.exit("gfmFootnoteDefinition")}function HU(e,t,n){const r=this;return Be(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):n(i)}}function UU(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,a){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let c=l;for(;c--;)if(s[c][0]==="exit"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[c][1].end.offset-s[c][1].start.offset){s[l][1].type="strikethroughSequence",s[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},s[c][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[c][1].end),end:Object.assign({},s[l][1].start)},f=[["enter",u,a],["enter",s[c][1],a],["exit",s[c][1],a],["enter",d,a]],h=a.parser.constructs.insideSpan.null;h&&_n(f,f.length,0,nd(h,s.slice(c+1,l),a)),_n(f,f.length,0,[["exit",d,a],["enter",s[l][1],a],["exit",s[l][1],a],["exit",u,a]]),_n(s,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function i(s,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(s.enter("strikethroughSequenceTemporary"),h(p))}function h(p){const g=us(c);if(p===126)return d>1?l(p):(s.consume(p),d++,h);if(d<2&&!n)return l(p);const y=s.exit("strikethroughSequenceTemporary"),b=us(p);return y._open=!b||b===2&&!!g,y._close=!g||g===2&&!!b,a(p)}}}class VU{constructor(){this.map=[]}add(t,n,r){$U(this,t,n,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function $U(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function jU(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function zU(){return{flow:{null:{name:"table",tokenize:WU,resolveAll:qU}}}}function WU(e,t,n){const r=this;let o=0,i=0,s;return a;function a(N){let K=r.events.length-1;for(;K>-1;){const L=r.events[K][1].type;if(L==="lineEnding"||L==="linePrefix")K--;else break}const F=K>-1?r.events[K][1].type:null,q=F==="tableHead"||F==="tableRow"?A:l;return q===A&&r.parser.lazy[r.now().line]?n(N):q(N)}function l(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(s=!0,i+=1),u(N)}function u(N){return N===null?n(N):me(N)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),h):n(N):Oe(N)?Be(e,u,"whitespace")(N):(i+=1,s&&(s=!1,o+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),s=!0,u):(e.enter("data"),d(N)))}function d(N){return N===null||N===124||Ze(N)?(e.exit("data"),u(N)):(e.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(e.consume(N),d):d(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),s=!1,Oe(N)?Be(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):p(N))}function p(N){return N===45||N===58?y(N):N===124?(s=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),g):M(N)}function g(N){return Oe(N)?Be(e,y,"whitespace")(N):y(N)}function y(N){return N===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):N===45?(i+=1,b(N)):N===null||me(N)?O(N):M(N)}function b(N){return N===45?(e.enter("tableDelimiterFiller"),x(N)):M(N)}function x(N){return N===45?(e.consume(N),x):N===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(N))}function k(N){return Oe(N)?Be(e,O,"whitespace")(N):O(N)}function O(N){return N===124?p(N):N===null||me(N)?!s||o!==i?M(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):M(N)}function M(N){return n(N)}function A(N){return e.enter("tableRow"),D(N)}function D(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),D):N===null||me(N)?(e.exit("tableRow"),t(N)):Oe(N)?Be(e,D,"whitespace")(N):(e.enter("data"),z(N))}function z(N){return N===null||N===124||Ze(N)?(e.exit("data"),D(N)):(e.consume(N),N===92?Y:z)}function Y(N){return N===92||N===124?(e.consume(N),z):z(N)}}function qU(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,c,u,d;const f=new VU;for(;++n<e.length;){const h=e[n],p=h[1];h[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(Vb(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],s=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,t]])),o=p.type==="tableDelimiterRow"?2:u?3:1):o&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],d=gl(f,t,i,o,void 0,d),i=[0,0,0,0]),s[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],d=gl(f,t,i,o,void 0,d)),i=s,s=[i[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(s[0]=s[1],d=gl(f,t,i,o,n,d)):s[1]!==0&&(d=gl(f,t,s,o,n,d)),o=0):o&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(s[3]=n)}for(l!==0&&Vb(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=jU(t.events,n))}return e}function gl(e,t,n,r,o,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Di(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Di(t.events,n[1]);if(i={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Di(t.events,n[2]),u=Di(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],h=t.events[n[3]];if(f[1].end=Object.assign({},h[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;e.add(p,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return o!==void 0&&(i.end=Object.assign({},Di(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function Vb(e,t,n,r,o){const i=[],s=Di(t.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Di(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const GU={name:"tasklistCheck",tokenize:KU};function YU(){return{text:{91:GU}}}function KU(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ze(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return me(l)?t(l):Oe(l)?e.check({tokenize:QU},t,n)(l):n(l)}}function QU(e,t,n){return Be(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function XU(e){return V2([aH(),OU(),UU(e),zU(),YU()])}const ZU={};function rw(e){const t=this,n=e||ZU,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(XU(n)),i.push(tH()),s.push(nH(n))}function JU(e){const t=this;t.compiler=n;function n(r){return BF(r,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function $b(e){if(e)throw e}var ff,jb;function eV(){if(jb)return ff;jb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},s=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return ff=function l(){var c,u,d,f,h,p,g=arguments[0],y=1,b=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},y=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});y<b;++y)if(c=arguments[y],c!=null)for(u in c)d=a(g,u),f=a(c,u),g!==f&&(x&&f&&(i(f)||(h=o(f)))?(h?(h=!1,p=d&&o(d)?d:[]):p=d&&i(d)?d:{},s(g,{name:u,newValue:l(x,p,f)})):typeof f<"u"&&s(g,{name:u,newValue:f}));return g},ff}var tV=eV();const hf=cp(tV);function Hh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function nV(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(l,...c){const u=e[++i];let d=-1;if(l){s(l);return}for(;++d<o.length;)(c[d]===null||c[d]===void 0)&&(c[d]=o[d]);o=c,u?rV(u,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function rV(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(o);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return o(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}const oV=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),iV={}.hasOwnProperty;class Rm extends oV{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=nV()}copy(){const t=new Rm;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(gf("data",this.frozen),this.namespace[t]=n,this):iV.call(this.namespace,t)&&this.namespace[t]||void 0:t?(gf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=bl(t),r=this.parser||this.Parser;return pf("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),pf("process",this.parser||this.Parser),mf("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const a=bl(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const h=d,p=r.stringify(h,f);aV(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?s(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),pf("processSync",this.parser||this.Parser),mf("processSync",this.compiler||this.Compiler),this.process(t,o),Wb("processSync","process",n),r;function o(i,s){n=!0,$b(i),r=s}}run(t,n,r){zb(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){const l=bl(n);o.run(t,l,c);function c(u,d,f){const h=d||t;u?a(u):s?s(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),Wb("runSync","run",r),o;function i(s,a){$b(s),o=a,r=!0}}stringify(t,n){this.freeze();const r=bl(n),o=this.compiler||this.Compiler;return mf("stringify",o),zb(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(gf("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(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");a(c.plugins),c.settings&&(o.settings=hf(!0,o.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[h,...p]=u;const g=r[f][1];Hh(g)&&Hh(h)&&(h=hf(!0,g,h)),r[f]=[c,h,...p]}}}}const ow=new Rm().freeze();function pf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function mf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function gf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zb(e){if(!Hh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Wb(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bl(e){return sV(e)?e:new Rh(e)}function sV(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function aV(e){return typeof e=="string"||lV(e)}function lV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}function cV(e,t){return iw(e,{})||{type:"root",children:[]}}function iw(e,t){const n=uV(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function uV(e,t){switch(e.nodeType){case 1:return pV(e,t);case 3:return fV(e);case 8:return hV(e);case 9:return qb(e,t);case 10:return dV();case 11:return qb(e,t);default:return}}function qb(e,t){return{type:"root",children:sw(e,t)}}function dV(){return{type:"doctype"}}function fV(e){return{type:"text",value:e.nodeValue||""}}function hV(e){return{type:"comment",value:e.nodeValue||""}}function pV(e,t){const n=e.namespaceURI,r=n===Fl.svg?pT:hT,o=n===Fl.html?e.tagName.toLowerCase():e.tagName,i=n===Fl.html&&o==="template"?e.content:e,s=e.getAttributeNames(),a={};let l=-1;for(;++l<s.length;)a[s[l]]=e.getAttribute(s[l])||"";return r(o,a,sw(i,t))}function sw(e,t){const n=e.childNodes,r=[];let o=-1;for(;++o<n.length;){const i=iw(n[o],t);i!==void 0&&r.push(i)}return r}function aw(e){let t=Array.from(e.classList).filter(n=>!n.startsWith("bn-"))||[];t.length>0?e.className=t.join(" "):e.removeAttribute("class")}function lw(e,t,n,r){let o;if(!t)throw Error("blockContent is required");if(typeof t=="string")o=ir([t],e.pmSchema);else if(Array.isArray(t))o=ir(t,e.pmSchema);else if(t.type==="tableContent")o=Uu(t,e.pmSchema);else throw new Tr(t.type);let i=(r?.document??document).createDocumentFragment();for(let s of o)if(s.type.name!=="text"&&e.schema.inlineContentSchema[s.type.name]){let a=e.schema.inlineContentSpecs[s.type.name].implementation;if(a){let l=rm(s,e.schema.inlineContentSchema,e.schema.styleSchema),c=a.toExternalHTML?a.toExternalHTML(l,e):a.render.call({renderType:"dom",props:void 0},l,()=>{},e);if(c){if(i.appendChild(c.dom),c.contentDOM){let u=n.serializeFragment(s.content,r);c.contentDOM.dataset.editable="",c.contentDOM.appendChild(u)}continue}}}else if(s.type.name==="text"){let a=document.createTextNode(s.textContent);for(let l of s.marks.toReversed())if(l.type.name in e.schema.styleSpecs){let c=(e.schema.styleSpecs[l.type.name].implementation.toExternalHTML??e.schema.styleSpecs[l.type.name].implementation.render)(l.attrs.stringValue,e);c.contentDOM.appendChild(a),a=c.dom}else{let c=l.type.spec.toDOM(l,!0),u=On.renderSpec(document,c);u.contentDOM.appendChild(a),a=u.dom}i.appendChild(a)}else{let a=n.serializeFragment(j.from([s]),r);i.appendChild(a)}return i.childNodes.length===1&&i.firstChild?.nodeType===1&&aw(i.firstChild),i}function mV(e,t,n,r,o,i,s,a){let l=a?.document??document,c=t.pmSchema.nodes.blockContainer,u=n.props||{};for(let[b,x]of Object.entries(t.schema.blockSchema[n.type].propSchema))!(b in u)&&x.default!==void 0&&(u[b]=x.default);let d=c.spec?.toDOM?.(c.create({id:n.id,...u})),f=Array.from(d.dom.attributes),h=t.blockImplementations[n.type].implementation,p=h.toExternalHTML?.call({},{...n,props:u},t,{nestingLevel:s})||h.render.call({},{...n,props:u},t),g=l.createDocumentFragment();if(p.dom.classList.contains("bn-block-content")){let b=[...f,...Array.from(p.dom.attributes)].filter(x=>x.name.startsWith("data")&&x.name!=="data-content-type"&&x.name!=="data-file-block"&&x.name!=="data-node-view-wrapper"&&x.name!=="data-node-type"&&x.name!=="data-id"&&x.name!=="data-editable");for(let x of b)p.dom.firstChild.setAttribute(x.name,x.value);aw(p.dom.firstChild),s>0&&p.dom.firstChild.setAttribute("data-nesting-level",s.toString()),g.append(...Array.from(p.dom.childNodes))}else g.append(p.dom),s>0&&p.dom.setAttribute("data-nesting-level",s.toString());if(p.contentDOM&&n.content){let b=lw(t,n.content,r,a);p.contentDOM.appendChild(b)}let y;if(o.has(n.type)?y="OL":i.has(n.type)&&(y="UL"),y){if(e.lastChild?.nodeName!==y){let b=l.createElement(y);y==="OL"&&"start"in u&&u.start&&u?.start!==1&&b.setAttribute("start",u.start+""),e.append(b)}e.lastChild.appendChild(g)}else e.append(g);if(n.children&&n.children.length>0){let b=l.createDocumentFragment();if(cw(b,t,n.children,r,o,i,s+1,a),e.lastChild?.nodeName==="UL"||e.lastChild?.nodeName==="OL")for(;b.firstChild?.nodeName==="UL"||b.firstChild?.nodeName==="OL";)e.lastChild.lastChild.appendChild(b.firstChild);"childrenDOM"in p&&p.childrenDOM?p.childrenDOM.append(b):t.pmSchema.nodes[n.type].isInGroup("blockContent")?e.append(b):p.contentDOM?.append(b)}}var cw=(e,t,n,r,o,i,s=0,a)=>{for(let l of n)mV(e,t,l,r,o,i,s,a)},gV=(e,t,n,r,o,i)=>{let s=(i?.document??document).createDocumentFragment();return cw(s,e,t,n,r,o,0,i),s},rd=(e,t)=>{let n=On.fromSchema(e);return{exportBlocks:(r,o)=>{let i=gV(t,r,n,new Set(["numberedListItem"]),new Set(["bulletListItem","checkListItem","toggleListItem"]),o),s=document.createElement("div");return s.append(i),s.innerHTML},exportInlineContent:(r,o)=>{let i=lw(t,r,n,o),s=document.createElement("div");return s.append(i.cloneNode(!0)),s.innerHTML}}};function bV(e,t){if(t===0)return;let n=e.resolve(t);for(let r=n.depth;r>0;r--){let o=n.node(r);if(im(o))return o.attrs.id}}function yV(e){return e.getMeta("paste")?{type:"paste"}:e.getMeta("uiEvent")==="drop"?{type:"drop"}:e.getMeta("history$")?{type:e.getMeta("history$").redo?"redo":"undo"}:e.getMeta("y-sync$")?e.getMeta("y-sync$").isUndoRedoOperation?{type:"undo-redo"}:{type:"yjs-remote"}:{type:"local"}}function Gb(e){let t={},n={},r=kt(e);return e.descendants((o,i)=>{if(!im(o))return!0;let s=bV(e,i),a=s??"__root__";n[a]||(n[a]=[]);let l=pt(o,r);return t[o.attrs.id]={block:l,parentId:s},n[a].push(o.attrs.id),!0}),{byId:t,childrenByParent:n}}function EV(e,t){let n=new Set;if(!e||!t)return n;let r=new Set(e),o=t.filter(g=>r.has(g)),i=e.filter(g=>o.includes(g));if(i.length<=1||o.length<=1)return n;let s={};for(let g=0;g<i.length;g++)s[i[g]]=g;let a=o.map(g=>s[g]),l=a.length,c=[],u=[],d=Array(l).fill(-1),f=(g,y)=>{let b=0,x=g.length;for(;b<x;){let k=b+x>>>1;g[k]<y?b=k+1:x=k}return b};for(let g=0;g<l;g++){let y=a[g],b=f(c,y);b>0&&(d[g]=u[b-1]),b===c.length?(c.push(y),u.push(g)):(c[b]=y,u[b]=g)}let h=new Set,p=u[u.length-1]??-1;for(;p!==-1;)h.add(p),p=d[p];for(let g=0;g<o.length;g++)h.has(g)||n.add(o[g]);return n}function uw(e,t=[]){let n=yV(e),r=Lu(e.before,[e,...t]),o=Gb(r.before),i=Gb(r.doc),s=[],a=new Set;Object.keys(i.byId).filter(f=>!(f in o.byId)).forEach(f=>{s.push({type:"insert",block:i.byId[f].block,source:n,prevBlock:void 0}),a.add(f)}),Object.keys(o.byId).filter(f=>!(f in i.byId)).forEach(f=>{s.push({type:"delete",block:o.byId[f].block,source:n,prevBlock:void 0}),a.add(f)}),Object.keys(i.byId).filter(f=>f in o.byId).forEach(f=>{let h=o.byId[f],p=i.byId[f];h.parentId===p.parentId?J6({...h.block,children:void 0},{...p.block,children:void 0})||(s.push({type:"update",block:p.block,prevBlock:h.block,source:n}),a.add(f)):(s.push({type:"move",block:p.block,prevBlock:h.block,source:n,prevParent:h.parentId?o.byId[h.parentId]?.block:void 0,currentParent:p.parentId?i.byId[p.parentId]?.block:void 0}),a.add(f))});let l=o.childrenByParent,c=i.childrenByParent,u=new Set([...Object.keys(l),...Object.keys(c)]),d=new Set;return u.forEach(f=>{let h=EV(l[f],c[f]);h.size!==0&&h.forEach(p=>{let g=o.byId[p],y=i.byId[p];!g||!y||g.parentId===y.parentId&&(a.has(p)||(g.parentId??"__root__")===f&&(d.has(p)||(d.add(p),s.push({type:"move",block:y.block,prevBlock:g.block,source:n,prevParent:g.parentId?o.byId[g.parentId]?.block:void 0,currentParent:y.parentId?i.byId[y.parentId]?.block:void 0}),a.add(p))))})}),s}var dw=Ve(()=>{let e=[];return{key:"blockChange",prosemirrorPlugins:[new Ae({key:new $e("blockChange"),filterTransaction:t=>{let n;return e.reduce((r,o)=>r===!1?r:o({getChanges(){return n||(n=uw(t),n)},tr:t})!==!1,!0)}})],subscribe(t){return e.push(t),()=>{e.splice(e.indexOf(t),1)}}}});function Yb(e){let t=e.charAt(0)==="#"?e.substring(1,7):e,n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),o=parseInt(t.substring(4,6),16),i=[n/255,r/255,o/255].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*i[0]+.7152*i[1]+.0722*i[2]<=.179}function xV(e){let t=document.createElement("span");t.classList.add("bn-collaboration-cursor__base");let n=document.createElement("span");n.setAttribute("contentedEditable","false"),n.classList.add("bn-collaboration-cursor__caret"),n.setAttribute("style",`background-color: ${e.color}; color: ${Yb(e.color)?"white":"black"}`);let r=document.createElement("span");return r.classList.add("bn-collaboration-cursor__label"),r.setAttribute("style",`background-color: ${e.color}; color: ${Yb(e.color)?"white":"black"}`),r.insertBefore(document.createTextNode(e.name),null),n.insertBefore(r,null),t.insertBefore(document.createTextNode("⁠"),null),t.insertBefore(n,null),t.insertBefore(document.createTextNode("⁠"),null),t}var Uh=Ve(({options:e})=>{let t=new Map,n=e.provider&&"awareness"in e.provider&&typeof e.provider.awareness=="object"?e.provider.awareness:void 0;return n&&("setLocalStateField"in n&&typeof n.setLocalStateField=="function"&&n.setLocalStateField("user",e.user),"on"in n&&typeof n.on=="function"&&e.showCursorLabels!=="always"&&n.on("change",({updated:r})=>{for(let o of r){let i=t.get(o);i&&(setTimeout(()=>{i.element.setAttribute("data-active","")},10),i.hideTimeout&&clearTimeout(i.hideTimeout),t.set(o,{element:i.element,hideTimeout:setTimeout(()=>{i.element.removeAttribute("data-active")},2e3)}))}})),{key:"yCursor",prosemirrorPlugins:[n?LL(n,{selectionBuilder:Nk,cursorBuilder(r,o){let i=t.get(o);if(!i){let s=(e.renderCursor??xV)(r);e.showCursorLabels!=="always"&&(s.addEventListener("mouseenter",()=>{let a=t.get(o);a.element.setAttribute("data-active",""),a.hideTimeout&&(clearTimeout(a.hideTimeout),t.set(o,{element:a.element,hideTimeout:void 0}))}),s.addEventListener("mouseleave",()=>{let a=t.get(o);t.set(o,{element:a.element,hideTimeout:setTimeout(()=>{a.element.removeAttribute("data-active")},2e3)})})),i={element:s,hideTimeout:void 0},t.set(o,i)}return i.element}}):void 0].filter(Boolean),dependsOn:["ySync"],updateUser(r){n?.setLocalStateField("user",r)}}}),$l=Ve(({options:e})=>({key:"ySync",prosemirrorPlugins:[yL(e.fragment)],runsBefore:["default"]})),jl=Ve(()=>({key:"yUndo",prosemirrorPlugins:[VL()],dependsOn:["yCursor","ySync"],undoCommand:BL,redoCommand:FL}));function CV(e,t){let n=e.doc;if(e._item===null){let r=Array.from(n.share.keys()).find(o=>n.share.get(o)===e);if(r==null)throw Error("type does not exist in other ydoc");return t.get(r,e.constructor)}else{let r=e._item,o=t.store.clients.get(r.id.client)??[];return o[EE(o,r.id.clock)].content.type}}var kV=Ve(({editor:e,options:t})=>{let n,r=Po({isForked:!1});return{key:"yForkDoc",store:r,fork(){if(n)return;let o=t.fragment;if(!o)throw Error("No fragment to fork from");let i=new yE;pg(i,mg(o.doc));let s=CV(o,i);n={undoStack:yr.getState(e.prosemirrorState).undoManager.undoStack,originalFragment:o,forkedFragment:s},e.unregisterExtension([jl,Uh,$l]);let a={...t,fragment:s};e.registerExtension([$l(a),jl()]),r.setState({isForked:!0})},merge({keepChanges:o}){if(!n)return;e.unregisterExtension(["ySync","yCursor","yUndo"]);let{originalFragment:i,forkedFragment:s,undoStack:a}=n;if(e.registerExtension([$l(t),Uh(t),jl()]),yr.getState(e.prosemirrorState).undoManager.undoStack=a,o){let l=mg(s.doc,LA(i.doc));pg(i.doc,l,e)}n=void 0,r.setState({isForked:!1})}}}),fw=(e,t)=>{t(e),e.forEach(n=>{n instanceof er&&fw(n,t)})},TV=[(e,t)=>{let n=new Map;return e.forEach(r=>{r instanceof er&&fw(r,o=>{if(o.nodeName==="blockContainer"&&o.hasAttribute("id")){let i=o.getAttribute("textColor"),s=o.getAttribute("backgroundColor"),a={textColor:i===Ue.textColor.default?void 0:i,backgroundColor:s===Ue.backgroundColor.default?void 0:s};(a.textColor||a.backgroundColor)&&n.set(o.getAttribute("id"),a)}})}),n.size===0?!1:(t.doc.descendants((r,o)=>{if(r.type.name==="blockContainer"&&n.has(r.attrs.id)){let i=t.doc.nodeAt(o+1);if(!i)throw Error("No element found");t.setNodeMarkup(o+1,void 0,{...i.attrs,...n.get(r.attrs.id)})}}),!0)}],wV=Ve(({options:e})=>{let t=!1;return{key:"schemaMigration",prosemirrorPlugins:[new Ae({key:new $e("schemaMigration"),appendTransaction:(n,r,o)=>{if(t||!n.some(s=>s.getMeta("y-sync$"))||n.every(s=>!s.docChanged)||!e.fragment.firstChild)return;let i=o.tr;for(let s of TV)s(e.fragment,i);if(t=!0,i.docChanged)return i}})]}});function Kb(e,t){return!e||!t?!1:!!e.closest(`.${t}`)}function SV(e,t,n,r,o){let i=e.state.doc.resolve(t.pos);if(i.parent.inlineContent||t.orientation==="inline")return null;let s=i.nodeBefore,a=i.nodeAfter;if(!s&&!a)return null;let l=t.orientation==="block-vertical-left"||t.orientation==="block-vertical-right",c=l?t.pos:t.pos-(s?s.nodeSize:0),u=e.nodeDOM(c);if(!u)return null;let d=u.getBoundingClientRect();if(l){let p=n/2*r,g=t.orientation==="block-vertical-left"?d.left:d.right;return{left:g-p,right:g+p,top:d.top,bottom:d.bottom}}let f=s?d.bottom:d.top;s&&a&&(f=(f+e.nodeDOM(t.pos).getBoundingClientRect().top)/2);let h=n/2*o;return{left:d.left,right:d.right,top:f-h,bottom:f+h}}function vV(e,t,n,r){let o=e.coordsAtPos(t.pos),i=n/2*r;return{left:o.left-i,right:o.left+i,top:o.top,bottom:o.bottom}}function AV(e,t){e.classList.toggle("prosemirror-dropcursor-inline",t==="inline"),e.classList.toggle("prosemirror-dropcursor-block-horizontal",t==="block-horizontal"),e.classList.toggle("prosemirror-dropcursor-block-vertical-left",t==="block-vertical-left"),e.classList.toggle("prosemirror-dropcursor-block-vertical-right",t==="block-vertical-right"),e.classList.toggle("prosemirror-dropcursor-block",t==="block-horizontal"),e.classList.toggle("prosemirror-dropcursor-vertical",t==="block-vertical-left"||t==="block-vertical-right")}function NV(e){if(!e||e===document.body&&getComputedStyle(e).position==="static")return{parentLeft:-window.pageXOffset,parentTop:-window.pageYOffset};let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return{parentLeft:t.left-e.scrollLeft*n,parentTop:t.top-e.scrollTop*r}}var IV=Ve(({editor:e,options:t})=>{let n=null,r=null,o=-1,i=null,s={width:t.dropCursor?.width??5,color:t.dropCursor?.color??"#ddeeff",exclude:t.dropCursor?.exclude??"bn-drag-exclude",hooks:t.dropCursor?.hooks},a=g=>{g?.pos===n?.pos&&g?.orientation===n?.orientation||(n=g,g==null?(r&&r.parentNode&&r.parentNode.removeChild(r),r=null):l())},l=()=>{if(!n)return;let g=e.prosemirrorView,y=g.dom,b=y.getBoundingClientRect(),x=b.width/y.offsetWidth,k=b.height/y.offsetHeight,O=SV(g,n,s.width,x,k)??vV(g,n,s.width,x),M=g.dom.offsetParent;r||(r=M.appendChild(document.createElement("div")),r.style.cssText="position: absolute; z-index: 50; pointer-events: none;",s.color&&(r.style.backgroundColor=s.color)),AV(r,n.orientation);let{parentLeft:A,parentTop:D}=NV(M);r.style.left=(O.left-A)/x+"px",r.style.top=(O.top-D)/k+"px",r.style.width=(O.right-O.left)/x+"px",r.style.height=(O.bottom-O.top)/k+"px"},c=g=>{clearTimeout(o),o=window.setTimeout(()=>a(null),g)},u=g=>{let y=g;i=y.target instanceof Element?y.target:null},d=g=>{let y=g;if(i&&Kb(i,s.exclude)||y.target instanceof Element&&Kb(y.target,s.exclude))return;let b=e.prosemirrorView;if(!b.editable)return;let x=b.posAtCoords({left:y.clientX,top:y.clientY}),k=x&&x.inside>=0&&b.state.doc.nodeAt(x.inside),O=k&&k.type.spec.disableDropCursor,M=typeof O=="function"?O(b,x,y):O;if(x&&!M){let A=x.pos;if(b.dragging&&b.dragging.slice){let N=Rx(b.state.doc,A,b.dragging.slice);N!=null&&(A=N)}let D=!b.state.doc.resolve(A).parent.inlineContent,z={pos:A,orientation:D?"block-horizontal":"inline"},Y=z;if(s.hooks?.computeDropPosition){let N=s.hooks.computeDropPosition({editor:e,event:y,view:b,defaultPosition:z});if(N===null){a(null);return}Y=N}a(Y),c(5e3)}},f=g=>{let y=g;(!(y.relatedTarget instanceof Node)||!e.prosemirrorView.dom.contains(y.relatedTarget))&&a(null)},h=()=>{c(20)},p=()=>{c(20),i=null};return{key:"dropCursor",mount({signal:g,dom:y,root:b}){b.addEventListener("dragstart",u,{capture:!0,signal:g}),y.addEventListener("dragover",d,{signal:g}),y.addEventListener("dragleave",f,{signal:g}),y.addEventListener("drop",h,{signal:g}),y.addEventListener("dragend",p,{signal:g}),g.addEventListener("abort",()=>{clearTimeout(o),a(null)})}}}),Lo=Ve(({editor:e})=>{let t=Po(!1),n=()=>e.transact(r=>{if(r.selection.empty||r.selection instanceof le&&(r.selection.node.type.spec.content==="inline*"||r.selection.node.firstChild?.type.spec.content==="inline*")||r.selection instanceof se&&r.doc.textBetween(r.selection.from,r.selection.to).length===0)return!1;let o=!1;return r.selection.content().content.descendants(i=>(i.type.spec.code&&(o=!0),!o)),!o});return{key:"formattingToolbar",store:t,mount({dom:r,signal:o}){let i=!1,s=e.onChange(()=>{i||t.setState(n())}),a=e.onSelectionChange(()=>{i||t.setState(n())});r.addEventListener("pointerdown",()=>{i=!0,t.setState(!1)},{signal:o}),e.prosemirrorView.root.addEventListener("pointerup",()=>{i=!1,e.isFocused()&&t.setState(n())},{signal:o,capture:!0}),r.addEventListener("pointercancel",()=>{i=!1},{signal:o,capture:!0}),o.addEventListener("abort",()=>{s(),a()})}}}),MV=Ve(()=>({key:"history",prosemirrorPlugins:[lP()],undoCommand:rT,redoCommand:oT})),ja=Ve(({editor:e})=>{function t(o){let i=e.prosemirrorView.nodeDOM(o);for(;i&&i.parentElement;){if(i.nodeName==="A")return i;i=i.parentElement}return null}function n(o,i){return e.transact(s=>{let a=s.doc.resolve(o),l=a.marks().find(u=>u.type.name===i);if(!l)return;let c=Ou(a,l.type);if(c)return{range:c,mark:l,get text(){return s.doc.textBetween(c.from,c.to)},get position(){return Wp(e.prosemirrorView,c.from,c.to).toJSON()}}})}function r(){return e.transact(o=>{let i=o.selection;if(i.empty)return n(i.anchor,"link")})}return{key:"linkToolbar",getLinkAtSelection:r,getLinkElementAtPos:t,getMarkAtPos:n,getLinkAtElement(o){return e.transact(()=>n(e.prosemirrorView.posAtDOM(o,0)+1,"link"))},editLink(o,i,s=e.transact(a=>a.selection.anchor)){e.transact(a=>{let l=kt(a),{range:c}=n(s+1,"link")||{range:{from:a.selection.from,to:a.selection.to}};c&&(a.insertText(i,c.from,c.to),a.addMark(c.from,c.from+i.length,l.mark("link",{href:o})))}),e.prosemirrorView.focus()},deleteLink(o=e.transact(i=>i.selection.anchor)){e.transact(i=>{let s=kt(i),{range:a}=n(o+1,"link")||{range:{from:i.selection.from,to:i.selection.to}};a&&i.removeMark(a.from,a.to,s.marks.link).setMeta("preventAutolink",!0)}),e.prosemirrorView.focus()}}}),hw=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"],pw="https",_V=new $e("node-selection-keyboard"),OV=Ve(()=>({key:"nodeSelectionKeyboard",prosemirrorPlugins:[new Ae({key:_V,props:{handleKeyDown:(e,t)=>{if("node"in e.state.selection){if(t.ctrlKey||t.metaKey)return!1;if(t.key.length===1)return t.preventDefault(),!0;if(t.key==="Enter"&&!t.isComposing&&!t.shiftKey&&!t.altKey&&!t.ctrlKey&&!t.metaKey){let n=e.state.tr;return e.dispatch(n.insert(e.state.tr.selection.$to.after(),e.state.schema.nodes.paragraph.createChecked()).setSelection(new se(n.doc.resolve(e.state.tr.selection.$to.after()+1)))),!0}}return!1}}})]})),RV=new $e("blocknote-placeholder"),LV=Ve(({editor:e,options:t})=>{let n=t.placeholders;return{key:"placeholder",prosemirrorPlugins:[new Ae({key:RV,view:r=>{let o=`placeholder-selector-${hk()}`;r.dom.classList.add(o);let i=document.createElement("style"),s=e._tiptapEditor.options.injectNonce;s&&i.setAttribute("nonce",s),r.root instanceof window.ShadowRoot?r.root.append(i):r.root.head.appendChild(i);let a=i.sheet,l=(c="")=>`.${o} .bn-block-content${c}:has(.ProseMirror-trailingBreak:only-child):after`;try{let{default:c,emptyDocument:u,...d}=n||{};for(let[f,h]of Object.entries(d)){let p=`[data-content-type="${f}"]`;a.insertRule(`${l(p)} { content: ${JSON.stringify(h)}; }`)}a.insertRule(`${l("[data-is-only-empty-block]")} { content: ${JSON.stringify(u)}; }`),a.insertRule(`${l("[data-is-empty-and-focused]")} { content: ${JSON.stringify(c)}; }`)}catch(c){console.warn("Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)",c)}return{destroy:()=>{r.root instanceof window.ShadowRoot?r.root.removeChild(i):r.root.head.removeChild(i)}}},props:{decorations:r=>{let{doc:o,selection:i}=r;if(!e.isEditable||!i.empty||i.$from.parent.type.spec.code)return;let s=[];r.doc.content.size===6&&s.push(qe.node(2,4,{"data-is-only-empty-block":"true"}));let a=i.$anchor,l=a.parent;if(l.content.size===0){let c=a.before();s.push(qe.node(c,c+l.nodeSize,{"data-is-empty-and-focused":"true"}))}return _e.create(o,s)}}})]}}),Qb=new $e("previous-blocks"),DV={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},PV=Ve(()=>{let e;return{key:"previousBlockType",prosemirrorPlugins:[new Ae({key:Qb,view(t){return{update:async(n,r)=>{this.key?.getState(n.state).updatedBlocks.size>0&&(e=setTimeout(()=>{n.dispatch(n.state.tr.setMeta(Qb,{clearUpdate:!0}))},0))},destroy:()=>{e&&clearTimeout(e)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(t,n,r,o){if(n.currentTransactionOldBlockAttrs={},n.updatedBlocks.clear(),!t.docChanged)return n;let i=t.changedRange();if(!i)return n;let s=t.mapping.invert(),a={from:s.map(i.from,-1),to:s.map(i.to,1)},l={},c=yc(r.doc,a,f=>f.attrs.id),u=new Map(c.map(f=>[f.node.attrs.id,f])),d=yc(o.doc,i,f=>f.attrs.id);for(let f of d){let h=u.get(f.node.attrs.id),p=h?.node.firstChild,g=f.node.firstChild;if(h&&p&&g){let y={index:g.attrs.index,level:g.attrs.level,type:g.type.name,depth:o.doc.resolve(f.pos).depth},b={index:p.attrs.index,level:p.attrs.level,type:p.type.name,depth:r.doc.resolve(h.pos).depth};l[f.node.attrs.id]=b,n.currentTransactionOldBlockAttrs[f.node.attrs.id]=b,(b.index!==y.index||b.level!==y.level||b.type!==y.type||b.depth!==y.depth)&&(b["depth-change"]=b.depth-y.depth,n.updatedBlocks.add(f.node.attrs.id))}}return n.prevTransactionOldBlockAttrs=l,n}},props:{decorations(t){let n=this.getState(t);if(n.updatedBlocks.size===0)return;let r=[];return t.doc.descendants((o,i)=>{if(!o.attrs.id||!n.updatedBlocks.has(o.attrs.id))return;let s=n.currentTransactionOldBlockAttrs[o.attrs.id],a={};for(let[l,c]of Object.entries(s))a["data-prev-"+DV[l]]=c||"none";r.push(qe.node(i,i+o.nodeSize,{...a}))}),_e.create(t.doc,r)}}})]}});function mw(e,t){for(;e&&e.parentElement&&e.parentElement!==t.dom&&e.getAttribute?.("data-node-type")!=="blockContainer";)e=e.parentElement;if(e.getAttribute?.("data-node-type")==="blockContainer")return{node:e,id:e.getAttribute("data-id")}}function BV(){let e=t=>{let n=t.children.length;for(let r=0;r<n;r++){let o=t.children[r];if(o.type==="element"&&(e(o),o.tagName==="u"))if(o.children.length>0){t.children.splice(r,1,...o.children);let i=o.children.length-1;n+=i,r+=i}else t.children.splice(r,1),n--,r--}};return e}function FV(){let e=t=>{if(t.children&&"length"in t.children&&t.children.length)for(let n=t.children.length-1;n>=0;n--){let r=t.children[n],o=n+1<t.children.length?t.children[n+1]:void 0;r.type==="element"&&r.tagName==="input"&&r.properties?.type==="checkbox"&&o?.type==="element"&&o.tagName==="p"?(o.tagName="span",o.children.splice(0,0,cV(document.createTextNode(" ")))):e(r)}};return e}function HV(){return e=>{gi(e,"element",(t,n,r)=>{if(r&&t.tagName==="video"){let o=t.properties?.src||t.properties?.["data-url"]||"",i=t.properties?.title||t.properties?.["data-name"]||"";r.children[n]={type:"text",value:`![${i}](${o})`}}})}}function Lm(e){return ow().use(N8,{fragment:!0}).use(HV).use(BV).use(FV).use(o7).use(rw).use(JU,{handlers:{text:t=>t.value}}).processSync(e).value}function UV(e,t,n,r){return Lm(rd(t,n).exportBlocks(e,r))}function gw(e){let t=[];return e.descendants(n=>{let r=kt(n);return n.type.name==="blockContainer"&&n.firstChild?.type.name==="blockGroup"?!0:n.type.name==="columnList"&&n.childCount===1?(n.firstChild?.forEach(o=>{t.push(pt(o,r))}),!1):n.type.isInGroup("bnBlock")?(t.push(pt(n,r)),!1):!0}),t}var Vh=class zl extends ge{nodes;constructor(t,n){super(t,n);let r=t.node();this.nodes=[],t.doc.nodesBetween(t.pos,n.pos,(o,i,s)=>{if(s!==null&&s.eq(r))return this.nodes.push(o),!1})}static create(t,n,r=n){return new zl(t.resolve(n),t.resolve(r))}content(){return new Z(j.from(this.nodes),0,0)}eq(t){if(!(t instanceof zl)||this.nodes.length!==t.nodes.length||this.from!==t.from||this.to!==t.to)return!1;for(let n=0;n<this.nodes.length;n++)if(!this.nodes[n].eq(t.nodes[n]))return!1;return!0}map(t,n){let r=n.mapResult(this.from),o=n.mapResult(this.to);return o.deleted?ge.near(t.resolve(r.pos)):r.deleted?ge.near(t.resolve(o.pos)):new zl(t.resolve(r.pos),t.resolve(o.pos))}toJSON(){return{type:"multiple-node",anchor:this.anchor,head:this.head}}};ge.jsonID("multiple-node",Vh);var Qn;function VV(e,t){let n,r,o=t.resolve(e.from).node().type.spec.group==="blockContent",i=t.resolve(e.to).node().type.spec.group==="blockContent",s=Math.min(e.$anchor.depth,e.$head.depth);if(o&&i){let a=e.$from.start(s-1),l=e.$to.end(s-1);n=t.resolve(a-1).pos,r=t.resolve(l+1).pos}else n=e.from,r=e.to;return{from:n,to:r}}function Xb(e,t,n=t){t===n&&(n+=e.state.doc.resolve(t+1).node().nodeSize);let r=e.domAtPos(t).node.cloneNode(!0),o=e.domAtPos(t).node,i=(u,d)=>Array.prototype.indexOf.call(u.children,d),s=i(o,e.domAtPos(t+1).node.parentElement),a=i(o,e.domAtPos(n-1).node.parentElement);for(let u=o.childElementCount-1;u>=0;u--)(u>a||u<s)&&r.removeChild(r.children[u]);bw(e.root),Qn=r;let l=Qn.getElementsByTagName("iframe");for(let u=0;u<l.length;u++){let d=l[u],f=d.parentElement;f&&f.removeChild(d)}let c=e.dom.className.split(" ").filter(u=>u!=="ProseMirror"&&u!=="bn-root"&&u!=="bn-editor").join(" ");Qn.className=Qn.className+" bn-drag-preview "+c,e.root instanceof ShadowRoot?e.root.appendChild(Qn):e.root.body.appendChild(Qn)}function bw(e){Qn!==void 0&&(e instanceof ShadowRoot?e.removeChild(Qn):e.body.removeChild(Qn),Qn=void 0)}function $V(e,t,n){if(!e.dataTransfer||n.headless)return;let r=n.prosemirrorView,o=cn(t.id,r.state.doc);if(!o)throw Error(`Block with ID ${t.id} not found`);let i=o.posBeforeNode;if(i!=null){let s=r.state.selection,a=r.state.doc,{from:l,to:c}=VV(s,a),u=l<=i&&i<c,d=s.$anchor.node()!==s.$head.node()||s instanceof Vh;u&&d?(r.dispatch(r.state.tr.setSelection(Vh.create(a,l,c))),Xb(r,l,c)):(r.dispatch(r.state.tr.setSelection(le.create(r.state.doc,i))),Xb(r,i));let f=r.state.selection.content(),h=n.pmSchema,p=r.serializeForClipboard(f).dom.innerHTML,g=rd(h,n),y=gw(f.content),b=g.exportBlocks(y,{}),x=Lm(b);e.dataTransfer.clearData(),e.dataTransfer.setData("blocknote/html",p),e.dataTransfer.setData("text/html",b),e.dataTransfer.setData("text/plain",x),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(Qn,0,0)}}var Zb=250;function $h(e,t,n=!0){let r=e.root.elementsFromPoint(t.left,t.top);for(let o of r)if(e.dom.contains(o))return n&&o.closest("[data-node-type=columnList]")?$h(e,{left:t.left+50,top:t.top},!1):mw(o,e)}function jV(e,t){if(!t.dom.firstChild)return;let n=t.dom.firstChild.getBoundingClientRect(),r=$h(t,{left:Math.min(Math.max(n.left+10,e.x),n.right-10),top:e.y});if(r)return $h(t,{left:r.node.getBoundingClientRect().right-10,top:e.y},!1)}var zV=class{state;emitUpdate;mousePos;hoveredBlock;menuFrozen=!1;isDragOrigin=!1;constructor(t,n,r){this.editor=t,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized side menu");r(this.state)},this.pmView.root.addEventListener("dragstart",this.onDragStart),this.pmView.root.addEventListener("dragover",this.onDragOver),this.pmView.root.addEventListener("drop",this.onDrop,!0),this.pmView.root.addEventListener("dragend",this.onDragEnd,!0),this.pmView.root.addEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.addEventListener("keydown",this.onKeyDown,!0)}updateState=t=>{this.state=t,this.emitUpdate(this.state)};updateStateFromMousePos=()=>{if(this.menuFrozen||!this.mousePos)return;let t=this.findClosestEditorElement({clientX:this.mousePos.x,clientY:this.mousePos.y});if(t?.element!==this.pmView.dom||t.distance>Zb){this.state?.show&&(this.state.show=!1,this.updateState(this.state));return}let n=jV(this.mousePos,this.pmView);if(!n||!this.editor.isEditable){this.state?.show&&(this.state.show=!1,this.updateState(this.state));return}if(!(this.state?.show&&this.hoveredBlock?.hasAttribute("data-id")&&this.hoveredBlock?.getAttribute("data-id")===n.id)&&(this.hoveredBlock=n.node,this.editor.isEditable)){let r=n.node.getBoundingClientRect(),o=n.node.closest("[data-node-type=column]");this.state={show:!0,referencePos:new DOMRect(o?o.firstElementChild.getBoundingClientRect().x:this.pmView.dom.firstChild.getBoundingClientRect().x,r.y,r.width,r.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.updateState(this.state)}};onDragStart=t=>{let n=t.dataTransfer?.getData("blocknote/html");if(!n||this.pmView.dragging)return;let r=document.createElement("div");r.innerHTML=n;let o=sn.fromSchema(this.pmView.state.schema).parse(r,{topNode:this.pmView.state.schema.nodes.blockGroup.create()});this.pmView.dragging={slice:new Z(o.content,0,0),move:!0}};findClosestEditorElement=t=>{let n=Array.from(this.pmView.root.querySelectorAll(".bn-editor"));if(n.length===0)return null;let r=n[0],o=Number.MAX_VALUE;return n.forEach(i=>{let s=i.querySelector(".bn-block-group").getBoundingClientRect(),a=t.clientX<s.left?s.left-t.clientX:t.clientX>s.right?t.clientX-s.right:0,l=t.clientY<s.top?s.top-t.clientY:t.clientY>s.bottom?t.clientY-s.bottom:0,c=Math.sqrt(a**2+l**2);c<o&&(o=c,r=i)}),{element:r,distance:o}};onDragOver=t=>{if(t.synthetic||!(this.pmView.dragging!==null||this.isDragOrigin||t.dataTransfer?.types.includes("blocknote/html")||t.target instanceof Node&&this.pmView.dom.contains(t.target)))return;let n=this.getDragEventContext(t);if(!n||!n.isDropPoint){this.closeDropCursor();return}n.isDropPoint&&!n.isDropWithinEditorBounds&&this.dispatchSyntheticEvent(t)};closeDropCursor=()=>{let t=new Event("dragleave",{bubbles:!1});t.synthetic=!0,this.pmView.dom.dispatchEvent(t)};getDragEventContext=t=>{if(!(this.pmView.dragging!==null||this.isDragOrigin||t.dataTransfer?.types.includes("blocknote/html")||t.target instanceof Node&&this.pmView.dom.contains(t.target)))return;let n=!t.dataTransfer?.types.includes("blocknote/html")&&!!this.pmView.dragging,r=!!this.isDragOrigin,o=n||r,i=this.findClosestEditorElement(t);if(!i||i.distance>Zb)return;let s=i.element===this.pmView.dom,a=s&&i.distance===0;if(!(!s&&!o))return{isDropPoint:s,isDropWithinEditorBounds:a,isDragOrigin:o}};onDrop=t=>{if(t.synthetic||!(this.pmView.dragging!==null||this.isDragOrigin||t.dataTransfer?.types.includes("blocknote/html")||t.target instanceof Node&&this.pmView.dom.contains(t.target)))return;let n=this.getDragEventContext(t);if(!n){this.closeDropCursor();return}let{isDropPoint:r,isDropWithinEditorBounds:o,isDragOrigin:i}=n;if(!o&&r&&this.dispatchSyntheticEvent(t),r){if(this.pmView.dragging)return;this.pmView.dispatch(this.pmView.state.tr.setSelection(se.create(this.pmView.state.tr.doc,this.pmView.state.tr.selection.anchor)));return}else if(i){setTimeout(()=>this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),0);return}};onDragEnd=t=>{t.synthetic||(this.pmView.dragging=null)};onKeyDown=t=>{this.state?.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state))};onMouseMove=t=>{if(this.menuFrozen)return;this.mousePos={x:t.clientX,y:t.clientY};let n=this.pmView.dom.getBoundingClientRect();if(this.mousePos.x>n.left&&this.mousePos.x<n.right&&this.mousePos.y>n.top&&this.mousePos.y<n.bottom&&t&&t.target&&!this.editor.isWithinEditor(t.target)){this.state?.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.updateStateFromMousePos()};dispatchSyntheticEvent(t){let n=new Event(t.type,t),r=this.pmView.dom.firstChild.getBoundingClientRect();n.clientX=t.clientX,n.clientY=t.clientY,n.clientX=Math.min(Math.max(t.clientX,r.left),r.left+r.width),n.clientY=Math.min(Math.max(t.clientY,r.top),r.top+r.height),n.dataTransfer=t.dataTransfer,n.preventDefault=()=>t.preventDefault(),n.synthetic=!0,this.pmView.dom.dispatchEvent(n)}update(t,n){!n.doc.eq(this.pmView.state.doc)&&this.state?.show&&this.updateStateFromMousePos()}destroy(){this.state?.show&&(this.state.show=!1,this.emitUpdate(this.state)),this.pmView.root.removeEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.removeEventListener("dragstart",this.onDragStart),this.pmView.root.removeEventListener("dragover",this.onDragOver),this.pmView.root.removeEventListener("drop",this.onDrop,!0),this.pmView.root.removeEventListener("dragend",this.onDragEnd,!0),this.pmView.root.removeEventListener("keydown",this.onKeyDown,!0)}},WV=new $e("SideMenuPlugin"),qn=Ve(({editor:e})=>{let t,n=Po(void 0);return{key:"sideMenu",store:n,prosemirrorPlugins:[new Ae({key:WV,view:r=>(t=new zV(e,r,o=>{n.setState({...o})}),t)})],blockDragStart(r,o){t&&(t.isDragOrigin=!0),$V(r,o,e)},blockDragEnd(){bw(e.prosemirrorView.root),t&&(t.isDragOrigin=!1),e.blur()},freezeMenu(){t.menuFrozen=!0,t.state.show=!0,t.emitUpdate(t.state)},unfreezeMenu(){t.menuFrozen=!1,t.state.show=!1,t.emitUpdate(t.state)},hideMenuIfNotFrozen(){!t.menuFrozen&&t.state.show&&(t.state.show=!1,t.emitUpdate(t.state))}}}),bf;async function qV(){return bf||(bf=(async()=>{let[e,t]=await Promise.all([Qi(()=>import("./module-RjUF93sV.js"),[]),Qi(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in e?e.default:e,r="default"in t?t.default:t;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),bf)}async function GV(e,t){if(!("text"in e.schema.inlineContentSchema)||e.schema.inlineContentSchema.text!==Q6.text)return[];let{emojiData:n,emojiMart:r}=await qV();return(t.trim()===""?Object.values(n.emojis):await r.SearchIndex.search(t)).map(o=>({id:o.skins[0].native,onItemClick:()=>e.insertInlineContent(o.skins[0].native+" ")}))}var Sn;function Jb(e){Sn||(Sn=document.createElement("div"),Sn.innerHTML="_",Sn.style.opacity="0",Sn.style.height="1px",Sn.style.width="1px",e instanceof Document?e.body.appendChild(Sn):e.appendChild(Sn))}function YV(e){Sn&&=(e instanceof Document?e.body.removeChild(Sn):e.removeChild(Sn),void 0)}function yl(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}function KV(e){let t=e;for(;t&&t.nodeName!=="TD"&&t.nodeName!=="TH"&&!t.classList.contains("tableWrapper");){if(t.classList.contains("ProseMirror"))return;let n=t.parentNode;if(!n||!(n instanceof Element))return;t=n}return t.nodeName==="TD"||t.nodeName==="TH"?{type:"cell",domNode:t,tbodyNode:t.closest("tbody")}:{type:"wrapper",domNode:t,tbodyNode:t.querySelector("tbody")}}function QV(e,t){let n=t.querySelectorAll(e);for(let r=0;r<n.length;r++)n[r].style.visibility="hidden"}var XV=class{state;emitUpdate;tableId;tablePos;tableElement;menuFrozen=!1;mouseState="up";prevWasEditable=null;constructor(t,n,r){this.editor=t,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized image toolbar");r(this.state)},n.dom.addEventListener("mousemove",this.mouseMoveHandler),n.dom.addEventListener("mousedown",this.viewMousedownHandler),window.addEventListener("mouseup",this.mouseUpHandler),n.root.addEventListener("dragover",this.dragOverHandler),n.root.addEventListener("drop",this.dropHandler)}viewMousedownHandler=()=>{this.mouseState="down"};mouseUpHandler=t=>{this.mouseState="up",this.mouseMoveHandler(t)};mouseMoveHandler=t=>{if(this.menuFrozen||this.mouseState==="selecting"||!(t.target instanceof Element)||!this.pmView.dom.contains(t.target))return;let n=KV(t.target);if(n?.type==="cell"&&this.mouseState==="down"&&!this.state?.draggingState){this.mouseState="selecting",this.state?.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!n||!this.editor.isEditable){this.state?.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!n.tbodyNode)return;let r=n.tbodyNode.getBoundingClientRect(),o=mw(n.domNode,this.pmView);if(!o)return;this.tableElement=o.node;let i,s=this.editor.transact(c=>cn(o.id,c.doc));if(!s)throw Error(`Block with ID ${o.id} not found`);let a=pt(s.node,this.editor.pmSchema,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema);if(it(this.editor,"table")&&(this.tablePos=s.posBeforeNode+1,i=a),!i)return;this.tableId=o.id;let l=n.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");if(n?.type==="wrapper"){let c=t.clientY>=r.bottom-1&&t.clientY<r.bottom+20,u=t.clientX>=r.right-1&&t.clientX<r.right+20,d=this.state?.block.id!==i.id||t.clientX>r.right||t.clientY>r.bottom;this.state={...this.state,show:!0,showAddOrRemoveRowsButton:c,showAddOrRemoveColumnsButton:u,referencePosTable:r,block:i,widgetContainer:l,colIndex:d?void 0:this.state?.colIndex,rowIndex:d?void 0:this.state?.rowIndex,referencePosCell:d?void 0:this.state?.referencePosCell}}else{let c=yl(n.domNode),u=yl(n.domNode.parentElement),d=n.domNode.getBoundingClientRect();if(this.state!==void 0&&this.state.show&&this.tableId===o.id&&this.state.rowIndex===u&&this.state.colIndex===c)return;this.state={show:!0,showAddOrRemoveColumnsButton:c===i.content.rows[0].cells.length-1,showAddOrRemoveRowsButton:u===i.content.rows.length-1,referencePosTable:r,block:i,draggingState:void 0,referencePosCell:d,colIndex:c,rowIndex:u,widgetContainer:l}}return this.emitUpdate(),!1};dragOverHandler=t=>{if(this.state?.draggingState===void 0)return;t.preventDefault(),t.dataTransfer.dropEffect="move",QV(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",this.pmView.root);let n={left:Math.min(Math.max(t.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(t.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},r=this.pmView.root.elementsFromPoint(n.left,n.top).filter(d=>d.tagName==="TD"||d.tagName==="TH");if(r.length===0)return;let o=r[0],i=!1,s=yl(o.parentElement),a=yl(o),l=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,c=(this.state.draggingState.draggedCellOrientation==="row"?s:a)!==l;(this.state.rowIndex!==s||this.state.colIndex!==a)&&(this.state.rowIndex=s,this.state.colIndex=a,this.state.referencePosCell=o.getBoundingClientRect(),i=!0);let u=this.state.draggingState.draggedCellOrientation==="row"?n.top:n.left;this.state.draggingState.mousePos!==u&&(this.state.draggingState.mousePos=u,i=!0),i&&this.emitUpdate(),c&&this.editor.transact(d=>d.setMeta(Ls,!0))};dropHandler=t=>{if(this.mouseState="up",this.state===void 0||this.state.draggingState===void 0)return!1;if(this.state.rowIndex===void 0||this.state.colIndex===void 0)throw Error("Attempted to drop table row or column, but no table block was hovered prior.");t.preventDefault();let{draggingState:n,colIndex:r,rowIndex:o}=this.state,i=this.state.block.content.columnWidths;if(n.draggedCellOrientation==="row"){if(!Uk(this.state.block,n.originalIndex,o))return!1;let s=_D(this.state.block,n.originalIndex,o);this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,rows:s}})}else{if(!Vk(this.state.block,n.originalIndex,r))return!1;let s=MD(this.state.block,n.originalIndex,r),[a]=i.splice(n.originalIndex,1);i.splice(r,0,a),this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,columnWidths:i,rows:s}})}return this.editor.setTextCursorPosition(this.state.block.id),!0};update(){if(!this.state||!this.state.show)return;if(this.state.block=this.editor.getBlock(this.state.block.id),!this.state.block||this.state.block.type!=="table"||!this.tableElement?.isConnected){this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate();return}let{height:t,width:n}=om(this.state.block);this.state.rowIndex!==void 0&&this.state.colIndex!==void 0&&(this.state.rowIndex>=t&&(this.state.rowIndex=t-1),this.state.colIndex>=n&&(this.state.colIndex=n-1));let r=this.tableElement.querySelector("tbody");if(!r)throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");if(this.state.rowIndex!==void 0&&this.state.colIndex!==void 0){let o=r.children[this.state.rowIndex].children[this.state.colIndex];o?this.state.referencePosCell=o.getBoundingClientRect():(this.state.rowIndex=void 0,this.state.colIndex=void 0)}this.state.referencePosTable=r.getBoundingClientRect(),this.emitUpdate()}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),window.removeEventListener("mouseup",this.mouseUpHandler),this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.root.removeEventListener("dragover",this.dragOverHandler),this.pmView.root.removeEventListener("drop",this.dropHandler)}},Ls=new $e("TableHandlesPlugin"),Je=Ve(({editor:e})=>{let t,n=Po(void 0);return{key:"tableHandles",store:n,prosemirrorPlugins:[new Ae({key:Ls,view:r=>(t=new XV(e,r,o=>{n.setState(o.block?{...o,draggingState:o.draggingState?{...o.draggingState}:void 0}:void 0)}),t),props:{decorations:r=>{if(t===void 0||t.state===void 0||t.state.draggingState===void 0||t.tablePos===void 0)return;let o=t.state.draggingState.draggedCellOrientation==="row"?t.state.rowIndex:t.state.colIndex;if(o===void 0)return;let i=[],{block:s,draggingState:a}=t.state,{originalIndex:l,draggedCellOrientation:c}=a;if(o===l||!s||c==="row"&&!Uk(s,l,o)||c==="col"&&!Vk(s,l,o))return _e.create(r.doc,i);let u=r.doc.resolve(t.tablePos+1);return t.state.draggingState.draggedCellOrientation==="row"?Eh(t.state.block,o).forEach(({row:d,col:f})=>{let h=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(h.posAtIndex(f)+1),g=p.node(),y=p.pos+(o>l?g.nodeSize-2:0);i.push(qe.widget(y,()=>{let b=document.createElement("div");return b.className="bn-table-drop-cursor",b.style.left="0",b.style.right="0",o>l?b.style.bottom="-2px":b.style.top="-3px",b.style.height="4px",b}))}):xh(t.state.block,o).forEach(({row:d,col:f})=>{let h=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(h.posAtIndex(f)+1),g=p.node(),y=p.pos+(o>l?g.nodeSize-2:0);i.push(qe.widget(y,()=>{let b=document.createElement("div");return b.className="bn-table-drop-cursor",b.style.top="0",b.style.bottom="0",o>l?b.style.right="-2px":b.style.left="-3px",b.style.width="4px",b}))}),_e.create(r.doc,i)}}})],colDragStart(r){if(t===void 0||t.state===void 0||t.state.colIndex===void 0)throw Error("Attempted to drag table column, but no table block was hovered prior.");t.state.draggingState={draggedCellOrientation:"col",originalIndex:t.state.colIndex,mousePos:r.clientX},t.emitUpdate(),e.transact(o=>o.setMeta(Ls,{draggedCellOrientation:t.state.draggingState.draggedCellOrientation,originalIndex:t.state.colIndex,newIndex:t.state.colIndex,tablePos:t.tablePos})),!e.headless&&(Jb(e.prosemirrorView.root),r.dataTransfer.setDragImage(Sn,0,0),r.dataTransfer.effectAllowed="move")},rowDragStart(r){if(t.state===void 0||t.state.rowIndex===void 0)throw Error("Attempted to drag table row, but no table block was hovered prior.");t.state.draggingState={draggedCellOrientation:"row",originalIndex:t.state.rowIndex,mousePos:r.clientY},t.emitUpdate(),e.transact(o=>o.setMeta(Ls,{draggedCellOrientation:t.state.draggingState.draggedCellOrientation,originalIndex:t.state.rowIndex,newIndex:t.state.rowIndex,tablePos:t.tablePos})),!e.headless&&(Jb(e.prosemirrorView.root),r.dataTransfer.setDragImage(Sn,0,0),r.dataTransfer.effectAllowed="copyMove")},dragEnd(){if(t.state===void 0)throw Error("Attempted to drag table row, but no table block was hovered prior.");t.state.draggingState=void 0,t.emitUpdate(),e.transact(r=>r.setMeta(Ls,null)),!e.headless&&YV(e.prosemirrorView.root)},freezeHandles(){t.menuFrozen=!0},unfreezeHandles(){t.menuFrozen=!1},hideHandlesIfNotFrozen(){!t.menuFrozen&&t.state?.show&&(t.state.show=!1,t.state.showAddOrRemoveRowsButton=!1,t.state.showAddOrRemoveColumnsButton=!1,t.emitUpdate())},getCellsAtRowHandle(r,o){return Eh(r,o)},getCellsAtColumnHandle(r,o){return xh(r,o)},setCellSelection(r,o,i=o){if(!t)throw Error("Table handles view not initialized");let s=r.doc.resolve(t.tablePos+1),a=r.doc.resolve(s.posAtIndex(o.row)+1),l=r.doc.resolve(a.posAtIndex(o.col)),c=r.doc.resolve(s.posAtIndex(i.row)+1),u=r.doc.resolve(c.posAtIndex(i.col)),d=r.tr;return d.setSelection(new Ge(l,u)),r.apply(d)},addRowOrColumn(r,o){e.exec((i,s)=>{let a=this.setCellSelection(i,o.orientation==="row"?{row:r,col:0}:{row:0,col:r});return o.orientation==="row"?o.side==="above"?C4(a,s):k4(a,s):o.side==="left"?g4(a,s):b4(a,s)})},removeRowOrColumn(r,o){return o==="row"?e.exec((i,s)=>w4(this.setCellSelection(i,{row:r,col:0}),s)):e.exec((i,s)=>E4(this.setCellSelection(i,{row:0,col:r}),s))},mergeCells(r){return e.exec((o,i)=>v4(r?this.setCellSelection(o,r.relativeStartCell,r.relativeEndCell):o,i))},splitCell(r){return e.exec((o,i)=>A4(r?this.setCellSelection(o,r):o,i))},getCellSelection(){return e.transact(r=>{let o=r.selection,i=o.$from,s=o.$to;if(Th(o)){let{ranges:g}=o;g.forEach(y=>{i=y.$from.min(i??y.$from),s=y.$to.max(s??y.$to)})}else if(i=r.doc.resolve(o.$from.pos-o.$from.parentOffset-1),s=r.doc.resolve(o.$to.pos-o.$to.parentOffset-1),i.pos===0||s.pos===0)return;let a=r.doc.resolve(i.pos-i.parentOffset-1),l=r.doc.resolve(s.pos-s.parentOffset-1),c=r.doc.resolve(a.pos-a.parentOffset-1),u=i.index(a.depth),d=a.index(c.depth),f=s.index(l.depth),h=l.index(c.depth),p=[];for(let g=d;g<=h;g++)for(let y=u;y<=f;y++)p.push({row:g,col:y});return{from:{row:d,col:u},to:{row:h,col:f},cells:p}})},getMergeDirection(r){return e.transact(o=>{let i=Th(o.selection)?o.selection:void 0;if(!i||!r||i.ranges.length<=1)return;let s=this.getCellSelection();if(s)return LD(s.from,s.to,r)?"vertical":"horizontal"})},cropEmptyRowsOrColumns(r,o){return OD(r,o)},addRowsOrColumns(r,o,i){return RD(r,o,i)}}}),ey=new $e("trailingNode"),ZV=Ve(()=>({key:"trailingNode",prosemirrorPlugins:[new Ae({key:ey,appendTransaction:(e,t,n)=>{let{doc:r,tr:o,schema:i}=n,s=ey.getState(n),a=r.content.size-2,l=i.nodes.blockContainer,c=i.nodes.paragraph;if(s)return o.insert(a,l.create(void 0,c.create()))},state:{init:(e,t)=>{},apply:(e,t)=>{if(!e.docChanged)return t;let n=e.doc.lastChild;if(!n||n.type.name!=="blockGroup")throw Error("Expected blockGroup");if(n=n.lastChild,!n||n.type.name!=="blockContainer")return!0;let r=n.firstChild;if(!r)throw Error("Expected blockContent");return n.nodeSize>4||r.type.spec.content!=="inline*"}}})]})),ty=new $e("blocknote-show-selection"),va=Ve(({editor:e})=>{let t=Po({enabledSet:new Set},{onUpdate(){e.transact(n=>n.setMeta(ty,{}))}});return{key:"showSelection",store:t,prosemirrorPlugins:[new Ae({key:ty,props:{decorations:n=>{let{doc:r,selection:o}=n;if(t.state.enabledSet.size===0)return _e.empty;let i=qe.inline(o.from,o.to,{"data-show-selection":"true"});return _e.create(r,[i])}}})],showSelection(n,r){t.setState({enabledSet:n?new Set([...t.state.enabledSet,r]):new Set([...t.state.enabledSet].filter(o=>o!==r))})}}}),JV={slash_menu:{heading:{title:"Heading 1",subtext:"Top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Key section heading",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Subsection and group heading",aliases:["h3","heading3","subheading"],group:"Headings"},heading_4:{title:"Heading 4",subtext:"Minor subsection heading",aliases:["h4","heading4","subheading4"],group:"Subheadings"},heading_5:{title:"Heading 5",subtext:"Small subsection heading",aliases:["h5","heading5","subheading5"],group:"Subheadings"},heading_6:{title:"Heading 6",subtext:"Lowest-level heading",aliases:["h6","heading6","subheading6"],group:"Subheadings"},toggle_heading:{title:"Toggle Heading 1",subtext:"Toggleable top-level heading",aliases:["h","heading1","h1","collapsable"],group:"Subheadings"},toggle_heading_2:{title:"Toggle Heading 2",subtext:"Toggleable key section heading",aliases:["h2","heading2","subheading","collapsable"],group:"Subheadings"},toggle_heading_3:{title:"Toggle Heading 3",subtext:"Toggleable subsection and group heading",aliases:["h3","heading3","subheading","collapsable"],group:"Subheadings"},quote:{title:"Quote",subtext:"Quote or excerpt",aliases:["quotation","blockquote","bq"],group:"Basic blocks"},toggle_list:{title:"Toggle List",subtext:"List with hideable sub-items",aliases:["li","list","toggleList","toggle list","collapsable list"],group:"Basic blocks"},numbered_list:{title:"Numbered List",subtext:"List with ordered items",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"List with unordered items",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},check_list:{title:"Check List",subtext:"List with checkboxes",aliases:["ul","li","list","checklist","check list","checked list","checkbox"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"The body of your document",aliases:["p","paragraph"],group:"Basic blocks"},code_block:{title:"Code Block",subtext:"Code block with syntax highlighting",aliases:["code","pre"],group:"Basic blocks"},page_break:{title:"Page Break",subtext:"Page separator",aliases:["page","break","separator"],group:"Basic blocks"},table:{title:"Table",subtext:"Table with editable cells",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Resizable image with caption",aliases:["image","imageUpload","upload","img","picture","media","url"],group:"Media"},video:{title:"Video",subtext:"Resizable video with caption",aliases:["video","videoUpload","upload","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Embedded audio with caption",aliases:["audio","audioUpload","upload","mp3","sound","media","url"],group:"Media"},file:{title:"File",subtext:"Embedded file",aliases:["file","upload","embed","media","url"],group:"Media"},emoji:{title:"Emoji",subtext:"Search for and insert an emoji",aliases:["emoji","emote","emotion","face"],group:"Others"},divider:{title:"Divider",subtext:"Visually divide blocks",aliases:["divider","hr","line","horizontal rule"],group:"Basic blocks"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",toggleListItem:"Toggle",bulletListItem:"List",numberedListItem:"List",checkListItem:"List",emptyDocument:void 0,new_comment:"Write a comment...",edit_comment:"Edit comment...",comment_reply:"Add comment..."},file_blocks:{add_button_text:{image:"Add image",video:"Add video",audio:"Add audio",file:"Add file"}},toggle_blocks:{add_block_button:"Empty toggle. Click to add a block."},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors",header_row_menuitem:"Header row",header_column_menuitem:"Header column"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below",split_cell_menuitem:"Split cell",merge_cells_menuitem:"Merge cells",background_color_menuitem:"Background color"},suggestion_menu:{no_items_title:"No items found"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+S"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},file_replace:{tooltip:{image:"Replace image",video:"Replace video",audio:"Replace audio",file:"Replace file"}},file_rename:{tooltip:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"},input_placeholder:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"}},file_download:{tooltip:{image:"Download image",video:"Download video",audio:"Download audio",file:"Download file"}},file_delete:{tooltip:{image:"Delete image",video:"Delete video",audio:"Delete audio",file:"Delete file"}},file_preview_toggle:{tooltip:"Toggle preview"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"},table_cell_merge:{tooltip:"Merge cells"},comment:{tooltip:"Add comment"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload image",video:"Upload video",audio:"Upload audio",file:"Upload file"},upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:{image:"Embed image",video:"Embed video",audio:"Embed audio",file:"Embed file"},url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},comments:{edited:"edited",save_button_text:"Save",cancel_button_text:"Cancel",actions:{add_reaction:"Add reaction",resolve:"Resolve",edit_comment:"Edit comment",delete_comment:"Delete comment",more_actions:"More actions"},reactions:{reacted_by:"Reacted by"},sidebar:{marked_as_resolved:"Marked as resolved",more_replies:e=>`${e} more replies`}},generic:{ctrl_shortcut:"Ctrl"}},Dm=class{callbacks={};on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),()=>this.off(t,n)}emit(t,...n){let r=this.callbacks[t];r&&r.forEach(o=>o.apply(this,n))}off(t,n){let r=this.callbacks[t];r&&(n?this.callbacks[t]=r.filter(o=>o!==n):delete this.callbacks[t])}removeAllListeners(){this.callbacks={}}};const e$={tokenize:t$};function t$(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Be(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return me(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}const n$={tokenize:r$},ny={tokenize:o$};function r$(e){const t=this,n=[];let r=0,o,i,s;return a;function a(k){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,l,c)(k)}return c(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&x();const O=t.events.length;let M=O,A;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){A=t.events[M][1].end;break}b(r);let D=O;for(;D<t.events.length;)t.events[D][1].end={...A},D++;return _n(t.events,M+1,0,t.events.slice(O)),t.events.length=D,c(k)}return a(k)}function c(k){if(r===n.length){if(!o)return f(k);if(o.currentConstruct&&o.currentConstruct.concrete)return p(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ny,u,d)(k)}function u(k){return o&&x(),b(r),f(k)}function d(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,p(k)}function f(k){return t.containerState={},e.attempt(ny,h,p)(k)}function h(k){return r++,n.push([t.currentConstruct,t.containerState]),f(k)}function p(k){if(k===null){o&&x(),b(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),g(k)}function g(k){if(k===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return me(k)?(e.consume(k),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(k),g)}function y(k,O){const M=t.sliceStream(k);if(O&&M.push(null),k.previous=i,i&&(i.next=k),i=k,o.defineSkip(k.start),o.write(M),t.parser.lazy[k.start.line]){let A=o.events.length;for(;A--;)if(o.events[A][1].start.offset<s&&(!o.events[A][1].end||o.events[A][1].end.offset>s))return;const D=t.events.length;let z=D,Y,N;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(Y){N=t.events[z][1].end;break}Y=!0}for(b(r),A=D;A<t.events.length;)t.events[A][1].end={...N},A++;_n(t.events,z+1,0,t.events.slice(D)),t.events.length=A}}function b(k){let O=n.length;for(;O-- >k;){const M=n[O];t.containerState=M[1],M[0].exit.call(t,e)}n.length=k}function x(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function o$(e,t,n){return Be(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const i$={tokenize:s$};function s$(e){const t=this,n=e.attempt($a,r,e.attempt(this.parser.constructs.flowInitial,o,Be(e,e.attempt(this.parser.constructs.flow,o,e.attempt(BH,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const a$={resolveAll:Ew()},l$=yw("string"),c$=yw("text");function yw(e){return{resolveAll:Ew(e==="text"?u$:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=o[u];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Ew(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function u$(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,s=-1,a=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const d$={42:fn,43:fn,45:fn,48:fn,49:fn,50:fn,51:fn,52:fn,53:fn,54:fn,55:fn,56:fn,57:fn,62:Q2},f$={91:$H},h$={[-2]:uf,[-1]:uf,32:uf},p$={35:YH,42:Vl,45:[Ub,Vl],60:ZH,61:Ub,95:Vl,96:Fb,126:Fb},m$={38:Z2,92:X2},g$={[-5]:df,[-4]:df,[-3]:df,33:gU,38:Z2,42:Fh,60:[yH,iU],91:yU,92:[qH,X2],93:Om,95:Fh,96:_H},b$={null:[Fh,a$]},y$={null:[42,95]},E$={null:[]},x$=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:y$,contentInitial:f$,disable:E$,document:d$,flow:p$,flowInitial:h$,insideSpan:b$,string:m$,text:g$},Symbol.toStringTag,{value:"Module"}));function C$(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let s=[],a=[];const l={attempt:D(M),check:D(A),consume:x,enter:k,exit:O,interrupt:D(A,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(K){return s=Un(s,K),y(),s[s.length-1]!==null?[]:(z(t,0),c.events=nd(i,c.events,c),c.events)}function f(K,F){return T$(h(K),F)}function h(K){return k$(s,K)}function p(){const{_bufferIndex:K,_index:F,line:q,column:L,offset:H}=r;return{_bufferIndex:K,_index:F,line:q,column:L,offset:H}}function g(K){o[K.line]=K.column,N()}function y(){let K;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for(K=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===K&&r._bufferIndex<F.length;)b(F.charCodeAt(r._bufferIndex));else b(F)}}function b(K){u=u(K)}function x(K){me(K)?(r.line++,r.column=1,r.offset+=K===-3?2:1,N()):K!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=K}function k(K,F){const q=F||{};return q.type=K,q.start=p(),c.events.push(["enter",q,c]),a.push(q),q}function O(K){const F=a.pop();return F.end=p(),c.events.push(["exit",F,c]),F}function M(K,F){z(K,F.from)}function A(K,F){F.restore()}function D(K,F){return q;function q(L,H,re){let W,G,te,S;return Array.isArray(L)?pe(L):"tokenize"in L?pe([L]):ye(L);function ye(Le){return Et;function Et(Pe){const We=Pe!==null&&Le[Pe],dt=Pe!==null&&Le.null,xt=[...Array.isArray(We)?We:We?[We]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return pe(xt)(Pe)}}function pe(Le){return W=Le,G=0,Le.length===0?re:v(Le[G])}function v(Le){return Et;function Et(Pe){return S=Y(),te=Le,Le.partial||(c.currentConstruct=Le),Le.name&&c.parser.constructs.disable.null.includes(Le.name)?ve():Le.tokenize.call(F?Object.assign(Object.create(c),F):c,l,ze,ve)(Pe)}}function ze(Le){return K(te,S),H}function ve(Le){return S.restore(),++G<W.length?v(W[G]):re}}}function z(K,F){K.resolveAll&&!i.includes(K)&&i.push(K),K.resolve&&_n(c.events,F,c.events.length-F,K.resolve(c.events.slice(F),c)),K.resolveTo&&(c.events=K.resolveTo(c.events,c))}function Y(){const K=p(),F=c.previous,q=c.currentConstruct,L=c.events.length,H=Array.from(a);return{from:L,restore:re};function re(){r=K,c.previous=F,c.currentConstruct=q,c.events.length=L,a=H,N()}}function N(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function k$(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function T$(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
149
+ `;break}case-3:{s=`\r
150
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function w$(e){const r={constructs:V2([x$,...(e||{}).extensions||[]]),content:o(e$),defined:[],document:o(n$),flow:o(i$),lazy:{},string:o(l$),text:o(c$)};return r;function o(i){return s;function s(a){return C$(r,i,a)}}}function S$(e){for(;!J2(e););return e}const ry=/[\0\t\n\r]/g;function v$(){let e=1,t="",n=!0,r;return o;function o(i,s,a){const l=[];let c,u,d,f,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(ry.lastIndex=d,c=ry.exec(i),f=c&&c.index!==void 0?c.index:i.length,h=i.charCodeAt(f),!c){t=i.slice(d);break}if(h===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),h){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const xw={}.hasOwnProperty;function A$(e,t,n){return typeof t!="string"&&(n=t,t=void 0),N$(n)(S$(w$(n).document().write(v$()(e,t,!0))))}function N$(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(zt),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:i(Ke),blockQuote:i(dt),characterEscape:Y,characterReference:Y,codeFenced:i(xt),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(xt,s),codeText:i(Ee,s),codeTextData:Y,data:Y,codeFlowValue:Y,definition:i(De),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Ne),hardBreakEscape:i(ft),hardBreakTrailing:i(ft),htmlFlow:i(Fe,s),htmlFlowData:Y,htmlText:i(Fe,s),htmlTextData:Y,image:i(Tn),label:s,link:i(zt),listItem:i(_),listItemValue:f,listOrdered:i(It,d),listUnordered:i(It),paragraph:i(P),reference:v,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(Ke),strong:i(U),thematicBreak:i(ne)},exit:{atxHeading:l(),atxHeadingSequence:M,autolink:l(),autolinkEmail:We,autolinkProtocol:Pe,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:Le,characterReference:Et,codeFenced:l(y),codeFencedFence:g,codeFencedFenceInfo:h,codeFencedFenceMeta:p,codeFlowValue:N,codeIndented:l(b),codeText:l(H),codeTextData:N,data:N,definition:l(),definitionDestinationString:O,definitionLabelString:x,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(F),hardBreakTrailing:l(F),htmlFlow:l(q),htmlFlowData:N,htmlText:l(L),htmlTextData:N,image:l(W),label:te,labelText:G,lineEnding:K,link:l(re),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ze,resourceDestinationString:S,resourceTitleString:ye,resource:pe,setextHeading:l(z),setextHeadingLineSequence:D,setextHeadingText:A,strong:l(),thematicBreak:l()}};Cw(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(R){let V={type:"root",children:[]};const ie={stack:[V],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},ae=[];let xe=-1;for(;++xe<R.length;)if(R[xe][1].type==="listOrdered"||R[xe][1].type==="listUnordered")if(R[xe][0]==="enter")ae.push(xe);else{const Mt=ae.pop();xe=o(R,Mt,xe)}for(xe=-1;++xe<R.length;){const Mt=t[R[xe][0]];xw.call(Mt,R[xe][1].type)&&Mt[R[xe][1].type].call(Object.assign({sliceSerialize:R[xe][2].sliceSerialize},ie),R[xe][1])}if(ie.tokenStack.length>0){const Mt=ie.tokenStack[ie.tokenStack.length-1];(Mt[1]||oy).call(ie,void 0,Mt[0])}for(V.position={start:no(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:no(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)V=t.transforms[xe](V)||V;return V}function o(R,V,ie){let ae=V-1,xe=-1,Mt=!1,Wt,Yn,Ir,Mr;for(;++ae<=ie;){const tn=R[ae];switch(tn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tn[0]==="enter"?xe++:xe--,Mr=void 0;break}case"lineEndingBlank":{tn[0]==="enter"&&(Wt&&!Mr&&!xe&&!Ir&&(Ir=ae),Mr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mr=void 0}if(!xe&&tn[0]==="enter"&&tn[1].type==="listItemPrefix"||xe===-1&&tn[0]==="exit"&&(tn[1].type==="listUnordered"||tn[1].type==="listOrdered")){if(Wt){let _r=ae;for(Yn=void 0;_r--;){const Kn=R[_r];if(Kn[1].type==="lineEnding"||Kn[1].type==="lineEndingBlank"){if(Kn[0]==="exit")continue;Yn&&(R[Yn][1].type="lineEndingBlank",Mt=!0),Kn[1].type="lineEnding",Yn=_r}else if(!(Kn[1].type==="linePrefix"||Kn[1].type==="blockQuotePrefix"||Kn[1].type==="blockQuotePrefixWhitespace"||Kn[1].type==="blockQuoteMarker"||Kn[1].type==="listItemIndent"))break}Ir&&(!Yn||Ir<Yn)&&(Wt._spread=!0),Wt.end=Object.assign({},Yn?R[Yn][1].start:tn[1].end),R.splice(Yn||ae,0,["exit",Wt,tn[2]]),ae++,ie++}if(tn[1].type==="listItemPrefix"){const _r={type:"listItem",_spread:!1,start:Object.assign({},tn[1].start),end:void 0};Wt=_r,R.splice(ae,0,["enter",_r,tn[2]]),ae++,ie++,Ir=void 0,Mr=!0}}}return R[V][1]._spread=Mt,ie}function i(R,V){return ie;function ie(ae){a.call(this,R(ae),ae),V&&V.call(this,ae)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(R,V,ie){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([V,ie||void 0]),R.position={start:no(V.start),end:void 0}}function l(R){return V;function V(ie){R&&R.call(this,ie),c.call(this,ie)}}function c(R,V){const ie=this.stack.pop(),ae=this.tokenStack.pop();if(ae)ae[0].type!==R.type&&(V?V.call(this,R,ae[0]):(ae[1]||oy).call(this,R,ae[0]));else throw new Error("Cannot close `"+R.type+"` ("+Qs({start:R.start,end:R.end})+"): it’s not open");ie.position.end=no(R.end)}function u(){return Ju(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(R){if(this.data.expectingFirstListItemValue){const V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function h(){const R=this.resume(),V=this.stack[this.stack.length-1];V.lang=R}function p(){const R=this.resume(),V=this.stack[this.stack.length-1];V.meta=R}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const R=this.resume(),V=this.stack[this.stack.length-1];V.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const R=this.resume(),V=this.stack[this.stack.length-1];V.value=R.replace(/(\r?\n|\r)$/g,"")}function x(R){const V=this.resume(),ie=this.stack[this.stack.length-1];ie.label=V,ie.identifier=or(this.sliceSerialize(R)).toLowerCase()}function k(){const R=this.resume(),V=this.stack[this.stack.length-1];V.title=R}function O(){const R=this.resume(),V=this.stack[this.stack.length-1];V.url=R}function M(R){const V=this.stack[this.stack.length-1];if(!V.depth){const ie=this.sliceSerialize(R).length;V.depth=ie}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function D(R){const V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(R){const ie=this.stack[this.stack.length-1].children;let ae=ie[ie.length-1];(!ae||ae.type!=="text")&&(ae=oe(),ae.position={start:no(R.start),end:void 0},ie.push(ae)),this.stack.push(ae)}function N(R){const V=this.stack.pop();V.value+=this.sliceSerialize(R),V.position.end=no(R.end)}function K(R){const V=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=V.children[V.children.length-1];ie.position.end=no(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(V.type)&&(Y.call(this,R),N.call(this,R))}function F(){this.data.atHardBreak=!0}function q(){const R=this.resume(),V=this.stack[this.stack.length-1];V.value=R}function L(){const R=this.resume(),V=this.stack[this.stack.length-1];V.value=R}function H(){const R=this.resume(),V=this.stack[this.stack.length-1];V.value=R}function re(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=V,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function W(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=V,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function G(R){const V=this.sliceSerialize(R),ie=this.stack[this.stack.length-2];ie.label=U2(V),ie.identifier=or(V).toLowerCase()}function te(){const R=this.stack[this.stack.length-1],V=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const ae=R.children;ie.children=ae}else ie.alt=V}function S(){const R=this.resume(),V=this.stack[this.stack.length-1];V.url=R}function ye(){const R=this.resume(),V=this.stack[this.stack.length-1];V.title=R}function pe(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function ze(R){const V=this.resume(),ie=this.stack[this.stack.length-1];ie.label=V,ie.identifier=or(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function ve(R){this.data.characterReferenceType=R.type}function Le(R){const V=this.sliceSerialize(R),ie=this.data.characterReferenceType;let ae;ie?(ae=H2(V,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=Mm(V);const xe=this.stack[this.stack.length-1];xe.value+=ae}function Et(R){const V=this.stack.pop();V.position.end=no(R.end)}function Pe(R){N.call(this,R);const V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(R)}function We(R){N.call(this,R);const V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(R)}function dt(){return{type:"blockquote",children:[]}}function xt(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function De(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function ft(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Tn(){return{type:"image",title:null,url:"",alt:null}}function zt(){return{type:"link",title:null,url:"",children:[]}}function It(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function _(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function P(){return{type:"paragraph",children:[]}}function U(){return{type:"strong",children:[]}}function oe(){return{type:"text",value:""}}function ne(){return{type:"thematicBreak"}}}function no(e){return{line:e.line,column:e.column,offset:e.offset}}function Cw(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Cw(e,r):I$(e,r)}}function I$(e,t){let n;for(n in t)if(xw.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function oy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is still open")}function M$(e){const t=this;t.parser=n;function n(r){return A$(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _$(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function O$(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
151
+ `}]}function R$(e,t){const n=t.value?t.value+`
152
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function L$(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D$(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function P$(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=ms(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function B$(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function F$(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kw(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function H$(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kw(e,t);const o={src:ms(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function U$(e,t){const n={src:ms(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function V$(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function $$(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kw(e,t);const o={href:ms(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function j$(e,t){const n={href:ms(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function z$(e,t,n){const r=e.all(t),o=n?W$(n):Tw(t),i={},s=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(o||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
153
+ `}),u.type==="element"&&u.tagName==="p"&&!o?s.push(...u.children):s.push(u)}const l=r[r.length-1];l&&(o||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
154
+ `});const c={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,c),e.applyData(t,c)}function W$(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Tw(n[r])}return t}function Tw(e){const t=e.spread;return t??e.children.length>1}function q$(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const s=r[o];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function G$(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Y$(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function K$(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q$(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),o.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=o2(t.children[1]),l=r2(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function X$(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],f={},h=s?s[l]:void 0;h&&(f.align=h);let p={type:"element",tagName:i,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function Z$(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const iy=9,sy=32;function J$(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(ay(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(ay(t.slice(o),o>0,!1)),i.join("")}function ay(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===iy||i===sy;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===iy||i===sy;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function ej(e,t){const n={type:"text",value:J$(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tj(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const jh={blockquote:_$,break:O$,code:R$,delete:L$,emphasis:D$,footnoteReference:P$,heading:B$,html:F$,imageReference:H$,image:U$,inlineCode:V$,linkReference:$$,link:j$,listItem:z$,list:q$,paragraph:G$,root:Y$,strong:K$,table:Q$,tableCell:Z$,tableRow:X$,text:ej,thematicBreak:tj,toml:El,yaml:El,definition:El,footnoteDefinition:El};function El(){}function nj(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function rj(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function oj(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||nj,r=e.options.footnoteBackLabel||rj,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),f=ms(d.toLowerCase());let h=0;const p=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++h<=g;){p.length>0&&p.push({type:"text",value:" "});let x=typeof n=="string"?n:n(l,h);typeof x=="string"&&(x={type:"text",value:x}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...p)}else u.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...cs(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
155
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
156
+ `}]}}const zh={}.hasOwnProperty,ij={};function sj(e,t){const n=t||ij,r=new Map,o=new Map,i=new Map,s={...jh,...n.handlers},a={all:c,applyData:lj,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:l,options:n,patch:aj,wrap:uj};return gi(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:o,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,h=a.handlers[f];if(zh.call(a.handlers,f)&&h)return h(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:g,...y}=u,b=cs(y);return b.children=a.all(u),b}return cs(u)}return(a.options.unknownHandler||cj)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let h=-1;for(;++h<f.length;){const p=a.one(f[h],u);if(p){if(h&&f[h-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=ly(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=ly(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function aj(e,t){e.position&&(t.position=s2(e))}function lj(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,cs(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function cj(e,t){const n=t.data||{},r="value"in t&&!(zh.call(n,"hProperties")||zh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uj(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
157
+ `});++r<e.length;)r&&n.push({type:"text",value:`
158
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
159
+ `}),n}function ly(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function cy(e,t){const n=sj(e,t),r=n.one(e,void 0),o=oj(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
160
+ `},o),i}function dj(e,t){return e&&"run"in e?async function(n,r){const o=cy(n,{file:r,...t});await e.run(o,r)}:function(n,r){return cy(n,{file:r,...e||t})}}const fj=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],hj=/["&'<>`]/g,pj=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,mj=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,gj=/[|\\{}()[\]^$+*?.]/g,uy=new WeakMap;function bj(e,t){if(e=e.replace(t.subset?yj(t.subset):hj,r),t.subset||t.escapeOnly)return e;return e.replace(pj,n).replace(mj,r);function n(o,i,s){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),t)}function r(o,i,s){return t.format(o.charCodeAt(0),s.charCodeAt(i+1),t)}}function yj(e){let t=uy.get(e);return t||(t=Ej(e),uy.set(e,t)),t}function Ej(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(gj,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const xj=/[\dA-Fa-f]/;function Cj(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!xj.test(String.fromCharCode(t))?r:r+";"}const kj=/\d/;function Tj(e,t,n){const r="&#"+String(e);return n&&t&&!kj.test(String.fromCharCode(t))?r:r+";"}const wj=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],yf={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Sj=["cent","copy","divide","gt","lt","not","para","times"],ww={}.hasOwnProperty,Wh={};let xl;for(xl in yf)ww.call(yf,xl)&&(Wh[yf[xl]]=xl);const vj=/[^\dA-Za-z]/;function Aj(e,t,n,r){const o=String.fromCharCode(e);if(ww.call(Wh,o)){const i=Wh[o],s="&"+i;return n&&wj.includes(i)&&!Sj.includes(i)&&(!r||t&&t!==61&&vj.test(String.fromCharCode(t)))?s:s+";"}return""}function Nj(e,t,n){let r=Cj(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=Aj(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=Tj(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Yi(e,t){return bj(e,Object.assign({format:Nj},t))}const Ij=/^>|^->|<!--|-->|--!>|<!-$/g,Mj=[">"],_j=["<",">"];function Oj(e,t,n,r){return r.settings.bogusComments?"<?"+Yi(e.value,Object.assign({},r.settings.characterReferences,{subset:Mj}))+">":"<!--"+e.value.replace(Ij,o)+"-->";function o(i){return Yi(i,Object.assign({},r.settings.characterReferences,{subset:_j}))}}function Rj(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Ot=vw(1),Sw=vw(-1),Lj=[];function vw(e){return t;function t(n,r,o){const i=n?n.children:Lj;let s=(r||0)+e,a=i[s];if(!o)for(;a&&Ua(a);)s+=e,a=i[s];return a}}const Dj={}.hasOwnProperty;function Aw(e){return t;function t(n,r,o){return Dj.call(e,n.tagName)&&e[n.tagName](n,r,o)}}const Pm=Aw({body:Bj,caption:Ef,colgroup:Ef,dd:Vj,dt:Uj,head:Ef,html:Pj,li:Hj,optgroup:$j,option:jj,p:Fj,rp:dy,rt:dy,tbody:Wj,td:fy,tfoot:qj,th:fy,thead:zj,tr:Gj});function Ef(e,t,n){const r=Ot(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Ua(r.value.charAt(0)))}function Pj(e,t,n){const r=Ot(n,t);return!r||r.type!=="comment"}function Bj(e,t,n){const r=Ot(n,t);return!r||r.type!=="comment"}function Fj(e,t,n){const r=Ot(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Hj(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Uj(e,t,n){const r=Ot(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Vj(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function dy(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function $j(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function jj(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function zj(e,t,n){const r=Ot(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Wj(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function qj(e,t,n){return!Ot(n,t)}function Gj(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function fy(e,t,n){const r=Ot(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Yj=Aw({body:Xj,colgroup:Zj,head:Qj,html:Kj,tbody:Jj});function Kj(e){const t=Ot(e,-1);return!t||t.type!=="comment"}function Qj(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Xj(e){const t=Ot(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Ua(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Zj(e,t,n){const r=Sw(n,t),o=Ot(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Pm(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function Jj(e,t,n){const r=Sw(n,t),o=Ot(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Pm(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const Cl={name:[[`
161
+ \f\r &/=>`.split(""),`
162
+ \f\r "&'/=>\``.split("")],[`\0
163
+ \f\r "&'/<=>`.split(""),`\0
164
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
165
+ \f\r &>`.split(""),`\0
166
+ \f\r "&'<=>\``.split("")],[`\0
167
+ \f\r "&'<=>\``.split(""),`\0
168
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ez(e,t,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let s=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;o.space==="html"&&e.tagName==="svg"&&(r.schema=Ba);const c=tz(r,e.properties),u=r.all(o.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=o,u&&(s=!1),(c||!i||!Yj(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),s&&(o.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!s&&(!i||!Pm(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function tz(e,t){const n=[];let r=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=nz(e,o,t[o]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function nz(e,t,n){const r=fm(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let s=e.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Yi(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Cl.name[o][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?gP:yP)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Yi(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Cl.unquoted[o][i]}))),a!==n&&(e.settings.quoteSmart&&Mc(n,s)>Mc(n,e.alternative)&&(s=e.alternative),a=s+Yi(n,Object.assign({},e.settings.characterReferences,{subset:(s==="'"?Cl.single:Cl.double)[o][i],attribute:!0}))+s),l+(a&&"="+a))}const rz=["<","&"];function Nw(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Yi(e.value,Object.assign({},r.settings.characterReferences,{subset:rz}))}function oz(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Nw(e,t,n,r)}function iz(e,t,n,r){return r.all(e)}const sz=S2("type",{invalid:az,unknown:lz,handlers:{comment:Oj,doctype:Rj,element:ez,raw:oz,root:iz,text:Nw}});function az(e){throw new Error("Expected node, not `"+e+"`")}function lz(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const cz={},uz={},dz=[];function fz(e,t){const n=t||cz,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:hz,all:pz,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||fj,characterReferences:n.characterReferences||uz,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ba:Wu,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function hz(e,t,n){return sz(e,t,n,this)}function pz(e){const t=[],n=e&&e.children||dz;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function mz(e){const t=this,n={...t.data("settings"),...e};t.compiler=r;function r(o){return fz(o,n)}}class Ti{match;handler;undoable;inCode;inCodeMark;constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?gz(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function gz(e){return function(t,n,r,o){let i=e;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let a=r-o;a>0&&(i=n[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}}const bz=500;function yz({rules:e}){let t=new Ae({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return hy(n,r,o,i,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&hy(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function hy(e,t,n,r,o,i){if(e.composing)return!1;const s=e.state.tr.insertText(r,t,n),a=s.mapping.map(t),l=s.mapping.map(n);let c=null,u=s.doc.resolve(a),d=u.parent.textBetween(Math.max(0,u.parentOffset-bz),u.parentOffset,null,"");for(let f=0;f<o.length;f++){let h=o[f];if(!h.inCodeMark&&u.marks().some(y=>y.type.spec.code))continue;if(u.parent.type.spec.code){if(!h.inCode)continue}else if(h.inCode==="only")continue;let p=h.match.exec(d);if(!p||p[0].length<r.length)continue;c??=e.state.apply(s);let g=h.handler(c,p,a-p[0].length,l);if(g)return e.dispatch(s),e.dispatch(aP(e.state.tr)),h.undoable&&g.setMeta(i,{transform:g,from:a,to:l,text:r}),e.dispatch(g),!0}return!1}new Ti(/--$/,"—",{inCodeMark:!1});new Ti(/\.\.\.$/,"…",{inCodeMark:!1});new Ti(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Ti(/"$/,"”",{inCodeMark:!1});new Ti(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Ti(/'$/,"’",{inCodeMark:!1});class bt extends ge{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return bt.valid(r)?new bt(r):ge.near(r)}content(){return Z.empty}eq(t){return t instanceof bt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new bt(t.resolve(n.pos))}getBookmark(){return new Bm(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Ez(t)||!xz(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&bt.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(bt.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!le.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(bt.valid(a))return a}return null}}}bt.prototype.visible=!1;bt.findFrom=bt.findGapCursorFrom;ge.jsonID("gapcursor",bt);class Bm{constructor(t){this.pos=t}map(t){return new Bm(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return bt.valid(n)?new bt(n):ge.near(n)}}function Iw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Ez(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||Iw(o.type))return!0;if(o.inlineContent)return!1}}return!0}function xz(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||Iw(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Cz(){return new Ae({props:{decorations:Sz,createSelectionBetween(e,t,n){return t.pos==n.pos&&bt.valid(n)?new bt(n):null},handleClick:Tz,handleKeyDown:kz,handleDOMEvents:{beforeinput:wz}}})}const kz=Pp({ArrowLeft:kl("horiz",-1),ArrowRight:kl("horiz",1),ArrowUp:kl("vert",-1),ArrowDown:kl("vert",1)});function kl(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof se){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=bt.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new bt(c))),!0):!1}}function Tz(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!bt.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&le.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new bt(r))),!0)}function wz(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof bt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=j.empty;for(let s=r.length-1;s>=0;s--)o=j.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Z(o,0,0));return i.setSelection(se.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Sz(e){if(!(e.selection instanceof bt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",_e.create(e.doc,[qe.widget(e.selection.head,t,{key:"gapcursor"})])}var vz=mt.create({name:"gapCursor",addProseMirrorPlugins(){return[Cz()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Qe(de(e,"allowGapCursor",n)))!=null?t:null}}});const Az="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Nz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",qh="numeric",Gh="ascii",Yh="alpha",Js="asciinumeric",Ds="alphanumeric",Kh="domain",Mw="emoji",Iz="scheme",Mz="slashscheme",xf="whitespace";function _z(e,t){return e in t||(t[e]=[]),t[e]}function Ko(e,t,n){t[qh]&&(t[Js]=!0,t[Ds]=!0),t[Gh]&&(t[Js]=!0,t[Yh]=!0),t[Js]&&(t[Ds]=!0),t[Yh]&&(t[Ds]=!0),t[Ds]&&(t[Kh]=!0),t[Mw]&&(t[Kh]=!0);for(const r in t){const o=_z(r,n);o.indexOf(e)<0&&o.push(e)}}function Oz(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function gn(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}gn.groups={};gn.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const o=t.jr[r][0],i=t.jr[r][1];if(i&&o.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){r=r||gn.groups;let o;return t&&t.j?o=t:(o=new gn(t),n&&r&&Ko(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(e[s]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||gn.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new gn,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new gn,i){if(r)if(s.t&&typeof s.t=="string"){const l=Object.assign(Oz(s.t,r),n);Ko(i,l,r)}else n&&Ko(i,n,r);s.t=i}return o.j[e]=s,s}};const we=(e,t,n,r,o)=>e.ta(t,n,r,o),gt=(e,t,n,r,o)=>e.tr(t,n,r,o),py=(e,t,n,r,o)=>e.ts(t,n,r,o),J=(e,t,n,r,o)=>e.tt(t,n,r,o),Fr="WORD",Qh="UWORD",_w="ASCIINUMERICAL",Ow="ALPHANUMERICAL",Aa="LOCALHOST",Xh="TLD",Zh="UTLD",Wl="SCHEME",Pi="SLASH_SCHEME",Fm="NUM",Jh="WS",Hm="NL",ea="OPENBRACE",ta="CLOSEBRACE",Rc="OPENBRACKET",Lc="CLOSEBRACKET",Dc="OPENPAREN",Pc="CLOSEPAREN",Bc="OPENANGLEBRACKET",Fc="CLOSEANGLEBRACKET",Hc="FULLWIDTHLEFTPAREN",Uc="FULLWIDTHRIGHTPAREN",Vc="LEFTCORNERBRACKET",$c="RIGHTCORNERBRACKET",jc="LEFTWHITECORNERBRACKET",zc="RIGHTWHITECORNERBRACKET",Wc="FULLWIDTHLESSTHAN",qc="FULLWIDTHGREATERTHAN",Gc="AMPERSAND",Yc="APOSTROPHE",Kc="ASTERISK",fo="AT",Qc="BACKSLASH",Xc="BACKTICK",Zc="CARET",go="COLON",Um="COMMA",Jc="DOLLAR",dr="DOT",eu="EQUALS",Vm="EXCLAMATION",Pn="HYPHEN",na="PERCENT",tu="PIPE",nu="PLUS",ru="POUND",ra="QUERY",$m="QUOTE",Rw="FULLWIDTHMIDDLEDOT",jm="SEMI",fr="SLASH",oa="TILDE",ou="UNDERSCORE",Lw="EMOJI",iu="SYM";var Dw=Object.freeze({__proto__:null,ALPHANUMERICAL:Ow,AMPERSAND:Gc,APOSTROPHE:Yc,ASCIINUMERICAL:_w,ASTERISK:Kc,AT:fo,BACKSLASH:Qc,BACKTICK:Xc,CARET:Zc,CLOSEANGLEBRACKET:Fc,CLOSEBRACE:ta,CLOSEBRACKET:Lc,CLOSEPAREN:Pc,COLON:go,COMMA:Um,DOLLAR:Jc,DOT:dr,EMOJI:Lw,EQUALS:eu,EXCLAMATION:Vm,FULLWIDTHGREATERTHAN:qc,FULLWIDTHLEFTPAREN:Hc,FULLWIDTHLESSTHAN:Wc,FULLWIDTHMIDDLEDOT:Rw,FULLWIDTHRIGHTPAREN:Uc,HYPHEN:Pn,LEFTCORNERBRACKET:Vc,LEFTWHITECORNERBRACKET:jc,LOCALHOST:Aa,NL:Hm,NUM:Fm,OPENANGLEBRACKET:Bc,OPENBRACE:ea,OPENBRACKET:Rc,OPENPAREN:Dc,PERCENT:na,PIPE:tu,PLUS:nu,POUND:ru,QUERY:ra,QUOTE:$m,RIGHTCORNERBRACKET:$c,RIGHTWHITECORNERBRACKET:zc,SCHEME:Wl,SEMI:jm,SLASH:fr,SLASH_SCHEME:Pi,SYM:iu,TILDE:oa,TLD:Xh,UNDERSCORE:ou,UTLD:Zh,UWORD:Qh,WORD:Fr,WS:Jh});const Rr=/[a-z]/,ws=new RegExp("\\p{L}","u"),Cf=new RegExp("\\p{Emoji}","u"),Lr=/\d/,kf=/\s/,my="\r",Tf=`
169
+ `,Rz="️",Lz="‍",wf="";let Tl=null,wl=null;function Dz(e=[]){const t={};gn.groups=t;const n=new gn;Tl==null&&(Tl=gy(Az)),wl==null&&(wl=gy(Nz)),J(n,"'",Yc),J(n,"{",ea),J(n,"}",ta),J(n,"[",Rc),J(n,"]",Lc),J(n,"(",Dc),J(n,")",Pc),J(n,"<",Bc),J(n,">",Fc),J(n,"(",Hc),J(n,")",Uc),J(n,"「",Vc),J(n,"」",$c),J(n,"『",jc),J(n,"』",zc),J(n,"<",Wc),J(n,">",qc),J(n,"&",Gc),J(n,"*",Kc),J(n,"@",fo),J(n,"`",Xc),J(n,"^",Zc),J(n,":",go),J(n,",",Um),J(n,"$",Jc),J(n,".",dr),J(n,"=",eu),J(n,"!",Vm),J(n,"-",Pn),J(n,"%",na),J(n,"|",tu),J(n,"+",nu),J(n,"#",ru),J(n,"?",ra),J(n,'"',$m),J(n,"/",fr),J(n,";",jm),J(n,"~",oa),J(n,"_",ou),J(n,"\\",Qc),J(n,"・",Rw);const r=gt(n,Lr,Fm,{[qh]:!0});gt(r,Lr,r);const o=gt(r,Rr,_w,{[Js]:!0}),i=gt(r,ws,Ow,{[Ds]:!0}),s=gt(n,Rr,Fr,{[Gh]:!0});gt(s,Lr,o),gt(s,Rr,s),gt(o,Lr,o),gt(o,Rr,o);const a=gt(n,ws,Qh,{[Yh]:!0});gt(a,Rr),gt(a,Lr,i),gt(a,ws,a),gt(i,Lr,i),gt(i,Rr),gt(i,ws,i);const l=J(n,Tf,Hm,{[xf]:!0}),c=J(n,my,Jh,{[xf]:!0}),u=gt(n,kf,Jh,{[xf]:!0});J(n,wf,u),J(c,Tf,l),J(c,wf,u),gt(c,kf,u),J(u,my),J(u,Tf),gt(u,kf,u),J(u,wf,u);const d=gt(n,Cf,Lw,{[Mw]:!0});J(d,"#"),gt(d,Cf,d),J(d,Rz,d);const f=J(d,Lz);J(f,"#"),gt(f,Cf,d);const h=[[Rr,s],[Lr,o]],p=[[Rr,null],[ws,a],[Lr,i]];for(let g=0;g<Tl.length;g++)ro(n,Tl[g],Xh,Fr,h);for(let g=0;g<wl.length;g++)ro(n,wl[g],Zh,Qh,p);Ko(Xh,{tld:!0,ascii:!0},t),Ko(Zh,{utld:!0,alpha:!0},t),ro(n,"file",Wl,Fr,h),ro(n,"mailto",Wl,Fr,h),ro(n,"http",Pi,Fr,h),ro(n,"https",Pi,Fr,h),ro(n,"ftp",Pi,Fr,h),ro(n,"ftps",Pi,Fr,h),Ko(Wl,{scheme:!0,ascii:!0},t),Ko(Pi,{slashscheme:!0,ascii:!0},t),e=e.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<e.length;g++){const y=e[g][0],x=e[g][1]?{[Iz]:!0}:{[Mz]:!0};y.indexOf("-")>=0?x[Kh]=!0:Rr.test(y)?Lr.test(y)?x[Js]=!0:x[Gh]=!0:x[qh]=!0,py(n,y,y,x)}return py(n,"localhost",Aa,{ascii:!0}),n.jd=new gn(iu),{start:n,tokens:Object.assign({groups:t},Dw)}}function Pw(e,t){const n=Pz(t.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function Pz(e){const t=[],n=e.length;let r=0;for(;r<n;){let o=e.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}function ro(e,t,n,r,o){let i;const s=t.length;for(let a=0;a<s-1;a++){const l=t[a];e.j[l]?i=e.j[l]:(i=new gn(r),i.jr=o.slice(),e.j[l]=i),e=i}return i=new gn(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function gy(e){const t=[],n=[];let r=0,o="0123456789";for(;r<e.length;){let i=0;for(;o.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let s=parseInt(e.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(e[r]),r++}return t}const Na={defaultProtocol:"http",events:null,format:by,formatHref:by,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function zm(e,t=null){let n=Object.assign({},Na);e&&(n=Object.assign(n,e instanceof zm?e.o:e));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}zm.prototype={o:Na,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let o=this.o[e];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Na[e],typeof o=="function"&&r&&(o=o(t,n))):typeof o=="function"&&r&&(o=o(t,n.t,n)),o)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function by(e){return e}function Bw(e,t){this.t="token",this.v=e,this.tk=t}Bw.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Na.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function od(e,t){class n extends Bw{constructor(o,i){super(o,i),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const yy=od("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ey=od("text"),Bz=od("nl"),Sl=od("url",{isLink:!0,toHref(e=Na.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Aa&&e[1].t===go}}),Dn=e=>new gn(e);function Fz({groups:e}){const t=e.domain.concat([Gc,Kc,fo,Qc,Xc,Zc,Jc,eu,Pn,Fm,na,tu,nu,ru,fr,iu,oa,ou]),n=[Yc,go,Um,dr,Vm,na,ra,$m,jm,Bc,Fc,ea,ta,Lc,Rc,Dc,Pc,Hc,Uc,Vc,$c,jc,zc,Wc,qc],r=[Gc,Yc,Kc,Qc,Xc,Zc,Jc,eu,Pn,ea,ta,na,tu,nu,ru,ra,fr,iu,oa,ou],o=Dn(),i=J(o,oa);we(i,r,i),we(i,e.domain,i);const s=Dn(),a=Dn(),l=Dn();we(o,e.domain,s),we(o,e.scheme,a),we(o,e.slashscheme,l),we(s,r,i),we(s,e.domain,s);const c=J(s,fo);J(i,fo,c),J(a,fo,c),J(l,fo,c);const u=J(i,dr);we(u,r,i),we(u,e.domain,i);const d=Dn();we(c,e.domain,d),we(d,e.domain,d);const f=J(d,dr);we(f,e.domain,d);const h=Dn(yy);we(f,e.tld,h),we(f,e.utld,h),J(c,Aa,h);const p=J(d,Pn);J(p,Pn,p),we(p,e.domain,d),we(h,e.domain,d),J(h,dr,f),J(h,Pn,p);const g=J(h,go);we(g,e.numeric,yy);const y=J(s,Pn),b=J(s,dr);J(y,Pn,y),we(y,e.domain,s),we(b,r,i),we(b,e.domain,s);const x=Dn(Sl);we(b,e.tld,x),we(b,e.utld,x),we(x,e.domain,s),we(x,r,i),J(x,dr,b),J(x,Pn,y),J(x,fo,c);const k=J(x,go),O=Dn(Sl);we(k,e.numeric,O);const M=Dn(Sl),A=Dn();we(M,t,M),we(M,n,A),we(A,t,M),we(A,n,A),J(x,fr,M),J(O,fr,M);const D=J(a,go),z=J(l,go),Y=J(z,fr),N=J(Y,fr);we(a,e.domain,s),J(a,dr,b),J(a,Pn,y),we(l,e.domain,s),J(l,dr,b),J(l,Pn,y),we(D,e.domain,M),J(D,fr,M),J(D,ra,M),we(N,e.domain,M),we(N,t,M),J(N,fr,M);const K=[[ea,ta],[Rc,Lc],[Dc,Pc],[Bc,Fc],[Hc,Uc],[Vc,$c],[jc,zc],[Wc,qc]];for(let F=0;F<K.length;F++){const[q,L]=K[F],H=J(M,q);J(A,q,H),J(H,L,M);const re=Dn(Sl);we(H,t,re);const W=Dn();we(H,n),we(re,t,re),we(re,n,W),we(W,t,re),we(W,n,W),J(re,L,M),J(W,L,M)}return J(o,Aa,x),J(o,Hm,Bz),{start:o,tokens:Dw}}function Hz(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Sf(Ey,t,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Sf(h,t,p))}}return s.length>0&&i.push(Sf(Ey,t,s)),i}function Sf(e,t,n){const r=n[0].s,o=n[n.length-1].e,i=t.slice(r,o);return new e(i,n)}const Uz=typeof console<"u"&&console&&console.warn||(()=>{}),Vz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",st={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $z(){return gn.groups={},st.scanner=null,st.parser=null,st.tokenQueue=[],st.pluginQueue=[],st.customSchemes=[],st.initialized=!1,st}function xy(e,t=!1){if(st.initialized&&Uz(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Vz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
170
+ 1. Must only contain digits, lowercase ASCII letters or "-"
171
+ 2. Cannot start or end with "-"
172
+ 3. "-" cannot repeat`);st.customSchemes.push([e,t])}function jz(){st.scanner=Dz(st.customSchemes);for(let e=0;e<st.tokenQueue.length;e++)st.tokenQueue[e][1]({scanner:st.scanner});st.parser=Fz(st.scanner.tokens);for(let e=0;e<st.pluginQueue.length;e++)st.pluginQueue[e][1]({scanner:st.scanner,parser:st.parser});return st.initialized=!0,st}function Wm(e){return st.initialized||jz(),Hz(st.parser.start,e,Pw(st.scanner.start,e))}Wm.scan=Pw;function Fw(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new zm(n),o=Wm(e),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!t||a.t===t)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var qm="[\0-   ᠎ -\u2029  ]",zz=new RegExp(qm),Wz=new RegExp(`${qm}$`),qz=new RegExp(qm,"g");function Gz(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Yz(e){return new Ae({key:new $e("autolink"),appendTransaction:(t,n,r)=>{const o=t.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=t.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=Lu(n.doc,[...t]);if($p(a).forEach(({newRange:c})=>{const u=yc(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Wz.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(zz).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const y=Wm(p).map(b=>b.toObject(e.defaultProtocol));if(!Gz(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>e.validate(b.value)).filter(b=>e.shouldAutoLink(b.value)).forEach(b=>{jp(b.from,b.to,r.doc).some(x=>x.mark.type===e.type)||s.addMark(b.from,b.to,e.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Kz(e){return new Ae({key:new $e("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(r.button!==0||!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const l=r.target;if(!l)return!1;const c=e.editor.view.dom;s=l.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const l=KC(t.state,e.type.name),c=(o=s.href)!=null?o:l.href,u=(i=s.target)!=null?i:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function Qz(e){return new Ae({key:new $e("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=Fw(l,{defaultProtocol:e.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||o!==void 0&&!o(c.value)?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function zo(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!e||e.replace(qz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Xz=Gn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){xy(e);return}xy(e.scheme,e.optionalSlashes)})},onDestroy(){$z()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!zo(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const o=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!zo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!zo(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rn(this.options.HTMLAttributes,e),0]:["a",Rn(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=(r=(n=e.attrs)==null?void 0:n.href)!=null?r:"",a=(i=(o=e.attrs)==null?void 0:o.title)!=null?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!zo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!zo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ui({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=Fw(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!zo(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Yz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!zo(o,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Kz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Qz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Zz=sr.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""});function Jz(e,t,n,r="before"){let o=typeof n=="string"?n:n.id,i=kt(e),s=t.map(c=>Ei(c,i)),a=cn(o,e.doc);if(!a)throw Error(`Block with ID ${o} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),e.step(new vt(l,l,new Z(j.from(s),0,0))),s.map(c=>pt(c,i))}function ep(e){if(!e||e.type.name!=="column")throw Error("Invalid columnPos: does not point to column node.");let t=e.firstChild;if(!t)throw Error("Invalid column: does not have child node.");let n=t.firstChild;if(!n)throw Error("Invalid blockContainer: does not have child node.");return e.childCount===1&&t.childCount===1&&n.type.name==="paragraph"&&n.content.content.length===0}function eW(e,t){let n=e.doc.resolve(t),r=n.nodeAfter;if(!r||r.type.name!=="columnList")throw Error("Invalid columnListPos: does not point to columnList node.");for(let o=r.childCount-1;o>=0;o--){let i=e.doc.resolve(n.pos+1).posAtIndex(o),s=e.doc.resolve(i).nodeAfter;if(!s||s.type.name!=="column")throw Error("Invalid columnPos: does not point to column node.");ep(s)&&e.delete(i,i+s.nodeSize)}}function ql(e,t){eW(e,t);let n=e.doc.resolve(t).nodeAfter;if(!n||n.type.name!=="columnList")throw Error("Invalid columnListPos: does not point to columnList node.");if(n.childCount>2)return;if(n.childCount<2)throw Error("Invalid columnList: contains fewer than two children.");let r=t+1,o=e.doc.resolve(r).nodeAfter,i=t+n.nodeSize-1,s=e.doc.resolve(i).nodeBefore;if(!o||!s)throw Error("Invalid columnList: does not contain children.");let a=ep(o),l=ep(s);if(a&&l){e.delete(t,t+n.nodeSize);return}if(a){e.step(new yt(t,t+n.nodeSize,i-s.nodeSize+1,i-1,Z.empty,0,!1));return}if(l){e.step(new yt(t,t+n.nodeSize,r+1,r+o.nodeSize-1,Z.empty,0,!1));return}}function Cy(e,t,n){let r=kt(e),o=n.map(u=>Ei(u,r)),i=new Set(t.map(u=>typeof u=="string"?u:u.id)),s=[],a=new Set,l=typeof t[0]=="string"?t[0]:t[0].id,c=0;if(e.doc.descendants((u,d)=>{if(i.size===0)return!1;if(!u.type.isInGroup("bnBlock")||!i.has(u.attrs.id))return!0;if(s.push(pt(u,r)),i.delete(u.attrs.id),n.length>0&&u.attrs.id===l){let g=e.doc.nodeSize;e.insert(d,o);let y=e.doc.nodeSize;c+=g-y}let f=e.doc.nodeSize,h=e.doc.resolve(d-c);h.node().type.name==="column"?a.add(h.before(-1)):h.node().type.name==="columnList"&&a.add(h.before()),h.node().type.name==="blockGroup"&&h.node(h.depth-1).type.name!=="doc"&&h.node().childCount===1?e.delete(h.before(),h.after()):e.delete(d-c,d-c+u.nodeSize);let p=e.doc.nodeSize;return c+=f-p,!1}),i.size>0){let u=[...i].join(`
173
+ `);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>ql(e,u)),{insertedBlocks:o.map(u=>pt(u,r)),removedBlocks:s}}function tW(e,t,n,r,o){let i;if(!t)throw Error("blockContent is required");if(typeof t=="string")i=ir([t],e.pmSchema,r);else if(Array.isArray(t))i=ir(t,e.pmSchema,r);else if(t.type==="tableContent")i=Uu(t,e.pmSchema);else throw new Tr(t.type);let s=(o?.document??document).createDocumentFragment();for(let a of i)if(a.type.name!=="text"&&e.schema.inlineContentSchema[a.type.name]){let l=e.schema.inlineContentSpecs[a.type.name].implementation;if(l){let c=rm(a,e.schema.inlineContentSchema,e.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},e);if(u){if(s.appendChild(u.dom),u.contentDOM){let d=n.serializeFragment(a.content,o);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(let c of a.marks.toReversed())if(c.type.name in e.schema.styleSpecs){let u=e.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,e);u.contentDOM.appendChild(l),l=u.dom}else{let u=c.type.spec.toDOM(c,!0),d=On.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{let l=n.serializeFragment(j.from([a]),o);s.appendChild(l)}return s}function nW(e,t,n,r){let o=e.pmSchema.nodes.blockContainer,i=t.props||{};for(let[c,u]of Object.entries(e.schema.blockSchema[t.type].propSchema))!(c in i)&&u.default!==void 0&&(i[c]=u.default);let s=t.children||[],a=e.blockImplementations[t.type].implementation.render.call({renderType:"dom",props:void 0},{...t,props:i,children:s},e);if(a.contentDOM&&t.content){let c=tW(e,t.content,n,t.type,r);a.contentDOM.appendChild(c)}if(e.pmSchema.nodes[t.type].isInGroup("bnBlock")){if(t.children&&t.children.length>0){let c=Hw(e,t.children,n,r);a.contentDOM?.append(c)}return a.dom}let l=o.spec?.toDOM?.(o.create({id:t.id,...i}));return l.contentDOM?.appendChild(a.dom),t.children&&t.children.length>0&&l.contentDOM?.appendChild(Uw(e,t.children,n,r)),l.dom}function Hw(e,t,n,r){let o=(r?.document??document).createDocumentFragment();for(let i of t){let s=nW(e,i,n,r);o.appendChild(s)}return o}var Uw=(e,t,n,r)=>{let o=e.pmSchema.nodes.blockGroup,i=o.spec.toDOM(o.create({})),s=Hw(e,t,n,r);return i.contentDOM?.appendChild(s),i.dom},rW=e=>(e.querySelectorAll('[data-content-type="numberedListItem"]').forEach(t=>{let n=t.closest(".bn-block-outer")?.previousElementSibling?.querySelector('[data-content-type="numberedListItem"]');if(!n)t.setAttribute("data-index",t.getAttribute("data-start")||"1");else{let r=n.getAttribute("data-index");t.setAttribute("data-index",(parseInt(r||"0")+1).toString())}}),e),oW=e=>(e.querySelectorAll('[data-content-type="checkListItem"] input').forEach(t=>{t.disabled=!0}),e),iW=e=>(e.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(t=>{t.setAttribute("data-show-children","true")}),e),sW=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(t=>{t.setAttribute("style","--default-cell-min-width: 120px;"),t.setAttribute("data-show-children","true")}),e),aW=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(t=>{let n=document.createElement("div");n.className="tableWrapper";let r=document.createElement("div");r.className="tableWrapper-inner",n.appendChild(r),t.parentElement?.appendChild(n),n.appendChild(t)}),e),lW=e=>(e.querySelectorAll(".bn-inline-content:empty").forEach(t=>{let n=document.createElement("span");n.className="ProseMirror-trailingBreak",n.setAttribute("style","display: inline-block;"),t.appendChild(n)}),e),cW=(e,t)=>{let n=On.fromSchema(e),r=[rW,oW,iW,sW,aW,lW];return{serializeBlocks:(o,i)=>{let s=Uw(t,o,n,i);for(let a of r)s=a(s);return s.outerHTML}}};function uW(e){return e.transact(t=>{let n=_o(t.doc,t.selection.anchor);if(t.selection instanceof Ge)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:t.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:t.selection.$headCell.pos-n.posBeforeNode};if(t.selection instanceof le)return{type:"node",anchorBlockId:n.node.attrs.id};{let r=_o(t.doc,t.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:t.selection.anchor-n.posBeforeNode,headOffset:t.selection.head-r.posBeforeNode}}})}function dW(e,t){let n=cn(t.anchorBlockId,e.doc)?.posBeforeNode;if(n===void 0)throw Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);let r;if(t.type==="cell")r=Ge.create(e.doc,n+t.anchorCellOffset,n+t.headCellOffset);else if(t.type==="node")r=le.create(e.doc,n+1);else{let o=cn(t.headBlockId,e.doc)?.posBeforeNode;if(o===void 0)throw Error(`Could not find block with ID ${t.headBlockId} to update selection`);r=se.create(e.doc,n+t.anchorOffset,o+t.headOffset)}e.setSelection(r)}function tp(e){return e.map(t=>t.type==="columnList"?t.children.map(n=>tp(n.children)).flat():{...t,children:tp(t.children)}).flat()}function Vw(e,t,n){e.transact(r=>{let o=e.getSelection()?.blocks||[e.getTextCursorPosition().block],i=uW(e);e.removeBlocks(o),e.insertBlocks(tp(o),t,n),dW(r,i)})}function $w(e){return!e||e.type!=="columnList"}function jw(e,t,n){let r,o;if(t?t.children.length>0?(r=t.children[t.children.length-1],o="after"):(r=t,o="before"):n&&(r=n,o="before"),!r||!o)return;let i=e.getParentBlock(r);return $w(i)?{referenceBlock:r,placement:o}:jw(e,o==="after"?r:e.getPrevBlock(r),i)}function zw(e,t,n){let r,o;if(t?t.children.length>0?(r=t.children[0],o="before"):(r=t,o="after"):n&&(r=n,o="after"),!r||!o)return;let i=e.getParentBlock(r);return $w(i)?{referenceBlock:r,placement:o}:zw(e,o==="before"?r:e.getNextBlock(r),i)}function fW(e){e.transact(()=>{let t=e.getSelection()?.blocks[0]||e.getTextCursorPosition().block,n=jw(e,e.getPrevBlock(t),e.getParentBlock(t));n&&Vw(e,n.referenceBlock,n.placement)})}function hW(e){e.transact(()=>{let t=e.getSelection(),n=t?.blocks[t?.blocks.length-1]||e.getTextCursorPosition().block,r=zw(e,e.getNextBlock(n),e.getParentBlock(n));r&&Vw(e,r.referenceBlock,r.placement)})}function pW(e,t,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,h=>h.childCount>0&&(h.type.name==="blockGroup"||h.type.name==="column"));if(!i)return!1;let s=i.startIndex;if(s===0)return!1;let a=i.parent.child(s-1);if(a.type!==t)return!1;let l=a.lastChild&&a.lastChild.type===n,c=j.from(l?t.create():null),u=new Z(j.from(t.create(null,j.from(n.create(null,c)))),l?3:1,0),d=i.start,f=i.end;return e.step(new yt(d-(l?3:1),f,d,f,u,1,!0)).scrollIntoView(),!0}function Ww(e){return e.transact(t=>pW(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}function mW(e,t,n,r){let o=r.end,i=r.$to.end(r.depth);if(o<i){let l=r.parent.child(r.endIndex-1),c=l.lastChild&&l.lastChild.type===n;e.step(new yt(o-(c?2:1),i,o,i,new Z(j.from(t.create(null,n.create())),c?2:1,0),c?0:1,!0)),r=new ca(e.doc.resolve(r.$from.pos),e.doc.resolve(i),r.depth)}let s=yi(r);if(s==null)return!1;e.lift(r,s);let a=e.doc.resolve(e.mapping.map(o,-1)-1);return Bo(e.doc,a.pos)&&a.nodeBefore.type===a.nodeAfter.type&&e.join(a.pos),e.scrollIntoView(),!0}function np(e,t,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&(s.type.name==="blockGroup"||s.type.name==="column"));return i&&r.node(i.depth-1).type===t?mW(e,t,n,i):!1}function qw(e){return e.transact(t=>np(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}function gW(e){return e.transact(t=>{let{bnBlock:n}=La(t);return t.doc.resolve(n.beforePos).nodeBefore!==null})}function bW(e){return e.transact(t=>{let{bnBlock:n}=La(t);return t.doc.resolve(n.beforePos).depth>1})}function yW(e,t){let n=typeof t=="string"?t:t.id,r=kt(e),o=cn(n,e);if(o)return pt(o.node,r)}function EW(e,t){let n=cn(typeof t=="string"?t:t.id,e),r=kt(e);if(!n)return;let o=e.resolve(n.posBeforeNode).nodeBefore;if(o)return pt(o,r)}function xW(e,t){let n=cn(typeof t=="string"?t:t.id,e),r=kt(e);if(!n)return;let o=e.resolve(n.posBeforeNode+n.node.nodeSize).nodeAfter;if(o)return pt(o,r)}function CW(e,t){let n=typeof t=="string"?t:t.id,r=kt(e),o=cn(n,e);if(!o)return;let i=e.resolve(o.posBeforeNode),s=i.node(),a=i.node(-1),l=a.type.name==="doc"?void 0:s.type.name==="blockGroup"?a:s;if(l)return pt(l,r)}var kW=class{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>xD(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(t=>yW(t.doc,e))}getPrevBlock(e){return this.editor.transact(t=>EW(t.doc,e))}getNextBlock(e){return this.editor.transact(t=>xW(t.doc,e))}getParentBlock(e){return this.editor.transact(t=>CW(t.doc,e))}forEachBlock(e,t=!1){let n=this.document.slice();t&&n.reverse();function r(o){for(let i of o)if(e(i)===!1||!r(t?i.children.slice().reverse():i.children))return!1;return!0}r(n)}insertBlocks(e,t,n="before"){return this.editor.transact(r=>Jz(r,e,t,n))}updateBlock(e,t){return this.editor.transact(n=>FD(n,e,t))}removeBlocks(e){return this.editor.transact(t=>Cy(t,e,[]).removedBlocks)}replaceBlocks(e,t){return this.editor.transact(n=>Cy(n,e,t))}canNestBlock(){return gW(this.editor)}nestBlock(){Ww(this.editor)}canUnnestBlock(){return bW(this.editor)}unnestBlock(){qw(this.editor)}moveBlocksUp(){return fW(this.editor)}moveBlocksDown(){return hW(this.editor)}},TW=class extends Dm{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:t,appendedTransactions:n})=>{this.emit("onChange",{editor:e,transaction:t,appendedTransactions:n})}),e._tiptapEditor.on("selectionUpdate",({transaction:t})=>{this.emit("onSelectionChange",{editor:e,transaction:t})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,t=!0){let n=({transaction:r,appendedTransactions:o})=>{!t&&ky(r)||e(this.editor,{getChanges(){return uw(r,o)}})};return this.on("onChange",n),()=>{this.off("onChange",n)}}onSelectionChange(e,t=!1){let n=r=>{!t&&ky(r.transaction)||e(this.editor)};return this.on("onSelectionChange",n),()=>{this.off("onSelectionChange",n)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}};function ky(e){return!!e.getMeta("y-sync$")}function wW(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}function SW(e){return e.nodeType===3&&!/\S/.test(e.nodeValue||"")}function vW(e){e.querySelectorAll("li > ul, li > ol").forEach(t=>{let n=wW(t),r=t.parentElement,o=Array.from(r.childNodes).slice(n+1);t.remove(),o.forEach(i=>{i.remove()}),r.insertAdjacentElement("afterend",t),o.reverse().forEach(i=>{if(SW(i))return;let s=document.createElement("li");s.append(i),t.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function AW(e){e.querySelectorAll("li + ul, li + ol").forEach(t=>{let n=t.previousElementSibling,r=document.createElement("div");n.insertAdjacentElement("afterend",r),r.append(n);let o=document.createElement("div");for(o.setAttribute("data-node-type","blockGroup"),r.append(o);r.nextElementSibling?.nodeName==="UL"||r.nextElementSibling?.nodeName==="OL";)o.append(r.nextElementSibling)})}var NW=null;function IW(){return NW||=document.implementation.createHTMLDocument("title")}function MW(e){if(typeof e=="string"){let t=IW().createElement("div");t.innerHTML=e,e=t}return vW(e),AW(e),e}function _W(e){let t=e.ownerDocument.createTreeWalker(e,128),n;for(;n=t.nextNode();)if(/^\s*notionvc:/.test(n.nodeValue||""))return!0;return!1}function OW(e){let t=new Set(["PRE","CODE"]),n=e.ownerDocument.createTreeWalker(e,4,{acceptNode(i){let s=i.parentElement;for(;s&&s!==e;){if(t.has(s.tagName))return 2;s=s.parentElement}return 1}}),r=[],o;for(;o=n.nextNode();)r.push(o);for(let i of r)i.nodeValue&&/[\r\n]/.test(i.nodeValue)&&(i.nodeValue=i.nodeValue.replace(/[ \t\r\n\f]+/g," "))}function RW(e){_W(e)||OW(e)}function Gw(e,t){let n=MW(e);RW(n);let r=sn.fromSchema(t).parse(n,{topNode:t.nodes.blockGroup.create()}),o=[];for(let i=0;i<r.childCount;i++)o.push(pt(r.child(i),t));return o}function LW(e,t){let n=t.value?t.value:"",r={};t.lang&&(r["data-language"]=t.lang);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function DW(e,t){let n=String(t?.url||""),r=t?.title?String(t.title):void 0,o={type:"element",tagName:"video",properties:{src:n,"data-name":r,"data-url":n,controls:!0},children:[]};return e.patch?.(t,o),o=e.applyData?e.applyData(t,o):o,o}function Yw(e){return ow().use(M$).use(rw).use(dj,{handlers:{...jh,image:(t,n)=>pD(String(n?.url||""))?DW(t,n):jh.image(t,n),code:LW,blockquote:(t,n)=>{let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(n),!1)};return t.patch(n,r),t.applyData(n,r)}}}).use(mz).processSync(e).value}function PW(e,t){return Gw(Yw(e),t)}var BW=class{constructor(t){this.editor=t}blocksToHTMLLossy(t=this.editor.document){return rd(this.editor.pmSchema,this.editor).exportBlocks(t,{})}blocksToFullHTML(t=this.editor.document){return cW(this.editor.pmSchema,this.editor).serializeBlocks(t,{})}tryParseHTMLToBlocks(t){return Gw(t,this.editor.pmSchema)}blocksToMarkdownLossy(t=this.editor.document){return UV(t,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(t){return PW(t,this.editor.pmSchema)}pasteHTML(t,n=!1){let r=t;if(!n){let o=this.tryParseHTMLToBlocks(t);r=this.blocksToFullHTML(o)}r&&this.editor.prosemirrorView?.pasteHTML(r)}pasteText(t){return this.editor.prosemirrorView?.pasteText(t)}pasteMarkdown(t){let n=Yw(t);return this.pasteHTML(n)}},Gm=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function FW(e,t){if(!e.startsWith(".")||!t.startsWith("."))throw Error("The strings provided are not valid file extensions.");return e===t}function HW(e,t){let n=e.split("/"),r=t.split("/");if(n.length!==2)throw Error(`The string ${e} is not a valid MIME type.`);if(r.length!==2)throw Error(`The string ${t} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function Ty(e,t,n,r="after"){let o;return o=Array.isArray(t.content)&&t.content.length===0?e.updateBlock(t,n).id:e.insertBlocks([n],t,r)[0].id,o}async function Kw(e,t){if(!t.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}let n="dataTransfer"in e?e.dataTransfer:e.clipboardData;if(n===null)return;let r=null;for(let i of Gm)if(n.types.includes(i)){r=i;break}if(r!=="Files")return;let o=n.items;if(o){e.preventDefault();for(let i=0;i<o.length;i++){let s="file";for(let l of Object.values(t.schema.blockSpecs))for(let c of l.implementation.meta?.fileBlockAccept||[]){let u=c.startsWith("."),d=o[i].getAsFile();if(d&&(!u&&d.type&&HW(o[i].type,c)||u&&FW("."+d.name.split(".").pop(),c))){s=l.config.type;break}}let a=o[i].getAsFile();if(a){let l={type:s,props:{name:a.name}},c;if(e.type==="paste"){let f=t.getTextCursorPosition().block;c=Ty(t,f,l)}else if(e.type==="drop"){let f={left:e.clientX,top:e.clientY},h=t.prosemirrorView.posAtCoords(f);if(!h)return;c=t.transact(p=>{let g=_o(p.doc,h.pos),y=t.domElement?.querySelector(`[data-id="${g.node.attrs.id}"]`)?.getBoundingClientRect();return Ty(t,t.getBlock(g.node.attrs.id),l,y&&(y.top+y.bottom)/2>f.top?"before":"after")})}else return;let u=await t.uploadFile(a,c),d=typeof u=="string"?{props:{url:u}}:{...u};t.updateBlock(c,d)}}}}var UW=e=>mt.create({name:"dropFile",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{drop(t,n){if(!e.isEditable)return;let r=null;for(let o of Gm)if(n.dataTransfer.types.includes(o)){r=o;break}return r===null?!0:r==="Files"?(Kw(n,e),!0):!1}}}})]}}),VW=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,$W=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,jW=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,zW=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,WW=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,qW=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,GW=/\n{2} {0,3}-{2,48}\n{2}/,YW=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,KW=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,QW=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,XW=/^\s*\|(.+\|)+\s*$/m,ZW=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,JW=/^\s*\|(.+\|)+\s*$/m,eq=e=>VW.test(e)||$W.test(e)||jW.test(e)||zW.test(e)||WW.test(e)||qW.test(e)||GW.test(e)||YW.test(e)||KW.test(e)||QW.test(e)||XW.test(e)||ZW.test(e)||JW.test(e);async function tq(e,t){let{schema:n}=t.state;if(!e.clipboardData)return!1;let r=e.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return t.pasteText(r),!0;let o=e.clipboardData.getData("vscode-editor-data"),i=(o?JSON.parse(o):void 0)?.mode;return i?(t.pasteHTML(`<pre><code class="language-${i}">${r.replace(/\r\n?/g,`
174
+ `)}</code></pre>`),!0):!1}function nq({event:e,editor:t,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){if(t.transact(s=>s.selection.$from.parent.type.spec.code&&s.selection.$to.parent.type.spec.code)){let s=e.clipboardData?.getData("text/plain");if(s)return t.pasteText(s),!0}let o;for(let s of Gm)if(e.clipboardData.types.includes(s)){o=s;break}if(!o)return!0;if(o==="vscode-editor-data")return tq(e,t.prosemirrorView),!0;if(o==="Files")return Kw(e,t),!0;let i=e.clipboardData.getData(o);if(o==="blocknote/html")return t.pasteHTML(i,!0),!0;if(o==="text/markdown")return t.pasteMarkdown(i),!0;if(n){let s=e.clipboardData.getData("text/plain");if(eq(s))return t.pasteMarkdown(s),!0}return o==="text/html"?(t.pasteHTML(i),!0):r?(t.pasteMarkdown(i),!0):(t.pasteText(i),!0)}var rq=(e,t)=>mt.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),e.isEditable)return t({event:r,editor:e,defaultPasteHandler:({prioritizeMarkdownOverHTML:o=!0,plainTextAsMarkdown:i=!0}={})=>nq({event:r,editor:e,prioritizeMarkdownOverHTML:o,plainTextAsMarkdown:i})})}}}})]}});function oq(e,t,n){let r=!1,o=e.state.selection instanceof Ge;if(!o){let a=e.state.doc.slice(e.state.selection.from,e.state.selection.to,!1).content,l=[];for(let c=0;c<a.childCount;c++)l.push(a.child(c));r=l.find(c=>c.type.isInGroup("bnBlock")||c.type.name==="blockGroup"||c.type.spec.group==="blockContent")===void 0,r&&(t=a)}let i,s=rd(e.state.schema,n);if(o){t.firstChild?.type.name==="table"&&(t=t.firstChild.content);let a=Rk(t,n.schema.inlineContentSchema,n.schema.styleSchema);i=`<table>${s.exportInlineContent(a,{})}</table>`}else if(r){let a=Hu(t,n.schema.inlineContentSchema,n.schema.styleSchema);i=s.exportInlineContent(a,{})}else{let a=gw(t);i=s.exportBlocks(a,{})}return i}function Qw(e,t){"node"in e.state.selection&&e.state.selection.node.type.spec.group==="blockContent"&&t.transact(i=>i.setSelection(new le(i.doc.resolve(e.state.selection.from-1))));let n=e.serializeForClipboard(e.state.selection.content()).dom.innerHTML,r=e.state.selection.content().content,o=oq(e,r,t);return{clipboardHTML:n,externalHTML:o,markdown:Lm(o)}}var wy=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return!0;let t=e.focusNode;for(;t;){if(t instanceof HTMLElement&&t.getAttribute("contenteditable")==="false")return!0;t=t.parentElement}return!1},Sy=(e,t,n)=>{n.preventDefault(),n.clipboardData.clearData();let{clipboardHTML:r,externalHTML:o,markdown:i}=Qw(t,e);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",o),n.clipboardData.setData("text/plain",i)},iq=e=>mt.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new Ae({props:{handleDOMEvents:{copy(t,n){return wy()||Sy(e,t,n),!0},cut(t,n){return wy()||(Sy(e,t,n),t.editable&&t.dispatch(t.state.tr.deleteSelection())),!0},dragstart(t,n){if(!("node"in t.state.selection)||t.state.selection.node.type.spec.group!=="blockContent")return;e.transact(s=>s.setSelection(new le(s.doc.resolve(t.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();let{clipboardHTML:r,externalHTML:o,markdown:i}=Qw(t,e);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",o),n.dataTransfer.setData("text/plain",i),!0}}}})]}}),sq=mt.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:VD()}}]}}),aq=sr.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Rn(this.options.HTMLAttributes,e)]},renderText(){return`
175
+ `}}),Xw=(e,t)=>{let n=e.resolve(t),r=n.depth-1;if(r<1)return;let o=n.before(r),i=e.resolve(o).nodeAfter;if(i)return i.type.spec.group?.includes("bnBlock")?Oo(e.resolve(o)):Xw(e,o)},Ps=(e,t)=>{let n=e.resolve(t),r=n.index();if(r===0)return;let o=n.posAtIndex(r-1);return Oo(e.resolve(o))},Ss=(e,t)=>{let n=e.resolve(t),r=n.index();if(r===n.node().childCount-1)return;let o=n.posAtIndex(r+1);return Oo(e.resolve(o))},rp=(e,t)=>{for(;t.childContainer;){let n=t.childContainer.node,r=e.resolve(t.childContainer.beforePos+1).posAtIndex(n.childCount-1);t=Oo(e.resolve(r))}return t},lq=(e,t)=>e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*"&&e.blockContent.node.childCount>0&&t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*",cq=(e,t,n,r)=>{if(!r.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){let o=e.doc.resolve(r.childContainer.beforePos+1),i=e.doc.resolve(r.childContainer.afterPos-1),s=o.blockRange(i);if(t){let a=e.doc.resolve(r.bnBlock.beforePos);e.tr.lift(s,a.depth)}}if(t){if(!n.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);t(e.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},vy=e=>({state:t,dispatch:n})=>{let r=Oo(t.doc.resolve(e)),o=Ps(t.doc,r.bnBlock.beforePos);if(!o)return!1;let i=rp(t.doc,o);return lq(i,r)?cq(t,n,i,r):!1},uq=mt.create({priority:50,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?o.command(PD(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>o.command(({state:i,tr:s})=>{let a=Ct(i);if(!a.isBlockContainer)return!1;let{blockContent:l}=a;return i.selection.from===l.beforePos+1?np(s,s.doc.type.schema.nodes.blockContainer,s.doc.type.schema.nodes.blockGroup):!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,c=Ps(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer||c.blockContent.node.type.spec.content!=="inline*")return!1;let u=i.selection.from===l.beforePos+1,d=i.selection.empty,f=a.beforePos;return u&&d?r().command(vy(f)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||i.selection.from!==l.blockContent.beforePos+1)return!1;let c=Ps(i.doc,l.bnBlock.beforePos);if(!c||c.isBlockContainer)return!1;if(a){let u=c.bnBlock.afterPos-1,d=s.doc.resolve(u-1);return s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),s.insert(d.pos,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(d.pos+1))),!0}return!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;let c=s.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;let u=s.doc.resolve(l.bnBlock.beforePos),d=s.doc.resolve(u.before()),f=d.before();return a&&(s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),ql(s,f),d.pos===f+1?(s.insert(f,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(f)))):(s.insert(d.pos-1,l.bnBlock.node),s.setSelection(se.near(s.doc.resolve(d.pos))))),!0}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Ps(i.doc,s.bnBlock.beforePos);if(!a)return!1;let l=rp(i.doc,a);if(!l.isBlockContainer||!l||!l.isBlockContainer)return!1;let c=r();if(s.childContainer&&c.insertContentAt(s.bnBlock.afterPos,s.childContainer?.node.content),l.blockContent.node.type.spec.content==="tableRow+"){let u=s.bnBlock.beforePos-1-1-1-1-1;c=c.setTextSelection(u)}else if(l.blockContent.node.type.spec.content==="")c=c.setNodeSelection(l.blockContent.beforePos);else{let u=l.blockContent.afterPos-1;c=c.setTextSelection(u)}return c.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.beforePos+1,l=i.selection.empty,c=Ps(i.doc,s.bnBlock.beforePos);if(c&&a&&l){let u=rp(i.doc,c);if(!u.isBlockContainer)return!1;if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),t=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer||!s.childContainer)return!1;let{blockContent:a,childContainer:l}=s,c=i.selection.from===a.afterPos-1,u=i.selection.empty,d=Oo(i.doc.resolve(l.beforePos+1));if(!d.isBlockContainer)return!1;if(c&&u){let f=d.blockContent.node,h=f.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||j.empty).deleteRange(l.node.childCount===1?{from:l.beforePos,to:l.afterPos}:{from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(i.selection.from,h&&p?f.content:null).setTextSelection(i.selection.from).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,c=Ss(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer)return!1;let u=i.selection.from===l.afterPos-1,d=i.selection.empty,f=a.afterPos;return u&&d?r().command(vy(f)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||i.selection.from!==l.blockContent.afterPos-1)return!1;let c=Ss(i.doc,l.bnBlock.beforePos);if(!c||c.isBlockContainer)return!1;if(a){let u=c.bnBlock.beforePos+1,d=s.doc.resolve(u+1);return s.delete(d.pos,d.pos+d.nodeAfter.nodeSize),ql(s,c.bnBlock.beforePos),s.insert(l.bnBlock.afterPos,d.nodeAfter),s.setSelection(se.near(s.doc.resolve(d.pos))),!0}return!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{let l=Ct(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.afterPos-1)return!1;let c=s.doc.resolve(l.bnBlock.afterPos);if(c.nodeAfter||c.node().type.name!=="column")return!1;let u=s.doc.resolve(l.bnBlock.afterPos),d=s.doc.resolve(u.after()),f=d.after();if(a){let h=d.pos===f-1?f:d.pos+1,p=Oo(s.doc.resolve(h));s.delete(p.bnBlock.beforePos,p.bnBlock.afterPos),ql(s,f-d.node().nodeSize),s.insert(u.pos,p.bnBlock.node),s.setSelection(se.near(s.doc.resolve(h)))}return!0}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let{blockContent:a}=s,l=i.selection.from===a.afterPos-1,c=i.selection.empty;if(l&&c){let u=(g,y)=>{let b=Ss(g,y);if(b)return b;let x=Xw(g,y);if(x)return u(g,x.bnBlock.beforePos)},d=u(i.doc,s.bnBlock.beforePos);if(!d||!d.isBlockContainer)return!1;let f=d.blockContent.node,h=f.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||j.empty).deleteRange({from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(i.selection.from,h&&p?f.content:null).setTextSelection(i.selection.from).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Ss(i.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){let c=s.bnBlock.afterPos+1+1+1+1+1;l=l.setTextSelection(c)}else l=a.blockContent.node.type.spec.content===""?l.setNodeSelection(a.blockContent.beforePos):l.setTextSelection(a.blockContent.beforePos+1);return l.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{let s=Ct(i);if(!s.isBlockContainer)return!1;let a=i.selection.from===s.blockContent.afterPos-1,l=i.selection.empty,c=Ss(i.doc,s.bnBlock.beforePos);if(!c||!c.isBlockContainer)return!1;if(c&&a&&l&&(c.blockContent.node.type.spec.content===""||c.blockContent.node.type.spec.content==="inline*"&&c.blockContent.node.childCount===0)){let u=c.bnBlock.node.lastChild.content;return r().deleteRange({from:c.bnBlock.beforePos,to:c.bnBlock.afterPos}).insertContentAt(s.bnBlock.afterPos,c.bnBlock.node.childCount===2?u:null).run()}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:o,tr:i})=>[()=>o.command(({state:s,tr:a})=>{let l=Ct(s);if(!l.isBlockContainer)return!1;let{bnBlock:c,blockContent:u}=l,{depth:d}=s.doc.resolve(c.beforePos),f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,p=u.node.childCount===0;return f&&h&&p&&d>1?np(a,a.doc.type.schema.nodes.blockContainer,a.doc.type.schema.nodes.blockGroup):!1}),()=>o.command(({state:s})=>{let a=Ct(s),l=this.options.editor.schema.blockSchema[a.blockNoteType].meta?.hardBreakShortcut??"shift+enter";if(l==="none")return!1;if(l==="shift+enter"&&r||l==="enter"){let c=i.storedMarks||i.selection.$head.marks().filter(u=>this.editor.extensionManager.splittableMarks.includes(u.type.name));return i.insert(i.selection.head,i.doc.type.schema.nodes.hardBreak.create()).ensureMarks(c),!0}return!1}),()=>o.command(({state:s,dispatch:a,tr:l})=>{let c=Ct(s);if(!c.isBlockContainer)return!1;let{bnBlock:u,blockContent:d}=c,f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,p=d.node.childCount===0;if(f&&h&&p){let g=u.afterPos,y=g+2;if(a){let b=s.schema.nodes.blockContainer.createAndFill(void 0,[s.schema.nodes.paragraph.createAndFill()||void 0,c.childContainer?.node].filter(x=>x!==void 0));l.insert(g,b).setSelection(new se(l.doc.resolve(y))).scrollIntoView(),c.childContainer&&l.delete(c.childContainer.beforePos,c.childContainer.afterPos)}return!0}return!1}),()=>o.command(({state:s,chain:a})=>{let l=Ct(s);if(!l.isBlockContainer)return!1;let{blockContent:c}=l,u=s.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(p6(s.selection.from,u,u)).run(),!0)})]);return{Backspace:e,Delete:t,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Lo)?.store.state||this.options.editor.getExtension(rr)?.store.state!==void 0)?!1:Ww(this.options.editor),"Shift-Tab":()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Lo)?.store.state||this.options.editor.getExtension(rr)?.store.state!==void 0)?!1:qw(this.options.editor),"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),dq=Gn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name==="insertion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["ins",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}:{}}}),fq=Gn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name==="deletion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["del",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}:{}}}),hq=Gn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(e){return e.name==="modification"?{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return[n?"span":"div",{"data-type":"modification","data-id":String(t.attrs.id),"data-mod-type":t.attrs.type,"data-mod-prev-val":JSON.stringify(t.attrs.previousValue),"data-mod-new-val":JSON.stringify(t.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal,newValue:t.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal}:!1}}]}:{}}}),pq=mt.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:e=>e.getAttribute("data-text-alignment"),renderHTML:e=>e.textAlignment==="left"?{}:{"data-text-alignment":e.textAlignment}}}}]}}),mq=mt.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:$D()}}]}}),gq={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},bq=sr.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:e=>{if(typeof e=="string")return!1;let t={};for(let[n,r]of Object.entries(gq))e.getAttribute(r)&&(t[n]=e.getAttribute(r));return t}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:e}){let t=document.createElement("div");t.className="bn-block-outer",t.setAttribute("data-node-type","blockOuter");for(let[o,i]of Object.entries(e))o!=="class"&&t.setAttribute(o,i);let n={...this.options.domAttributes?.block||{},...e},r=document.createElement("div");r.className=ut("bn-block",n.class),r.setAttribute("data-node-type",this.name);for(let[o,i]of Object.entries(n))o!=="class"&&r.setAttribute(o,i);return t.appendChild(r),{dom:t,contentDOM:r}}}),yq=sr.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:e}){let t={...this.options.domAttributes?.blockGroup||{},...e},n=document.createElement("div");n.className=ut("bn-block-group",t.class),n.setAttribute("data-node-type","blockGroup");for(let[r,o]of Object.entries(t))r!=="class"&&n.setAttribute(r,o);return{dom:n,contentDOM:n}}}),Eq=sr.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),xq=Ve(({options:e})=>({key:"collaboration",blockNoteExtensions:[kV(e),Uh(e),$l(e),jl(),wV(e)]})),Ay=!1;function Cq(e,t){let n=[Li.ClipboardTextSerializer,Li.Commands,Li.Editable,Li.FocusEvents,Li.Tabindex,vz,Fu.configure({types:["blockContainer","columnList","column"],setIdAttribute:t.setIdAttribute,isWithinEditor:e.isWithinEditor}),aq,Zz,dq,fq,hq,Xz.extend({inclusive:!1}).extend({addAttributes(){let r=this.parent?.()||{};return delete r.title,r}}).configure({defaultProtocol:pw,protocols:Ay?[]:hw}),...Object.values(e.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:e})),mq,sq,pq,mt.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>e.getExtension(zn)?.shown()?!1:(e.blur(),!0)})}),Eq,bq.configure({editor:e,domAttributes:t.domAttributes}),uq.configure({editor:e,tabBehavior:t.tabBehavior}),yq.configure({domAttributes:t.domAttributes}),...Object.values(e.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:e})),...Object.values(e.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:e,domAttributes:t.domAttributes})]:[]]),iq(e),rq(e,t.pasteHandler||(r=>r.defaultPasteHandler())),UW(e)];return Ay=!0,n}function kq(e,t){let n=[dw(),IV(t),rr(t),Lo(t),ja(t),OV(),LV(t),va(t),qn(t),zn(t),...t.trailingBlock===!1?[]:[ZV()]];return t.collaboration?n.push(xq(t.collaboration)):n.push(MV()),"table"in e.schema.blockSpecs&&n.push(Je(t)),t.animations!==!1&&n.push(PV()),n}var Tq=class{disabledExtensions=new Set;extensions=[];abortMap=new Map;extensionFactories=new Map;extensionPlugins=new Map;constructor(t,n){this.editor=t,this.options=n,t.onMount(()=>{for(let r of this.extensions)if(r.mount){let o=new window.AbortController,i=r.mount({dom:t.prosemirrorView.dom,root:t.prosemirrorView.root,signal:o.signal});i&&o.signal.addEventListener("abort",()=>{i()}),this.abortMap.set(r,o)}}),t.onUnmount(()=>{for(let[r,o]of this.abortMap.entries())this.abortMap.delete(r),o.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(let r of kq(this.editor,this.options))this.addExtension(r);for(let r of this.options.extensions??[])this.addExtension(r);for(let r of Object.values(this.editor.schema.blockSpecs))for(let o of r.extensions??[])this.addExtension(o)}registerExtension(t){let n=[].concat(t).filter(Boolean);if(!n.length){console.warn("No extensions found to register",t);return}let r=n.map(i=>this.addExtension(i)).filter(Boolean),o=new Set;for(let i of r)i?.tiptapExtensions&&console.warn(`Extension ${i.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),i?.inputRules?.length&&console.warn(`Extension ${i.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),this.getProsemirrorPluginsFromExtension(i).plugins.forEach(s=>{o.add(s)});this.updatePlugins(i=>[...i,...o])}addExtension(t){let n;if(n=typeof t=="function"?t({editor:this.editor}):t,!(!n||this.disabledExtensions.has(n.key))){if(typeof t=="function"){let r=n[Wf];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(let r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(t){let n=[];if(typeof t=="function"){let r=this.extensionFactories.get(t);r&&n.push(r)}else if(Array.isArray(t))for(let r of t)n.push(...this.resolveExtensions(r));else if(typeof t=="object"&&"key"in t)n.push(t);else if(typeof t=="string"){let r=this.extensions.find(o=>o.key===t);r&&n.push(r)}return n}unregisterExtension(t){let n=this.resolveExtensions(t);if(!n.length){console.warn("No extensions found to unregister",t);return}let r=!1,o=new Set;for(let i of n)this.extensions=this.extensions.filter(s=>s!==i),this.extensionFactories.forEach((s,a)=>{s===i&&this.extensionFactories.delete(a)}),this.abortMap.get(i)?.abort(),this.abortMap.delete(i),this.extensionPlugins.get(i)?.forEach(s=>{o.add(s)}),this.extensionPlugins.delete(i),i.tiptapExtensions&&!r&&(r=!0,console.warn(`Extension ${i.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,t));this.updatePlugins(i=>i.filter(s=>!o.has(s)))}updatePlugins(t){let n=this.editor.prosemirrorState,r=n.reconfigure({plugins:t(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){let t=Cq(this.editor,this.options).filter(o=>!this.disabledExtensions.has(o.name)),n=Fk(this.extensions),r=new Map;for(let o of this.extensions){o.tiptapExtensions&&t.push(...o.tiptapExtensions);let i=n(o.key),{plugins:s,inputRules:a}=this.getProsemirrorPluginsFromExtension(o);s.length&&t.push(mt.create({name:o.key,priority:i,addProseMirrorPlugins:()=>s})),a.length&&(r.has(i)||r.set(i,[]),r.get(i).push(...a))}t.push(mt.create({name:"blocknote-input-rules",addProseMirrorPlugins(){let o=[];return Array.from(r.keys()).sort().reverse().forEach(i=>{o.push(...r.get(i))}),[yz({rules:o})]}}));for(let o of this.options._tiptapOptions?.extensions??[])t.push(o);return t}getProsemirrorPluginsFromExtension(t){let n=[...t.prosemirrorPlugins??[]],r=[];return!t.prosemirrorPlugins?.length&&!Object.keys(t.keyboardShortcuts||{}).length&&!t.inputRules?.length?{plugins:n,inputRules:r}:(this.extensionPlugins.set(t,n),t.inputRules?.length&&r.push(...t.inputRules.map(o=>new Ti(o.find,(i,s,a,l)=>{let c=o.replace({match:s,range:{from:a,to:l},editor:this.editor});if(c){let u=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[u.block.type].content!=="inline")return null;let d=La(i.tr),f=i.tr.deleteRange(a,l);return Vu(f,d.bnBlock.beforePos,c),f}return null}))),Object.keys(t.keyboardShortcuts||{}).length&&n.push(LC(Object.fromEntries(Object.entries(t.keyboardShortcuts).map(([o,i])=>[o,()=>i({editor:this.editor})])))),{plugins:n,inputRules:r})}getExtensions(){return new Map(this.extensions.map(t=>[t.key,t]))}getExtension(t){if(typeof t=="string")return this.extensions.find(n=>n.key===t)||void 0;if(typeof t=="function")return this.extensionFactories.get(t)||void 0;throw Error(`Invalid extension type: ${typeof t}`)}hasExtension(t){return typeof t=="string"?this.extensions.some(n=>n.key===t):typeof t=="object"&&"key"in t?this.extensions.some(n=>n.key===t.key):typeof t=="function"?this.extensionFactories.has(t):!1}};function wq(e,t){let{$from:n,$to:r}=t;if(n.pos>n.start()&&n.pos<e.content.size){let o=e.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(o)){let i=e.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);i&&(n=e.resolve(n.pos-i[0].length))}}if(r.pos<r.end()&&r.pos>0){let o=e.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(o)){let i=e.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);i&&(r=e.resolve(r.pos+i[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function Sq(e){let t=kt(e);if(e.selection.empty||"node"in e.selection)return;let n=e.doc.resolve(_o(e.doc,e.selection.from).posBeforeNode),r=e.doc.resolve(_o(e.doc,e.selection.to).posBeforeNode),o=(c,u)=>{let d=n.posAtIndex(c,u),f=e.doc.resolve(d).nodeAfter;if(!f)throw Error(`Error getting selection - node not found at position ${d}`);return pt(f,t)},i=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){i.push(pt(n.nodeAfter,t));for(let c=n.depth;c>s;c--)if(n.node(c).type.isInGroup("childContainer")){let u=n.index(c)+1,d=n.node(c).childCount;for(let f=u;f<d;f++)i.push(o(f,c))}}else i.push(o(a,s));for(let c=a+1;c<=l;c++)i.push(o(c,s));if(i.length===0)throw Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);return{blocks:i}}function vq(e,t,n){let r=typeof t=="string"?t:t.id,o=typeof n=="string"?n:n.id,i=Da(kt(e));if(r===o)throw Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);let s=cn(r,e.doc);if(!s)throw Error(`Block with ID ${r} not found`);let a=cn(o,e.doc);if(!a)throw Error(`Block with ID ${o} not found`);let l=Qr(s),c=Qr(a),u=i.blockSchema[l.blockNoteType],d=i.blockSchema[c.blockNoteType];if(!l.isBlockContainer||u.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!c.isBlockContainer||d.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${o})`);let f,h;if(u.content==="table"){let p=nt.get(l.blockContent.node);f=l.blockContent.beforePos+p.positionAt(0,0,l.blockContent.node)+1+2}else f=l.blockContent.beforePos+1;if(d.content==="table"){let p=nt.get(c.blockContent.node),g=c.blockContent.beforePos+p.positionAt(p.height-1,p.width-1,c.blockContent.node)+1;h=g+e.doc.resolve(g).nodeAfter.nodeSize-2}else h=c.blockContent.afterPos-1;e.setSelection(se.create(e.doc,f,h))}function Aq(e,t=!1){let n=kt(e),r=t?wq(e.doc,e.selection):e.selection,o=r.$from,i=r.$to;for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=e.doc.resolve(i.pos+1);for(;i.parentOffset===0&&i.depth>0;)i=e.doc.resolve(i.pos-1);for(;o.parentOffset===0&&o.depth>0;)o=e.doc.resolve(o.pos-1);for(;o.parentOffset>=o.parent.nodeSize-2&&o.depth>0;)o=e.doc.resolve(o.pos+1);let s=CD(e.doc.slice(o.pos,i.pos,!0),n);return{_meta:{startPos:o.pos,endPos:i.pos},...s}}function Nq(e){let{bnBlock:t}=La(e),n=kt(e.doc),r=e.doc.resolve(t.beforePos),o=r.nodeBefore,i=e.doc.resolve(t.afterPos).nodeAfter,s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:pt(t.node,n),prevBlock:o===null?void 0:pt(o,n),nextBlock:i===null?void 0:pt(i,n),parentBlock:s===void 0?void 0:pt(s,n)}}function Zw(e,t,n="start"){let r=typeof t=="string"?t:t.id,o=Da(kt(e.doc)),i=cn(r,e.doc);if(!i)throw Error(`Block with ID ${r} not found`);let s=Qr(i),a=o.blockSchema[s.blockNoteType].content;if(s.isBlockContainer){let l=s.blockContent;if(a==="none"){e.setSelection(le.create(e.doc,l.beforePos));return}if(a==="inline")n==="start"?e.setSelection(se.create(e.doc,l.beforePos+1)):e.setSelection(se.create(e.doc,l.afterPos-1));else if(a==="table")n==="start"?e.setSelection(se.create(e.doc,l.beforePos+4)):e.setSelection(se.create(e.doc,l.afterPos-4));else throw new Tr(a)}else Zw(e,(n==="start"?s.childContainer.node.firstChild:s.childContainer.node.lastChild).attrs.id,n)}var Iq=class{constructor(t){this.editor=t}getSelection(){return this.editor.transact(t=>Sq(t))}getSelectionCutBlocks(t=!1){return this.editor.transact(n=>Aq(n,t))}setSelection(t,n){return this.editor.transact(r=>vq(r,t,n))}getTextCursorPosition(){return this.editor.transact(t=>Nq(t))}setTextCursorPosition(t,n="start"){return this.editor.transact(r=>Zw(r,t,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;let{selection:t}=this.editor.prosemirrorState,{ranges:n}=t,r=Math.min(...n.map(i=>i.$from.pos)),o=Math.max(...n.map(i=>i.$to.pos));if(eR(t)){let i=this.editor.prosemirrorView.nodeDOM(r);if(i)return i.getBoundingClientRect()}return Wp(this.editor.prosemirrorView,r,o).toJSON()}},Mq=class{constructor(t){this.editor=t}activeTransaction=null;can(t){try{return this.isInCan=!0,t()}finally{this.isInCan=!1}}isInCan=!1;exec(t){if(this.activeTransaction)throw Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(t);let n=this.prosemirrorState,r=this.prosemirrorView;return t(n,o=>this.prosemirrorView.dispatch(o),r)}canExec(t){if(this.activeTransaction)throw Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");let n=this.prosemirrorState,r=this.prosemirrorView;return t(n,void 0,r)}transact(t){if(this.activeTransaction)return t(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;let n=t(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){return this.prosemirrorView?.hasFocus()||!1}focus(){this.prosemirrorView?.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(t){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==t&&this.editor._tiptapEditor.setEditable(t)}undo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.undoCommand);let n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw Error("No undo plugin found")}redo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.redoCommand);let n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw Error("No redo plugin found")}};function _q(e,t,n,r={updateSelection:!0}){let{from:o,to:i}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},s=!0,a=!0,l="";if(n.forEach(c=>{c.check(),s&&c.isText&&c.marks.length===0?l+=c.text:s=!1,a=a?c.isBlock:!1}),o===i&&a){let{parent:c}=e.doc.resolve(o);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(--o,i+=1)}return s?e.insertText(l,o,i):e.replaceWith(o,i,n),r.updateSelection&&UC(e,e.steps.length-1,-1),!0}var Oq=class{constructor(t){this.editor=t}insertInlineContent(t,{updateSelection:n=!1}={}){let r=ir(t,this.editor.pmSchema);this.editor.transact(o=>{_q(o,{from:o.selection.from,to:o.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(t=>{let n={},r=t.selection.$to.marks();for(let o of r){let i=this.editor.schema.styleSchema[o.type.name];if(!i){o.type.name!=="link"&&!o.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",o.type.name);continue}i.propSchema==="boolean"?n[i.type]=!0:n[i.type]=o.attrs.stringValue}return n})}addStyles(t){for(let[n,r]of Object.entries(t)){let o=this.editor.schema.styleSchema[n];if(!o)throw Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Tr(o.propSchema)}}removeStyles(t){for(let n of Object.keys(t))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(t){for(let[n,r]of Object.entries(t)){let o=this.editor.schema.styleSchema[n];if(!o)throw Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Tr(o.propSchema)}}getSelectedText(){return this.editor.transact(t=>t.doc.textBetween(t.selection.from,t.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(t,n){if(t==="")return;let r=this.editor.pmSchema.mark("link",{href:t});this.editor.transact(o=>{let{from:i,to:s}=o.selection;n?o.insertText(n,i,s).addMark(i,i+n.length,r):o.setSelection(se.create(o.doc,s)).addMark(i,s,r)})}};function Rq(e){return jC(e.state.selection.$from,t=>t.type.name==="tableCell"||t.type.name==="tableHeader")!==void 0}function Jw(e,t){let n=t.nodes.hardBreak,r=j.empty;return e.forEach(o=>{o.isTextblock&&o.childCount>0?(r=r.append(o.content),r=r.addToEnd(n.create())):o.isText?r=r.addToEnd(o):o.isBlock&&o.childCount>0&&(r=r.append(Jw(o.content,t)),r=r.addToEnd(n.create()))}),r.lastChild?.type===n&&(r=r.cut(0,r.size-1)),r}function Lq(e,t){let n=[];return e.forEach((r,o,i)=>{i!==t&&n.push(r)}),j.from(n)}function Dq(e,t){let n=[];for(let r=0;r<e.childCount;r++)if(e.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){let o=n[n.length-1],i=o.copy(o.content.addToEnd(e.child(r)));n[n.length-1]=i}else{let o=t.nodes.table.createChecked(void 0,e.child(r));n.push(o)}else n.push(e.child(r));return e=j.from(n),e}function Pq(e,t){let n=j.from(e.content);if(n=Dq(n,t.state.schema),Rq(t)){let r=!1;if(n.descendants(o=>{o.type.isInGroup("tableContent")&&(r=!0)}),!r&&!t.state.schema.nodes.tableParagraph.validContent(n))return new Z(Jw(n,t.state.schema),0,0)}if(!Bq(n,t))return new Z(n,e.openStart,e.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){let o=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){let s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(o.push(n.child(r+1)),n=Lq(n,r+1))}let i=t.state.schema.nodes.blockContainer.createChecked(void 0,o);n=n.replaceChild(r,i)}return new Z(n,e.openStart,e.openEnd)}function Bq(e,t){let n=e.childCount===1,r=e.firstChild?.type.spec.content==="inline*",o=e.firstChild?.type.spec.content==="tableRow+";if(n){if(r)return!1;if(o){let i=Ct(t.state);if(i.isBlockContainer)return i.blockContent.node.type.spec.content!=="tableRow+"}}return!0}var Fq={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1},Hq=class eS extends Dm{pmSchema;_tiptapEditor;elementRenderer=null;blockCache=new WeakMap;dictionary;schema;blockImplementations;inlineContentImplementations;styleImplementations;uploadFile;onUploadStartCallbacks=[];onUploadEndCallbacks=[];resolveFileUrl;settings;static create(t){return new eS(t??{})}constructor(t){super(),this.options=t,this.dictionary=t.dictionary||JV,this.settings={tables:{splitCells:t?.tables?.splitCells??!1,cellBackgroundColor:t?.tables?.cellBackgroundColor??!1,cellTextColor:t?.tables?.cellTextColor??!1,headers:t?.tables?.headers??!1}};let n={defaultStyles:!0,schema:t.schema||um.create(),...t,placeholders:{...this.dictionary.placeholders,...t.placeholders}};if(this.schema=n.schema,this.blockImplementations=n.schema.blockSpecs,this.inlineContentImplementations=n.schema.inlineContentSpecs,this.styleImplementations=n.schema.styleSpecs,n.uploadFile){let l=n.uploadFile;this.uploadFile=async(c,u)=>{this.onUploadStartCallbacks.forEach(d=>d.apply(this,[u]));try{return await l(c,u)}finally{this.onUploadEndCallbacks.forEach(d=>d.apply(this,[u]))}}}this.resolveFileUrl=n.resolveFileUrl,this._eventManager=new TW(this),this._extensionManager=new Tq(this,n);let r=this._extensionManager.getTiptapExtensions(),o=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");o&&n.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");let i={...Fq,...n._tiptapOptions,element:null,autofocus:n.autofocus??!1,extensions:r,editorProps:{...n._tiptapOptions?.editorProps,attributes:{tabIndex:"0",...n._tiptapOptions?.editorProps?.attributes,...n.domAttributes?.editor,class:ut("bn-editor",n.defaultStyles?"bn-default-styles":"",n.domAttributes?.editor?.class||"")},transformPasted:Pq}};try{let l=n.initialContent||(o?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Fu.options.generateID()}]);if(!Array.isArray(l)||l.length===0)throw Error("initialContent must be a non-empty array of blocks, received: "+l);let c=G3(i.extensions),u=bc({type:"doc",content:[{type:"blockGroup",content:l.map(d=>Ei(d,c,this.schema.styleSchema).toJSON())}]},c,i.parseOptions);this._tiptapEditor=new FR({...i,content:u.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(l){throw Error("Error creating document from blocks passed as `initialContent`",{cause:l})}let s,a=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...l)=>{if(s)return s;let c=a.apply(this.pmSchema.nodes.doc,l),u=JSON.parse(JSON.stringify(c.toJSON()));return u.content[0].content[0].attrs.id="initialBlockId",s=Gr.fromJSON(this.pmSchema,u),s},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new kW(this),this._exportManager=new BW(this),this._selectionManager=new Iq(this),this._stateManager=new Mq(this),this._styleManager=new Oq(this),this.emit("create")}_blockManager;_eventManager;_exportManager;_extensionManager;_selectionManager;_stateManager;_styleManager;get extensions(){return this._extensionManager.getExtensions()}exec(t){return this._stateManager.exec(t)}canExec(t){return this._stateManager.canExec(t)}transact(t){return this._stateManager.transact(t)}unregisterExtension=(...t)=>this._extensionManager.unregisterExtension(...t);registerExtension=(...t)=>this._extensionManager.registerExtension(...t);getExtension=((...t)=>this._extensionManager.getExtension(...t));mount=t=>{let n=t.getRootNode();typeof ShadowRoot<"u"&&n instanceof ShadowRoot?n.appendChild(this.portalElement):document.body.appendChild(this.portalElement),this._tiptapEditor.mount({mount:t})};unmount=()=>{this.portalElement?.remove(),this._tiptapEditor.unmount()};get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){if(!this.headless)return this.prosemirrorView?.dom}_portalElement;get portalElement(){if(typeof document>"u")throw Error("Portal element accessed, but not available in headless mode");return this._portalElement||=document.createElement("div"),this._portalElement}isWithinEditor=t=>!!(this.domElement?.parentElement?.contains(t)||this.portalElement?.contains(t));isFocused(){return this.headless?!1:this.prosemirrorView?.hasFocus()||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){this.headless||this.domElement?.blur()}onUploadStart(t){return this.onUploadStartCallbacks.push(t),()=>{let n=this.onUploadStartCallbacks.indexOf(t);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(t){return this.onUploadEndCallbacks.push(t),()=>{let n=this.onUploadEndCallbacks.indexOf(t);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(t){return this._blockManager.getBlock(t)}getPrevBlock(t){return this._blockManager.getPrevBlock(t)}getNextBlock(t){return this._blockManager.getNextBlock(t)}getParentBlock(t){return this._blockManager.getParentBlock(t)}forEachBlock(t,n=!1){this._blockManager.forEachBlock(t,n)}onEditorContentChange(t){this._tiptapEditor.on("update",t)}onEditorSelectionChange(t){this._tiptapEditor.on("selectionUpdate",t)}onBeforeChange(t){return this._extensionManager.getExtension(dw).subscribe(t)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(t,n="start"){return this._selectionManager.setTextCursorPosition(t,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(t=!1){return this._selectionManager.getSelectionCutBlocks(t)}setSelection(t,n){return this._selectionManager.setSelection(t,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(t){this._stateManager.isEditable=t}insertBlocks(t,n,r="before"){return this._blockManager.insertBlocks(t,n,r)}updateBlock(t,n){return this._blockManager.updateBlock(t,n)}removeBlocks(t){return this._blockManager.removeBlocks(t)}replaceBlocks(t,n){return this._blockManager.replaceBlocks(t,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(t,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(t,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(t){this._styleManager.addStyles(t)}removeStyles(t){this._styleManager.removeStyles(t)}toggleStyles(t){this._styleManager.toggleStyles(t)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(t,n){this._styleManager.createLink(t,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(t=this.document){return this._exportManager.blocksToHTMLLossy(t)}blocksToFullHTML(t=this.document){return this._exportManager.blocksToFullHTML(t)}tryParseHTMLToBlocks(t){return this._exportManager.tryParseHTMLToBlocks(t)}blocksToMarkdownLossy(t=this.document){return this._exportManager.blocksToMarkdownLossy(t)}tryParseMarkdownToBlocks(t){return this._exportManager.tryParseMarkdownToBlocks(t)}onChange(t,n){return this._eventManager.onChange(t,n)}onSelectionChange(t,n){return this._eventManager.onSelectionChange(t,n)}onMount(t){this._eventManager.onMount(t)}onUnmount(t){this._eventManager.onUnmount(t)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){let t=this.document;return t.length===0||t.length===1&&t[0].type==="paragraph"&&t[0].content.length===0}pasteHTML(t,n=!1){this._exportManager.pasteHTML(t,n)}pasteText(t){return this._exportManager.pasteText(t)}pasteMarkdown(t){return this._exportManager.pasteMarkdown(t)}},vf,Ny;function Uq(){return Ny||(Ny=1,vf=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),vf}var Vq=Uq();const $q=cp(Vq);var tS=C.createContext(void 0);function Nr(e){return C.useContext(tS)}function be(e){let t=Nr();if(!t?.editor)throw Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return t.editor}function je(e,t){let n=(t?.editor??be()).getExtension(e);if(!n)throw Error("Extension not found",{cause:{plugin:e}});return n}function rt(e,t){let{store:n}=je(e,t);if(!n)throw Error("Store not found on plugin",{cause:{plugin:e}});return YI(n,t?.selector)}function jq(e){let t=new DOMRect,n="getBoundingClientRect"in e?()=>e.getBoundingClientRect():()=>e.element.getBoundingClientRect();return()=>e.element&&(e.cacheMountedBoundingClientRect??!0)?(e.element.isConnected&&(t=n()),t):n()}function zq(e,t){return e?t?(n,r,o)=>{let i=e(n,r,o),s=t(n,r,o);return()=>{i?.(),s?.()}}:e:t}var mr=e=>{let t=be()?.portalElement;if(!t)throw Error("Portal element not found");let{whileElementsMounted:n,...r}=e.useFloatingOptions??{},{refs:o,floatingStyles:i,context:s}=PI({whileElementsMounted:zq(mp,e.useFloatingOptions?.whileElementsMounted),...r}),{isMounted:a,styles:l}=HI(s,e.useTransitionStylesProps),{status:c}=nx(s,e.useTransitionStatusProps),{getFloatingProps:u}=BI([LI(s,e.useDismissProps),xI(s,{enabled:!1,...e.useHoverProps})]),d=C.useRef(""),f=C.useRef(null),h=dI([f,o.setFloating]);if(C.useEffect(()=>{if(e.reference){let g="element"in e.reference?e.reference.element:void 0;g!==void 0&&o.setReference(g),o.setPositionReference({getBoundingClientRect:jq(e.reference),contextElement:g})}},[e.reference,o]),C.useEffect(()=>{(c==="initial"||c==="open")&&f.current?.innerHTML&&(d.current=f.current.innerHTML)},[c,e.reference,e.children]),!a)return!1;let p={...e.elementProps,style:{display:"flex",...e.elementProps?.style,zIndex:`calc(var(--bn-ui-base-z-index, 0) + ${e.elementProps?.style?.zIndex||0})`,...i,...l},...u()};return c==="close"?E.jsx(xd,{root:t,children:E.jsx("div",{ref:h,...p,dangerouslySetInnerHTML:{__html:d.current}})}):e.focusManagerProps?.disabled?E.jsx(xd,{root:t,children:E.jsx("div",{ref:h,...p,children:e.children})}):E.jsx(xd,{root:t,children:E.jsx(_I,{...e.focusManagerProps,context:s,children:E.jsx("div",{ref:h,...p,children:e.children})})})},nS=C.createContext(void 0);function fe(){return C.useContext(nS)}function Se(){return Nr().editor.dictionary}var Wq=typeof window<"u"?C.useLayoutEffect:C.useEffect,qq=class{transactionNumber=0;lastTransactionNumber=0;lastSnapshot;editor;subscribers=new Set;constructor(t){this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t,n){if(this.editor=t,this.editor){let r=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},o=this.editor._tiptapEditor,i={all:"transaction",selection:"selectionUpdate",change:"update"};return o.on(i[n],r),()=>{o.off(i[n],r)}}}};function jt(e){let t=Nr(),n=e.editor||t?.editor||null,r=e.on||"all",[o]=C.useState(()=>new qq(n)),i=ox.useSyncExternalStoreWithSelector(o.subscribe,o.getSnapshot,o.getServerSnapshot,e.selector,e.equalityFn??$q);return Wq(()=>o.watch(n,r),[n,o,r]),C.useDebugValue(i),i}var rS=e=>{let{position:t,children:n,...r}=e,{from:o,to:i}=t||{},s=be();return E.jsx(mr,{reference:C.useMemo(()=>{if(!(o===void 0||i===void 0))return{element:s.domElement?.firstElementChild||void 0,getBoundingClientRect:()=>Wp(s.prosemirrorView,o,i??o)}},[s,o,i]),...r,children:t!==void 0&&n})},Ym=(e={},t=[])=>C.useMemo(()=>{let n=Hq.create(e);return window&&(window.ProseMirror=n._tiptapEditor),n},t),oS=e=>{let[t,n]=C.useState(!1),r=jt({editor:e.editor,selector:({editor:a})=>a.isEmpty}),o=fe(),i=C.useCallback(()=>{n(!0)},[]),s=C.useCallback(()=>{n(!1)},[]);return C.useEffect(()=>{e.editable&&e.autoFocus&&e.editor.focus()},[e.autoFocus,e.editable,e.editor]),E.jsxs(E.Fragment,{children:[E.jsx(o.Comments.Editor,{autoFocus:e.autoFocus,className:"bn-comment-editor",editor:e.editor,onFocus:i,onBlur:s,editable:e.editable}),e.actions&&E.jsx("div",{className:"bn-comment-actions-wrapper",children:E.jsx(e.actions,{isFocused:t,isEmpty:r})})]})},{textColor:cJ,backgroundColor:uJ,...Gq}=cm,iS=um.create({blockSpecs:{paragraph:Kk()},styleSpecs:Gq}),Iy=Object.defineProperty,Yq=(e,t)=>{let n={};for(var r in e)Iy(n,r,{get:e[r],enumerable:!0});return Iy(n,Symbol.toStringTag,{value:"Module"}),n},My=Gn.create({name:"comment",excludes:"",inclusive:!1,keepOnSplit:!0,addAttributes(){return{orphan:{parseHTML:e=>!!e.getAttribute("data-orphan"),renderHTML:e=>e.orphan?{"data-orphan":"true"}:{},default:!1},threadId:{parseHTML:e=>e.getAttribute("data-bn-thread-id"),renderHTML:e=>({"data-bn-thread-id":e.threadId}),default:""}}},renderHTML({HTMLAttributes:e}){return["span",Rn(e,{class:"bn-thread-mark"})]},parseHTML(){return[{tag:"span.bn-thread-mark"}]},extendMarkSchema(e){return e.name==="comment"?{blocknoteIgnore:!0}:{}}}),Kq=class extends Dm{userCache=new Map;loadingUsers=new Set;constructor(e){super(),this.resolveUsers=e}async loadUsers(e){let t=e.filter(n=>!this.userCache.has(n)&&!this.loadingUsers.has(n));if(t.length!==0){for(let n of t)this.loadingUsers.add(n);try{let n=await this.resolveUsers(t);for(let r of n)this.userCache.set(r.id,r);this.emit("update",this.userCache)}finally{for(let n of t)this.loadingUsers.delete(n)}}}getUser(e){return this.userCache.get(e)}subscribe(e){return this.on("update",e)}},vl=new $e("blocknote-comments");function Qq(e,t){let n=new Map;return e.descendants((r,o)=>{r.marks.forEach(i=>{if(i.type.name===t){let s=i.attrs.threadId;if(!s)return;let a=o,l=a+r.nodeSize,c=n.get(s)??{from:1/0,to:0};n.set(s,{from:Math.min(a,c.from),to:Math.max(l,c.to)})}})}),n}var Jr=Ve(({editor:e,options:{schema:t,threadStore:n,resolveUsers:r}})=>{if(!r)throw Error("resolveUsers is required to be defined when using comments");if(!n)throw Error("threadStore is required to be defined when using comments");let o=My.name,i=new Kq(r),s=Po({pendingComment:!1,selectedThreadId:void 0,threadPositions:new Map},{onUpdate(){s.state.selectedThreadId!==s.prevState.selectedThreadId&&e.transact(l=>l.setMeta(vl,!0))}}),a=l=>{e.transact(c=>{c.doc.descendants((u,d)=>{u.marks.forEach(f=>{if(f.type.name===o){let h=f.type,p=f.attrs.threadId,g=l.get(p),y=!!(!g||g.resolved||g.deletedAt);if(y!==f.attrs.orphan){let b=Math.max(d,0),x=Math.min(d+u.nodeSize,c.doc.content.size-1,c.doc.content.size-1);c.removeMark(b,x,f),c.addMark(b,x,h.create({...f.attrs,orphan:y})),y&&s.state.selectedThreadId===p&&s.setState(k=>({...k,selectedThreadId:void 0}))}}})})})};return{key:"comments",store:s,prosemirrorPlugins:[new Ae({key:vl,state:{init(){return{decorations:_e.empty}},apply(l,c){let u=l.getMeta(vl);if(!l.docChanged&&!u)return c;let d=l.docChanged?Qq(l.doc,o):s.state.threadPositions;(d.size>0||s.state.threadPositions.size>0)&&s.setState(h=>({...h,threadPositions:d}));let f=[];if(s.state.selectedThreadId){let h=d.get(s.state.selectedThreadId);h&&f.push(qe.inline(h.from,h.to,{class:"bn-thread-mark-selected"}))}return{decorations:_e.create(l.doc,f)}}},props:{decorations(l){return vl.getState(l)?.decorations??_e.empty},handleClick:(l,c,u)=>{if(u.button!==0)return;let d=l.state.doc.nodeAt(c);if(!d){s.setState(h=>({...h,selectedThreadId:void 0}));return}let f=d.marks.find(h=>h.type.name===o&&h.attrs.orphan!==!0)?.attrs.threadId;f!==s.state.selectedThreadId&&s.setState(h=>({...h,selectedThreadId:f}))}}})],threadStore:n,mount(){let l=n.subscribe(a);a(n.getThreads());let c=e.onSelectionChange(()=>{s.state.pendingComment&&s.setState(u=>({...u,pendingComment:!1}))});return()=>{l(),c()}},selectThread(l,c=!0){if(s.state.selectedThreadId!==l&&(s.setState(u=>({...u,pendingComment:!1,selectedThreadId:l})),l&&c)){let u=s.state.threadPositions.get(l);if(!u)return;e.prosemirrorView?.domAtPos(u.from).node?.scrollIntoView({behavior:"smooth",block:"center"})}},startPendingComment(){s.setState(l=>({...l,selectedThreadId:void 0,pendingComment:!0})),e.getExtension(va)?.showSelection(!0,"comments")},stopPendingComment(){s.setState(l=>({...l,selectedThreadId:void 0,pendingComment:!1})),e.getExtension(va)?.showSelection(!1,"comments")},async createThread(l){let c=await n.createThread(l);if(n.addThreadToDocument){let u=e.prosemirrorView,d=u.state.selection,f=tt.getState(u.state),h={prosemirror:{head:d.head,anchor:d.anchor},yjs:f?Cc(f.binding,u.state):void 0};await n.addThreadToDocument({threadId:c.id,selection:h})}else e._tiptapEditor.commands.setMark(o,{orphan:!1,threadId:c.id})},userStore:i,commentEditorSchema:t,tiptapExtensions:[My]}}),sS={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_y=Re.createContext&&Re.createContext(sS),Xq=["attr","size","title"];function Zq(e,t){if(e==null)return{};var n=Jq(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Jq(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function su(){return su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},su.apply(this,arguments)}function Oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function au(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Oy(Object(n),!0).forEach(function(r){eG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eG(e,t,n){return t=tG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tG(e){var t=nG(e,"string");return typeof t=="symbol"?t:t+""}function nG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aS(e){return e&&e.map((t,n)=>Re.createElement(t.tag,au({key:n},t.attr),aS(t.child)))}function he(e){return t=>Re.createElement(rG,su({attr:au({},e.attr)},t),aS(e.child))}function rG(e){var t=n=>{var{attr:r,size:o,title:i}=e,s=Zq(e,Xq),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),Re.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:au(au({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Re.createElement("title",null,i),e.children)};return _y!==void 0?Re.createElement(_y.Consumer,null,n=>t(n)):t(sS)}function oG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(e)}function lS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(e)}function iG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(e)}function sG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(e)}function aG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(e)}function lG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(e)}function cG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(e)}function uG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(e)}function dG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(e)}function fG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(e)}function hG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(e)}function Ry(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(e)}function lu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(e)}function cu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(e)}function uu(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function cS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(e)}function uS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function dS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(e)}function pG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(e)}function mG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(e)}function Ly(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(e)}function gG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(e)}function bG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(e)}function fS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(e)}function hS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(e)}function pS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function mS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function yG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(e)}function EG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(e)}function gS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(e)}function xG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(e)}function CG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(e)}function Km(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(e)}function kG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(e)}function TG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(e)}function wG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(e)}function SG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(e)}function vG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(e)}function bS(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(e)}function AG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(e)}function NG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(e)}function IG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(e)}function MG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function _G(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function OG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(e)}function RG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(e)}function LG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(e)}function DG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(e)}function PG(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(e)}function Dy(e){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(e)}var Af;async function BG(){return Af||(Af=(async()=>{let[e,t]=await Promise.all([Qi(()=>import("./module-RjUF93sV.js"),[]),Qi(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in e?e.default:e,r="default"in t?t.default:t;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),Af)}function FG(e){let t=C.useRef(null),n=C.useRef(null);return n.current&&n.current.update(e),C.useEffect(()=>((async()=>{let{emojiMart:r}=await BG();n.current=new r.Picker({...e,ref:t})})(),()=>{n.current=null}),[]),Re.createElement("div",{ref:t})}var Py=e=>{let[t,n]=C.useState(!1),r=fe(),o=Nr(),i=o.editor?.portalElement;if(!i)throw Error("Portal root not found");return E.jsxs(r.Generic.Popover.Root,{open:t,portalRoot:i,children:[E.jsx(r.Generic.Popover.Trigger,{children:E.jsx("div",{onClick:s=>{s.preventDefault(),s.stopPropagation(),n(!t),e.onOpenChange?.(!t)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.children})}),E.jsx(r.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:E.jsx(FG,{perLine:7,onClickOutside:()=>{n(!1),e.onOpenChange?.(!1)},onEmojiSelect:s=>{e.onEmojiSelect(s),n(!1),e.onOpenChange?.(!1)},theme:o?.colorSchemePreference})})]})};function yS(e){return id([e]).get(e)}function id(e){let t=je(Jr).userStore,n=C.useCallback(()=>{let o=new Map;for(let i of e){let s=t.getUser(i);s&&o.set(i,s)}return o},[t,e]),r=C.useMemo(()=>({current:n()}),[n]);return C.useSyncExternalStore(C.useCallback(o=>{let i=t.subscribe(s=>{r.current=n(),o()});return t.loadUsers(e),i},[t,n,e,r]),()=>r.current)}var HG=e=>{let t=fe(),n=Se(),r=je(Jr),o=e.comment.reactions.find(l=>l.emoji===e.emoji);if(!o)throw Error("Trying to render reaction badge for non-existing reaction");let[i,s]=C.useState([]),a=id(i);return E.jsx(t.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-reaction"),text:o.userIds.length.toString(),icon:o.emoji,isSelected:r.threadStore.auth.canDeleteReaction(e.comment,o.emoji),onClick:()=>e.onReactionSelect(o.emoji),onMouseEnter:()=>s(o.userIds),mainTooltip:n.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(l=>l.username).join(`
176
+ `)}`},o.emoji)},ES=({comment:e,thread:t,showResolveButton:n})=>{let r=je(Jr),o=Se(),i=Ym({initialContent:e.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||iS}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,e.body),l(!1)},[i,e.body]),p=C.useCallback(async N=>{await d.updateComment({commentId:e.id,comment:{body:i.document},threadId:t.id}),l(!1)},[e,t.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:e.id,threadId:t.id})},[e,t.id,d]),y=C.useCallback(async N=>{d.auth.canAddReaction(e,N)?await d.addReaction({threadId:t.id,commentId:e.id,emoji:N}):d.auth.canDeleteReaction(e,N)&&await d.deleteReaction({threadId:t.id,commentId:e.id,emoji:N})},[d,e,t.id]),b=C.useCallback(async()=>{await d.resolveThread({threadId:t.id})},[t.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:t.id})},[t.id,d]),k=yS(e.userId);if(!e.body)return null;let O,M=d.auth.canAddReaction(e),A=d.auth.canDeleteComment(e),D=d.auth.canUpdateComment(e),z=n&&(t.resolved?d.auth.canUnresolveThread(t):d.auth.canResolveThread(t));a||(O=E.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[M&&E.jsx(Py,{onEmojiSelect:N=>y(N.native),onOpenChange:u,children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:E.jsx(Dy,{size:16})},"add-reaction")}),z&&(t.resolved?E.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:E.jsx(oG,{size:16})},"reopen"):E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:b,children:E.jsx(IG,{size:16})},"resolve")),(A||D)&&E.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[E.jsx(s.Generic.Menu.Trigger,{children:E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:E.jsx(LG,{size:16})},"more-actions")}),E.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[D&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(iG,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),A&&E.jsx(s.Generic.Menu.Item,{icon:E.jsx(_G,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));let Y=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw Error("soft deletes are not yet supported");return E.jsx(s.Comments.Comment,{authorInfo:k??"loading",timeString:Y,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:O,className:"bn-thread-comment",emojiPickerOpen:c,children:E.jsx(oS,{autoFocus:a,editor:i,editable:a,actions:e.reactions.length>0||a?({isEmpty:N})=>E.jsxs(E.Fragment,{children:[e.reactions.length>0&&!a&&E.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(K=>E.jsx(HG,{comment:e,emoji:K.emoji,onReactionSelect:y},K.emoji)),M&&E.jsx(Py,{onEmojiSelect:K=>y(K.native),onOpenChange:u,children:E.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:E.jsx(Dy,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&E.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[E.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:N,children:o.comments.save_button_text}),E.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},xS=({thread:e,maxCommentsBeforeCollapse:t})=>{let n=fe(),r=Se(),o=id(e.resolvedBy?[e.resolvedBy]:[]),i=e.comments.map((s,a)=>E.jsx(ES,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!o.get(e.resolvedBy))throw Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);let s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,E.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&o.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:E.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return t&&i.length>t&&i.splice(1,i.length-2,E.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),i},Qm=({thread:e,selected:t,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{let a=fe(),l=Se(),c=je(Jr),u=Ym({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||iS}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:e.id}),u.removeBlocks(u.document)},[c,u,e.id]);return E.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:t,tabIndex:s,children:[E.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:E.jsx(xS,{thread:e,maxCommentsBeforeCollapse:t?void 0:r||5})}),t&&E.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:E.jsx(oS,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:E.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:E.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function CS(){let e=je(Jr).threadStore,t=C.useRef(void 0);return t.current||=e.getThreads(),C.useSyncExternalStore(C.useCallback(n=>e.subscribe(r=>{t.current=r,n()}),[e]),()=>t.current)}var UG=Yq({default:()=>kS});function kS(e){let t=be(),n=je(Jr),r=rt(Jr,{editor:t,selector:l=>l.selectedThreadId?{id:l.selectedThreadId,position:l.threadPositions.get(l.selectedThreadId)}:void 0}),o=CS(),i=C.useMemo(()=>r?o.get(r.id):void 0,[r,o]),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(l,c,u)=>{u==="escape-key"&&t.focus(),l||n.selectThread(void 0)},placement:"bottom",middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:30},...e.floatingUIOptions?.elementProps}}),[n,t,e.floatingUIOptions,r]),a=e.floatingThread||Qm;return E.jsx(rS,{position:r?.position,...s,children:i&&E.jsx(a,{thread:i,selected:!0})})}const VG=Object.freeze(Object.defineProperty({__proto__:null,a:xS,c:id,i:Qm,n:UG,o:ES,r:CS,s:yS,t:kS},Symbol.toStringTag,{value:"Module"}));function $G(e){return he({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(e)}function TS(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(e)}function jG(e){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(e)}var zG=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},WG=({contentComponent:e})=>{const t=Mv.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})};function qG(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Iv.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var GG=class extends Re.Component{constructor(e){var t;super(e),this.editorContentRef=Re.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=qG(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:zG(t,this.editorContentRef),...n}),e?.contentComponent&&E.jsx(WG,{contentComponent:e.contentComponent})]})}},YG=C.forwardRef((e,t)=>{const n=Re.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Re.createElement(GG,{key:n,innerRef:t,...e})}),KG=Re.memo(YG),wS=C.createContext({editor:null});wS.Consumer;var SS=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),vS=()=>C.useContext(SS),QG=Re.forwardRef((e,t)=>{const{onDragStart:n}=vS(),r=e.as||"div";return E.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function By(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function Fy(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function XG(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function ZG(e){if(By(e)||Fy(e))return!0;if(XG(e)){const t=e.type;if(t)return By(t)||Fy(t)}return!1}function JG(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var eY=class{constructor(e,{editor:t,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Xr.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;const t=this.component,n=this.props,r=this.editor,o=JG(),i=ZG(t),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=E.jsx(t,{...s}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;const t=this.editor;(e=t?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};Re.createContext({markViewContentRef:()=>{}});var tY=class extends YR{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,o){var i;return r==="storage"?(i=e.storage[t.name])!=null?i:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,i=C.memo(l=>E.jsx(SS.Provider,{value:r,children:C.createElement(o,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new eY(i,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,n=ya(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function nY(e,t){return n=>n.editor.contentComponent?new tY(e,n,t):{}}var Xm=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Xm.displayName="TiptapContext";var rY=()=>C.useContext(Xm);function AS({editor:e,instance:t,children:n}){const r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=C.useMemo(()=>({editor:r}),[r]),i=C.useMemo(()=>({editor:r}),[r]);return E.jsx(wS.Provider,{value:i,children:E.jsx(Xm.Provider,{value:o,children:n})})}AS.displayName="Tiptap";function NS({...e}){const{editor:t}=rY();return E.jsx(KG,{editor:t,...e})}NS.displayName="Tiptap.Content";Object.assign(AS,{Content:NS});var IS=e=>{let{blockId:t,children:n,...r}=e,o=be();return E.jsx(mr,{reference:C.useMemo(()=>o.transact(i=>{if(!t)return;let s=cn(t,i.doc);if(!s)return;let{node:a}=o.prosemirrorView.domAtPos(s.posBeforeNode+1);if(a instanceof Element)return{element:a}}),[o,t]),...r,children:t!==void 0&&n})},oY=e=>{let t=fe(),n=Se(),r=be(),o=r.getBlock(e.blockId),[i,s]=C.useState(""),a=C.useCallback(u=>{s(u.currentTarget.value)},[]),l=C.useCallback(u=>{u.key==="Enter"&&!u.nativeEvent.isComposing&&(u.preventDefault(),r.updateBlock(o.id,{props:{name:k1(i),url:i}}))},[r,o.id,i]),c=C.useCallback(()=>{r.updateBlock(o.id,{props:{name:k1(i),url:i}})},[r,o.id,i]);return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:l,"data-test":"embed-input"}),E.jsx(t.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[o.type]||n.file_panel.embed.embed_button.file})]})},iY=e=>{let t=fe(),n=Se(),{setLoading:r}=e,o=be(),i=o.getBlock(e.blockId),[s,a]=C.useState(!1);C.useEffect(()=>{s&&setTimeout(()=>{a(!1)},3e3)},[s]);let l=C.useCallback(d=>{if(d===null)return;async function f(h){if(r(!0),o.uploadFile!==void 0)try{let p=await o.uploadFile(h,e.blockId);typeof p=="string"&&(p={props:{name:h.name,url:p}}),o.updateBlock(e.blockId,p)}catch{a(!0)}finally{r(!1)}}f(d)},[e.blockId,o,r]),c=o.schema.blockSpecs[i.type],u=c.implementation.meta?.fileBlockAccept?.length?c.implementation.meta.fileBlockAccept.join(","):"*/*";return E.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[E.jsx(t.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:u,placeholder:n.file_panel.upload.file_placeholder[i.type]||n.file_panel.upload.file_placeholder.file,value:null,onChange:l}),s&&E.jsx("div",{className:"bn-error-text",children:n.file_panel.upload.upload_error})]})},MS=e=>{let t=fe(),n=Se(),r=be(),[o,i]=C.useState(!1),s=e.tabs??[...r.uploadFile===void 0?[]:[{name:n.file_panel.upload.title,tabPanel:E.jsx(iY,{blockId:e.blockId,setLoading:i})}],{name:n.file_panel.embed.title,tabPanel:E.jsx(oY,{blockId:e.blockId})}],[a,l]=C.useState(e.defaultOpenTab||s[0].name);return E.jsx(t.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:o})},sY=e=>{let t=be(),n=je(rr),r=rt(rr),o=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&t.focus()},middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:90},...e.floatingUIOptions?.elementProps}}),[r,t,n,e.floatingUIOptions]),i=e.filePanel||MS;return E.jsx(IS,{blockId:r,...o,children:r&&E.jsx(i,{blockId:r})})},aY={bold:fG,italic:gG,underline:kG,strike:xG,code:sG};function lY(e,t){return e in t.schema.styleSchema&&t.schema.styleSchema[e].type===e&&t.schema.styleSchema[e].propSchema==="boolean"}var Al=e=>{let t=Se(),n=fe(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!(!a.isEditable||!lY(e.basicTextStyle,a)||!(a.getSelection()?.blocks||[a.getTextCursorPosition().block]).find(l=>l.content!==void 0)))return e.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=C.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,e]);if(o===void 0)return null;let s=aY[e.basicTextStyle];return E.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":e.basicTextStyle,onClick:()=>i(e.basicTextStyle),isSelected:o.active,label:t.formatting_toolbar[e.basicTextStyle].tooltip,mainTooltip:t.formatting_toolbar[e.basicTextStyle].tooltip,secondaryTooltip:Bn(t.formatting_toolbar[e.basicTextStyle].secondary_tooltip,t.generic.ctrl_shortcut),icon:E.jsx(s,{})})},op=e=>{let t=e.textColor||"default",n=e.backgroundColor||"default",r=e.size||16,o=C.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return E.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":t,style:o,children:"A"})},Hy=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],sd=e=>{let t=fe(),n=Se();return E.jsxs(E.Fragment,{children:[E.jsx(()=>e.text?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.text_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(r)},"data-test":"text-color-"+r,icon:E.jsx(op,{textColor:r,size:e.iconSize}),checked:e.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),E.jsx(()=>e.background?E.jsxs(E.Fragment,{children:[E.jsx(t.Generic.Menu.Label,{children:n.color_picker.background_title}),Hy.map(r=>E.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(r)},"data-test":"background-color-"+r,icon:E.jsx(op,{backgroundColor:r,size:e.iconSize}),checked:e.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function Nl(e,t){return`${e}Color`in t.schema.styleSchema&&t.schema.styleSchema[`${e}Color`].type===`${e}Color`&&t.schema.styleSchema[`${e}Color`].propSchema==="string"}var cY=()=>{let e=fe(),t=Se(),n=be(),r=Nl("text",n),o=Nl("background",n),i=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(d=>d.content!==void 0))return;let c=Nl("text",l),u=Nl("background",l);if(!(!c&&!u))return{textColor:c?l.getActiveStyles().textColor||"default":void 0,backgroundColor:u?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=C.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=C.useCallback(l=>{if(!o)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[o,n]);return i===void 0?null:E.jsxs(e.Generic.Menu.Root,{children:[E.jsx(e.Generic.Menu.Trigger,{children:E.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:t.formatting_toolbar.colors.tooltip,mainTooltip:t.formatting_toolbar.colors.tooltip,icon:E.jsx(op,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),E.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Uy=e=>{for(let t of hw)if(e.startsWith(t))return e;return`${pw}://${e}`},_S=e=>{let t=fe(),n=Se(),{editLink:r}=je(ja),{url:o,text:i,showTextField:s}=e,[a,l]=C.useState(o),[c,u]=C.useState(i);C.useEffect(()=>{l(o),u(i)},[i,o]);let d=C.useCallback(g=>{g.key==="Enter"&&!g.nativeEvent.isComposing&&(g.preventDefault(),r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1))},[r,a,c,e]),f=C.useCallback(g=>l(g.currentTarget.value),[]),h=C.useCallback(g=>u(g.currentTarget.value),[]),p=C.useCallback(()=>{r(Uy(a),c,e.range.from),e.setToolbarOpen?.(!1),e.setToolbarPositionFrozen?.(!1)},[r,a,c,e]);return E.jsxs(t.Generic.Form.Root,{children:[E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:E.jsx(fS,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:d,onChange:f,onSubmit:p}),s!==!1&&E.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:E.jsx(Km,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:d,onChange:h,onSubmit:p})]})};function uY(e){return"link"in e.schema.inlineContentSchema&&e.schema.inlineContentSchema.link==="link"}var dY=()=>{let e=be(),t=fe(),n=Se(),r=je(Lo),{showSelection:o}=je(va),[i,s]=C.useState(!1);C.useEffect(()=>(o(i,"createLinkButton"),()=>o(!1,"createLinkButton")),[i,o]);let a=jt({editor:e,selector:({editor:l})=>{if(!(!l.isEditable||!uY(l)||Th(l.prosemirrorState.selection)||!(l.getSelection()?.blocks||[l.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return C.useEffect(()=>{s(!1)},[a]),C.useEffect(()=>{let l=u=>{(u.ctrlKey||u.metaKey)&&u.key==="k"&&(s(!0),u.preventDefault())},c=e.domElement;return c?.addEventListener("keydown",l),()=>{c?.removeEventListener("keydown",l)}},[e.domElement]),a===void 0?null:E.jsxs(t.Generic.Popover.Root,{open:i,onOpenChange:s,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:Bn(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:E.jsx(fS,{}),onClick:()=>s(l=>!l)})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},fY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",caption:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.caption)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{caption:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_caption.tooltip,mainTooltip:e.formatting_toolbar.file_caption.tooltip,icon:E.jsx(Ly,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-caption",icon:E.jsx(Ly,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},hY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,mainTooltip:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,icon:E.jsx(MG,{}),onClick:o})},pY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:l})=>{if(!l.isEditable)return;let c=l.getSelection()?.blocks||[l.getTextCursorPosition().block];if(c.length!==1)return;let u=c[0];if(En(u,l,u.type,{url:"string",name:"string"}))return u}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.name)},[r]);let s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&it(n,r.type,{name:"string"})&&l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:o}}))},[r,o,n]);return r===void 0?null:E.jsxs(t.Generic.Popover.Root,{children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,mainTooltip:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,icon:E.jsx(Ry,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(t.Generic.Form.Root,{children:E.jsx(t.Generic.Form.TextInput,{name:"file-name",icon:E.jsx(Ry,{}),value:o||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_rename.input_placeholder[r.type]||e.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},mY=()=>{let e=Se(),t=fe(),n=jt({editor:be(),selector:({editor:r})=>{if(!r.isEditable)return;let o=r.getSelection()?.blocks||[r.getTextCursorPosition().block];if(o.length!==1)return;let i=o[0];if(En(i,r,i.type,{url:"string"}))return i}});return n===void 0?null:E.jsxs(t.Generic.Popover.Root,{position:"bottom",children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",mainTooltip:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,label:e.formatting_toolbar.file_replace.tooltip[n.type]||e.formatting_toolbar.file_replace.tooltip.file,icon:E.jsx(vG,{})})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:E.jsx(MS,{blockId:n.id})})]})},gY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:o,isDisabled:!r.canNestBlock,label:e.formatting_toolbar.nest.tooltip,mainTooltip:e.formatting_toolbar.nest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.nest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(mG,{})})},bY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!(!i.isEditable||!(i.getSelection()?.blocks||[i.getTextCursorPosition().block]).find(s=>s.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:o,isDisabled:!r.canUnnestBlock,label:e.formatting_toolbar.unnest.tooltip,mainTooltip:e.formatting_toolbar.unnest.tooltip,secondaryTooltip:Bn(e.formatting_toolbar.unnest.secondary_tooltip,e.generic.ctrl_shortcut),icon:E.jsx(pG,{})})},yY=e=>[{name:e.slash_menu.paragraph.title,type:"paragraph",icon:Km},{name:e.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:lu},{name:e.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:cu},{name:e.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:uu},{name:e.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:cS},{name:e.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:uS},{name:e.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:dS},{name:e.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:lu},{name:e.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:cu},{name:e.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:uu},{name:e.slash_menu.quote.title,type:"quote",icon:gS},{name:e.slash_menu.toggle_list.title,type:"toggleListItem",icon:bS},{name:e.slash_menu.bullet_list.title,type:"bulletListItem",icon:mS},{name:e.slash_menu.numbered_list.title,type:"numberedListItem",icon:pS},{name:e.slash_menu.check_list.title,type:"checkListItem",icon:hS}],EY=e=>{let t=fe(),n=be(),r=jt({editor:n,selector:({editor:a})=>a.getSelection()?.blocks||[a.getTextCursorPosition().block]}),o=r[0],i=C.useMemo(()=>(e.items||yY(n.dictionary)).filter(a=>it(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,e.items]),s=C.useMemo(()=>i.map(a=>{let l=a.icon,c=a.type===o.type,u=Object.entries(a.props||{}).filter(([d,f])=>f!==o.props[d]).length===0;return{text:a.name,icon:E.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(let d of r)n.updateBlock(d,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,i,o.props,o.type,r]);return!C.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:E.jsx(t.FormattingToolbar.Select,{className:"bn-select",items:s})},xY=()=>{let e=Se(),t=fe(),n=je("comments"),{store:r}=je(Lo),o=C.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:o})},CY=()=>be().getExtension("comments")?E.jsx(xY,{}):null,kY=()=>{let e=Se(),t=fe(),n=be(),r=C.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:E.jsx(lS,{}),onClick:r})};function ip(e,t){try{let n=new URL(e,t);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}var TY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string"}))return a}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(i=>window.open(ip(i,window.location.href))):window.open(ip(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,mainTooltip:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,icon:E.jsx(OG,{}),onClick:o})},wY=()=>{let e=Se(),t=fe(),n=be(),r=jt({editor:n,selector:({editor:i})=>{if(!i.isEditable)return;let s=i.getSelection()?.blocks||[i.getTextCursorPosition().block];if(s.length!==1)return;let a=s[0];if(En(a,i,a.type,{url:"string",showPreview:"boolean"}))return a}}),o=C.useCallback(()=>{r!==void 0&&it(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:e.formatting_toolbar.file_preview_toggle.tooltip,icon:E.jsx(SG,{}),isSelected:r.props.showPreview,onClick:o})},SY=()=>{let e=Se(),t=fe(),n=be(),r=je(Je),o=jt({editor:n,selector:({editor:s})=>{if(!s.isEditable||!s.settings.tables.splitCells)return;let a=s.getSelection()?.blocks||[s.getTextCursorPosition().block];if(a.length!==1)return;let l=a[0];if(l.type==="table")return{mergeDirection:r.getMergeDirection(l)}}}),i=C.useCallback(()=>{r?.mergeCells()},[r]);return o===void 0?null:E.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:e.formatting_toolbar.table_cell_merge.tooltip,icon:o.mergeDirection==="horizontal"?E.jsx(yG,{}):E.jsx(EG,{}),onClick:i})},vY=()=>be().getExtension(Je)?E.jsx(SY,{}):null,AY={left:uG,center:lG,right:dG,justify:cG},Nf=e=>{let t=fe(),n=Se(),r=be(),o=jt({editor:r,selector:({editor:a})=>{if(!a.isEditable)return;let l=a.getSelection()?.blocks||[a.getTextCursorPosition().block],c=l[0];if(En(c,a,c.type,{textAlignment:Ue.textAlignment}))return{textAlignment:c.props.textAlignment,blocks:l};if(l.length===1&&En(c,a,"table"))return a.getExtension(Je)?.getCellSelection()?{textAlignment:Io(c.content.rows[0].cells[0]).props.textAlignment,blocks:[c]}:void 0}}),i=C.useCallback(a=>{if(o!==void 0){r.focus();for(let l of o.blocks)if(En(l,r,l.type,{textAlignment:Ue.textAlignment})&&it(r,l.type,{textAlignment:Ue.textAlignment}))r.updateBlock(l,{props:{textAlignment:a}});else if(l.type==="table"){let c=r.getExtension(Je)?.getCellSelection();if(!c)continue;let u=l.content.rows.map(d=>({...d,cells:d.cells.map(f=>Io(f))}));c.cells.forEach(({row:d,col:f})=>{u[d].cells[f].props.textAlignment=a}),r.updateBlock(l,{type:"table",content:{...l.content,type:"tableContent",rows:u}}),r.setTextCursorPosition(l)}}},[r,o]);if(o===void 0)return null;let s=AY[e.textAlignment];return E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1)}`,onClick:()=>i(e.textAlignment),isSelected:o.textAlignment===e.textAlignment,label:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,icon:E.jsx(s,{})})},Zm=e=>[E.jsx(EY,{items:e},"blockTypeSelect"),E.jsx(vY,{},"tableCellMergeButton"),E.jsx(fY,{},"fileCaptionButton"),E.jsx(mY,{},"replaceFileButton"),E.jsx(pY,{},"fileRenameButton"),E.jsx(hY,{},"fileDeleteButton"),E.jsx(TY,{},"fileDownloadButton"),E.jsx(wY,{},"filePreviewButton"),E.jsx(Al,{basicTextStyle:"bold"},"boldStyleButton"),E.jsx(Al,{basicTextStyle:"italic"},"italicStyleButton"),E.jsx(Al,{basicTextStyle:"underline"},"underlineStyleButton"),E.jsx(Al,{basicTextStyle:"strike"},"strikeStyleButton"),E.jsx(Nf,{textAlignment:"left"},"textAlignLeftButton"),E.jsx(Nf,{textAlignment:"center"},"textAlignCenterButton"),E.jsx(Nf,{textAlignment:"right"},"textAlignRightButton"),E.jsx(cY,{},"colorStyleButton"),E.jsx(gY,{},"nestBlockButton"),E.jsx(bY,{},"unnestBlockButton"),E.jsx(dY,{},"createLinkButton"),E.jsx(CY,{},"addCommentButton"),E.jsx(kY,{},"addTiptapCommentButton")],Jm=e=>E.jsx(fe().FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:e.children||Zm(e.blockTypeSelectItems)}),NY=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},eg=e=>{let t=be(),n=je(Lo,{editor:t}),r=rt(Lo,{editor:t}),o=jt({editor:t,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),i=jt({editor:t,selector:({editor:l})=>{let c=l.getTextCursorPosition().block;return En(c,l,c.type,{textAlignment:Ue.textAlignment})?NY(c.props.textAlignment):"top-start"}}),s=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&t.focus()},placement:i,middleware:[qr(10),xu(),Cu()],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:40},...e.floatingUIOptions?.elementProps}}),[r,i,e.floatingUIOptions,n.store,t]),a=e.formattingToolbar||Jm;return E.jsx(rS,{position:o,...s,children:r&&E.jsx(a,{})})},OS=e=>{let t=fe(),n=Se(),{deleteLink:r}=je(ja);return E.jsx(t.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{r(e.range.from),e.setToolbarOpen?.(!1)},icon:E.jsx(bG,{})})},RS=e=>{let t=fe(),n=Se();return E.jsxs(t.Generic.Popover.Root,{onOpenChange:e.setToolbarPositionFrozen,children:[E.jsx(t.Generic.Popover.Trigger,{children:E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),E.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:E.jsx(_S,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen})})]})},IY=e=>{let t=fe(),n=Se();return E.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(ip(e.url,window.location.href),"_blank")},icon:E.jsx(RG,{})})},LS=e=>E.jsx(fe().LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen}),E.jsx(IY,{url:e.url}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}),DS=e=>{let t=be(),[n,r]=C.useState(!1),[o,i]=C.useState(!1),s=je(ja),[a,l]=C.useState(void 0);C.useEffect(()=>{let f=()=>{let b=s.getLinkAtSelection();if(!b){l(void 0),o||r(!1);return}l({cursorType:"text",url:b.mark.attrs.href,text:b.text,range:b.range,element:s.getLinkElementAtPos(b.range.from)}),o||r(!0)},h=b=>{if(a!==void 0&&a.cursorType==="text"||!(b.target instanceof HTMLElement))return;let x=s.getLinkAtElement(b.target);x&&l({cursorType:"mouse",url:x.mark.attrs.href,text:x.text,range:x.range,element:s.getLinkElementAtPos(x.range.from)})},p=t.onChange(f),g=t.onSelectionChange(f),y=t.domElement;return y?.addEventListener("mouseover",h),()=>{p(),g(),y?.removeEventListener("mouseover",h)}},[t,t.domElement,s,a,o]);let c=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,onOpenChange:(f,h,p)=>{o||a!==void 0&&a.cursorType==="text"&&p==="hover"||(p==="escape-key"&&t.focus(),r(f))},placement:"top-start",middleware:[qr(10),Cu()],...e.floatingUIOptions?.useFloatingOptions},useHoverProps:{enabled:a!==void 0&&a.cursorType==="mouse",delay:{open:250,close:250},handleClose:VI(),...e.floatingUIOptions?.useHoverProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:50},...e.floatingUIOptions?.elementProps}}),[t,a,e.floatingUIOptions,n,o]),u=C.useMemo(()=>a?.element?{element:a.element}:void 0,[a?.element]);if(!t.isEditable)return null;let d=e.linkToolbar||LS;return E.jsx(mr,{reference:u,...c,children:a&&E.jsx(d,{url:a.url,text:a.text,range:a.range,setToolbarOpen:r,setToolbarPositionFrozen:i})})},MY=()=>{let e=fe(),t=Se(),n=be(),r=je(zn),o=rt(qn,{editor:n,selector:s=>s?.block}),i=C.useCallback(()=>{if(o===void 0)return;let s=o.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(o),r.openSuggestionMenu("/");else{let a=n.insertBlocks([{type:"paragraph"}],o,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[o,n,r]);return o===void 0?null:E.jsx(e.SideMenu.Button,{className:"bn-button",label:t.side_menu.add_block_label,icon:E.jsx($G,{size:24,onClick:i,"data-test":"dragHandleAdd"})})},_Y=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0||!En(r,n,r.type,{textColor:"string"})&&!En(r,n,r.type,{backgroundColor:"string"})?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:En(r,n,r.type,{textColor:"string"})&&it(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:o=>n.updateBlock(r,{type:r.type,props:{textColor:o}})}:void 0,background:En(r,n,r.type,{backgroundColor:"string"})&&it(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:o=>n.updateBlock(r,{props:{backgroundColor:o}})}:void 0})})]})},OY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:o=>o?.block});return r===void 0?null:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:e.children})},RY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:o?void 0:1}})},children:e.children})},LY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;let o=!!r.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:o?void 0:1}})},children:e.children})},DY=e=>{let t=fe(),n=Se();return E.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(OY,{children:n.drag_handle.delete_menuitem}),E.jsx(_Y,{children:n.drag_handle.colors_menuitem}),E.jsx(RY,{children:n.drag_handle.header_row_menuitem}),E.jsx(LY,{children:n.drag_handle.header_column_menuitem})]})})},PY=e=>{let t=fe(),n=Se(),r=je(qn),o=rt(qn,{selector:s=>s?.block});if(o===void 0)return null;let i=e.dragHandleMenu||DY;return E.jsxs(t.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,o),onDragEnd:r.blockDragEnd,className:"bn-button",icon:E.jsx(TS,{size:24,"data-test":"dragHandle"})})}),E.jsx(i,{children:e.children})]})},BY=e=>{let t=fe(),n=be(),r=rt(qn,{editor:n,selector:i=>i?.block}),o=C.useMemo(()=>{if(r===void 0)return{};let i={"data-block-type":r.type};return r.type==="heading"&&(i["data-level"]=r.props.level.toString()),n.schema.blockSpecs[r.type].implementation.meta?.fileBlockAccept&&(r.props.url?i["data-url"]="true":i["data-url"]="false"),i},[r,n.schema.blockSpecs]);return E.jsx(t.SideMenu.Root,{className:"bn-side-menu",...o,children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(MY,{}),E.jsx(PY,{dragHandleMenu:e.dragHandleMenu})]})})},FY=e=>{let t=be(),{show:n,block:r}=rt(qn,{selector:a=>a===void 0?void 0:{show:a.show,block:a.block}})||{},o=C.useCallback((a,l,c)=>{let u=!1;return mp(a,l,()=>{if(!u){u=!0;return}t.getExtension(qn)?.hideMenuIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),i=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:n,placement:"left-start",whileElementsMounted:o,...e.floatingUIOptions?.useFloatingOptions},useDismissProps:{enabled:!1,...e.floatingUIOptions?.useDismissProps},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{style:{zIndex:20},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,n,o]),s=e.sideMenu||BY;return E.jsx(IS,{blockId:n?r?.id:void 0,...i,children:r?.id&&E.jsx(s,{})})};async function HY(e,t){return(await GV(e,t)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function UY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s,columns:a}=e,l=o==="loading-initial"||o==="loading"?E.jsx(t.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=C.useMemo(()=>{let u=[];for(let d=0;d<r.length;d++){let f=r[d];u.push(E.jsx(t.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:f,id:`bn-grid-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.id))}return u},[t,r,s,i]);return E.jsxs(t.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&e.loadingState==="loaded"&&E.jsx(t.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function PS(e,t,n,r=3){let o=C.useRef(0);C.useEffect(()=>{t!==void 0&&(e.length>0?o.current=t.length:t.length-o.current>r&&n())},[n,r,e.length,t])}function BS(e,t){let[n,r]=C.useState([]),[o,i]=C.useState(!1),s=C.useRef(void 0),a=C.useRef(void 0);return C.useEffect(()=>{let l=e;s.current=e,i(!0),t(e).then(c=>{s.current===l&&(r(c),i(!1),a.current=l)})},[e,t]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":o?"loading":"loaded"}}function VY(e,t,n,r,o){let[i,s]=C.useState(0),a=r!==void 0&&r>1;return C.useEffect(()=>{let l=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((i-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((i+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((i-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((i+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&o?.(n[i]),!0):!1),c=e.domElement;return c?.addEventListener("keydown",l,!0),()=>{c?.removeEventListener("keydown",l,!0)}},[e.domElement,n,i,o,r,a]),C.useEffect(()=>{s(0)},[t]),{selectedIndex:n.length===0?void 0:i}}function $Y(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,gridSuggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=e,u=C.useCallback(g=>{a(),s(),l?.(g)},[l,a,s]),{items:d,usedQuery:f,loadingState:h}=BS(i,r);PS(d,f,a);let{selectedIndex:p}=VY(n,i,d,c,u);return C.useEffect(()=>(t(g=>({...g,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(g=>({...g,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(g=>({...g,"aria-activedescendant":p?"bn-suggestion-menu-item-"+p:void 0})),()=>{t(g=>({...g,"aria-activedescendant":void 0}))}),[t,p]),E.jsx(o,{items:d,onItemClick:u,loadingState:h,selectedIndex:p,columns:c})}function jY(e){let t=be(),{triggerCharacter:n,gridSuggestionMenuComponent:r,columns:o,shouldOpen:i,minQueryLength:s,onItemClick:a,getItems:l}=e,c=C.useMemo(()=>a||(g=>{g.onItemClick(t)}),[t,a]),u=C.useMemo(()=>l||(async g=>await HY(t,g)),[t,l]),d=je(zn);C.useEffect(()=>{d.addSuggestionMenu({triggerCharacter:n,shouldOpen:i})},[d,n,i]);let f=rt(zn),h=rt(zn,{selector:g=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>g?.referencePos||new DOMRect})}),p=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:f?.show&&f?.triggerCharacter===n,onOpenChange:g=>{g||d.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:g,availableHeight:y}){g.floating.style.maxHeight=`${Math.max(0,y)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:70},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,f?.show,f?.triggerCharacter,d,n]);return!f||!f.ignoreQueryLength&&s&&(f.query.startsWith(" ")||f.query.length<s)?null:E.jsx(mr,{reference:h,...p,children:n&&E.jsx($Y,{query:f.query,closeMenu:d.closeMenu,clearQuery:d.clearQuery,getItems:u,columns:o,gridSuggestionMenuComponent:r||UY,onItemClick:c})})}function zY(e){let t=fe(),n=Se(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s}=e,a=o==="loading-initial"||o==="loading"?E.jsx(t.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=C.useMemo(()=>{let c,u=[];for(let d=0;d<r.length;d++){let f=r[d];f.group!==c&&(c=f.group,u.push(E.jsx(t.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(E.jsx(t.SuggestionMenu.Item,{className:ut("bn-suggestion-menu-item",f.size==="small"?"bn-suggestion-menu-item-small":""),item:f,id:`bn-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.title))}return u},[t,r,s,i]);return E.jsxs(t.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(e.loadingState==="loading"||e.loadingState==="loaded")&&E.jsx(t.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function WY(e,t){let[n,r]=C.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:o=>{if(o.key==="ArrowUp")return o.preventDefault(),e.length&&r((n-1+e.length)%e.length),!0;if(o.key==="ArrowDown")return o.preventDefault(),e.length&&r((n+1)%e.length),!0;if(o.key==="PageUp")return o.preventDefault(),e.length&&r(0),!0;if(o.key==="PageDown")return o.preventDefault(),e.length&&r(e.length-1),!0;let i=qY(o)?o.nativeEvent.isComposing:o.isComposing;return o.key==="Enter"&&!i?(o.preventDefault(),o.stopPropagation(),e.length&&t?.(e[n]),!0):!1}}}function qY(e){return e.nativeEvent!==void 0}function GY(e,t,n,r,o){let{selectedIndex:i,setSelectedIndex:s,handler:a}=WY(n,r);return C.useEffect(()=>{let l=e.domElement;return l?.addEventListener("keydown",a,!0),()=>{l?.removeEventListener("keydown",a,!0)}},[e.domElement,n,i,r,o,a]),C.useEffect(()=>{s(0)},[t,s]),{selectedIndex:n.length===0?void 0:i}}function YY(e){let t=Nr().setContentEditableProps,n=be(),{getItems:r,suggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l}=e,c=C.useCallback(p=>{a(),s(),l?.(p)},[l,a,s]),{items:u,usedQuery:d,loadingState:f}=BS(i,r);PS(u,d,a);let{selectedIndex:h}=GY(n,i,u,c);return C.useEffect(()=>(t(p=>({...p,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(p=>({...p,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),C.useEffect(()=>(t(p=>({...p,"aria-activedescendant":h?"bn-suggestion-menu-item-"+h:void 0})),()=>{t(p=>({...p,"aria-activedescendant":void 0}))}),[t,h]),E.jsx(o,{items:u,onItemClick:c,loadingState:f,selectedIndex:h})}var KY={heading:lu,heading_2:cu,heading_3:uu,heading_4:cS,heading_5:uS,heading_6:dS,toggle_heading:lu,toggle_heading_2:cu,toggle_heading_3:uu,quote:gS,toggle_list:bS,numbered_list:pS,bullet_list:mS,check_list:hS,paragraph:Km,table:CG,image:wG,video:TG,audio:AG,file:aG,emoji:PG,code_block:hG,divider:DG};function FS(e){return q6(e).map(t=>{let n=KY[t.key];return{...t,icon:E.jsx(n,{size:18})}})}function HS(e){let t=be(),{triggerCharacter:n,suggestionMenuComponent:r,shouldOpen:o,minQueryLength:i,onItemClick:s,getItems:a}=e,l=C.useMemo(()=>s||(p=>{p.onItemClick(t)}),[t,s]),c=C.useMemo(()=>a||(async p=>G6(FS(t),p)),[t,a]),u=je(zn);C.useEffect(()=>{u.addSuggestionMenu({triggerCharacter:n,shouldOpen:o})},[u,n,o]);let d=rt(zn),f=rt(zn,{selector:p=>({element:t.domElement?.firstChild||void 0,getBoundingClientRect:()=>p?.referencePos||new DOMRect})}),h=C.useMemo(()=>({...e.floatingUIOptions,useFloatingOptions:{open:d?.show&&d?.triggerCharacter===n,onOpenChange:p=>{p||u.closeMenu()},placement:"bottom-start",middleware:[qr(10),QE({allowedPlacements:["bottom-start","top-start"],padding:10}),xu(),rc({apply({elements:p,availableHeight:g}){p.floating.style.maxHeight=`${Math.max(0,g)}px`},padding:10})],...e.floatingUIOptions?.useFloatingOptions},focusManagerProps:{disabled:!0,...e.floatingUIOptions?.focusManagerProps},elementProps:{onMouseDownCapture:p=>p.preventDefault(),style:{zIndex:80},...e.floatingUIOptions?.elementProps}}),[e.floatingUIOptions,d?.show,d?.triggerCharacter,u,n]);return!d||!d.ignoreQueryLength&&i&&(d.query.startsWith(" ")||d.query.length<i)?null:E.jsx(mr,{reference:f,...h,children:n&&E.jsx(YY,{query:d.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,suggestionMenuComponent:r||zY,onItemClick:l})})}var QY=(e,t=.3)=>{let n=Math.floor(e)+t,r=Math.ceil(e)-t;return e>=n&&e<=r?Math.round(e):e<n?Math.floor(e):Math.ceil(e)},XY=e=>{let t=fe(),n=be(),r=je(Je),o=rt(Je,{selector:u=>u?.block}),i=C.useRef(!1),[s,a]=C.useState(),l=C.useCallback(u=>{r.freezeHandles(),e.hideOtherElements(!0),o&&(a({originalContent:o.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(o,e.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:e.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),i.current=!1,u.preventDefault())},[o,e,r]),c=C.useCallback(()=>{!o||i.current||n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(o,"columns",1):r.addRowsOrColumns(o,"rows",1)}})},[o,n,e.orientation,r]);return C.useEffect(()=>{let u=d=>{if(!o)return;if(!s)throw Error("editingState is undefined");i.current=!0;let f=(e.orientation==="addOrRemoveColumns"?d.clientX:d.clientY)-s.startPos,h=e.orientation==="addOrRemoveColumns"?s.originalCroppedContent.rows[0]?.cells.length??0:s.originalCroppedContent.rows.length,p=e.orientation==="addOrRemoveColumns"?s.originalContent.rows[0]?.cells.length??0:s.originalContent.rows.length,g=e.orientation==="addOrRemoveColumns"?o.content.rows[0].cells.length:o.content.rows.length,y=p+QY(f/(e.orientation==="addOrRemoveColumns"?N6:I6),.3);y>=h&&y>0&&y!==g&&(n.updateBlock(o,{type:"table",content:{...o.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",y-h):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",y-h)}}),o.content&&n.setTextCursorPosition(o))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[o,s,n,e.orientation,r]),C.useEffect(()=>{let u=()=>{e.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,e,r]),n.isEditable?E.jsx(t.TableHandle.ExtendButton,{className:ut("bn-extend-button",e.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s===null?"":"bn-extend-button-editing"),onClick:c,onMouseDown:l,children:e.children||E.jsx(NG,{size:18,"data-test":"extendButton"})}):null},ZY=e=>{let t=fe(),n=Se(),r=be(),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:c=>({block:c?.block,colIndex:c?.colIndex,rowIndex:c?.rowIndex})}),a=(c,u)=>{if(o===void 0||i===void 0||s===void 0)return;let d=o.content.rows.map(f=>({...f,cells:f.cells.map(h=>Io(h))}));u==="text"?d[s].cells[i].props.textColor=c:d[s].cells[i].props.backgroundColor=c,r.updateBlock(o,{type:"table",content:{...o.content,rows:d}}),r.setTextCursorPosition(o)};if(o===void 0||i===void 0||s===void 0)return null;let l=o.content.rows[s]?.cells?.[i];return!l||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1?null:E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:Mo(l)?l.props.textColor:"default",setColor:c=>a(c,"text")}:void 0,background:r.settings.tables.cellBackgroundColor?{color:Mo(l)?l.props.backgroundColor:"default",setColor:c=>a(c,"background")}:void 0})})]})},JY=()=>{let e=fe(),t=Se(),n=be(),r=je(Je),{block:o,colIndex:i,rowIndex:s}=rt(Je,{selector:l=>({block:l?.block,colIndex:l?.colIndex,rowIndex:l?.rowIndex})});if(o===void 0||i===void 0||s===void 0)return null;let a=o.content.rows[s]?.cells?.[i];return!a||!Mo(a)||ka(a)===1&&pi(a)===1||!n.settings.tables.splitCells?null:E.jsx(e.Generic.Menu.Item,{onClick:()=>{r.splitCell({row:s,col:i})},children:t.table_handle.split_cell_menuitem})},eK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(JY,{}),E.jsx(ZY,{})]})}),tK=e=>{let t=fe(),n=be(),r=je(Je),o=e.tableCellMenu||eK;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:E.jsxs(t.Generic.Menu.Root,{onOpenChange:i=>{i?(r.freezeHandles(),e.hideOtherElements(!0)):(r.unfreezeHandles(),e.hideOtherElements(!1),n.focus())},position:"right",children:[E.jsx(t.Generic.Menu.Trigger,{children:E.jsx(t.Generic.Menu.Button,{className:"bn-table-cell-handle",children:e.children||E.jsx(jG,{size:12,"data-test":"tableCellHandle"})})}),E.jsx(o,{})]})},Vy=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(o,e.orientation==="row"?{orientation:"row",side:e.side}:{orientation:"column",side:e.side})},children:n.table_handle[`add_${e.side}_menuitem`]})},nK=e=>{let t=fe(),n=Se(),r=je(Je),o=rt(Je,{selector:i=>e.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:E.jsx(t.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(o,e.orientation),children:e.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},rK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:u=>({block:u?.block,index:e.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=C.useMemo(()=>o===void 0||i===void 0||s===void 0?[]:e.orientation==="row"?o.getCellsAtRowHandle(i,s):o.getCellsAtColumnHandle(i,s),[i,s,e.orientation,o]),l=(u,d)=>{if(i===void 0)return;let f=i.content.rows.map(h=>({...h,cells:h.cells.map(p=>Io(p))}));a.forEach(({row:h,col:p})=>{d==="text"?f[h].cells[p].props.textColor=u:f[h].cells[p].props.backgroundColor=u}),r.updateBlock(i,{type:"table",content:{...i.content,rows:f}}),r.setTextCursorPosition(i)};if(!a||!a[0]||!o||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;let c=Io(a[0].cell);return E.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[E.jsx(t.Generic.Menu.Trigger,{sub:!0,children:E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),E.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:E.jsx(sd,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Mo(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},oK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),{block:i,index:s}=rt(Je,{selector:l=>({block:l?.block,index:e.orientation==="column"?l?.colIndex:l?.rowIndex})});if(o===void 0||i===void 0||s!==0||e.orientation!=="row"||!r.settings.tables.headers)return null;let a=!!i.content.headerRows;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},iK=e=>{let t=fe(),n=Se(),r=be(),o=je(Je),i=rt(Je,{selector:l=>l?.block}),s=rt(Je,{selector:l=>e.orientation==="column"?l?.colIndex:l?.rowIndex});if(!o||s!==0||!i||e.orientation!=="column"||!r.settings.tables.headers)return null;let a=!!i.content.headerCols;return E.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},sK=e=>E.jsx(fe().Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:e.children||E.jsxs(E.Fragment,{children:[E.jsx(nK,{orientation:e.orientation}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"above":"left"}),E.jsx(Vy,{orientation:e.orientation,side:e.orientation==="row"?"below":"right"}),E.jsx(oK,{orientation:e.orientation}),E.jsx(iK,{orientation:e.orientation}),E.jsx(rK,{orientation:e.orientation})]})}),aK=e=>{let t=be(),n=fe(),[r,o]=C.useState(!1),i=e.tableHandleMenu||sK,s=je(Je),a=rt(Je),l=C.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:e.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>pi(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>ka(c)===1),[e.orientation,a,s]);return a?E.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),e.hideOtherElements(!0)):(s.unfreezeHandles(),e.hideOtherElements(!1),t.focus())},position:"right",children:[E.jsx(n.Generic.Menu.Trigger,{children:E.jsx(n.TableHandle.Root,{className:ut("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{o(!0),e.hideOtherElements(!0),e.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),e.hideOtherElements(!1),o(!1)},style:e.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:e.children||E.jsx(TS,{size:24,"data-test":"tableHandle"})})}),E.jsx(i,{orientation:e.orientation})]}):null},lK=e=>{let t=be(),[n,r]=C.useState(),o=rt(Je),i=C.useMemo(()=>{let d={};if(o===void 0)return{};let f=cn(o.block.id,t.prosemirrorState.doc);if(!f)return{};let h=f.posBeforeNode+1,p=t.prosemirrorView.domAtPos(h+1).node;if(!(p instanceof Element))return{};if(d.tableReference={element:p},o.rowIndex===void 0||o.colIndex===void 0)return d;let g=t.prosemirrorState.doc.resolve(h+1).posAtIndex(o.rowIndex),y=t.prosemirrorState.doc.resolve(g+1).posAtIndex(o.colIndex),b=t.prosemirrorView.domAtPos(y+1).node;return b instanceof Element?(d.cellReference={element:b},d.rowReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(x.x,o.draggingState&&o.draggingState.draggedCellOrientation==="row"?o.draggingState.mousePos-k.height/2:k.y,x.width,k.height)}},d.columnReference={element:p,getBoundingClientRect:()=>{let x=p.getBoundingClientRect(),k=b.getBoundingClientRect();return new DOMRect(o.draggingState&&o.draggingState.draggedCellOrientation==="col"?o.draggingState.mousePos-k.width/2:k.x,x.y,k.width,x.height)}},d):{}},[t,o]),s=C.useCallback((d,f,h)=>{let p=!1;return mp(d,f,()=>{if(!p){p=!0;return}t.getExtension(Je)?.hideHandlesIfNotFrozen()},{ancestorScroll:!0,ancestorResize:!1,elementResize:!1,layoutShift:!1})},[t]),a=C.useMemo(()=>o===void 0?void 0:{rowTableHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[qr(-10)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[qr(-12)],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[qr({mainAxis:-15,crossAxis:-1})],whileElementsMounted:s},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{width:`${d.reference.width}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",whileElementsMounted:s,middleware:[rc({apply({rects:d,elements:f}){Object.assign(f.floating.style,{height:`${d.reference.height}px`})}})]},focusManagerProps:{disabled:!0},elementProps:{style:{zIndex:10}}}},[n,o,s]);if(!o)return null;let l=e.tableHandle||aK,c=e.extendButton||XY,u=e.tableCellHandle||tK;return E.jsxs(E.Fragment,{children:[E.jsx(mr,{reference:i?.rowReference,...a?.rowTableHandle,children:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&E.jsx(l,{orientation:"row",hideOtherElements:d=>r(d?"rowTableHandle":void 0)})}),E.jsx(mr,{reference:i?.columnReference,...a?.columnTableHandle,children:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle")&&E.jsx(l,{orientation:"column",hideOtherElements:d=>r(d?"columnTableHandle":void 0)})}),E.jsx(mr,{reference:i?.cellReference,...a?.tableCellHandle,children:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle")&&E.jsx(u,{hideOtherElements:d=>r(d?"tableCellHandle":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendRowsButton,children:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&E.jsx(c,{orientation:"addOrRemoveRows",hideOtherElements:d=>r(d?"extendRowsButton":void 0)})}),E.jsx(mr,{reference:i?.tableReference,...a?.extendColumnsButton,children:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&E.jsx(c,{orientation:"addOrRemoveColumns",hideOtherElements:d=>r(d?"extendColumnsButton":void 0)})})]})},cK=C.lazy(()=>Qi(()=>import("./FloatingComposerController-D4uLQfUX-C0Lhbmda.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>e.n)),uK=C.lazy(()=>Qi(()=>Promise.resolve().then(()=>VG),void 0).then(e=>e.n));function dK(e){let t=be();if(!t)throw Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return E.jsxs(E.Fragment,{children:[t.getExtension(Lo)&&e.formattingToolbar!==!1&&E.jsx(eg,{}),t.getExtension(ja)&&e.linkToolbar!==!1&&E.jsx(DS,{}),t.getExtension(zn)&&e.slashMenu!==!1&&E.jsx(HS,{triggerCharacter:"/",shouldOpen:n=>!n.selection.$from.parent.type.isInGroup("tableContent")}),t.getExtension(zn)&&e.emojiPicker!==!1&&E.jsx(jY,{triggerCharacter:":",columns:10,minQueryLength:2}),t.getExtension(qn)&&e.sideMenu!==!1&&E.jsx(FY,{}),t.getExtension(rr)&&e.filePanel!==!1&&E.jsx(sY,{}),t.getExtension(Je)&&e.tableHandles!==!1&&E.jsx(lK,{}),t.getExtension(Jr)&&e.comments!==!1&&E.jsxs(C.Suspense,{children:[E.jsx(cK,{}),E.jsx(uK,{})]})]})}function fK(e,t){let n=Nr();t||=n?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onChange(e)},[e,t])}function hK(e,t,n){let r=Nr();t||=r?.editor,C.useEffect(()=>{if(!t)throw Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onSelectionChange(e,n)},[e,t,n])}var pK=()=>{let e=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: dark)"),[]),t=C.useMemo(()=>window.matchMedia?.("(prefers-color-scheme: light)"),[]),n=e?.matches,r=t?.matches,[o,i]=C.useState(n?"dark":r?"light":"no-preference");return C.useEffect(()=>{i(n?"dark":r?"light":"no-preference")},[n,r]),C.useEffect(()=>{if(typeof e?.addEventListener=="function"){let s=({matches:l})=>l&&i("dark"),a=({matches:l})=>l&&i("light");return e?.addEventListener("change",s),t?.addEventListener("change",a),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",a)}}else{let s=()=>i(e.matches?"dark":t.matches?"light":"no-preference");return e?.addEventListener("change",s),t?.addEventListener("change",s),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",s)}}},[e,t]),o},US=C.createContext(void 0);function mK(){return C.useContext(US)}function gK(){let e=new Set,t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Xr.createPortal(r.reactElement,r.element,n)},e.forEach(o=>o())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(o=>o())}}}var bK=({contentComponent:e})=>{let t=C.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(t)})},yK=C.forwardRef((e,t)=>{let[n,r]=C.useState();return C.useImperativeHandle(t,()=>(o,i)=>{Xr.flushSync(()=>{r({node:o,container:i})}),r(void 0)},[]),E.jsx(E.Fragment,{children:n&&Xr.createPortal(n.node,n.container)})}),$y=()=>{};function EK(e,t){let{editor:n,className:r,theme:o,children:i,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:y,autoFocus:b,renderEditor:x=!0,...k}=e,[O,M]=C.useState(),A=Nr(),D=pK(),z=A?.colorSchemePreference||D,Y=o||(z==="dark"?"dark":"light"),N=fe(),K=C.useMemo(()=>({formattingToolbar:N?c:!1,linkToolbar:N?u:!1,sideMenu:N?h:!1,slashMenu:N?d:!1,filePanel:N?p:!1,tableHandles:N?g:!1,emojiPicker:N?f:!1,comments:N?y:!1}),[y,N,f,p,c,u,h,d,g]);fK(l||$y,n),hK(a||$y,n);let F=C.useCallback(H=>{n.elementRenderer=H},[n]);C.useEffect(()=>{if(!n.portalElement)throw Error("Portal element not found");n.portalElement.className=ut("bn-root",Y,r||""),n.portalElement.setAttribute("data-color-scheme",Y)},[n,Y,r]);let q=C.useMemo(()=>({...A,editor:n,setContentEditableProps:M,colorSchemePreference:Y}),[A,n,Y]),L=C.useMemo(()=>({editorProps:{autoFocus:b,contentEditableProps:O,editable:s},defaultUIProps:K}),[b,O,s,K]);return E.jsx(tS.Provider,{value:q,children:E.jsxs(US.Provider,{value:L,children:[E.jsx(yK,{ref:F}),E.jsx(xK,{className:r,renderEditor:x,editorColorScheme:Y,ref:t,...k,children:i})]})})}var xK=Re.forwardRef(({className:e,renderEditor:t,editorColorScheme:n,children:r,...o},i)=>E.jsx("div",{className:ut("bn-root","bn-container",n,e),"data-color-scheme":n,...o,ref:i,children:t?E.jsx(kK,{children:r}):r})),CK=Re.forwardRef(EK),kK=e=>{let t=mK(),n=be(),r=C.useMemo(()=>gK(),[]),o=C.useCallback(i=>{n.isEditable=t.editorProps.editable!==!1,n._tiptapEditor.contentComponent=r,i?n.mount(i):n.unmount()},[t.editorProps.editable,n,r]);return E.jsxs(E.Fragment,{children:[E.jsx(bK,{contentComponent:r}),E.jsx(TK,{...t.editorProps,...e,mount:o}),E.jsx(dK,{...t.defaultUIProps}),e.children]})},TK=e=>{let{autoFocus:t,mount:n,contentEditableProps:r}=e;return E.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":t,ref:n,...r})};function jy(e,t){let n,r=document.createElement("div"),o;if(t?.elementRenderer)t.elementRenderer(e(l=>n=l||void 0),r);else{if(!t?.headless)throw Error("elementRenderer not available, expected headless editor");o=Cv.createRoot(r),Xr.flushSync(()=>{o.render(e(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");let i=r.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),o?.unmount(),{dom:s,contentDOM:a||void 0}}function If(e){return E.jsx(QG,{onDragOver:t=>t.preventDefault(),...Object.fromEntries(Object.entries(e.domAttributes||{}).filter(([t])=>t!=="class")),className:ut("bn-block-content",e.domAttributes?.class||""),"data-content-type":e.blockType,...Object.fromEntries(Object.entries(e.blockProps).filter(([t,n])=>n!==e.propSchema[t].default).map(([t,n])=>[Tc(t),n])),"data-file-block":e.isFileBlock===!0||void 0,children:e.children})}function VS(e,t,n){return(r={})=>{let o=typeof e=="function"?e(r):e,i=typeof t=="function"?t(r):t;return{config:o,implementation:{...i,toExternalHTML(a,l,c){let u=i.toExternalHTML||i.render;return jy(d=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,isFileBlock:i.meta?.fileBlockAccept!==void 0,children:E.jsx(u,{block:a,editor:l,contentRef:f=>{d(f),f&&(f.className=ut("bn-inline-content",f.className))},context:c})}),l)},render(a,l){if(this.renderType==="nodeView")return nY(c=>{let u=_k(c.getPos,l,c.editor,o.type),d=vS().nodeViewContentRef;if(!d)throw Error("nodeViewContentRef is not set");let f=i.render;return E.jsx(If,{blockType:u.type,blockProps:u.props,propSchema:o.propSchema,isFileBlock:!!i.meta?.fileBlockAccept,domAttributes:this.blockContentDOMAttributes,children:E.jsx(f,{block:u,editor:l,contentRef:h=>{d(h),h&&(h.className=ut("bn-inline-content",h.className),h.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{let c=i.render;return jy(u=>E.jsx(If,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:E.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)}}},extensions:void 0}}}Re.memo(({thread:e,selectedThreadId:t,maxCommentsBeforeCollapse:n,referenceText:r})=>{let o=je(Jr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(e.id)},[o,e.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;let l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return E.jsx(Qm,{thread:e,selected:e.id===t,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function wK(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function SK({onBlur:e,onFocus:t}={}){let n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),t?.(c))},l=c=>{i.current&&!wK(c)&&(s(!1),e?.(c))};return C.useEffect(()=>{let c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function $S(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function jS(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var za=e=>e.type==="checkbox",Qo=e=>e instanceof Date,mn=e=>e==null;const zS=e=>typeof e=="object";var Nt=e=>!mn(e)&&!Array.isArray(e)&&zS(e)&&!Qo(e),vK=e=>Nt(e)&&e.target?za(e.target)?e.target.checked:e.target.value:e,AK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,NK=(e,t)=>e.has(AK(t)),IK=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},tg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _t(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(tg&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Nt(e)&&IK(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=_t(e[o]));return r}var ad=e=>/^\w*$/.test(e),ht=e=>e===void 0,ng=e=>Array.isArray(e)?e.filter(Boolean):[],rg=e=>ng(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(e,t,n)=>{if(!t||!Nt(e))return n;const r=(ad(t)?[t]:rg(t)).reduce((o,i)=>mn(o)?o:o[i],e);return ht(r)||r===e?ht(e[t])?n:e[t]:r},hr=e=>typeof e=="boolean",Zn=e=>typeof e=="function",lt=(e,t,n)=>{let r=-1;const o=ad(t)?[t]:rg(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=e[a];l=Nt(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const zy={BLUR:"blur",FOCUS_OUT:"focusout"},Jn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Dr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},WS=Re.createContext(null);WS.displayName="HookFormControlContext";var MK=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Jn.all&&(t._proxyFormState[s]=!r||Jn.all),e[s]}});return o};const _K=typeof window<"u"?Re.useLayoutEffect:Re.useEffect;var In=e=>typeof e=="string",OK=(e,t,n,r,o)=>In(e)?(r&&t.watch.add(e),ce(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ce(n,i))):(r&&(t.watchAll=!0),n),sp=e=>mn(e)||!zS(e);function bo(e,t,n=new WeakSet){if(sp(e)||sp(t))return Object.is(e,t);if(Qo(e)&&Qo(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Qo(s)&&Qo(a)||Nt(s)&&Nt(a)||Array.isArray(s)&&Array.isArray(a)?!bo(s,a,n):!Object.is(s,a))return!1}}return!0}const qS=Re.createContext(null);qS.displayName="HookFormContext";const RK=e=>{const{children:t,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}=e;return Re.createElement(qS.Provider,{value:Re.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:y,subscribe:b}),[s,p,c,o,r,f,g,d,u,i,y,a,b,l,h,n])},Re.createElement(WS.Provider,{value:p},t))};var LK=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ia=e=>Array.isArray(e)?e:[e],Wy=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function GS(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&Nt(o)&&i){const s=GS(o,i);Nt(s)&&(n[r]=s)}else e[r]&&(n[r]=i)}return n}var nn=e=>Nt(e)&&!Object.keys(e).length,og=e=>e.type==="file",du=e=>{if(!tg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},YS=e=>e.type==="select-multiple",ig=e=>e.type==="radio",DK=e=>ig(e)||za(e),Mf=e=>du(e)&&e.isConnected;function PK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ht(e)?r++:e[t[r++]];return e}function BK(e){for(const t in e)if(e.hasOwnProperty(t)&&!ht(e[t]))return!1;return!0}function wt(e,t){const n=Array.isArray(t)?t:ad(t)?[t]:rg(t),r=n.length===1?e:PK(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(Nt(r)&&nn(r)||Array.isArray(r)&&BK(r))&&wt(e,n.slice(0,-1)),e}var FK=e=>{for(const t in e)if(Zn(e[t]))return!0;return!1};function KS(e){return Array.isArray(e)||Nt(e)&&!FK(e)}function ap(e,t={}){for(const n in e){const r=e[n];KS(r)?(t[n]=Array.isArray(r)?[]:{},ap(r,t[n])):ht(r)||(t[n]=!0)}return t}function Bi(e,t,n){n||(n=ap(t));for(const r in e){const o=e[r];if(KS(o))ht(t)||sp(n[r])?n[r]=ap(o,Array.isArray(o)?[]:{}):Bi(o,mn(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!bo(o,i)}}return n}const qy={value:!1,isValid:!1},Gy={value:!0,isValid:!0};var QS=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ht(e[0].attributes.value)?ht(e[0].value)||e[0].value===""?Gy:{value:e[0].value,isValid:!0}:Gy:qy}return qy},XS=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ht(e)?e:t?e===""?NaN:e&&+e:n&&In(e)?new Date(e):r?r(e):e;const Yy={isValid:!1,value:null};var ZS=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Yy):Yy;function Ky(e){const t=e.ref;return og(t)?t.files:ig(t)?ZS(e.refs).value:YS(t)?[...t.selectedOptions].map(({value:n})=>n):za(t)?QS(e.refs).value:XS(ht(t.value)?e.ref.value:t.value,e)}var HK=(e,t,n,r)=>{const o={};for(const i of e){const s=ce(t,i);s&&lt(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},fu=e=>e instanceof RegExp,vs=e=>ht(e)?e:fu(e)?e.source:Nt(e)?fu(e.value)?e.value.source:e.value:e,Qy=e=>({isOnSubmit:!e||e===Jn.onSubmit,isOnBlur:e===Jn.onBlur,isOnChange:e===Jn.onChange,isOnAll:e===Jn.all,isOnTouch:e===Jn.onTouched});const Xy="AsyncFunction";var UK=e=>!!e&&!!e.validate&&!!(Zn(e.validate)&&e.validate.constructor.name===Xy||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Xy)),VK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Zy=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const sa=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=ce(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(sa(a,t))break}else if(Nt(a)&&sa(a,t))break}}};function Jy(e,t,n){const r=ce(e,n);if(r||ad(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(t,i),a=ce(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var $K=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return nn(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||Jn.all))},jK=(e,t,n)=>!e||!t||e===t||ia(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),zK=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,WK=(e,t)=>!ng(ce(e,t)).length&&wt(e,t),qK=(e,t,n)=>{const r=ia(ce(e,n));return lt(r,"root",t[n]),lt(e,n,r),e};function eE(e,t,n="validate"){if(In(e)||Array.isArray(e)&&e.every(In)||hr(e)&&!e)return{type:n,message:In(e)?e:"",ref:t}}var Mi=e=>Nt(e)&&!fu(e)?e:{value:e,message:""},tE=async(e,t,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:y,mount:b}=e._f,x=ce(n,g);if(!b||t.has(g))return{};const k=a?a[0]:s,O=F=>{o&&k.reportValidity&&(k.setCustomValidity(hr(F)?"":F||""),k.reportValidity())},M={},A=ig(s),D=za(s),z=A||D,Y=(y||og(s))&&ht(s.value)&&ht(x)||du(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,N=LK.bind(null,g,r,M),K=(F,q,L,H=Dr.maxLength,re=Dr.minLength)=>{const W=F?q:L;M[g]={type:F?H:re,message:W,ref:s,...N(F?H:re,W)}};if(i?!Array.isArray(x)||!x.length:l&&(!z&&(Y||mn(x))||hr(x)&&!x||D&&!QS(a).isValid||A&&!ZS(a).isValid)){const{value:F,message:q}=In(l)?{value:!!l,message:l}:Mi(l);if(F&&(M[g]={type:Dr.required,message:q,ref:k,...N(Dr.required,q)},!r))return O(q),M}if(!Y&&(!mn(d)||!mn(f))){let F,q;const L=Mi(f),H=Mi(d);if(!mn(x)&&!isNaN(x)){const re=s.valueAsNumber||x&&+x;mn(L.value)||(F=re>L.value),mn(H.value)||(q=re<H.value)}else{const re=s.valueAsDate||new Date(x),W=S=>new Date(new Date().toDateString()+" "+S),G=s.type=="time",te=s.type=="week";In(L.value)&&x&&(F=G?W(x)>W(L.value):te?x>L.value:re>new Date(L.value)),In(H.value)&&x&&(q=G?W(x)<W(H.value):te?x<H.value:re<new Date(H.value))}if((F||q)&&(K(!!F,L.message,H.message,Dr.max,Dr.min),!r))return O(M[g].message),M}if((c||u)&&!Y&&(In(x)||i&&Array.isArray(x))){const F=Mi(c),q=Mi(u),L=!mn(F.value)&&x.length>+F.value,H=!mn(q.value)&&x.length<+q.value;if((L||H)&&(K(L,F.message,q.message),!r))return O(M[g].message),M}if(h&&!Y&&In(x)){const{value:F,message:q}=Mi(h);if(fu(F)&&!x.match(F)&&(M[g]={type:Dr.pattern,message:q,ref:s,...N(Dr.pattern,q)},!r))return O(q),M}if(p){if(Zn(p)){const F=await p(x,n),q=eE(F,k);if(q&&(M[g]={...q,...N(Dr.validate,q.message)},!r))return O(q.message),M}else if(Nt(p)){let F={};for(const q in p){if(!nn(F)&&!r)break;const L=eE(await p[q](x,n),k,q);L&&(F={...L,...N(q,L.message)},O(L.message),r&&(M[g]=F))}if(!nn(F)&&(M[g]={ref:k,...F},!r))return M}}return O(!0),M};const GK={mode:Jn.onSubmit,reValidateMode:Jn.onChange,shouldFocusError:!0};function YK(e={}){let t={...GK,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Zn(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Nt(t.defaultValues)||Nt(t.values)?_t(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:_t(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:Wy(),state:Wy()},p=t.criteriaMode===Jn.all,g=_=>P=>{clearTimeout(c),c=setTimeout(_,P)},y=async _=>{if(!s.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||_)){let P;t.resolver?(P=nn((await z()).errors),b()):P=await N(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},b=(_,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((_||Array.from(a.mount)).forEach(U=>{U&&(P?lt(n.validatingFields,U,P):wt(n.validatingFields,U))}),h.state.next({validatingFields:n.validatingFields,isValidating:!nn(n.validatingFields)}))},x=(_,P=[],U,oe,ne=!0,R=!0)=>{if(oe&&U&&!t.disabled){if(s.action=!0,R&&Array.isArray(ce(r,_))){const V=U(ce(r,_),oe.argA,oe.argB);ne&&lt(r,_,V)}if(R&&Array.isArray(ce(n.errors,_))){const V=U(ce(n.errors,_),oe.argA,oe.argB);ne&&lt(n.errors,_,V),WK(n.errors,_)}if((d.touchedFields||f.touchedFields)&&R&&Array.isArray(ce(n.touchedFields,_))){const V=U(ce(n.touchedFields,_),oe.argA,oe.argB);ne&&lt(n.touchedFields,_,V)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Bi(o,i)),h.state.next({name:_,isDirty:F(_,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else lt(i,_,P)},k=(_,P)=>{lt(n.errors,_,P),h.state.next({errors:n.errors})},O=_=>{n.errors=_,h.state.next({errors:n.errors,isValid:!1})},M=(_,P,U,oe)=>{const ne=ce(r,_);if(ne){const R=ce(i,_,ht(U)?ce(o,_):U);ht(R)||oe&&oe.defaultChecked||P?lt(i,_,P?R:Ky(ne._f)):H(_,R),s.mount&&!s.action&&y()}},A=(_,P,U,oe,ne)=>{let R=!1,V=!1;const ie={name:_};if(!t.disabled){if(!U||oe){(d.isDirty||f.isDirty)&&(V=n.isDirty,n.isDirty=ie.isDirty=F(),R=V!==ie.isDirty);const ae=bo(ce(o,_),P);V=!!ce(n.dirtyFields,_),ae?wt(n.dirtyFields,_):lt(n.dirtyFields,_,!0),ie.dirtyFields=n.dirtyFields,R=R||(d.dirtyFields||f.dirtyFields)&&V!==!ae}if(U){const ae=ce(n.touchedFields,_);ae||(lt(n.touchedFields,_,U),ie.touchedFields=n.touchedFields,R=R||(d.touchedFields||f.touchedFields)&&ae!==U)}R&&ne&&h.state.next(ie)}return R?ie:{}},D=(_,P,U,oe)=>{const ne=ce(n.errors,_),R=(d.isValid||f.isValid)&&hr(P)&&n.isValid!==P;if(t.delayError&&U?(l=g(()=>k(_,U)),l(t.delayError)):(clearTimeout(c),l=null,U?lt(n.errors,_,U):wt(n.errors,_)),(U?!bo(ne,U):ne)||!nn(oe)||R){const V={...oe,...R&&hr(P)?{isValid:P}:{},errors:n.errors,name:_};n={...n,...V},h.state.next(V)}},z=async _=>(b(_,!0),await t.resolver(i,t.context,HK(_||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),Y=async _=>{const{errors:P}=await z(_);if(b(_),_)for(const U of _){const oe=ce(P,U);oe?lt(n.errors,U,oe):wt(n.errors,U)}else n.errors=P;return P},N=async(_,P,U={valid:!0})=>{for(const oe in _){const ne=_[oe];if(ne){const{_f:R,...V}=ne;if(R){const ie=a.array.has(R.name),ae=ne._f&&UK(ne._f);ae&&d.validatingFields&&b([R.name],!0);const xe=await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation&&!P,ie);if(ae&&d.validatingFields&&b([R.name]),xe[R.name]&&(U.valid=!1,P||e.shouldUseNativeValidation))break;!P&&(ce(xe,R.name)?ie?qK(n.errors,xe,R.name):lt(n.errors,R.name,xe[R.name]):wt(n.errors,R.name))}!nn(V)&&await N(V,P,U)}}return U.valid},K=()=>{for(const _ of a.unMount){const P=ce(r,_);P&&(P._f.refs?P._f.refs.every(U=>!Mf(U)):!Mf(P._f.ref))&&Pe(_)}a.unMount=new Set},F=(_,P)=>!t.disabled&&(_&&P&&lt(i,_,P),!bo(ye(),o)),q=(_,P,U)=>OK(_,a,{...s.mount?i:ht(P)?o:In(_)?{[_]:P}:P},U,P),L=_=>ng(ce(s.mount?i:o,_,t.shouldUnregister?ce(o,_,[]):[])),H=(_,P,U={})=>{const oe=ce(r,_);let ne=P;if(oe){const R=oe._f;R&&(!R.disabled&&lt(i,_,XS(P,R)),ne=du(R.ref)&&mn(P)?"":P,YS(R.ref)?[...R.ref.options].forEach(V=>V.selected=ne.includes(V.value)):R.refs?za(R.ref)?R.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(ne)?V.checked=!!ne.find(ie=>ie===V.value):V.checked=ne===V.value||!!ne)}):R.refs.forEach(V=>V.checked=V.value===ne):og(R.ref)?R.ref.value="":(R.ref.value=ne,R.ref.type||h.state.next({name:_,values:_t(i)})))}(U.shouldDirty||U.shouldTouch)&&A(_,ne,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&S(_)},re=(_,P,U)=>{for(const oe in P){if(!P.hasOwnProperty(oe))return;const ne=P[oe],R=_+"."+oe,V=ce(r,R);(a.array.has(_)||Nt(ne)||V&&!V._f)&&!Qo(ne)?re(R,ne,U):H(R,ne,U)}},W=(_,P,U={})=>{const oe=ce(r,_),ne=a.array.has(_),R=_t(P);lt(i,_,R),ne?(h.array.next({name:_,values:_t(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&U.shouldDirty&&h.state.next({name:_,dirtyFields:Bi(o,i),isDirty:F(_,R)})):oe&&!oe._f&&!mn(R)?re(_,R,U):H(_,R,U),Zy(_,a)?h.state.next({...n,name:_,values:_t(i)}):h.state.next({name:s.mount?_:void 0,values:_t(i)})},G=async _=>{s.mount=!0;const P=_.target;let U=P.name,oe=!0;const ne=ce(r,U),R=ae=>{oe=Number.isNaN(ae)||Qo(ae)&&isNaN(ae.getTime())||bo(ae,ce(i,U,ae))},V=Qy(t.mode),ie=Qy(t.reValidateMode);if(ne){let ae,xe;const Mt=P.type?Ky(ne._f):vK(_),Wt=_.type===zy.BLUR||_.type===zy.FOCUS_OUT,Yn=!VK(ne._f)&&!t.resolver&&!ce(n.errors,U)&&!ne._f.deps||zK(Wt,ce(n.touchedFields,U),n.isSubmitted,ie,V),Ir=Zy(U,a,Wt);lt(i,U,Mt),Wt?(!P||!P.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(_),l&&l(0)):ne._f.onChange&&ne._f.onChange(_);const Mr=A(U,Mt,Wt),tn=!nn(Mr)||Ir;if(!Wt&&h.state.next({name:U,type:_.type,values:_t(i)}),Yn)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Wt&&y():Wt||y()),tn&&h.state.next({name:U,...Ir?{}:Mr});if(!Wt&&Ir&&h.state.next({...n}),t.resolver){const{errors:_r}=await z([U]);if(b([U]),R(Mt),oe){const Kn=Jy(n.errors,r,U),cg=Jy(_r,r,Kn.name||U);ae=cg.error,U=cg.name,xe=nn(_r)}}else b([U],!0),ae=(await tE(ne,a.disabled,i,p,t.shouldUseNativeValidation))[U],b([U]),R(Mt),oe&&(ae?xe=!1:(d.isValid||f.isValid)&&(xe=await N(r,!0)));oe&&(ne._f.deps&&(!Array.isArray(ne._f.deps)||ne._f.deps.length>0)&&S(ne._f.deps),D(U,xe,ae,Mr))}},te=(_,P)=>{if(ce(n.errors,P)&&_.focus)return _.focus(),1},S=async(_,P={})=>{let U,oe;const ne=ia(_);if(t.resolver){const R=await Y(ht(_)?_:ne);U=nn(R),oe=_?!ne.some(V=>ce(R,V)):U}else _?(oe=(await Promise.all(ne.map(async R=>{const V=ce(r,R);return await N(V&&V._f?{[R]:V}:V)}))).every(Boolean),!(!oe&&!n.isValid)&&y()):oe=U=await N(r);return h.state.next({...!In(_)||(d.isValid||f.isValid)&&U!==n.isValid?{}:{name:_},...t.resolver||!_?{isValid:U}:{},errors:n.errors}),P.shouldFocus&&!oe&&sa(r,te,_?ne:a.mount),oe},ye=(_,P)=>{let U={...s.mount?i:o};return P&&(U=GS(P.dirtyFields?n.dirtyFields:n.touchedFields,U)),ht(_)?U:In(_)?ce(U,_):_.map(oe=>ce(U,oe))},pe=(_,P)=>({invalid:!!ce((P||n).errors,_),isDirty:!!ce((P||n).dirtyFields,_),error:ce((P||n).errors,_),isValidating:!!ce(n.validatingFields,_),isTouched:!!ce((P||n).touchedFields,_)}),v=_=>{_&&ia(_).forEach(P=>wt(n.errors,P)),h.state.next({errors:_?n.errors:{}})},ze=(_,P,U)=>{const oe=(ce(r,_,{_f:{}})._f||{}).ref,ne=ce(n.errors,_)||{},{ref:R,message:V,type:ie,...ae}=ne;lt(n.errors,_,{...ae,...P,ref:oe}),h.state.next({name:_,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&oe&&oe.focus&&oe.focus()},ve=(_,P)=>Zn(_)?h.state.subscribe({next:U=>"values"in U&&_(q(void 0,P),U)}):q(_,P,!0),Le=_=>h.state.subscribe({next:P=>{jK(_.name,P.name,_.exact)&&$K(P,_.formState||d,Tn,_.reRenderRoot)&&_.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Et=_=>(s.mount=!0,f={...f,..._.formState},Le({..._,formState:{...u,..._.formState}})),Pe=(_,P={})=>{for(const U of _?ia(_):a.mount)a.mount.delete(U),a.array.delete(U),P.keepValue||(wt(r,U),wt(i,U)),!P.keepError&&wt(n.errors,U),!P.keepDirty&&wt(n.dirtyFields,U),!P.keepTouched&&wt(n.touchedFields,U),!P.keepIsValidating&&wt(n.validatingFields,U),!t.shouldUnregister&&!P.keepDefaultValue&&wt(o,U);h.state.next({values:_t(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&y()},We=({disabled:_,name:P})=>{if(hr(_)&&s.mount||_||a.disabled.has(P)){const ne=a.disabled.has(P)!==!!_;_?a.disabled.add(P):a.disabled.delete(P),ne&&s.mount&&!s.action&&y()}},dt=(_,P={})=>{let U=ce(r,_);const oe=hr(P.disabled)||hr(t.disabled);return lt(r,_,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:_}},name:_,mount:!0,...P}}),a.mount.add(_),U?We({disabled:hr(P.disabled)?P.disabled:t.disabled,name:_}):M(_,!0,P.value),{...oe?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:vs(P.min),max:vs(P.max),minLength:vs(P.minLength),maxLength:vs(P.maxLength),pattern:vs(P.pattern)}:{},name:_,onChange:G,onBlur:G,ref:ne=>{if(ne){dt(_,P),U=ce(r,_);const R=ht(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,V=DK(R),ie=U._f.refs||[];if(V?ie.find(ae=>ae===R):R===U._f.ref)return;lt(r,_,{_f:{...U._f,...V?{refs:[...ie.filter(Mf),R,...Array.isArray(ce(o,_))?[{}]:[]],ref:{type:R.type,name:_}}:{ref:R}}}),M(_,!1,void 0,R)}else U=ce(r,_,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(NK(a.array,_)&&s.action)&&a.unMount.add(_)}}},xt=()=>t.shouldFocusError&&sa(r,te,a.mount),Ee=_=>{hr(_)&&(h.state.next({disabled:_}),sa(r,(P,U)=>{const oe=ce(r,U);oe&&(P.disabled=oe._f.disabled||_,Array.isArray(oe._f.refs)&&oe._f.refs.forEach(ne=>{ne.disabled=oe._f.disabled||_}))},0,!1))},De=(_,P)=>async U=>{let oe;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let ne=_t(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:R,values:V}=await z();b(),n.errors=R,ne=_t(V)}else await N(r);if(a.disabled.size)for(const R of a.disabled)wt(ne,R);if(wt(n.errors,"root"),nn(n.errors)){h.state.next({errors:{}});try{await _(ne,U)}catch(R){oe=R}}else P&&await P({...n.errors},U),xt(),setTimeout(xt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nn(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},Ne=(_,P={})=>{ce(r,_)&&(ht(P.defaultValue)?W(_,_t(ce(o,_))):(W(_,P.defaultValue),lt(o,_,_t(P.defaultValue))),P.keepTouched||wt(n.touchedFields,_),P.keepDirty||(wt(n.dirtyFields,_),n.isDirty=P.defaultValue?F(_,_t(ce(o,_))):F()),P.keepError||(wt(n.errors,_),d.isValid&&y()),h.state.next({...n}))},Ke=(_,P={})=>{const U=_?_t(_):o,oe=_t(U),ne=nn(_),R=ne?o:oe;if(P.keepDefaultValues||(o=U),!P.keepValues){if(P.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(Bi(o,i))]);for(const ie of Array.from(V)){const ae=ce(n.dirtyFields,ie),xe=ce(i,ie),Mt=ce(R,ie);ae&&!ht(xe)?lt(R,ie,xe):!ae&&!ht(Mt)&&W(ie,Mt)}}else{if(tg&&ht(_))for(const V of a.mount){const ie=ce(r,V);if(ie&&ie._f){const ae=Array.isArray(ie._f.refs)?ie._f.refs[0]:ie._f.ref;if(du(ae)){const xe=ae.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const V of a.mount)W(V,ce(R,V));else r={}}i=t.shouldUnregister?P.keepDefaultValues?_t(o):{}:_t(R),h.array.next({values:{...R}}),h.state.next({values:{...R}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!nn(R),s.watch=!!t.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:ne?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!bo(_,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ne?{}:P.keepDirtyValues?P.keepDefaultValues&&i?Bi(o,i):n.dirtyFields:P.keepDefaultValues&&_?Bi(o,_):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ft=(_,P)=>Ke(Zn(_)?_(i):_,{...t.resetOptions,...P}),Fe=(_,P={})=>{const U=ce(r,_),oe=U&&U._f;if(oe){const ne=oe.refs?oe.refs[0]:oe.ref;ne.focus&&setTimeout(()=>{ne.focus(),P.shouldSelect&&Zn(ne.select)&&ne.select()})}},Tn=_=>{n={...n,..._}},It={control:{register:dt,unregister:Pe,getFieldState:pe,handleSubmit:De,setError:ze,_subscribe:Le,_runSchema:z,_updateIsValidating:b,_focusError:xt,_getWatch:q,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:We,_setErrors:O,_getFieldArray:L,_reset:Ke,_resetDefaultValues:()=>Zn(t.defaultValues)&&t.defaultValues().then(_=>{ft(_,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:K,_disableForm:Ee,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(_){s=_},get _defaultValues(){return o},get _names(){return a},set _names(_){a=_},get _formState(){return n},get _options(){return t},set _options(_){t={...t,..._}}},subscribe:Et,trigger:S,register:dt,handleSubmit:De,watch:ve,setValue:W,getValues:ye,reset:ft,resetField:Ne,clearErrors:v,unregister:Pe,setError:ze,setFocus:Fe,getFieldState:pe};return{...It,formControl:It}}function KK(e={}){const t=Re.useRef(void 0),n=Re.useRef(void 0),[r,o]=Re.useState({isDirty:!1,isValidating:!1,isLoading:Zn(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Zn(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Zn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=YK(e);t.current={...a,formState:r}}const i=t.current.control;return i._options=e,_K(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Re.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Re.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Re.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Re.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Re.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Re.useEffect(()=>{var s;e.values&&!bo(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=e.values,o(a=>({...a}))):i._resetDefaultValues()},[i,e.values]),Re.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Re.useMemo(()=>MK(r,i),[i,r]),t.current}function QK(e,t=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[e]?.[l]||a,y=C.useMemo(()=>p,Object.values(p));return E.jsx(g.Provider,{value:y,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[e]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[e]||i;return C.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,XK(o,...t)]}function XK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var sg="Avatar",[ZK]=QK(sg),[JK,JS]=ZK(sg),ev=C.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,i]=C.useState("idle");return E.jsx(JK,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:E.jsx(hu.span,{...r,ref:t})})});ev.displayName=sg;var tv="AvatarImage",nv=C.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=e,s=JS(tv,n),a=eQ(r,i),l=_v(c=>{o(c),s.onImageLoadingStatusChange(c)});return Df(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?E.jsx(hu.img,{...i,ref:t,src:r}):null});nv.displayName=tv;var rv="AvatarFallback",ov=C.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,i=JS(rv,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?E.jsx(hu.span,{...o,ref:t}):null});ov.displayName=rv;function nE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function eQ(e,{referrerPolicy:t,crossOrigin:n}){const r=Ov(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>nE(i,e));return Df(()=>{a(nE(i,e))},[i,e]),Df(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,t]),s}var tQ=ev,nQ=nv,rQ=ov;const ag="-",oQ=e=>{const t=sQ(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(ag);return a[0]===""&&a.length!==1&&a.shift(),iv(a,t)||iQ(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},iv=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?iv(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(ag);return t.validators.find(({validator:s})=>s(i))?.classGroupId},rE=/^\[(.+)\]$/,iQ=e=>{if(rE.test(e)){const t=rE.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},sQ=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return lQ(Object.entries(e.classGroups),n).forEach(([i,s])=>{lp(s,r,i,t)}),r},lp=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:oE(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(aQ(o)){lp(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{lp(s,oE(t,i),n,r)})})},oE=(e,t)=>{let n=e;return t.split(ag).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},aQ=e=>e.isThemeGetter,lQ=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,cQ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},sv="!",uQ=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let y=0;y<a.length;y++){let b=a[y];if(c===0){if(b===o&&(r||a.slice(y,y+i)===t)){l.push(a.slice(u,y)),u=y+i;continue}if(b==="/"){d=y;continue}}b==="["?c++:b==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(sv),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},dQ=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},fQ=e=>({cache:cQ(e.cacheSize),parseClassName:uQ(e),...oQ(e)}),hQ=/\s+/,pQ=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(hQ);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const y=dQ(u).join(":"),b=d?y+sv:y,x=b+g;if(i.includes(x))continue;i.push(x);const k=o(g,p);for(let O=0;O<k.length;++O){const M=k[O];i.push(b+M)}a=c+(a.length>0?" "+a:a)}return a};function mQ(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=av(t))&&(r&&(r+=" "),r+=n);return r}const av=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=av(e[r]))&&(n&&(n+=" "),n+=t);return n};function gQ(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=fQ(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=pQ(l,n);return o(l,u),u}return function(){return i(mQ.apply(null,arguments))}}const ot=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},lv=/^\[(?:([a-z-]+):)?(.+)\]$/i,bQ=/^\d+\/\d+$/,yQ=new Set(["px","full","screen"]),EQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pr=e=>Ki(e)||yQ.has(e)||bQ.test(e),oo=e=>gs(e,"length",_Q),Ki=e=>!!e&&!Number.isNaN(Number(e)),_f=e=>gs(e,"number",Ki),As=e=>!!e&&Number.isInteger(Number(e)),wQ=e=>e.endsWith("%")&&Ki(e.slice(0,-1)),Ce=e=>lv.test(e),io=e=>EQ.test(e),SQ=new Set(["length","size","percentage"]),vQ=e=>gs(e,SQ,cv),AQ=e=>gs(e,"position",cv),NQ=new Set(["image","url"]),IQ=e=>gs(e,NQ,RQ),MQ=e=>gs(e,"",OQ),Ns=()=>!0,gs=(e,t,n)=>{const r=lv.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},_Q=e=>xQ.test(e)&&!CQ.test(e),cv=()=>!1,OQ=e=>kQ.test(e),RQ=e=>TQ.test(e),LQ=()=>{const e=ot("colors"),t=ot("spacing"),n=ot("blur"),r=ot("brightness"),o=ot("borderColor"),i=ot("borderRadius"),s=ot("borderSpacing"),a=ot("borderWidth"),l=ot("contrast"),c=ot("grayscale"),u=ot("hueRotate"),d=ot("invert"),f=ot("gap"),h=ot("gradientColorStops"),p=ot("gradientColorStopPositions"),g=ot("inset"),y=ot("margin"),b=ot("opacity"),x=ot("padding"),k=ot("saturate"),O=ot("scale"),M=ot("sepia"),A=ot("skew"),D=ot("space"),z=ot("translate"),Y=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],K=()=>["auto",Ce,t],F=()=>[Ce,t],q=()=>["",Pr,oo],L=()=>["auto",Ki,Ce],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],te=()=>["","0",Ce],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ye=()=>[Ki,Ce];return{cacheSize:500,separator:":",theme:{colors:[Ns],spacing:[Pr,oo],blur:["none","",io,Ce],brightness:ye(),borderColor:[e],borderRadius:["none","","full",io,Ce],borderSpacing:F(),borderWidth:q(),contrast:ye(),grayscale:te(),hueRotate:ye(),invert:te(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[wQ,oo],inset:K(),margin:K(),opacity:ye(),padding:F(),saturate:ye(),scale:ye(),sepia:te(),skew:ye(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Ce]}],container:["container"],columns:[{columns:[io]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),Ce]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",As,Ce]}],basis:[{basis:K()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ce]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:["first","last","none",As,Ce]}],"grid-cols":[{"grid-cols":[Ns]}],"col-start-end":[{col:["auto",{span:["full",As,Ce]},Ce]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Ns]}],"row-start-end":[{row:["auto",{span:[As,Ce]},Ce]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ce]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ce,t]}],"min-w":[{"min-w":[Ce,t,"min","max","fit"]}],"max-w":[{"max-w":[Ce,t,"none","full","min","max","fit","prose",{screen:[io]},io]}],h:[{h:[Ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",io,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_f]}],"font-family":[{font:[Ns]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ce]}],"line-clamp":[{"line-clamp":["none",Ki,_f]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pr,Ce]}],"list-image":[{"list-image":["none",Ce]}],"list-style-type":[{list:["none","disc","decimal",Ce]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pr,oo]}],"underline-offset":[{"underline-offset":["auto",Pr,Ce]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),AQ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vQ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},IQ]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:re()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[Pr,Ce]}],"outline-w":[{outline:[Pr,oo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Pr,oo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",io,MQ]}],"shadow-color":[{shadow:[Ns]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",io,Ce]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ce]}],duration:[{duration:ye()}],ease:[{ease:["linear","in","out","in-out",Ce]}],delay:[{delay:ye()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[As,Ce]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ce]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Pr,oo,_f]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},DQ=gQ(LQ);const PQ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BQ=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),iE=e=>{const t=BQ(e);return t.charAt(0).toUpperCase()+t.slice(1)},uv=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),FQ=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var HQ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const UQ=C.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...HQ,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uv("lucide",o),...!i&&!FQ(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const ld=(e,t)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(UQ,{ref:i,iconNode:t,className:uv(`lucide-${PQ(iE(e))}`,`lucide-${e}`,r),...o}));return n.displayName=iE(e),n};const VQ=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dv=ld("check",VQ);const $Q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fv=ld("chevron-down",$Q);const jQ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],hv=ld("chevron-right",jQ);const zQ=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WQ=ld("chevron-up",zQ);var qQ="Label",pv=C.forwardRef((e,t)=>E.jsx(hu.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));pv.displayName=qQ;var GQ=pv;function ue(...e){return DQ(kv(e))}function YQ({className:e,...t}){return E.jsx(tQ,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function KQ({className:e,...t}){return E.jsx(nQ,{"data-slot":"avatar-image",className:ue("aspect-square size-full",e),...t})}function QQ({className:e,...t}){return E.jsx(rQ,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var XQ=up("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ZQ({className:e,variant:t,asChild:n=!1,...r}){return E.jsx(n?vE:"span",{"data-slot":"badge",className:ue(XQ({variant:t}),e),...r})}var JQ=up("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function eX({className:e,variant:t,size:n,asChild:r=!1,...o}){return E.jsx(r?vE:"button",{"data-slot":"button",className:ue(JQ({variant:t,size:n,className:e})),...o})}function tX({className:e,...t}){return E.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function nX({className:e,...t}){return E.jsx("div",{"data-slot":"card-content",className:ue("px-6",e),...t})}function rX({...e}){return E.jsx(dA,{"data-slot":"dropdown-menu",...e})}function oX({...e}){return E.jsx(tA,{"data-slot":"dropdown-menu-trigger",...e})}function iX({className:e,sideOffset:t=4,...n}){return E.jsx(lA,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...n})}function sX({className:e,inset:t,variant:n="default",...r}){return E.jsx(aA,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function aX({className:e,children:t,checked:n,...r}){return E.jsxs(cA,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),checked:n,...r,children:[E.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:E.jsx(uA,{children:E.jsx(dv,{className:"size-4"})})}),t]})}function lX({className:e,inset:t,...n}){return E.jsx(sA,{"data-slot":"dropdown-menu-label","data-inset":t,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function cX({className:e,...t}){return E.jsx(iA,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",e),...t})}function uX({...e}){return E.jsx(oA,{"data-slot":"dropdown-menu-sub",...e})}function dX({className:e,inset:t,children:n,...r}){return E.jsxs(nA,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",e),...r,children:[n,E.jsx(hv,{className:"ml-auto size-4"})]})}function fX({className:e,...t}){return E.jsx(rA,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}function hX({className:e,...t}){return E.jsx(GQ,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}var pX=RK;C.createContext({}),C.createContext({});function mX({className:e,type:t,...n}){return E.jsx("input",{type:t,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function gX({...e}){return E.jsx(eA,{"data-slot":"popover",...e})}function bX({...e}){return E.jsx(Zv,{"data-slot":"popover-trigger",...e})}function yX({className:e,align:t="center",sideOffset:n=4,...r}){return E.jsx(Jv,{"data-slot":"popover-content",align:t,sideOffset:n,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",e),...r})}function EX({...e}){return E.jsx(Xv,{"data-slot":"select",...e})}function xX({...e}){return E.jsx(jv,{"data-slot":"select-value",...e})}function CX({className:e,size:t="default",children:n,...r}){return E.jsxs(zv,{"data-slot":"select-trigger","data-size":t,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,E.jsx(Wv,{asChild:!0,children:E.jsx(fv,{className:"size-4 opacity-50"})})]})}function kX({className:e,children:t,position:n="popper",...r}){return E.jsxs(Kv,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[E.jsx(wX,{}),E.jsx(Qv,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),E.jsx(SX,{})]})}function TX({className:e,children:t,...n}){return E.jsxs(qv,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[E.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:E.jsx(Gv,{children:E.jsx(dv,{className:"size-4"})})}),E.jsx(Yv,{children:t})]})}function wX({className:e,...t}){return E.jsx(fA,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(WQ,{className:"size-4"})})}function SX({className:e,...t}){return E.jsx(hA,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(fv,{className:"size-4"})})}function vX({className:e,...t}){return E.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",e),...t})}function AX({className:e,...t}){return E.jsx($v,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function NX({className:e,...t}){return E.jsx(Uv,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function IX({className:e,...t}){return E.jsx(Hv,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t})}function MX({className:e,...t}){return E.jsx(Vv,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}var _X=up("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function OX({className:e,variant:t,size:n,...r}){return E.jsx(Fv,{"data-slot":"toggle",className:ue(_X({variant:t,size:n,className:e})),...r})}function mv({delayDuration:e=0,...t}){return E.jsx(Lv,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function RX({...e}){return E.jsx(mv,{children:E.jsx(Bv,{"data-slot":"tooltip",...e})})}function LX({...e}){return E.jsx(Rv,{"data-slot":"tooltip-trigger",...e})}function DX({className:e,sideOffset:t=0,children:n,...r}){return E.jsxs(Dv,{"data-slot":"tooltip-content",sideOffset:t,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",e),...r,children:[n,E.jsx(Pv,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}var PX={Avatar:{Avatar:YQ,AvatarFallback:QQ,AvatarImage:KQ},Badge:{Badge:ZQ},Button:{Button:eX},Card:{Card:tX,CardContent:nX},DropdownMenu:{DropdownMenu:rX,DropdownMenuCheckboxItem:aX,DropdownMenuContent:iX,DropdownMenuItem:sX,DropdownMenuLabel:lX,DropdownMenuSeparator:cX,DropdownMenuSub:uX,DropdownMenuSubContent:fX,DropdownMenuSubTrigger:dX,DropdownMenuTrigger:oX},Form:{Form:pX},Input:{Input:mX},Label:{Label:hX},Popover:{Popover:gX,PopoverContent:yX,PopoverTrigger:bX},Select:{Select:EX,SelectContent:kX,SelectItem:TX,SelectTrigger:CX,SelectValue:xX},Skeleton:{Skeleton:vX},Tabs:{Tabs:AX,TabsContent:MX,TabsList:NX,TabsTrigger:IX},Toggle:{Toggle:OX},Tooltip:{Tooltip:RX,TooltipContent:DX,TooltipProvider:mv,TooltipTrigger:LX}},gv=C.createContext(void 0);function Ye(){return C.useContext(gv)}var BX=e=>{let{children:t,...n}=e;Te(n);let r=Ye(),o=KK();return E.jsx(r.Form.Form,{...o,children:t})},FX=C.forwardRef((e,t)=>{let{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,"aria-activedescendant":g,rightSection:y,...b}=e;Te(b);let x=Ye();return E.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,E.jsxs("div",{className:"flex-1",children:[o&&E.jsx(x.Label.Label,{htmlFor:o,children:o}),E.jsx(x.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:t,"aria-activedescendant":g})]}),y]})}),HX=e=>C.forwardRef((t,n)=>E.jsx(e,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{let o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...t,ref:n})),UX=e=>{let{children:t,onOpenChange:n,position:r,sub:o,...i}=e;Te(i);let s=Ye();return o?E.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:t}):E.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:t})},VX=e=>{let{children:t,sub:n,...r}=e;Te(r);let o=Ye(),i=C.useMemo(()=>HX(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?E.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:t}):E.jsx(i,{asChild:!0,...r,children:t})},$X=C.forwardRef((e,t)=>{let{className:n,children:r,sub:o,...i}=e;Te(i);let s=Ye();return E.jsx(o?s.DropdownMenu.DropdownMenuSubContent:s.DropdownMenu.DropdownMenuContent,{className:n,ref:t,children:r})}),jX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=e;Te(l);let c=Ye();return s?E.jsxs(E.Fragment,{children:[o,r]}):i===void 0?E.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:t,onClick:a,...l,children:[o,r,s&&E.jsx(hv,{className:"ml-auto h-4 w-4"})]}):E.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:t,checked:i,onClick:a,...l,children:[o,r]})}),zX=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx(Ye().DropdownMenu.DropdownMenuSeparator,{className:n,ref:t})}),WX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().DropdownMenu.DropdownMenuLabel,{className:n,ref:t,children:r})}),qX=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),GX=C.forwardRef((e,t)=>{let{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=e;Te(l);let c=Ye();return E.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:t,value:i,defaultValue:o,onValueChange:s,children:[E.jsx(c.Tabs.TabsList,{children:r.map(u=>E.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>E.jsx(c.Tabs.TabsContent,{value:u.name,children:E.jsx(c.Card.Card,{children:E.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),YX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:t,children:r})}),KX=C.forwardRef((e,t)=>{let{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:t,value:r,placeholder:o,onKeyDown:i,onChange:s})}),bv=C.createContext(void 0),QX=e=>{let{children:t,open:n,onOpenChange:r,position:o,portalRoot:i,...s}=e;return Te(s),E.jsx(Ye().Popover.Popover,{open:n,onOpenChange:r,children:E.jsx(bv.Provider,{value:i,children:t})})},XX=C.forwardRef((e,t)=>{let{children:n,...r}=e;return Te(r),E.jsx(Ye().Popover.PopoverTrigger,{ref:t,asChild:!0,children:n})}),ZX=C.forwardRef((e,t)=>{let{className:n,variant:r,children:o,...i}=e;Te(i);let s=Ye(),a=C.useContext(bv),l=E.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:t,children:o});return a?Xr.createPortal(l,a):l}),JX=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx("div",{className:n,ref:t,...o,children:r})}),eZ=C.forwardRef((e,t)=>{let{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;return Te(u,!1),E.jsxs(Ye().Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:t,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),tZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,columns:i,...s}=e;return Te(s),E.jsx("div",{className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:t,id:o,role:"grid",children:r})}),nZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),rZ=C.forwardRef((e,t)=>{let{className:n,children:r,id:o,...i}=e;return Te(i),E.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:t,children:r})}),oZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:t,children:E.jsx("div",{children:r})})}),iZ=C.forwardRef((e,t)=>{let n=Ye(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=e;Te(l);let c=C.useRef(null);return C.useEffect(()=>{!c.current||!i||$S(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"))!=="none"&&c.current.scrollIntoView({block:"nearest"})},[i]),E.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",e.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:jS([t,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&E.jsx("div",{className:ue("p-3",e.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),E.jsxs("div",{className:"flex-1",children:[E.jsx("div",{className:ue("text-base",e.item.size==="small"?"text-sm":"",r),children:o.title}),E.jsx("div",{className:ue("text-xs",e.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&E.jsx("div",{"data-position":"right",className:"text-xs",children:E.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),sZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:t,children:r})}),aZ=C.forwardRef((e,t)=>{let{className:n,...r}=e;return Te(r),E.jsx("div",{className:ue(n,"animate-spin"),ref:t,children:E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:E.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),lZ=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseDown:o,onClick:i,...s}=e;return Te(s,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n?.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n?.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:t,onClick:i,onMouseDown:o,...s,children:r})}),cZ=C.forwardRef((e,t)=>{let{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=e;return Te(c,!1),E.jsx(Ye().Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:t,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),Of=C.forwardRef((e,t)=>{let{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=e;return Te(a),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:t,onMouseEnter:o,onMouseLeave:i,children:r})})}),Rf=C.forwardRef((e,t)=>{let{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=e;Te(f,!1);let h=Ye(),p=a===void 0?E.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:t,"aria-label":u,...f,children:[s,r]}):E.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:t,...f,children:[s,r]});return E.jsxs(h.Tooltip.Tooltip,{children:[E.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),E.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:o}),i&&E.jsx("span",{children:i})]})]})}),Lf=C.forwardRef((e,t)=>{let{className:n,items:r,isDisabled:o,...i}=e;Te(i);let s=Ye(),a=c=>E.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?E.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>r.find(u=>u.text===c).onClick?.(),disabled:o,children:[E.jsx(s.Select.SelectTrigger,{className:"border-none",children:E.jsx(s.Select.SelectValue,{})}),E.jsx(s.Select.SelectContent,{className:n,ref:t,children:r.map(c=>E.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:E.jsx(a,{...c})},c.text))})]}):null}),uZ=C.forwardRef((e,t)=>{let{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=e;return Te(c),E.jsxs(Ye().Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:t,children:[i&&E.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),dZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx("div",{className:ue(n,"p-4",n?.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:t,children:r})}),fZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o,!1),E.jsx(Ye().Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:t,children:r})}),hZ=C.forwardRef((e,t)=>{let{authorInfo:n,timeString:r,edited:o,...i}=e,s=Se();Te(i,!1);let a=Ye();return n==="loading"?E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),E.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[E.jsxs(a.Avatar.Avatar,{children:[E.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),E.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),E.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[E.jsx("span",{className:"text-sm font-bold",children:n.username}),E.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),pZ=C.forwardRef((e,t)=>{let{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=e;Te(u);let[d,f]=C.useState(!1),{focused:h,ref:p}=SK(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h||l);return E.jsxs("div",{ref:t,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?E.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,E.jsx(hZ,{...e}),c]})}),mZ=C.forwardRef((e,t)=>{let{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=e;Te(l);let c=Nr();return E.jsx(yv,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:t,onFocus:r,onBlur:o,children:E.jsx(eg,{formattingToolbar:gZ})})}),gZ=()=>E.jsx(Jm,{blockTypeSelectItems:[],children:Zm([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton")}),bZ=C.forwardRef((e,t)=>{let{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=e;Te(u,!1);let d=Ye(),f=E.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:t,children:[E.jsx("span",{children:o}),E.jsx("span",{children:r})]});return s?E.jsxs(d.Tooltip.Tooltip,{children:[E.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),E.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[E.jsx("span",{children:s}),a&&E.jsx("span",{children:a})]})]}):f}),yZ=C.forwardRef((e,t)=>{let{className:n,children:r,...o}=e;return Te(o),E.jsx(Ye().Tooltip.TooltipProvider,{delayDuration:0,children:E.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:t,children:r})})}),EZ=C.forwardRef((e,t)=>{let{className:n,children:r,onClick:o,label:i,...s}=e;return Te(s),E.jsx(Ye().Button.Button,{type:"submit",className:n,"aria-label":i,ref:t,onClick:o,children:r})}),xZ=C.forwardRef((e,t)=>{let{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=e;return Te(a),E.jsx(Ye().Input.Input,{type:"file",className:n,ref:t,accept:r,value:o?o.name:void 0,onChange:async l=>s?.(l.target.files[0]),placeholder:i})}),CZ=C.forwardRef((e,t)=>{let{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=e;Te(a);let l=C.useRef(null);return C.useEffect(()=>{!l.current||!r||$S(l.current,l.current.closest(".bn-grid-suggestion-menu"))!=="none"&&l.current.scrollIntoView({block:"nearest"})},[r]),E.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:jS([t,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),kZ=C.forwardRef((e,t)=>{let{className:n,children:r,columns:o,...i}=e;return Te(i),E.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:t,children:r})}),TZ={FormattingToolbar:{Root:Of,Button:Rf,Select:Lf},FilePanel:{Root:GX,Button:EZ,FileInput:xZ,TabPanel:YX,TextInput:KX},LinkToolbar:{Root:Of,Button:Rf,Select:Lf},SideMenu:{Root:JX,Button:eZ},SuggestionMenu:{Root:rZ,Item:iZ,EmptyItem:oZ,Label:sZ,Loader:aZ},GridSuggestionMenu:{Root:tZ,Item:CZ,EmptyItem:nZ,Loader:kZ},TableHandle:{Root:cZ,ExtendButton:lZ},Comments:{Comment:pZ,Editor:mZ,Card:uZ,CardSection:dZ,ExpandSectionsPrompt:fZ},Generic:{Badge:{Root:bZ,Group:yZ},Toolbar:{Root:Of,Button:Rf,Select:Lf},Form:{Root:BX,TextInput:FX},Menu:{Root:UX,Trigger:VX,Dropdown:$X,Divider:zX,Label:WX,Item:jX,Button:qX},Popover:{Root:QX,Trigger:XX,Content:ZX}}},yv=e=>{let{className:t,shadCNComponents:n,...r}=e,o=C.useMemo(()=>({...PX,...n}),[n]);return E.jsx(gv.Provider,{value:o,children:E.jsx(nS.Provider,{value:TZ,children:E.jsx(CK,{className:ut("bn-shadcn",t||""),...r})})})};function sE({open:e,onClose:t,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.link??""),[g,y]=C.useState(r?.filename??""),[b,x]=C.useState(r?.width??0),[k,O]=C.useState(r?.height??0),[M,A]=C.useState(r?.thumbUrl??""),[D,z]=C.useState(!1),[Y,N]=C.useState(!1),K=!!a,F=i?K&&M?Ff(M):Ff(i):"";function q(W){if(s(W.url),l(W.mediaId),y(W.filename),x(W.width??0),O(W.height??0),A(W.urls?.thumb_md??""),N(!1),!c.trim()){const G=W.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(G)}z(!1)}function L(){s(""),l(""),y(""),x(0),O(0),A(""),N(!1)}function H(W){s(W),l(""),y(""),x(0),O(0),A(""),N(!1)}function re(){n({url:i,mediaId:a,alt:c,caption:d,link:h,filename:g,width:b,height:k})}return E.jsx(cE,{open:e,onOpenChange:()=>t(),children:E.jsxs(uE,{children:[E.jsxs(dE,{children:[E.jsx(fE,{children:r?"Edit Image":"Insert Image"}),E.jsx(hE,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),E.jsxs("div",{className:"space-y-4",children:[i&&!Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("img",{src:F,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>N(!0)})}):i&&Y?E.jsx("div",{className:"flex justify-center",children:E.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:E.jsx(pE,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{children:"Image"}),E.jsxs("div",{className:"flex gap-2",children:[K?E.jsxs(Tv,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[E.jsx(wv,{className:"h-3.5 w-3.5 shrink-0"}),E.jsx("span",{className:"truncate",children:g}),E.jsx("button",{type:"button",onClick:L,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:E.jsx(Sv,{className:"h-3 w-3"})})]}):E.jsx(qa,{placeholder:"https://example.com/image.jpg",value:i,onChange:W=>H(W.target.value)}),E.jsx(Bs,{type:"button",variant:"outline",onClick:()=>z(!0),children:"Select Media"})]})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-alt",children:"Alt Text"}),E.jsx(qa,{id:"image-alt",value:c,onChange:W=>u(W.target.value),placeholder:"Describe the image"})]}),!o&&E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-caption",children:"Caption (optional)"}),E.jsx(qa,{id:"image-caption",value:d,onChange:W=>f(W.target.value),placeholder:"Photo credit or description"})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsx(Wa,{htmlFor:"image-link",children:"Link (optional)"}),E.jsx(qa,{id:"image-link",value:h,onChange:W=>p(W.target.value),placeholder:"https://example.com"})]})]}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:t,children:"Cancel"}),E.jsx(Bs,{onClick:re,disabled:!i.trim(),children:"Save"})]}),D&&E.jsx(DA,{open:D,onClose:()=>z(!1),onSelect:W=>q(W),allowedTypes:["image/*"]})]})})}const wZ=VS({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},link:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:e,editor:t})=>E.jsx(SZ,{block:e,editor:t})});function SZ({block:e,editor:t}){const n=!!e.props.url,[r,o]=C.useState(!n&&t.isEditable),i=n?Ff(e.props.url):"";function s(l){t.updateBlock(e,{props:{url:l.url,mediaId:l.mediaId,alt:l.alt,caption:l.caption,filename:l.filename,link:l.link,width:l.width,height:l.height}}),o(!1)}if(!n)return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>t.isEditable&&o(!0),children:[E.jsx(pE,{className:"mx-auto h-8 w-8 text-muted-foreground"}),E.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s})]});const a=E.jsxs("div",{className:"relative inline-block",children:[E.jsx("img",{src:i,alt:e.props.alt,className:"max-w-full rounded-lg"}),t.isEditable&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:E.jsx(gE,{className:"h-6 w-6 text-white drop-shadow"})})]});return E.jsxs(E.Fragment,{children:[E.jsxs("figure",{className:`group my-2${t.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>t.isEditable&&o(!0),children:[e.props.link&&!t.isEditable?E.jsx("a",{href:e.props.link,target:"_blank",rel:"noopener noreferrer",children:a}):a,e.props.caption&&E.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:e.props.caption})]}),r&&E.jsx(sE,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:e.props.url,mediaId:e.props.mediaId,alt:e.props.alt,caption:e.props.caption,filename:e.props.filename,link:e.props.link,width:e.props.width,height:e.props.height}})]})}function vZ({blockType:e,data:t,blocksToHTML:n,onSave:r}){const[o,i]=C.useState(!1),[s,a]=C.useState({}),l=e.fields??[];function c(){a({...t}),i(!0)}function u(){r(s),i(!1)}return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"cursor-pointer",onClick:c,children:[E.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[E.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.icon&&E.jsx(vv,{name:e.icon,className:"h-3 w-3"}),e.label]}),E.jsx(gE,{className:"h-3 w-3 text-muted-foreground"})]}),E.jsx(BA,{blockType:e,props:t,blocksToHTML:n})]}),E.jsx(cE,{open:o,onOpenChange:i,modal:!1,children:E.jsxs(uE,{className:"max-w-lg max-h-[85vh] overflow-y-auto",onPointerDownOutside:d=>{d.target.closest(".bn-suggestion-menu, .bn-toolbar, .bn-popover-content, .bn-menu-dropdown")&&d.preventDefault()},onEscapeKeyDown:d=>{document.activeElement?.closest(".bn-editor")&&d.preventDefault()},children:[E.jsxs(dE,{children:[E.jsxs(fE,{children:["Edit ",e.label]}),E.jsx(hE,{className:"sr-only",children:"Edit block properties"})]}),E.jsx(PA,{fields:l,values:s,onChange:a}),E.jsxs(mE,{children:[E.jsx(Bs,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),E.jsx(Bs,{onClick:u,children:"Save"})]})]})})]})}function AZ(e){const t={};for(const n of e??[])switch(n.type){case"boolean":t[n.name]=!1;break;case"number":t[n.name]=0;break;case"array":case"blocks":t[n.name]=[];break;case"container":t[n.name]={};break;case"media":case"content":t[n.name]=null;break;default:t[n.name]=""}return t}function NZ(e){const{image:t,video:n,audio:r,file:o,...i}=Xk,s={...i,image:wZ()};for(const a of e){const l=AZ(a.fields??[]),c=VS({type:a.name,propSchema:{data:{default:l}},content:"none"},{render:({block:u,editor:d})=>{const f=u,h=d,p=f.props.data??l;return E.jsx(vZ,{blockType:a,data:p,blocksToHTML:g=>h.blocksToHTMLLossy(g),onSave:g=>{h.updateBlock(u,{props:{data:g}});const y=d._tiptapEditor;y.emit("update",{editor:y,transaction:y.state.tr,appendedTransactions:[]})}})}});s[a.name]=c()}return um.create({blockSpecs:s})}function IZ(e){const t=C.useMemo(()=>NZ(e),[e]),n=C.useMemo(()=>e.map(r=>r.name).sort().join(","),[e]);return{schema:t,schemaKey:n}}const lg="headroom://content/";function MZ(e){return e.startsWith(lg)}function _Z(e){if(!MZ(e))return null;const t=e.slice(lg.length),n=t.indexOf("/");if(n===-1)return null;const r=t.slice(0,n),o=t.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function OZ(e,t){return`${lg}${e}/${t}`}function RZ(){const e=be(),t=fe(),{host:n}=lE(),{showSelection:r}=je(va),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o,"contentLink")},[o,r]),!t||!n)return null;function s(a){const l=OZ(a.collection,a.contentId);e.createLink(l,a.title),i(!1)}return E.jsx(FA,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:E.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:E.jsx(Av,{size:18}),onClick:()=>i(!0)})})}function LZ({initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o}){const{schema:i,schemaKey:s}=IZ(n),a=o?"collab":"solo";return E.jsx(DZ,{schema:i,initialBlocks:e,onChange:t,blockTypes:n,compact:r,collaboration:o},`${s}-${a}`)}function DZ({schema:e,initialBlocks:t,onChange:n,blockTypes:r,compact:o,collaboration:i}){const s=Ym({schema:e,...i?{collaboration:{provider:i.provider,fragment:i.fragment,user:i.user,showCursorLabels:"activity"}}:{initialContent:t&&t.length>0?t:void 0}}),a=C.useRef(n);a.current=n,C.useMemo(()=>{let c=!1;s.onChange(()=>{if(!c){c=!0;return}a.current(s.document)})},[s]),C.useEffect(()=>{if(!i||!t||t.length===0)return;const c=setTimeout(()=>{const u=s.document;(u.length===0||u.length===1&&(!u[0]?.content||Array.isArray(u[0].content)&&u[0].content.length===0))&&s.replaceBlocks(s.document,t)},500);return()=>clearTimeout(c)},[s,i]);const l=C.useMemo(()=>{const c=FS(s),u=r.map(d=>({title:d.label,subtext:`Insert ${d.label} block`,onItemClick:()=>{const f=s.getTextCursorPosition().block;s.insertBlocks([{type:d.name}],f,"after")},aliases:[d.name],group:"Custom Blocks"}));return[...c,...u]},[s,r]);return E.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:E.jsxs(yv,{editor:s,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[E.jsx(HS,{triggerCharacter:"/",getItems:async c=>l.filter(u=>u.title.toLowerCase().includes(c.toLowerCase()))}),E.jsx(eg,{formattingToolbar:PZ}),E.jsx(DS,{linkToolbar:BZ})]})})}function PZ(e){return E.jsxs(Jm,{...e,children:[Zm(e.blockTypeSelectItems),E.jsx(RZ,{})]})}function BZ(e){const{host:t}=lE(),n=xv(),r=fe(),o=_Z(e.url);return!o||!r?E.jsx(LS,{...e}):E.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),E.jsx(RS,{url:e.url,text:e.text,range:e.range,setToolbarPositionFrozen:e.setToolbarPositionFrozen,setToolbarOpen:e.setToolbarOpen}),E.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${t}/content/${o.contentId}`)}}),E.jsx(OS,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})}const dJ=Object.freeze(Object.defineProperty({__proto__:null,default:LZ},Symbol.toStringTag,{value:"Module"}));export{Se as B,Ym as G,oS as K,be as M,je as N,rt as P,jt as U,rS as W,iS as X,dJ as a,Cu as f,qr as o,xu as s,Yq as t,Jr as v,ut as w,fe as z};