@blocknote/xl-multi-column 0.43.0 → 0.44.1
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.
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
"use strict";var Zh=Object.defineProperty;var ef=(e,t,n)=>t in e?Zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var de=(e,t,n)=>ef(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("@tiptap/core"),Pe=require("@blocknote/core"),D=require("prosemirror-state"),ne=require("prosemirror-model"),oe=require("prosemirror-tables"),K=require("prosemirror-view"),Js=require("prosemirror-transform"),tf=require("prosemirror-highlight"),nf=require("prosemirror-highlight/shiki"),rf=require("prosemirror-dropcursor"),Di=require("prosemirror-history"),aa=require("react/jsx-runtime"),sf=require("react"),of=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function af(e){if(e&&typeof e=="object"&&"default"in e)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ot=af(ne),xt=of(sf),uf={slash_menu:{two_columns:{title:"عمودان",subtext:"عمودان جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"},three_columns:{title:"ثلاثة أعمدة",subtext:"ثلاثة أعمدة جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"}}},cf={slash_menu:{two_columns:{title:"Zwei Spalten",subtext:"Zwei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende Blöcke"},three_columns:{title:"Drei Spalten",subtext:"Drei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende Blöcke"}}},lf={slash_menu:{two_columns:{title:"Two Columns",subtext:"Two columns side by side",aliases:["columns","row","split"],group:"Basic blocks"},three_columns:{title:"Three Columns",subtext:"Three columns side by side",aliases:["columns","row","split"],group:"Basic blocks"}}},df={slash_menu:{two_columns:{title:"Dos Columnas",subtext:"Dos columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"},three_columns:{title:"Tres Columnas",subtext:"Tres columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"}}},hf={slash_menu:{two_columns:{title:"Deux Colonnes",subtext:"Deux colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"},three_columns:{title:"Trois Colonnes",subtext:"Trois colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"}}},ff={slash_menu:{two_columns:{title:"Dva Stupca",subtext:"Dva stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"},three_columns:{title:"Tri Stupca",subtext:"Tri stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"}}},pf={slash_menu:{two_columns:{title:"Tvær Dálkar",subtext:"Tvær dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"},three_columns:{title:"Þrír Dálkar",subtext:"Þrír dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"}}},mf={slash_menu:{two_columns:{title:"二列",subtext:"二列並んで",aliases:["列","行","分割"],group:"基本ブロック"},three_columns:{title:"三列",subtext:"三列並んで",aliases:["列","行","分割"],group:"基本ブロック"}}},gf={slash_menu:{two_columns:{title:"두 열",subtext:"두 열 나란히",aliases:["열","행","분할"],group:"기본 블록"},three_columns:{title:"세 열",subtext:"세 열 나란히",aliases:["열","행","분할"],group:"기본 블록"}}},bf={slash_menu:{two_columns:{title:"Twee Kolommen",subtext:"Twee kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"},three_columns:{title:"Drie Kolommen",subtext:"Drie kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"}}},Ef={slash_menu:{two_columns:{title:"Dwie Kolumny",subtext:"Dwie kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"},three_columns:{title:"Trzy Kolumny",subtext:"Trzy kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"}}},Tf={slash_menu:{two_columns:{title:"Duas Colunas",subtext:"Duas colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"},three_columns:{title:"Três Colunas",subtext:"Três colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"}}},Cf={slash_menu:{two_columns:{title:"Два Столбца",subtext:"Два столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"},three_columns:{title:"Три Столбца",subtext:"Три столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"}}},yf={slash_menu:{two_columns:{title:"Hai Cột",subtext:"Hai cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"},three_columns:{title:"Ba Cột",subtext:"Ba cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"}}},_f={slash_menu:{two_columns:{title:"两列",subtext:"两列并排",aliases:["列","行","分割"],group:"基础"},three_columns:{title:"三列",subtext:"三列并排",aliases:["列","行","分割"],group:"基础"}}},Af=Object.freeze(Object.defineProperty({__proto__:null,ar:uf,de:cf,en:lf,es:df,fr:hf,hr:ff,is:pf,ja:mf,ko:gf,nl:bf,pl:Ef,pt:Tf,ru:Cf,vi:yf,zh:_f},Symbol.toStringTag,{value:"Module"}));function fs(e){if(!e.dictionary.multi_column)throw new Error("Multi-column dictionary not found");return e.dictionary.multi_column}function _c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kf=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,i,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))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(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n};const wf=_c(kf);var gr,Sf=new Uint8Array(16);function If(){if(!gr&&(gr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!gr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gr(Sf)}const xf=/^(?:[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 Nf(e){return typeof e=="string"&&xf.test(e)}var ce=[];for(var Oi=0;Oi<256;++Oi)ce.push((Oi+256).toString(16).substr(1));function Lf(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase();if(!Nf(n))throw TypeError("Stringified UUID is invalid");return n}function Ac(e,t,n){e=e||{};var r=e.random||(e.rng||If)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Lf(r)}function Df(e,t=JSON.stringify){const n={};return e.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Of(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Df(t)}const kc=L.Extension.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const e=window.__TEST_OPTIONS;return e.mockID===void 0?e.mockID=0:e.mockID++,e.mockID.toString()}return Ac()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:e=>e.getAttribute(`data-${this.options.attributeName}`),renderHTML:e=>{const t={[`data-${this.options.attributeName}`]:e[this.options.attributeName]};return this.options.setIdAttribute?{...t,id:e[this.options.attributeName]}:t}}}}]},addProseMirrorPlugins(){let e=null,t=!1;return[new D.Plugin({key:new D.PluginKey("uniqueID"),appendTransaction:(n,r,i)=>{const s=n.some(p=>p.docChanged)&&!r.doc.eq(i.doc),o=this.options.filterTransaction&&n.some(p=>{var m,T;return!((T=(m=this.options).filterTransaction)!=null&&T.call(m,p))});if(!s||o)return;const{tr:a}=i,{types:u,attributeName:c,generateID:h}=this.options,d=L.combineTransactionSteps(r.doc,n),{mapping:f}=d;if(L.getChangedRanges(d).forEach(({newRange:p})=>{const m=L.findChildrenInRange(i.doc,p,C=>u.includes(C.type.name)),T=m.map(({node:C})=>C.attrs[c]).filter(C=>C!==null),_=Of(T);m.forEach(({node:C,pos:x})=>{var I;const R=(I=a.doc.nodeAt(x))==null?void 0:I.attrs[c];if(R===null){const v=r.doc.type.createAndFill().content;if(r.doc.content.findDiffStart(v)===null){const te=JSON.parse(JSON.stringify(i.doc.toJSON()));if(te.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(te.content)===JSON.stringify(v.toJSON())){a.setNodeMarkup(x,void 0,{...C.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(x,void 0,{...C.attrs,[c]:h()});return}const{deleted:V}=f.invert().mapResult(x);V&&_.includes(R)&&a.setNodeMarkup(x,void 0,{...C.attrs,[c]:h()})})}),!!a.steps.length)return a.setMeta("uniqueID",!0),a},view(n){const r=i=>{let s;e=!((s=n.dom.parentElement)===null||s===void 0)&&s.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{let i;return e!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy"?t=!0:t=!1,e=null,!1},paste:()=>(t=!0,!1)},transformPasted:n=>{if(!t)return n;const{types:r,attributeName:i}=this.options,s=o=>{const a=[];return o.forEach(u=>{if(u.isText){a.push(u);return}if(!r.includes(u.type.name)){a.push(u.copy(s(u.content)));return}const c=u.type.create({...u.attrs,[i]:null},s(u.content),u.marks);a.push(c)}),ne.Fragment.from(a)};return t=!1,new ne.Slice(s(n.content),n.openStart,n.openEnd)}}})]}});function ua(e){return e.type==="link"}function wc(e){return typeof e!="string"&&e.type==="link"}function Rt(e){return typeof e!="string"&&e.type==="text"}function ps(e){var t,n,r,i,s;return Zs(e)?{...e}:Hn(e)?{type:"tableCell",content:[].concat(e.content),props:{backgroundColor:((t=e.props)==null?void 0:t.backgroundColor)??"default",textColor:((n=e.props)==null?void 0:n.textColor)??"default",textAlignment:((r=e.props)==null?void 0:r.textAlignment)??"left",colspan:((i=e.props)==null?void 0:i.colspan)??1,rowspan:((s=e.props)==null?void 0:s.rowspan)??1}}:{type:"tableCell",content:[].concat(e),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function Hn(e){return e!=null&&typeof e!="string"&&!Array.isArray(e)&&e.type==="tableCell"}function Zs(e){return Hn(e)&&e.props!==void 0&&e.content!==void 0}function Fn(e){return Zs(e)?e.props.colspan??1:1}function ms(e){return Zs(e)?e.props.rowspan??1:1}class fn extends Error{constructor(t){super(`Unreachable case: ${t}`)}}function eo(e,t){const n=e.resolve(t);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,i=n.node(r);for(;r>0;){if(i.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:i};r--,i=n.node(r)}const s=[];e.descendants((a,u)=>{a.type.isInGroup("bnBlock")&&s.push(u)}),console.warn(`Position ${t} is not within a blockContainer node.`);const o=e.resolve(s.find(a=>a>=t)||s[s.length-1]);return{posBeforeNode:o.pos,node:o.nodeAfter}}function to(e,t){if(!e.type.isInGroup("bnBlock"))throw new Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);const n=e,r=t,i=r+n.nodeSize,s={node:n,beforePos:r,afterPos:i};if(n.type.name==="blockContainer"){let o,a;if(n.forEach((u,c)=>{if(u.type.spec.group==="blockContent"){const h=u,d=r+c+1,f=d+u.nodeSize;o={node:h,beforePos:d,afterPos:f}}else if(u.type.name==="blockGroup"){const h=u,d=r+c+1,f=d+u.nodeSize;a={node:h,beforePos:d,afterPos:f}}}),!o)throw new Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:s,blockContent:o,childContainer:a,blockNoteType:o.node.type.name}}else{if(!s.node.type.isInGroup("childContainer"))throw new Error(`bnBlock node is not in the childContainer group: ${s.node}`);return{isBlockContainer:!1,bnBlock:s,childContainer:s,blockNoteType:s.node.type.name}}}function Vn(e){return to(e.node,e.posBeforeNode)}function Rf(e){if(!e.nodeAfter)throw new Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);return to(e.nodeAfter,e.pos)}function Sc(e){const t=eo(e.doc,e.selection.anchor);return Vn(t)}function Mf(e){const t=eo(e.doc,e.selection.anchor);return Vn(t)}function pt(e){return"doc"in e?e.doc.type.schema:e.type.schema}function Ic(e){return e.cached.blockNoteEditor}function no(e){return Ic(e).schema}function vf(e){return no(e).blockSchema}function Pf(e){return no(e).inlineContentSchema}function ci(e){return no(e).styleSchema}function Bf(e){return Ic(e).blockCache}function Uf(e,t,n){var r,i;const s={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},o=[];e.content.forEach((a,u,c)=>{const h={cells:[]};c===0&&a.content.forEach(d=>{let f=d.attrs.colwidth;f==null&&(f=new Array(d.attrs.colspan??1).fill(void 0)),s.columnWidths.push(...f)}),h.cells=a.content.content.map((d,f)=>(o[c]||(o[c]=[]),o[c][f]=d.type.name==="tableHeader",{type:"tableCell",content:d.content.content.map(p=>ro(p,t,n)).reduce((p,m)=>{if(!p.length)return m;const T=p[p.length-1],_=m[0];return _&&Rt(T)&&Rt(_)&&JSON.stringify(T.styles)===JSON.stringify(_.styles)?(T.text+=`
|
|
2
|
-
`+_.text,p.push(...m.slice(1)),p):(p.push(...m),p)},[]),props:{colspan:d.attrs.colspan,rowspan:d.attrs.rowspan,backgroundColor:d.attrs.backgroundColor,textColor:d.attrs.textColor,textAlignment:d.attrs.textAlignment}})),s.rows.push(h)});for(let a=0;a<o.length;a++)(r=o[a])!=null&&r.every(u=>u)&&(s.headerRows=(s.headerRows??0)+1);for(let a=0;a<((i=o[0])==null?void 0:i.length);a++)o!=null&&o.every(u=>u[a])&&(s.headerCols=(s.headerCols??0)+1);return s}function ro(e,t,n){const r=[];let i;return e.content.forEach(s=>{if(s.type.name==="hardBreak"){if(i)if(Rt(i))i.text+=`
|
|
3
|
-
`;else if(ua(i))i.content[i.content.length-1].text+=`
|
|
4
|
-
`;else throw new Error("unexpected");else i={type:"text",text:`
|
|
5
|
-
`,styles:{}};return}if(s.type.name!=="link"&&s.type.name!=="text"){if(!t[s.type.name]){console.warn("unrecognized inline content type",s.type.name);return}i&&(r.push(i),i=void 0),r.push(xc(s,t,n));return}const o={};let a;for(const u of s.marks)if(u.type.name==="link")a=u;else{const c=n[u.type.name];if(!c){if(u.type.spec.blocknoteIgnore)continue;throw new Error(`style ${u.type.name} not found in styleSchema`)}if(c.propSchema==="boolean")o[c.type]=!0;else if(c.propSchema==="string")o[c.type]=u.attrs.stringValue;else throw new fn(c.propSchema)}i?Rt(i)?a?(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}):JSON.stringify(i.styles)===JSON.stringify(o)?i.text+=s.textContent:(r.push(i),i={type:"text",text:s.textContent,styles:o}):ua(i)&&(a?i.href===a.attrs.href?JSON.stringify(i.content[i.content.length-1].styles)===JSON.stringify(o)?i.content[i.content.length-1].text+=s.textContent:i.content.push({type:"text",text:s.textContent,styles:o}):(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}):(r.push(i),i={type:"text",text:s.textContent,styles:o})):a?i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}:i={type:"text",text:s.textContent,styles:o}}),i&&r.push(i),r}function xc(e,t,n){if(e.type.name==="text"||e.type.name==="link")throw new Error("unexpected");const r={},i=t[e.type.name];for(const[o,a]of Object.entries(e.attrs)){if(!i)throw Error("ic node is of an unrecognized type: "+e.type.name);const u=i.propSchema;o in u&&(r[o]=a)}let s;return i.content==="styled"?s=ro(e,t,n):s=void 0,{type:e.type.name,props:r,content:s}}function sn(e,t,n=vf(t),r=Pf(t),i=ci(t),s=Bf(t)){var o;if(!e.type.isInGroup("bnBlock"))throw Error("Node should be a bnBlock, but is instead: "+e.type.name);const a=s==null?void 0:s.get(e);if(a)return a;const u=to(e,0);let c=u.bnBlock.node.attrs.id;c===null&&(c=kc.options.generateID());const h=n[u.blockNoteType];if(!h)throw Error("Block is of an unrecognized type: "+u.blockNoteType);const d={};for(const[_,C]of Object.entries({...e.attrs,...u.isBlockContainer?u.blockContent.node.attrs:{}})){const x=h.propSchema;_ in x&&!(x[_].default===void 0&&C===void 0)&&(d[_]=C)}const f=n[u.blockNoteType],p=[];(o=u.childContainer)==null||o.node.forEach(_=>{p.push(sn(_,t,n,r,i,s))});let m;if(f.content==="inline"){if(!u.isBlockContainer)throw new Error("impossible");m=ro(u.blockContent.node,r,i)}else if(f.content==="table"){if(!u.isBlockContainer)throw new Error("impossible");m=Uf(u.blockContent.node,r,i)}else if(f.content==="none")m=void 0;else throw new fn(f.content);const T={id:c,type:f.type,props:d,content:m,children:p};return s==null||s.set(e,T),T}function yt(e){const{height:t,width:n}=io(e),r=new Array(t).fill(!1).map(()=>new Array(n).fill(null)),i=(s,o)=>{for(let a=s;a<t;a++)for(let u=o;u<n;u++)if(!r[a][u])return{row:a,col:u};throw new Error("Unable to create occupancy grid for table, no more available cells")};for(let s=0;s<e.content.rows.length;s++)for(let o=0;o<e.content.rows[s].cells.length;o++){const a=ps(e.content.rows[s].cells[o]),u=ms(a),c=Fn(a),{row:h,col:d}=i(s,o);for(let f=h;f<h+u;f++)for(let p=d;p<d+c;p++){if(r[f][p])throw new Error(`Unable to create occupancy grid for table, cell at ${f},${p} is already occupied`);r[f][p]={row:s,col:o,rowspan:u,colspan:c,cell:a}}}return r}function Yn(e){const 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 Mt(e,t,n=yt(t)){for(let r=0;r<n.length;r++)for(let i=0;i<n[r].length;i++){const s=n[r][i];if(s.row===e.row&&s.col===e.col)return{row:r,col:i,cell:s.cell}}throw new Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`)}function io(e){const t=e.content.rows.length;let n=0;return e.content.rows.forEach(r=>{let i=0;r.cells.forEach(s=>{i+=Fn(s)}),n=Math.max(n,i)}),{height:t,width:n}}function Nc(e,t,n=yt(t)){var r;const i=(r=n[e.row])==null?void 0:r[e.col];if(i)return{row:i.row,col:i.col,cell:i.cell}}function gs(e,t){var n;const r=yt(e);if(t<0||t>=r.length)return[];let i=0;for(let o=0;o<t;o++){const a=(n=r[i])==null?void 0:n[0];if(!a)return[];i+=a.rowspan}const s=new Array(r[0].length).fill(!1).map((o,a)=>Nc({row:i,col:a},e,r)).filter(o=>o!==void 0);return s.filter((o,a)=>s.findIndex(u=>u.row===o.row&&u.col===o.col)===a)}function bs(e,t){var n;const r=yt(e);if(t<0||t>=r[0].length)return[];let i=0;for(let o=0;o<t;o++){const a=(n=r[0])==null?void 0:n[i];if(!a)return[];i+=a.colspan}const s=new Array(r.length).fill(!1).map((o,a)=>Nc({row:a,col:i},e,r)).filter(o=>o!==void 0);return s.filter((o,a)=>s.findIndex(u=>u.row===o.row&&u.col===o.col)===a)}function Hf(e,t,n,r=yt(e)){const{col:i}=Mt({row:0,col:t},e,r),{col:s}=Mt({row:0,col:n},e,r);return r.forEach(o=>{const[a]=o.splice(i,1);o.splice(s,0,a)}),Yn(r)}function Ff(e,t,n,r=yt(e)){const{row:i}=Mt({row:t,col:0},e,r),{row:s}=Mt({row:n,col:0},e,r),[o]=r.splice(i,1);return r.splice(s,0,o),Yn(r)}function Es(e){return e?Hn(e)?Es(e.content):typeof e=="string"?e.length===0:Array.isArray(e)?e.every(t=>typeof t=="string"?t.length===0:Rt(t)?t.text.length===0:wc(t)?typeof t.content=="string"?t.content.length===0:t.content.every(n=>n.text.length===0):!1):!1:!0}function Vf(e,t,n=yt(e)){if(t==="columns"){let s=0;for(let o=n[0].length-1;o>=0&&n.every(a=>Es(a[o].cell)&&a[o].colspan===1);o--)s++;for(let o=n.length-1;o>=0;o--){const a=Math.max(n[o].length-s,1);n[o]=n[o].slice(0,a)}return Yn(n)}let r=0;for(let s=n.length-1;s>=0&&n[s].every(o=>Es(o.cell)&&o.rowspan===1);s--)r++;const i=Math.min(r,n.length-1);return n.splice(n.length-i,i),Yn(n)}function Yf(e,t,n,r=yt(e)){const{width:i,height:s}=io(e);if(t==="columns")r.forEach((o,a)=>{if(n>=0)for(let u=0;u<n;u++)o.push({row:a,col:Math.max(...o.map(c=>c.col))+1,rowspan:1,colspan:1,cell:ps("")});else o.splice(i+n,-1*n)});else if(n>0)for(let o=0;o<n;o++){const a=new Array(i).fill(null).map((u,c)=>({row:s+o,col:c,rowspan:1,colspan:1,cell:ps("")}));r.push(a)}else n<0&&r.splice(s+n,-1*n);return Yn(r)}function Lc(e,t,n){const r=gs(e,n);if(!r.some(o=>ms(o.cell)>1))return!0;let i=n,s=n;return r.forEach(o=>{const a=ms(o.cell);i=Math.max(i,o.row+a-1),s=Math.min(s,o.row)}),t<n?n===i:n===s}function Dc(e,t,n){const r=bs(e,n);if(!r.some(o=>Fn(o.cell)>1))return!0;let i=n,s=n;return r.forEach(o=>{const a=Fn(o.cell);i=Math.max(i,o.col+a-1),s=Math.min(s,o.col)}),t<n?n===i:n===s}function zf(e,t,n){const r=Mt(e,n),i=Mt(t,n);return r.col===i.col}function ca(e,t,n,r){const i=[];for(const[s,o]of Object.entries(e.styles||{})){const a=n[s];if(!a)throw new Error(`style ${s} not found in styleSchema`);if(a.propSchema==="boolean")o&&i.push(t.mark(s));else if(a.propSchema==="string")o&&i.push(t.mark(s,{stringValue:o}));else throw new fn(a.propSchema)}return!r||!t.nodes[r].spec.code?e.text.split(/(\n)/g).filter(s=>s.length>0).map(s=>s===`
|
|
6
|
-
`?t.nodes.hardBreak.createChecked():t.text(s,i)):e.text.length>0?[t.text(e.text,i)]:[]}function $f(e,t,n){const r=t.marks.link.create({href:e.href});return Ts(e.content,t,n).map(i=>{if(i.type.name==="text")return i.mark([...i.marks,r]);if(i.type.name==="hardBreak")return i;throw new Error("unexpected node type")})}function Ts(e,t,n,r){const i=[];if(typeof e=="string")return i.push(...ca({text:e,styles:{}},t,n,r)),i;for(const s of e)i.push(...ca(s,t,n,r));return i}function mt(e,t,n,r=ci(t)){const i=[];for(const s of e)typeof s=="string"?i.push(...Ts(s,t,r,n)):wc(s)?i.push(...$f(s,t,r)):Rt(s)?i.push(...Ts([s],t,r,n)):i.push(Oc(s,t,r));return i}function so(e,t,n=ci(t)){const r=[],i=new Array(e.headerRows??0).fill(!0),s=new Array(e.headerCols??0).fill(!0),o=e.columnWidths??[];for(let a=0;a<e.rows.length;a++){const u=e.rows[a],c=[],h=i[a];for(let f=0;f<u.cells.length;f++){const p=u.cells[f],m=s[f],T=void 0;let _=null;const C=Mt({row:a,col:f},{content:e});let x=o[C.col]?[o[C.col]]:null;if(p)if(typeof p=="string")_=t.text(p);else if(Hn(p)){p.content&&(_=mt(p.content,t,"tableParagraph",n));const R=Fn(p);R>1&&(x=new Array(R).fill(!1).map((V,v)=>o[C.col+v]??void 0))}else _=mt(p,t,"tableParagraph",n);const I=t.nodes[m||h?"tableHeader":"tableCell"].createChecked({...Hn(p)?p.props:{},colwidth:x},t.nodes.tableParagraph.createChecked(T,_));c.push(I)}const d=t.nodes.tableRow.createChecked({},c);r.push(d)}return r}function Oc(e,t,n){let r,i=e.type;if(i===void 0&&(i="paragraph"),!t.nodes[i])throw new Error(`node type ${i} not found in schema`);if(!e.content)r=t.nodes[i].createChecked(e.props);else if(typeof e.content=="string"){const s=mt([e.content],t,i,n);r=t.nodes[i].createChecked(e.props,s)}else if(Array.isArray(e.content)){const s=mt(e.content,t,i,n);r=t.nodes[i].createChecked(e.props,s)}else if(e.content.type==="tableContent"){const s=so(e.content,t,n);r=t.nodes[i].createChecked(e.props,s)}else throw new fn(e.content.type);return r}function li(e,t,n=ci(t)){let r=e.id;r===void 0&&(r=kc.options.generateID());const i=[];if(e.children)for(const s of e.children)i.push(li(s,t,n));if(!e.type||t.nodes[e.type].isInGroup("blockContent")){const s=Oc(e,t,n),o=i.length>0?t.nodes.blockGroup.createChecked({},i):void 0;return t.nodes.blockContainer.createChecked({id:r,...e.props},o?[s,o]:s)}else{if(t.nodes[e.type].isInGroup("bnBlock"))return t.nodes[e.type].createChecked({id:r,...e.props},i);throw new Error(`block type ${e.type} doesn't match blockContent or bnBlock group`)}}const Oe=()=>new Map,Cs=e=>{const t=Oe();return e.forEach((n,r)=>{t.set(r,n)}),t},Ke=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Wf=(e,t)=>{const n=[];for(const[r,i]of e)n.push(t(i,r));return n},jf=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},vt=()=>new Set,Ri=e=>e[e.length-1],qf=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},gt=Array.from,Gf=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},ys=Array.isArray;class Rc{constructor(){this._observers=Oe()}on(t,n){return Ke(this._observers,t,vt).add(n),n}once(t,n){const r=(...i)=>{this.off(t,r),n(...i)};this.on(t,r)}off(t,n){const r=this._observers.get(t);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(t))}emit(t,n){return gt((this._observers.get(t)||Oe()).values()).forEach(r=>r(...n))}destroy(){this._observers=Oe()}}const rt=Math.floor,Dr=Math.abs,tt=(e,t)=>e<t?e:t,He=(e,t)=>e>t?e:t,Mc=e=>e!==0?e<0:1/e<0,la=1,da=2,Mi=4,vi=8,zn=32,nt=64,pe=128,Kf=1<<29,di=31,_s=63,Nt=127,Xf=2147483647,vc=Number.MAX_SAFE_INTEGER,Qf=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&rt(e)===e),Jf=String.fromCharCode,Zf=e=>e.toLowerCase(),e0=/^\s*/g,t0=e=>e.replace(e0,""),n0=/([A-Z])/g,ha=(e,t)=>t0(e.replace(n0,n=>`${t}${Zf(n)}`)),r0=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.codePointAt(i);return r},$n=typeof TextEncoder<"u"?new TextEncoder:null,i0=e=>$n.encode(e),s0=$n?i0:r0;let Ln=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ln&&Ln.decode(new Uint8Array).length===1&&(Ln=null);class sr{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const or=()=>new sr,o0=e=>{const t=or();return e(t),Be(t)},a0=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Be=e=>{const t=new Uint8Array(a0(e));let n=0;for(let r=0;r<e.bufs.length;r++){const i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},u0=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(He(n,t)*2),e.cpos=0)},se=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},As=se,H=(e,t)=>{for(;t>Nt;)se(e,pe|Nt&t),t=rt(t/128);se(e,Nt&t)},oo=(e,t)=>{const n=Mc(t);for(n&&(t=-t),se(e,(t>_s?pe:0)|(n?nt:0)|_s&t),t=rt(t/64);t>0;)se(e,(t>Nt?pe:0)|Nt&t),t=rt(t/128)},ks=new Uint8Array(3e4),c0=ks.length/3,l0=(e,t)=>{if(t.length<c0){const n=$n.encodeInto(t,ks).written||0;H(e,n);for(let r=0;r<n;r++)se(e,ks[r])}else ke(e,s0(t))},d0=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;H(e,r);for(let i=0;i<r;i++)se(e,n.codePointAt(i))},Xt=$n&&$n.encodeInto?l0:d0,hi=(e,t)=>{const n=e.cbuf.length,r=e.cpos,i=tt(n-r,t.length),s=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,s>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(He(n*2,s)),e.cbuf.set(t.subarray(i)),e.cpos=s)},ke=(e,t)=>{H(e,t.byteLength),hi(e,t)},ao=(e,t)=>{u0(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},h0=(e,t)=>ao(e,4).setFloat32(0,t,!1),f0=(e,t)=>ao(e,8).setFloat64(0,t,!1),p0=(e,t)=>ao(e,8).setBigInt64(0,t,!1),fa=new DataView(new ArrayBuffer(4)),m0=e=>(fa.setFloat32(0,e),fa.getFloat32(0)===e),on=(e,t)=>{switch(typeof t){case"string":se(e,119),Xt(e,t);break;case"number":Qf(t)&&Dr(t)<=Xf?(se(e,125),oo(e,t)):m0(t)?(se(e,124),h0(e,t)):(se(e,123),f0(e,t));break;case"bigint":se(e,122),p0(e,t);break;case"object":if(t===null)se(e,126);else if(ys(t)){se(e,117),H(e,t.length);for(let n=0;n<t.length;n++)on(e,t[n])}else if(t instanceof Uint8Array)se(e,116),ke(e,t);else{se(e,118);const n=Object.keys(t);H(e,n.length);for(let r=0;r<n.length;r++){const i=n[r];Xt(e,i),on(e,t[i])}}break;case"boolean":se(e,t?120:121);break;default:se(e,127)}};class pa extends sr{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&H(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const ma=e=>{e.count>0&&(oo(e.encoder,e.count===1?e.s:-e.s),e.count>1&&H(e.encoder,e.count-2))};class Or{constructor(){this.encoder=new sr,this.s=0,this.count=0}write(t){this.s===t?this.count++:(ma(this),this.count=1,this.s=t)}toUint8Array(){return ma(this),Be(this.encoder)}}const ga=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);oo(e.encoder,t),e.count>1&&H(e.encoder,e.count-2)}};class Pi{constructor(){this.encoder=new sr,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(ga(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return ga(this),Be(this.encoder)}}class g0{constructor(){this.sarr=[],this.s="",this.lensE=new Or}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new sr;return this.sarr.push(this.s),this.s="",Xt(t,this.sarr.join("")),hi(t,this.lensE.toUint8Array()),Be(t)}}const bt=e=>new Error(e),Ue=()=>{throw bt("Method unimplemented")},Ie=()=>{throw bt("Unexpected case")},Pc=bt("Unexpected end of array"),Bc=bt("Integer out of Range");class fi{constructor(t){this.arr=t,this.pos=0}}const pn=e=>new fi(e),b0=e=>e.pos!==e.arr.length,E0=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},we=e=>E0(e,U(e)),an=e=>e.arr[e.pos++],U=e=>{let t=0,n=1;const r=e.arr.length;for(;e.pos<r;){const i=e.arr[e.pos++];if(t=t+(i&Nt)*n,n*=128,i<pe)return t;if(t>vc)throw Bc}throw Pc},uo=e=>{let t=e.arr[e.pos++],n=t&_s,r=64;const i=(t&nt)>0?-1:1;if(!(t&pe))return i*n;const s=e.arr.length;for(;e.pos<s;){if(t=e.arr[e.pos++],n=n+(t&Nt)*r,r*=128,t<pe)return i*n;if(n>vc)throw Bc}throw Pc},T0=e=>{let t=U(e);if(t===0)return"";{let n=String.fromCodePoint(an(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(an(e));else for(;t>0;){const r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},C0=e=>Ln.decode(we(e)),Qt=Ln?C0:T0,co=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},y0=e=>co(e,4).getFloat32(0,!1),_0=e=>co(e,8).getFloat64(0,!1),A0=e=>co(e,8).getBigInt64(0,!1),k0=[e=>{},e=>null,uo,y0,_0,A0,e=>!1,e=>!0,Qt,e=>{const t=U(e),n={};for(let r=0;r<t;r++){const i=Qt(e);n[i]=Wn(e)}return n},e=>{const t=U(e),n=[];for(let r=0;r<t;r++)n.push(Wn(e));return n},we],Wn=e=>k0[127-an(e)](e);class ba extends fi{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),b0(this)?this.count=U(this)+1:this.count=-1),this.count--,this.s}}class Rr extends fi{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=uo(this);const t=Mc(this.s);this.count=1,t&&(this.s=-this.s,this.count=U(this)+2)}return this.count--,this.s}}class Bi extends fi{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=uo(this),n=t&1;this.diff=rt(t/2),this.count=1,n&&(this.count=U(this)+2)}return this.s+=this.diff,this.count--,this.s}}class w0{constructor(t){this.decoder=new Rr(t),this.str=Qt(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const S0=crypto.getRandomValues.bind(crypto),I0=Math.random,Uc=()=>S0(new Uint32Array(1))[0],x0=e=>e[rt(I0()*e.length)],N0="10000000-1000-4000-8000"+-1e11,L0=()=>N0.replace(/[018]/g,e=>(e^Uc()&15>>e/4).toString(16)),D0=Date.now,Ea=e=>new Promise(e);Promise.all.bind(Promise);const Ta=e=>e===void 0?null:e;class O0{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let Hc=new O0,R0=!0;try{typeof localStorage<"u"&&localStorage&&(Hc=localStorage,R0=!1)}catch{}const M0=Hc,v0=Object.assign,Fc=Object.keys,P0=(e,t)=>{for(const n in e)t(e[n],n)},Ca=e=>Fc(e).length,B0=e=>{for(const t in e)return!1;return!0},Vc=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},U0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),H0=(e,t)=>e===t||Ca(e)===Ca(t)&&Vc(e,(n,r)=>(n!==void 0||U0(t,r))&&t[r]===n),F0=Object.freeze,Yc=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&Yc(e[t])}return F0(e)},lo=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&lo(e,t,n+1)}},V0=e=>e,Y0=(e,t)=>t.includes(e),un=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zc=typeof window<"u"&&typeof document<"u"&&!un;let $e;const z0=()=>{if($e===void 0)if(un){$e=Oe();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&$e.set(t,""),t=r):t!==null&&($e.set(t,r),t=null)}t!==null&&$e.set(t,"")}else typeof location=="object"?($e=Oe(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");$e.set(`--${ha(t,"-")}`,n),$e.set(`-${ha(t,"-")}`,n)}})):$e=Oe();return $e},ws=e=>z0().has(e),Yr=e=>Ta(un?process.env[e.toUpperCase().replaceAll("-","_")]:M0.getItem(e)),$c=e=>ws("--"+e)||Yr(e)!==null;$c("production");const $0=un&&Y0(process.env.FORCE_COLOR,["true","1","2"]),W0=$0||!ws("--no-colors")&&!$c("no-color")&&(!un||process.stdout.isTTY)&&(!un||ws("--color")||Yr("COLORTERM")!==null||(Yr("TERM")||"").includes("color")),j0=e=>new Uint8Array(e),q0=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=Jf(e[n]);return btoa(t)},G0=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),K0=zc?q0:G0,X0=e=>{const t=j0(e.byteLength);return t.set(e),t},Q0=e=>o0(t=>on(t,e));class J0{constructor(t,n){this.left=t,this.right=n}}const Qe=(e,t)=>new J0(e,t),Z0=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const ep=e=>Wf(e,(t,n)=>`${n}:${t};`).join(""),tp=e=>class{constructor(n){this._=n}destroy(){e(this._)}},np=tp(clearTimeout),ho=(e,t)=>new np(setTimeout(t,e)),it=Symbol,Wc=it(),jc=it(),rp=it(),ip=it(),sp=it(),qc=it(),op=it(),fo=it(),ap=it(),up=e=>{var i;e.length===1&&((i=e[0])==null?void 0:i.constructor)===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const s=e[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)t.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const s=e[r];s instanceof Symbol||n.push(s)}return n},cp={[Wc]:Qe("font-weight","bold"),[jc]:Qe("font-weight","normal"),[rp]:Qe("color","blue"),[sp]:Qe("color","green"),[ip]:Qe("color","grey"),[qc]:Qe("color","red"),[op]:Qe("color","purple"),[fo]:Qe("color","orange"),[ap]:Qe("color","black")},lp=e=>{var o;e.length===1&&((o=e[0])==null?void 0:o.constructor)===Function&&(e=e[0]());const t=[],n=[],r=Oe();let i=[],s=0;for(;s<e.length;s++){const a=e[s],u=cp[a];if(u!==void 0)r.set(u.left,u.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const c=ep(r);s>0||c.length>0?(t.push("%c"+a),n.push(c)):t.push(a)}else break}}for(s>0&&(i=n,i.unshift(t.join("")));s<e.length;s++){const a=e[s];a instanceof Symbol||i.push(a)}return i},Gc=W0?lp:up,dp=(...e)=>{console.log(...Gc(e)),Xc.forEach(t=>t.print(e))},Kc=(...e)=>{console.warn(...Gc(e)),e.unshift(fo),Xc.forEach(t=>t.print(e))},Xc=vt(),Qc=e=>({[Symbol.iterator](){return this},next:e}),hp=(e,t)=>Qc(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Ui=(e,t)=>Qc(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});class po{constructor(t,n){this.clock=t,this.len=n}}class mn{constructor(){this.clients=new Map}}const Et=(e,t,n)=>t.clients.forEach((r,i)=>{const s=e.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],a=o.id.clock+o.length;for(let u=0,c=r[u];u<r.length&&c.clock<a;c=r[++u])dl(e,s,c.clock,c.len,n)}}),fp=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const i=rt((n+r)/2),s=e[i],o=s.clock;if(o<=t){if(t<o+s.len)return i;n=i+1}else r=i-1}return null},gn=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&fp(n,t.clock)!==null},mo=e=>{e.clients.forEach(t=>{t.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<t.length;n++){const i=t[r-1],s=t[n];i.clock+i.len>=s.clock?i.len=He(i.len,s.clock+s.len-i.clock):(r<n&&(t[r]=s),r++)}t.length=r})},Ss=e=>{const t=new mn;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){const s=r.slice();for(let o=n+1;o<e.length;o++)qf(s,e[o].clients.get(i)||[]);t.clients.set(i,s)}});return mo(t),t},jn=(e,t,n,r)=>{Ke(e.clients,t,()=>[]).push(new po(n,r))},Jc=()=>new mn,Zc=e=>{const t=Jc();return e.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const a=o.id.clock;let u=o.length;if(s+1<n.length)for(let c=n[s+1];s+1<n.length&&c.deleted;c=n[++s+1])u+=c.length;i.push(new po(a,u))}}i.length>0&&t.clients.set(r,i)}),t},bn=(e,t)=>{H(e.restEncoder,t.clients.size),gt(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),H(e.restEncoder,n);const i=r.length;H(e.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];e.writeDsClock(o.clock),e.writeDsLen(o.len)}})},go=e=>{const t=new mn,n=U(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();const i=U(e.restDecoder),s=U(e.restDecoder);if(s>0){const o=Ke(t.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new po(e.readDsClock(),e.readDsLen()))}}return t},ya=(e,t,n)=>{const r=new mn,i=U(e.restDecoder);for(let s=0;s<i;s++){e.resetDsCurVal();const o=U(e.restDecoder),a=U(e.restDecoder),u=n.clients.get(o)||[],c=Q(n,o);for(let h=0;h<a;h++){const d=e.readDsClock(),f=d+e.readDsLen();if(d<c){c<f&&jn(r,o,c,f-c);let p=Re(u,d),m=u[p];for(!m.deleted&&m.id.clock<d&&(u.splice(p+1,0,Kr(t,m,d-m.id.clock)),p++);p<u.length&&(m=u[p++],m.id.clock<f);)m.deleted||(f<m.id.clock+m.length&&u.splice(p,0,Kr(t,m,f-m.id.clock)),m.delete(t))}else jn(r,o,d,f-d)}}if(r.clients.size>0){const s=new Pt;return H(s.restEncoder,0),bn(s,r),s.toUint8Array()}return null},el=Uc;class _t extends Rc{constructor({guid:t=L0(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=el(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new cl,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Ea(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const u=()=>Ea(c=>{const h=d=>{(d===void 0||d===!0)&&(this.off("sync",h),c())};this.on("sync",h)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=u()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=u()}load(){const t=this._item;t!==null&&!this.shouldLoad&&W(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(gt(this.subdocs).map(t=>t.guid))}transact(t,n=null){return W(this,t,n)}get(t,n=ue){const r=Ke(this.share,t,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==ue&&i!==n)if(i===ue){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(t,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,en)}getText(t=""){return this.get(t,Tt)}getMap(t=""){return this.get(t,ln)}getXmlElement(t=""){return this.get(t,le)}getXmlFragment(t=""){return this.get(t,Bt)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,gt(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new _t({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,W(t.parent.doc,r=>{const i=n.doc;t.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class tl{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return U(this.restDecoder)}readDsLen(){return U(this.restDecoder)}}class nl extends tl{readLeftID(){return O(U(this.restDecoder),U(this.restDecoder))}readRightID(){return O(U(this.restDecoder),U(this.restDecoder))}readClient(){return U(this.restDecoder)}readInfo(){return an(this.restDecoder)}readString(){return Qt(this.restDecoder)}readParentInfo(){return U(this.restDecoder)===1}readTypeRef(){return U(this.restDecoder)}readLen(){return U(this.restDecoder)}readAny(){return Wn(this.restDecoder)}readBuf(){return X0(we(this.restDecoder))}readJSON(){return JSON.parse(Qt(this.restDecoder))}readKey(){return Qt(this.restDecoder)}}class pp{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=U(this.restDecoder),this.dsCurrVal}readDsLen(){const t=U(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class cn extends pp{constructor(t){super(t),this.keys=[],U(t),this.keyClockDecoder=new Bi(we(t)),this.clientDecoder=new Rr(we(t)),this.leftClockDecoder=new Bi(we(t)),this.rightClockDecoder=new Bi(we(t)),this.infoDecoder=new ba(we(t),an),this.stringDecoder=new w0(we(t)),this.parentInfoDecoder=new ba(we(t),an),this.typeRefDecoder=new Rr(we(t)),this.lenDecoder=new Rr(we(t))}readLeftID(){return new Jt(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Jt(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Wn(this.restDecoder)}readBuf(){return we(this.restDecoder)}readJSON(){return Wn(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class rl{constructor(){this.restEncoder=or()}toUint8Array(){return Be(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){H(this.restEncoder,t)}writeDsLen(t){H(this.restEncoder,t)}}class ar extends rl{writeLeftID(t){H(this.restEncoder,t.client),H(this.restEncoder,t.clock)}writeRightID(t){H(this.restEncoder,t.client),H(this.restEncoder,t.clock)}writeClient(t){H(this.restEncoder,t)}writeInfo(t){As(this.restEncoder,t)}writeString(t){Xt(this.restEncoder,t)}writeParentInfo(t){H(this.restEncoder,t?1:0)}writeTypeRef(t){H(this.restEncoder,t)}writeLen(t){H(this.restEncoder,t)}writeAny(t){on(this.restEncoder,t)}writeBuf(t){ke(this.restEncoder,t)}writeJSON(t){Xt(this.restEncoder,JSON.stringify(t))}writeKey(t){Xt(this.restEncoder,t)}}class il{constructor(){this.restEncoder=or(),this.dsCurrVal=0}toUint8Array(){return Be(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,H(this.restEncoder,n)}writeDsLen(t){t===0&&Ie(),H(this.restEncoder,t-1),this.dsCurrVal+=t}}class Pt extends il{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Pi,this.clientEncoder=new Or,this.leftClockEncoder=new Pi,this.rightClockEncoder=new Pi,this.infoEncoder=new pa(As),this.stringEncoder=new g0,this.parentInfoEncoder=new pa(As),this.typeRefEncoder=new Or,this.lenEncoder=new Or}toUint8Array(){const t=or();return H(t,0),ke(t,this.keyClockEncoder.toUint8Array()),ke(t,this.clientEncoder.toUint8Array()),ke(t,this.leftClockEncoder.toUint8Array()),ke(t,this.rightClockEncoder.toUint8Array()),ke(t,Be(this.infoEncoder)),ke(t,this.stringEncoder.toUint8Array()),ke(t,Be(this.parentInfoEncoder)),ke(t,this.typeRefEncoder.toUint8Array()),ke(t,this.lenEncoder.toUint8Array()),hi(t,Be(this.restEncoder)),Be(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){on(this.restEncoder,t)}writeBuf(t){ke(this.restEncoder,t)}writeJSON(t){on(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(n)}}const mp=(e,t,n,r)=>{r=He(r,t[0].id.clock);const i=Re(t,r);H(e.restEncoder,t.length-i),e.writeClient(n),H(e.restEncoder,r);const s=t[i];s.write(e,r-s.id.clock);for(let o=i+1;o<t.length;o++)t[o].write(e,0)},bo=(e,t,n)=>{const r=new Map;n.forEach((i,s)=>{Q(t,s)>i&&r.set(s,i)}),ur(t).forEach((i,s)=>{n.has(s)||r.set(s,0)}),H(e.restEncoder,r.size),gt(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{mp(e,t.clients.get(i),i,s)})},gp=(e,t)=>{const n=Oe(),r=U(e.restDecoder);for(let i=0;i<r;i++){const s=U(e.restDecoder),o=new Array(s),a=e.readClient();let u=U(e.restDecoder);n.set(a,{i:0,refs:o});for(let c=0;c<s;c++){const h=e.readInfo();switch(di&h){case 0:{const d=e.readLen();o[c]=new Le(O(a,u),d),u+=d;break}case 10:{const d=U(e.restDecoder);o[c]=new De(O(a,u),d),u+=d;break}default:{const d=(h&(nt|pe))===0,f=new $(O(a,u),null,(h&pe)===pe?e.readLeftID():null,null,(h&nt)===nt?e.readRightID():null,d?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,d&&(h&zn)===zn?e.readString():null,Rl(e,h));o[c]=f,u+=f.length}}}}return n},bp=(e,t,n)=>{const r=[];let i=gt(n.keys()).sort((p,m)=>p-m);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let p=n.get(i[i.length-1]);for(;p.refs.length===p.i;)if(i.pop(),i.length>0)p=n.get(i[i.length-1]);else return null;return p};let o=s();if(o===null)return null;const a=new cl,u=new Map,c=(p,m)=>{const T=u.get(p);(T==null||T>m)&&u.set(p,m)};let h=o.refs[o.i++];const d=new Map,f=()=>{for(const p of r){const m=p.id.client,T=n.get(m);T?(T.i--,a.clients.set(m,T.refs.slice(T.i)),n.delete(m),T.i=0,T.refs=[]):a.clients.set(m,[p]),i=i.filter(_=>_!==m)}r.length=0};for(;;){if(h.constructor!==De){const m=Ke(d,h.id.client,()=>Q(t,h.id.client))-h.id.clock;if(m<0)r.push(h),c(h.id.client,h.id.clock-1),f();else{const T=h.getMissing(e,t);if(T!==null){r.push(h);const _=n.get(T)||{refs:[],i:0};if(_.refs.length===_.i)c(T,Q(t,T)),f();else{h=_.refs[_.i++];continue}}else(m===0||m<h.length)&&(h.integrate(e,m),d.set(h.id.client,h.id.clock+h.length))}}if(r.length>0)h=r.pop();else if(o!==null&&o.i<o.refs.length)h=o.refs[o.i++];else{if(o=s(),o===null)break;h=o.refs[o.i++]}}if(a.clients.size>0){const p=new Pt;return bo(p,a,new Map),H(p.restEncoder,0),{missing:u,update:p.toUint8Array()}}return null},Ep=(e,t)=>bo(e,t.doc.store,t.beforeState),Tp=(e,t,n,r=new cn(e))=>W(t,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,u=gp(r,o),c=bp(i,a,u),h=a.pendingStructs;if(h){for(const[f,p]of h.missing)if(p<Q(a,f)){s=!0;break}if(c){for(const[f,p]of c.missing){const m=h.missing.get(f);(m==null||m>p)&&h.missing.set(f,p)}h.update=$r([h.update,c.update])}}else a.pendingStructs=c;const d=ya(r,i,a);if(a.pendingDs){const f=new cn(pn(a.pendingDs));U(f.restDecoder);const p=ya(f,i,a);d&&p?a.pendingDs=$r([d,p]):a.pendingDs=d||p}else a.pendingDs=d;if(s){const f=a.pendingStructs.update;a.pendingStructs=null,zr(i.doc,f)}},n,!1),zr=(e,t,n,r=cn)=>{const i=pn(t);Tp(i,e,n,new r(i))},_a=(e,t,n)=>zr(e,t,n,nl),Cp=(e,t,n=new Map)=>{bo(e,t.store,n),bn(e,Zc(t.store))},yp=(e,t=new Uint8Array([0]),n=new Pt)=>{const r=sl(t);Cp(n,e,r);const i=[n.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(Fp(e.store.pendingStructs.update,t)),i.length>1){if(n.constructor===ar)return Up(i.map((s,o)=>o===0?s:Yp(s)));if(n.constructor===Pt)return $r(i)}return i[0]},Aa=(e,t)=>yp(e,t,new ar),_p=e=>{const t=new Map,n=U(e.restDecoder);for(let r=0;r<n;r++){const i=U(e.restDecoder),s=U(e.restDecoder);t.set(i,s)}return t},sl=e=>_p(new tl(pn(e))),ol=(e,t)=>(H(e.restEncoder,t.size),gt(t.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{H(e.restEncoder,n),H(e.restEncoder,r)}),e),Ap=(e,t)=>ol(e,ur(t.store)),kp=(e,t=new il)=>(e instanceof Map?ol(t,e):Ap(t,e),t.toUint8Array()),wp=e=>kp(e,new rl);class Sp{constructor(){this.l=[]}}const ka=()=>new Sp,wa=(e,t)=>e.l.push(t),Sa=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(i=>t!==i),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},al=(e,t,n)=>lo(e.l,[t,n]);class Jt{constructor(t,n){this.client=t,this.clock=n}}const qt=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,O=(e,t)=>new Jt(e,t),qn=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Ie()},Gn=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};class Kn{constructor(t,n,r,i=0){this.type=t,this.tname=n,this.item=r,this.assoc=i}}const Dn=e=>new Kn(e.type==null?null:O(e.type.client,e.type.clock),e.tname??null,e.item==null?null:O(e.item.client,e.item.clock),e.assoc==null?0:e.assoc);class Ip{constructor(t,n,r=0){this.type=t,this.index=n,this.assoc=r}}const xp=(e,t,n=0)=>new Ip(e,t,n),br=(e,t,n)=>{let r=null,i=null;return e._item===null?i=qn(e):r=O(e._item.id.client,e._item.id.clock),new Kn(r,i,t,n)},Hi=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return br(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return br(e,O(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return br(e,r.lastId,n);r=r.right}return br(e,null,n)},Np=(e,t)=>{const n=Zt(e,t),r=t.clock-n.id.clock;return{item:n,diff:r}},Lp=(e,t,n=!0)=>{const r=t.store,i=e.item,s=e.type,o=e.tname,a=e.assoc;let u=null,c=0;if(i!==null){if(Q(r,i.client)<=i.clock)return null;const h=n?Ls(r,i):Np(r,i),d=h.item;if(!(d instanceof $))return null;if(u=d.parent,u._item===null||!u._item.deleted){c=d.deleted||!d.countable?0:h.diff+(a>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(c+=f.length),f=f.left}}else{if(o!==null)u=t.get(o);else if(s!==null){if(Q(r,s.client)<=s.clock)return null;const{item:h}=n?Ls(r,s):{item:Zt(r,s)};if(h instanceof $&&h.content instanceof Ve)u=h.content.type;else return null}else throw Ie();a>=0?c=u._length:c=0}return xp(u,c,e.assoc)},Ia=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&qt(e.item,t.item)&&qt(e.type,t.type)&&e.assoc===t.assoc;class Eo{constructor(t,n){this.ds=t,this.sv=n}}const ul=(e,t)=>new Eo(e,t),Fi=e=>ul(Zc(e.store),ur(e.store)),St=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!gn(t.ds,e.id),Is=(e,t)=>{const n=Ke(e.meta,Is,vt),r=e.doc.store;n.has(t)||(t.sv.forEach((i,s)=>{i<Q(r,s)&&Ee(e,O(s,i))}),Et(e,t.ds,i=>{}),n.add(t))};class cl{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const ur=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const i=n[n.length-1];t.set(r,i.id.clock+i.length)}),t},Q=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},ll=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw Ie()}n.push(t)},Re=(e,t)=>{let n=0,r=e.length-1,i=e[r],s=i.id.clock;if(s===t)return r;let o=rt(t/(s+i.length-1)*r);for(;n<=r;){if(i=e[o],s=i.id.clock,s<=t){if(t<s+i.length)return o;n=o+1}else r=o-1;o=rt((n+r)/2)}throw Ie()},Dp=(e,t)=>{const n=e.clients.get(t.client);return n[Re(n,t.clock)]},Zt=Dp,xs=(e,t,n)=>{const r=Re(t,n),i=t[r];return i.id.clock<n&&i instanceof $?(t.splice(r+1,0,Kr(e,i,n-i.id.clock)),r+1):r},Ee=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[xs(e,n,t.clock)]},xa=(e,t,n)=>{const r=t.clients.get(n.client),i=Re(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Le&&r.splice(i+1,0,Kr(e,s,n.clock-s.id.clock+1)),s},Op=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Re(r,t.id.clock)]=n},dl=(e,t,n,r,i)=>{if(r===0)return;const s=n+r;let o=xs(e,t,n),a;do a=t[o++],s<a.id.clock+a.length&&xs(e,t,s),i(a);while(o<t.length&&t[o].id.clock<s)};class Rp{constructor(t,n,r){this.doc=t,this.deleteSet=new mn,this.beforeState=ur(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Na=(e,t)=>t.deleteSet.clients.size===0&&!jf(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(mo(t.deleteSet),Ep(e,t),bn(e,t.deleteSet),!0),La=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ke(e.changed,t,vt).add(n)},Mr=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof $&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=t-i;return s&&e.splice(t+1-s,s),s},Mp=(e,t,n)=>{for(const[r,i]of e.clients.entries()){const s=t.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],u=a.clock+a.len;for(let c=Re(s,a.clock),h=s[c];c<s.length&&h.id.clock<u;h=s[++c]){const d=s[c];if(a.clock+a.len<=d.id.clock)break;d instanceof $&&d.deleted&&!d.keep&&n(d)&&d.gc(t,!1)}}}},vp=(e,t)=>{e.clients.forEach((n,r)=>{const i=t.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=tt(i.length-1,1+Re(i,o.clock+o.len-1));for(let u=a,c=i[u];u>0&&c.id.clock>=o.clock;c=i[u])u-=1+Mr(i,u)}})},hl=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{mo(s),n.afterState=ur(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((u,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,u)})),a.push(()=>{n.changedParentTypes.forEach((u,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(u=u.filter(h=>h.target._item===null||!h.target._item.deleted),u.forEach(h=>{h.currentTarget=c,h._path=null}),u.sort((h,d)=>h.path.length-d.path.length),al(c._dEH,u,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),lo(a,[]),n._needFormattingCleanup&&nm(n)}finally{r.gc&&Mp(s,i,r.gcFilter),vp(s,i),n.afterState.forEach((h,d)=>{const f=n.beforeState.get(d)||0;if(f!==h){const p=i.clients.get(d),m=He(Re(p,f),1);for(let T=p.length-1;T>=m;)T-=1+Mr(p,T)}});for(let h=o.length-1;h>=0;h--){const{client:d,clock:f}=o[h].id,p=i.clients.get(d),m=Re(p,f);m+1<p.length&&Mr(p,m+1)>1||m>0&&Mr(p,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(dp(fo,Wc,"[yjs] ",jc,qc,"Changed the client-id because another client seems to be using it."),r.clientID=el()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const h=new ar;Na(h,n)&&r.emit("update",[h.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const h=new Pt;Na(h,n)&&r.emit("updateV2",[h.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:u,subdocsRemoved:c}=n;(a.size>0||c.size>0||u.size>0)&&(a.forEach(h=>{h.clientID=r.clientID,h.collectionid==null&&(h.collectionid=r.collectionid),r.subdocs.add(h)}),c.forEach(h=>r.subdocs.delete(h)),r.emit("subdocs",[{loaded:u,added:a,removed:c},r,n]),c.forEach(h=>h.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):hl(e,t+1)}}},W=(e,t,n=null,r=!0)=>{const i=e._transactionCleanups;let s=!1,o=null;e._transaction===null&&(s=!0,e._transaction=new Rp(e,n,r),i.push(e._transaction),i.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(s){const a=e._transaction===i[0];e._transaction=null,a&&hl(i,0)}}return o};class Pp{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const Da=(e,t,n)=>{Et(e,n.deletions,r=>{r instanceof $&&t.scope.some(i=>i===e.doc||Gn(i,r))&&So(r,!1)})},Oa=(e,t,n)=>{let r=null;const i=e.doc,s=e.scope;W(i,a=>{for(;t.length>0&&e.currStackItem===null;){const u=i.store,c=t.pop(),h=new Set,d=[];let f=!1;Et(a,c.insertions,p=>{if(p instanceof $){if(p.redone!==null){let{item:m,diff:T}=Ls(u,p.id);T>0&&(m=Ee(a,O(m.id.client,m.id.clock+T))),p=m}!p.deleted&&s.some(m=>m===a.doc||Gn(m,p))&&d.push(p)}}),Et(a,c.deletions,p=>{p instanceof $&&s.some(m=>m===a.doc||Gn(m,p))&&!gn(c.insertions,p.id)&&h.add(p)}),h.forEach(p=>{f=Ol(a,p,h,c.insertions,e.ignoreRemoteMapChanges,e)!==null||f});for(let p=d.length-1;p>=0;p--){const m=d[p];e.deleteFilter(m)&&(m.delete(a),f=!0)}e.currStackItem=f?c:null}a.changed.forEach((u,c)=>{u.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},e);const o=e.currStackItem;if(o!=null){const a=r.changedParentTypes;e.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:e},e]),e.currStackItem=null}return o};class fl extends Rc{constructor(t,{captureTimeout:n=500,captureTransaction:r=u=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=ys(t)?t[0].doc:t instanceof _t?t:t.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(t),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=u=>{if(!this.captureTransaction(u)||!this.scope.some(_=>u.changedParentTypes.has(_)||_===this.doc)||!this.trackedOrigins.has(u.origin)&&(!u.origin||!this.trackedOrigins.has(u.origin.constructor)))return;const c=this.undoing,h=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():h||this.clear(!1,!0);const f=new mn;u.afterState.forEach((_,C)=>{const x=u.beforeState.get(C)||0,I=_-x;I>0&&jn(f,C,x,I)});const p=D0();let m=!1;if(this.lastChange>0&&p-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!h){const _=d[d.length-1];_.deletions=Ss([_.deletions,u.deleteSet]),_.insertions=Ss([_.insertions,f])}else d.push(new Pp(u.deleteSet,f)),m=!0;!c&&!h&&(this.lastChange=p),Et(u,u.deleteSet,_=>{_ instanceof $&&this.scope.some(C=>C===u.doc||Gn(C,_))&&So(_,!0)});const T=[{stackItem:d[d.length-1],origin:u.origin,type:c?"redo":"undo",changedParentTypes:u.changedParentTypes},this];m?this.emit("stack-item-added",T):this.emit("stack-item-updated",T)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=ys(t)?t:[t],t.forEach(r=>{n.has(r)||(n.add(r),(r instanceof ue?r.doc!==this.doc:r!==this.doc)&&Kc("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){(t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{t&&(this.undoStack.forEach(i=>Da(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>Da(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Oa(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Oa(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Bp(e){const t=U(e.restDecoder);for(let n=0;n<t;n++){const r=U(e.restDecoder),i=e.readClient();let s=U(e.restDecoder);for(let o=0;o<r;o++){const a=e.readInfo();if(a===10){const u=U(e.restDecoder);yield new De(O(i,s),u),s+=u}else if(di&a){const u=(a&(nt|pe))===0,c=new $(O(i,s),null,(a&pe)===pe?e.readLeftID():null,null,(a&nt)===nt?e.readRightID():null,u?e.readParentInfo()?e.readString():e.readLeftID():null,u&&(a&zn)===zn?e.readString():null,Rl(e,a));yield c,s+=c.length}else{const u=e.readLen();yield new Le(O(i,s),u),s+=u}}}}class To{constructor(t,n){this.gen=Bp(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===De);return this.curr}}class Co{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const Up=e=>$r(e,nl,ar),Hp=(e,t)=>{if(e.constructor===Le){const{client:n,clock:r}=e.id;return new Le(O(n,r+t),e.length-t)}else if(e.constructor===De){const{client:n,clock:r}=e.id;return new De(O(n,r+t),e.length-t)}else{const n=e,{client:r,clock:i}=n.id;return new $(O(r,i+t),null,O(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},$r=(e,t=cn,n=Pt)=>{if(e.length===1)return e[0];const r=e.map(h=>new t(pn(h)));let i=r.map(h=>new To(h,!0)),s=null;const o=new n,a=new Co(o);for(;i=i.filter(f=>f.curr!==null),i.sort((f,p)=>{if(f.curr.id.client===p.curr.id.client){const m=f.curr.id.clock-p.curr.id.clock;return m===0?f.curr.constructor===p.curr.constructor?0:f.curr.constructor===De?1:-1:m}else return p.curr.id.client-f.curr.id.client}),i.length!==0;){const h=i[0],d=h.curr.id.client;if(s!==null){let f=h.curr,p=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=h.next(),p=!0;if(f===null||f.id.client!==d||p&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)ct(a,s.struct,s.offset),s={struct:f,offset:0},h.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===De)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{ct(a,s.struct,s.offset);const m=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new De(O(d,s.struct.id.clock+s.struct.length),m),offset:0}}else{const m=s.struct.id.clock+s.struct.length-f.id.clock;m>0&&(s.struct.constructor===De?s.struct.length-=m:f=Hp(f,m)),s.struct.mergeWith(f)||(ct(a,s.struct,s.offset),s={struct:f,offset:0},h.next())}}else s={struct:h.curr,offset:0},h.next();for(let f=h.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==De;f=h.next())ct(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(ct(a,s.struct,s.offset),s=null),yo(a);const u=r.map(h=>go(h)),c=Ss(u);return bn(o,c),o.toUint8Array()},Fp=(e,t,n=cn,r=Pt)=>{const i=sl(t),s=new r,o=new Co(s),a=new n(pn(e)),u=new To(a,!1);for(;u.curr;){const h=u.curr,d=h.id.client,f=i.get(d)||0;if(u.curr.constructor===De){u.next();continue}if(h.id.clock+h.length>f)for(ct(o,h,He(f-h.id.clock,0)),u.next();u.curr&&u.curr.id.client===d;)ct(o,u.curr,0),u.next();else for(;u.curr&&u.curr.id.client===d&&u.curr.id.clock+u.curr.length<=f;)u.next()}yo(o);const c=go(a);return bn(s,c),s.toUint8Array()},pl=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:Be(e.encoder.restEncoder)}),e.encoder.restEncoder=or(),e.written=0)},ct=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&pl(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),H(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},yo=e=>{pl(e);const t=e.encoder.restEncoder;H(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const r=e.clientStructs[n];H(t,r.written),hi(t,r.restEncoder)}},Vp=(e,t,n,r)=>{const i=new n(pn(e)),s=new To(i,!1),o=new r,a=new Co(o);for(let c=s.curr;c!==null;c=s.next())ct(a,t(c),0);yo(a);const u=go(i);return bn(o,u),o.toUint8Array()},Yp=e=>Vp(e,V0,cn,ar),Ra="You must not compute changes after the event-handler fired.";class pi{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=zp(this.currentTarget,this.target))}deletes(t){return gn(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw bt(Ra);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let u=s.left;for(;u!==null&&this.adds(u);)u=u.left;if(this.deletes(s))if(u!==null&&this.deletes(u))o="delete",a=Ri(u.content.getContent());else return;else u!==null&&this.deletes(u)?(o="update",a=Ri(u.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=Ri(s.content.getContent());else return;t.set(i,{action:o,oldValue:a})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw bt(Ra);const n=this.target,r=vt(),i=vt(),s=[];if(t={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const u=()=>{a&&s.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(u(),a={delete:0}),a.delete+=c.length,i.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(u(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(u(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&u()}this._changes=t}return t}}const zp=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,i=t._item.parent._start;for(;i!==t._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}t=t._item.parent}return n},he=()=>{Kc("Invalid access: Add Yjs type to a document before reading data.")},ml=80;let _o=0;class $p{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=_o++}}const Wp=e=>{e.timestamp=_o++},gl=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=_o++},jp=(e,t,n)=>{if(e.length>=ml){const r=e.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return gl(r,t,n),r}else{const r=new $p(t,n);return e.push(r),r}},mi=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((s,o)=>Dr(t-s.index)<Dr(t-o.index)?s:o);let r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,Wp(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&Dr(n.index-i)<r.parent.length/ml?(gl(n,r,i),n):jp(e._searchMarker,r,i)},Xn=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const i=e[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){e.splice(r,1);continue}i.p=s,s.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=He(t,i.index+n))}},gi=(e,t,n)=>{const r=e,i=t.changedParentTypes;for(;Ke(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;al(r._eH,n,t)};class ue{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=ka(),this._dEH=ka(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw Ue()}clone(){throw Ue()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){wa(this._eH,t)}observeDeep(t){wa(this._dEH,t)}unobserve(t){Sa(this._eH,t)}unobserveDeep(t){Sa(this._dEH,t)}toJSON(){}}const bl=(e,t,n)=>{e.doc??he(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const i=[];let s=e._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=t)t-=o.length;else{for(let a=t;a<o.length&&r>0;a++)i.push(o[a]),r--;t=0}}s=s.right}return i},El=e=>{e.doc??he();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)t.push(r[i])}n=n.right}return t},Tl=(e,t)=>{const n=[];let r=e._start;for(;r!==null;){if(r.countable&&St(r,t)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Qn=(e,t)=>{let n=0,r=e._start;for(e.doc??he();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)t(i[s],n++,e)}r=r.right}},Cl=(e,t)=>{const n=[];return Qn(e,(r,i)=>{n.push(t(r,i,e))}),n},qp=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},yl=(e,t)=>{e.doc??he();const n=mi(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Wr=(e,t,n,r)=>{let i=n;const s=e.doc,o=s.clientID,a=s.store,u=n===null?t._start:n.right;let c=[];const h=()=>{c.length>0&&(i=new $(O(o,Q(a,o)),i,i&&i.lastId,u,u&&u.id,t,null,new Ut(c)),i.integrate(e,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(h(),d.constructor){case Uint8Array:case ArrayBuffer:i=new $(O(o,Q(a,o)),i,i&&i.lastId,u,u&&u.id,t,null,new cr(new Uint8Array(d))),i.integrate(e,0);break;case _t:i=new $(O(o,Q(a,o)),i,i&&i.lastId,u,u&&u.id,t,null,new lr(d)),i.integrate(e,0);break;default:if(d instanceof ue)i=new $(O(o,Q(a,o)),i,i&&i.lastId,u,u&&u.id,t,null,new Ve(d)),i.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},_l=()=>bt("Length exceeded!"),Al=(e,t,n,r)=>{if(n>t._length)throw _l();if(n===0)return t._searchMarker&&Xn(t._searchMarker,n,r.length),Wr(e,t,null,r);const i=n,s=mi(t,n);let o=t._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Ee(e,O(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Xn(t._searchMarker,i,r.length),Wr(e,t,o,r)},Gp=(e,t,n)=>{let i=(t._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:t._start}).p;if(i)for(;i.right;)i=i.right;return Wr(e,t,i,n)},kl=(e,t,n,r)=>{if(r===0)return;const i=n,s=r,o=mi(t,n);let a=t._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Ee(e,O(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Ee(e,O(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw _l();t._searchMarker&&Xn(t._searchMarker,i,-s+r)},jr=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Ao=(e,t,n,r)=>{const i=t._map.get(n)||null,s=e.doc,o=s.clientID;let a;if(r==null)a=new Ut([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Ut([r]);break;case Uint8Array:a=new cr(r);break;case _t:a=new lr(r);break;default:if(r instanceof ue)a=new Ve(r);else throw new Error("Unexpected content type")}new $(O(o,Q(s.store,o)),i,i&&i.lastId,null,null,t,n,a).integrate(e,0)},ko=(e,t)=>{e.doc??he();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},wl=e=>{const t={};return e.doc??he(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},Sl=(e,t)=>{e.doc??he();const n=e._map.get(t);return n!==void 0&&!n.deleted},Kp=(e,t)=>{const n={};return e._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!t.sv.has(s.id.client)||s.id.clock>=(t.sv.get(s.id.client)||0));)s=s.left;s!==null&&St(s,t)&&(n[i]=s.content.getContent()[s.length-1])}),n},Er=e=>(e.doc??he(),hp(e._map.entries(),t=>!t[1].deleted));class Xp extends pi{}class en extends ue{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new en;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new en}clone(){const t=new en;return t.insert(0,this.toArray().map(n=>n instanceof ue?n.clone():n)),t}get length(){return this.doc??he(),this._length}_callObserver(t,n){super._callObserver(t,n),gi(this,t,new Xp(this,t))}insert(t,n){this.doc!==null?W(this.doc,r=>{Al(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?W(this.doc,n=>{Gp(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?W(this.doc,r=>{kl(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return yl(this,t)}toArray(){return El(this)}slice(t=0,n=this.length){return bl(this,t,n)}toJSON(){return this.map(t=>t instanceof ue?t.toJSON():t)}map(t){return Cl(this,t)}forEach(t){Qn(this,t)}[Symbol.iterator](){return qp(this)}_write(t){t.writeTypeRef(ym)}}const Qp=e=>new en;class Jp extends pi{constructor(t,n,r){super(t,n),this.keysChanged=r}}class ln extends ue{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new ln}clone(){const t=new ln;return this.forEach((n,r)=>{t.set(r,n instanceof ue?n.clone():n)}),t}_callObserver(t,n){gi(this,t,new Jp(this,t,n))}toJSON(){this.doc??he();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];t[r]=i instanceof ue?i.toJSON():i}}),t}get size(){return[...Er(this)].length}keys(){return Ui(Er(this),t=>t[0])}values(){return Ui(Er(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Ui(Er(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??he(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?W(this.doc,n=>{jr(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?W(this.doc,r=>{Ao(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return ko(this,t)}has(t){return Sl(this,t)}clear(){this.doc!==null?W(this.doc,t=>{this.forEach(function(n,r,i){jr(t,i,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(_m)}}const Zp=e=>new ln,dt=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&H0(e,t);class Ns{constructor(t,n,r,i){this.left=t,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Ie(),this.right.content.constructor){case ee:this.right.deleted||En(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Ma=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case ee:t.right.deleted||En(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&Ee(e,O(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},Tr=(e,t,n,r)=>{const i=new Map,s=r?mi(t,n):null;if(s){const o=new Ns(s.p.left,s.p,s.index,i);return Ma(e,o,n-s.index)}else{const o=new Ns(null,t._start,0,i);return Ma(e,o,n)}},Il=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===ee&&dt(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=e.doc,s=i.clientID;r.forEach((o,a)=>{const u=n.left,c=n.right,h=new $(O(s,Q(i.store,s)),u,u&&u.lastId,c,c&&c.id,t,null,new ee(a,o));h.integrate(e,0),n.right=h,n.forward()})},En=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},xl=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===ee&&dt(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},Nl=(e,t,n,r)=>{const i=e.doc,s=i.clientID,o=new Map;for(const a in r){const u=r[a],c=n.currentAttributes.get(a)??null;if(!dt(c,u)){o.set(a,c);const{left:h,right:d}=n;n.right=new $(O(s,Q(i.store,s)),h,h&&h.lastId,d,d&&d.id,t,null,new ee(a,u)),n.right.integrate(e,0),n.forward()}}return o},Vi=(e,t,n,r,i)=>{n.currentAttributes.forEach((f,p)=>{i[p]===void 0&&(i[p]=null)});const s=e.doc,o=s.clientID;xl(n,i);const a=Nl(e,t,n,i),u=r.constructor===String?new Fe(r):r instanceof ue?new Ve(r):new Ft(r);let{left:c,right:h,index:d}=n;t._searchMarker&&Xn(t._searchMarker,n.index,u.getLength()),h=new $(O(o,Q(s.store,o)),c,c&&c.lastId,h,h&&h.id,t,null,u),h.integrate(e,0),n.right=h,n.index=d,n.forward(),Il(e,t,n,a)},va=(e,t,n,r,i)=>{const s=e.doc,o=s.clientID;xl(n,i);const a=Nl(e,t,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===ee));){if(!n.right.deleted)switch(n.right.content.constructor){case ee:{const{key:u,value:c}=n.right.content,h=i[u];if(h!==void 0){if(dt(h,c))a.delete(u);else{if(r===0)break e;a.set(u,c)}n.right.delete(e)}else n.currentAttributes.set(u,c);break}default:r<n.right.length&&Ee(e,O(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let u="";for(;r>0;r--)u+=`
|
|
7
|
-
`;n.right=new $(O(o,Q(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Fe(u)),n.right.integrate(e,0),n.forward()}Il(e,t,n,a)},Ll=(e,t,n,r,i)=>{let s=t;const o=Oe();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===ee){const c=s.content;o.set(c.key,c)}s=s.right}let a=0,u=!1;for(;t!==s;){if(n===t&&(u=!0),!t.deleted){const c=t.content;switch(c.constructor){case ee:{const{key:h,value:d}=c,f=r.get(h)??null;(o.get(h)!==c||f===d)&&(t.delete(e),a++,!u&&(i.get(h)??null)===d&&f!==d&&(f===null?i.delete(h):i.set(h,f))),!u&&!t.deleted&&En(i,c);break}}}t=t.right}return a},em=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===ee){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},tm=e=>{let t=0;return W(e.doc,n=>{let r=e._start,i=e._start,s=Oe();const o=Cs(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case ee:En(o,i.content);break;default:t+=Ll(n,r,i,s,o),s=Cs(o),r=i;break}i=i.right}}),t},nm=e=>{const t=new Set,n=e.doc;for(const[r,i]of e.afterState.entries()){const s=e.beforeState.get(r)||0;i!==s&&dl(e,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===ee&&o.constructor!==Le&&t.add(o.parent)})}W(n,r=>{Et(e,e.deleteSet,i=>{if(i instanceof Le||!i.parent._hasFormatting||t.has(i.parent))return;const s=i.parent;i.content.constructor===ee?t.add(s):em(r,i)});for(const i of t)tm(i)})},Pa=(e,t,n)=>{const r=n,i=Cs(t.currentAttributes),s=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Ve:case Ft:case Fe:n<t.right.length&&Ee(e,O(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}s&&Ll(e,s,t.right,i,t.currentAttributes);const o=(t.left||t.right).parent;return o._searchMarker&&Xn(o._searchMarker,t.index,-r+n),t};class rm extends pi{constructor(t,n,r){super(t,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){const t=this.target.doc,n=[];W(t,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const u={};let c="",h=0,d=0;const f=()=>{if(a!==null){let p=null;switch(a){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(p={insert:c},i.size>0&&(p.attributes={},i.forEach((m,T)=>{m!==null&&(p.attributes[T]=m)}))),c="";break;case"retain":h>0&&(p={retain:h},B0(u)||(p.attributes=v0({},u))),h=0;break}p&&n.push(p),a=null}};for(;o!==null;){switch(o.content.constructor){case Ve:case Ft:this.adds(o)?this.deletes(o)||(f(),a="insert",c=o.content.getContent()[0],f()):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=1):o.deleted||(a!=="retain"&&(f(),a="retain"),h+=1);break;case Fe:this.adds(o)?this.deletes(o)||(a!=="insert"&&(f(),a="insert"),c+=o.content.str):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=o.length):o.deleted||(a!=="retain"&&(f(),a="retain"),h+=o.length);break;case ee:{const{key:p,value:m}=o.content;if(this.adds(o)){if(!this.deletes(o)){const T=i.get(p)??null;dt(T,m)?m!==null&&o.delete(r):(a==="retain"&&f(),dt(m,s.get(p)??null)?delete u[p]:u[p]=m)}}else if(this.deletes(o)){s.set(p,m);const T=i.get(p)??null;dt(T,m)||(a==="retain"&&f(),u[p]=T)}else if(!o.deleted){s.set(p,m);const T=u[p];T!==void 0&&(dt(T,m)?T!==null&&o.delete(r):(a==="retain"&&f(),m===null?delete u[p]:u[p]=m))}o.deleted||(a==="insert"&&f(),En(i,o.content));break}}o=o.right}for(f();n.length>0;){const p=n[n.length-1];if(p.retain!==void 0&&p.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Tt extends ue{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??he(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Tt}clone(){const t=new Tt;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new rm(this,t,n);gi(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??he();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Fe&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?W(this.doc,r=>{const i=new Ns(null,this._start,0,new Map);for(let s=0;s<t.length;s++){const o=t[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===t.length-1&&i.right===null&&o.insert.slice(-1)===`
|
|
8
|
-
`?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&Vi(r,this,i,a,o.attributes||{})}else o.retain!==void 0?va(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Pa(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??he();const i=[],s=new Map,o=this.doc;let a="",u=this._start;function c(){if(a.length>0){const d={};let f=!1;s.forEach((m,T)=>{f=!0,d[T]=m});const p={insert:a};f&&(p.attributes=d),i.push(p),a=""}}const h=()=>{for(;u!==null;){if(St(u,t)||n!==void 0&&St(u,n))switch(u.content.constructor){case Fe:{const d=s.get("ychange");t!==void 0&&!St(u,t)?(d===void 0||d.user!==u.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",u.id):{type:"removed"})):n!==void 0&&!St(u,n)?(d===void 0||d.user!==u.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",u.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),a+=u.content.str;break}case Ve:case Ft:{c();const d={insert:u.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((p,m)=>{f[m]=p})}i.push(d);break}case ee:St(u,t)&&(c(),En(s,u.content));break}u=u.right}c()};return t||n?W(o,d=>{t&&Is(d,t),n&&Is(d,n),h()},"cleanup"):h(),i}insert(t,n,r){if(n.length<=0)return;const i=this.doc;i!==null?W(i,s=>{const o=Tr(s,this,t,!r);r||(r={},o.currentAttributes.forEach((a,u)=>{r[u]=a})),Vi(s,this,o,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const i=this.doc;i!==null?W(i,s=>{const o=Tr(s,this,t,!r);Vi(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?W(r,i=>{Pa(i,Tr(i,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const i=this.doc;i!==null?W(i,s=>{const o=Tr(s,this,t,!1);o.right!==null&&va(s,this,o,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?W(this.doc,n=>{jr(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?W(this.doc,r=>{Ao(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return ko(this,t)}getAttributes(){return wl(this)}_write(t){t.writeTypeRef(Am)}}const im=e=>new Tt;class Yi{constructor(t,n=()=>!0){this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??he()}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===le||n.constructor===Bt)&&n._start!==null)t=n._start;else for(;t!==null;){const r=t.next;if(r!==null){t=r;break}else t.parent===this._root?t=null:t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class Bt extends ue{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Bt}clone(){const t=new Bt;return t.insert(0,this.toArray().map(n=>n instanceof ue?n.clone():n)),t}get length(){return this.doc??he(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Yi(this,t)}querySelector(t){t=t.toUpperCase();const r=new Yi(this,i=>i.nodeName&&i.nodeName.toUpperCase()===t).next();return r.done?null:r.value}querySelectorAll(t){return t=t.toUpperCase(),gt(new Yi(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){gi(this,t,new am(this,n,t))}toString(){return Cl(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const i=t.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Qn(this,s=>{i.insertBefore(s.toDOM(t,n,r),null)}),i}insert(t,n){this.doc!==null?W(this.doc,r=>{Al(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)W(this.doc,r=>{const i=t&&t instanceof ue?t._item:t;Wr(r,this,i,n)});else{const r=this._prelimContent,i=t===null?0:r.findIndex(s=>s===t)+1;if(i===0&&t!==null)throw bt("Reference item not found");r.splice(i,0,...n)}}delete(t,n=1){this.doc!==null?W(this.doc,r=>{kl(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return El(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return yl(this,t)}slice(t=0,n=this.length){return bl(this,t,n)}forEach(t){Qn(this,t)}_write(t){t.writeTypeRef(wm)}}const sm=e=>new Bt;class le extends Bt{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new le(this.nodeName)}clone(){const t=new le(this.nodeName),n=this.getAttributes();return P0(n,(r,i)=>{typeof r=="string"&&t.setAttribute(i,r)}),t.insert(0,this.toArray().map(r=>r instanceof ue?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const a in t)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const u=r[a];n.push(u+'="'+t[u]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(t){this.doc!==null?W(this.doc,n=>{jr(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?W(this.doc,r=>{Ao(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return ko(this,t)}hasAttribute(t){return Sl(this,t)}getAttributes(t){return t?Kp(this,t):wl(this)}toDOM(t=document,n={},r){const i=t.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Qn(this,o=>{i.appendChild(o.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(t){t.writeTypeRef(km),t.writeKey(this.nodeName)}}const om=e=>new le(e.readKey());class am extends pi{constructor(t,n,r){super(t,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class qr extends ln{constructor(t){super(),this.hookName=t}_copy(){return new qr(this.hookName)}clone(){const t=new qr(this.hookName);return this.forEach((n,r)=>{t.set(r,n)}),t}toDOM(t=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(t){t.writeTypeRef(Sm),t.writeKey(this.hookName)}}const um=e=>new qr(e.readKey());class Se extends Tt{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new Se}clone(){const t=new Se;return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,r){const i=t.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(t=>{const n=[];for(const i in t.attributes){const s=[];for(const o in t.attributes[i])s.push({key:o,value:t.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=t.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Im)}}const cm=e=>new Se;class wo{constructor(t,n){this.id=t,this.length=n}get deleted(){throw Ue()}mergeWith(t){return!1}write(t,n,r){throw Ue()}integrate(t,n){throw Ue()}}const lm=0;class Le extends wo{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),ll(t.doc.store,this)}write(t,n){t.writeInfo(lm),t.writeLen(this.length-n)}getMissing(t,n){return null}}class cr{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new cr(this.content)}splice(t){throw Ue()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}}const dm=e=>new cr(e.readBuf());class Jn{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Jn(this.len)}splice(t){const n=new Jn(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){jn(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}}const hm=e=>new Jn(e.readLen()),Dl=(e,t)=>new _t({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class lr{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new lr(Dl(this.doc.guid,this.opts))}splice(t){throw Ue()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const fm=e=>new lr(Dl(e.readString(),e.readAny()));class Ft{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ft(this.embed)}splice(t){throw Ue()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const pm=e=>new Ft(e.readJSON());class ee{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new ee(this.key,this.value)}splice(t){throw Ue()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const mm=e=>new ee(e.readKey(),e.readJSON());class Gr{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Gr(this.arr)}splice(t){const n=new Gr(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];t.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const gm=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++){const i=e.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Gr(n)},bm=Yr("node_env")==="development";class Ut{constructor(t){this.arr=t,bm&&Yc(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ut(this.arr)}splice(t){const n=new Ut(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];t.writeAny(s)}}getRef(){return 8}}const Em=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new Ut(n)};class Fe{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Fe(this.str)}splice(t){const n=new Fe(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const Tm=e=>new Fe(e.readString()),Cm=[Qp,Zp,im,om,sm,um,cm],ym=0,_m=1,Am=2,km=3,wm=4,Sm=5,Im=6;class Ve{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Ve(this.type._copy())}splice(t){throw Ue()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const xm=e=>new Ve(Cm[e.readTypeRef()](e)),Ls=(e,t)=>{let n=t,r=0,i;do r>0&&(n=O(n.client,n.clock+r)),i=Zt(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof $);return{item:i,diff:r}},So=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},Kr=(e,t,n)=>{const{client:r,clock:i}=t.id,s=new $(O(r,i+n),t,O(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&s.markDeleted(),t.keep&&(s.keep=!0),t.redone!==null&&(s.redone=O(t.redone.client,t.redone.clock+n)),t.right=s,s.right!==null&&(s.right.left=s),e._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),t.length=n,s},Ba=(e,t)=>Gf(e,n=>gn(n.deletions,t)),Ol=(e,t,n,r,i,s)=>{const o=e.doc,a=o.store,u=o.clientID,c=t.redone;if(c!==null)return Ee(e,c);let h=t.parent._item,d=null,f;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||Ol(e,h,n,r,i,s)===null))return null;for(;h.redone!==null;)h=Ee(e,h.redone)}const p=h===null?t.parent:h.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let C=d;for(;C!==null&&C.parent._item!==h;)C=C.redone===null?null:Ee(e,C.redone);if(C!==null&&C.parent._item===h){d=C;break}d=d.left}for(;f!==null;){let C=f;for(;C!==null&&C.parent._item!==h;)C=C.redone===null?null:Ee(e,C.redone);if(C!==null&&C.parent._item===h){f=C;break}f=f.right}}else if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||gn(r,d.right.id)||Ba(s.undoStack,d.right.id)||Ba(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Ee(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;const m=Q(a,u),T=O(u,m),_=new $(T,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=T,So(_,!0),_.integrate(e,0),_};class $ extends wo{constructor(t,n,r,i,s,o,a,u){super(t,u.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=u,this.info=this.content.isCountable()?da:0}set marker(t){(this.info&vi)>0!==t&&(this.info^=vi)}get marker(){return(this.info&vi)>0}get keep(){return(this.info&la)>0}set keep(t){this.keep!==t&&(this.info^=la)}get countable(){return(this.info&da)>0}get deleted(){return(this.info&Mi)>0}set deleted(t){this.deleted!==t&&(this.info^=Mi)}markDeleted(){this.info|=Mi}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Q(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Q(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Jt&&this.id.client!==this.parent.client&&this.parent.clock>=Q(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=xa(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Ee(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Le||this.right&&this.right.constructor===Le)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===$?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===$&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Jt){const r=Zt(n,this.parent);r.constructor===Le?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=xa(t,t.doc.store,O(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),qt(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(qt(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Zt(t.doc.store,i.origin)))s.has(Zt(t.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),ll(t.doc.store,this),this.content.integrate(t,this),La(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new Le(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:O(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&qt(t.origin,this.lastId)&&this.right===t&&qt(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),jn(t.deleteSet,this.id.client,this.id.clock,this.length),La(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw Ie();this.content.gc(t),n?Op(t,this,new Le(this.id,this.length)):this.content=new Jn(this.length)}write(t,n){const r=n>0?O(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&di|(r===null?0:pe)|(i===null?0:nt)|(s===null?0:zn);if(t.writeInfo(o),r!==null&&t.writeLeftID(r),i!==null&&t.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const u=a._item;if(u===null){const c=qn(a);t.writeParentInfo(!0),t.writeString(c)}else t.writeParentInfo(!1),t.writeLeftID(u.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===Jt?(t.writeParentInfo(!1),t.writeLeftID(a)):Ie();s!==null&&t.writeString(s)}this.content.write(t,n)}}const Rl=(e,t)=>Nm[t&di](e),Nm=[()=>{Ie()},hm,gm,dm,Tm,pm,mm,xm,Em,fm,()=>{Ie()}],Lm=10;class De extends wo{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){Ie()}write(t,n){t.writeInfo(Lm),H(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const Ml=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},vl="__ $YJS$ __";Ml[vl]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Ml[vl]=!0;const Dm=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},Om=/[\uD800-\uDBFF]/,Rm=/[\uDC00-\uDFFF]/,Mm=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&Om.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&&Rm.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},vm=Mm,q=new D.PluginKey("y-sync"),qe=new D.PluginKey("y-undo"),Cr=new D.PluginKey("yjs-cursor"),Ge=(e,t)=>e>>>t|e<<32-t,Pm=e=>Ge(e,2)^Ge(e,13)^Ge(e,22),Bm=e=>Ge(e,6)^Ge(e,11)^Ge(e,25),Um=e=>Ge(e,7)^Ge(e,18)^e>>>3,Hm=e=>Ge(e,17)^Ge(e,19)^e>>>10,Fm=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]),Vm=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class Ym{constructor(){const t=new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(Vm),this._W=new Uint32Array(t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=Hm(n[d-2])+n[d-7]+Um(n[d-15])+n[d-16];let r=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],c=t[6],h=t[7];for(let d=0,f,p;d<64;d++)f=h+Bm(a)+(a&u^~a&c)+Fm[d]+n[d]>>>0,p=Pm(r)+(r&i^r&s^i&s)>>>0,h=c,c=u,u=a,a=o+f>>>0,o=s,s=i,i=r,r=f+p>>>0;t[0]+=r,t[1]+=i,t[2]+=s,t[3]+=o,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=h}digest(t){let n=0;for(;n+56<=t.length;){let o=0;for(;o<16&&n+3<t.length;o++)this._W[o]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<t.length;)this._W[o]|=t[n]<<(3-n%4)*8,n++;this._W[o]|=pe<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<t.length;i++)for(let o=3;o>=0&&n<t.length;o--)this._W[i]|=t[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=pe<<(3-n%4)*8),this._W[14]=t.byteLength/Kf,this._W[15]=t.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const zm=e=>new Ym().digest(e),$m=e=>{for(let n=6;n<e.length;n++)e[n%6]=e[n%6]^e[n];return e.slice(0,6)},Wm=e=>K0($m(zm(Q0(e)))),Xr=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!gn(t.ds,e.id),jm=[{light:"#ecd44433",dark:"#ecd444"}],qm=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){const r=vt();e.forEach(i=>r.add(i)),t=t.filter(i=>!r.has(i))}e.set(n,x0(t))}return e.get(n)},Gm=(e,{colors:t=jm,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new Xm(e,s),u=new D.Plugin({props:{editable:c=>{const h=q.getState(c);return h.snapshot==null&&h.prevSnapshot==null}},key:q,state:{init:(c,h)=>({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,h)=>{const d=c.getMeta(q);if(d!==void 0){h=Object.assign({},h);for(const f in d)h[f]=d[f]}return h.addToHistory=c.getMeta("addToHistory")!==!1,h.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,h.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&ho(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,h):(a._renderSnapshot(d.snapshot,d.snapshot,h),delete h.restore,delete h.snapshot,delete h.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),h}},view:c=>(a.initView(c),s==null&&a._forceRerender(),i(),{update:()=>{const h=u.getState(c.state);if(h.snapshot==null&&h.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,h.addToHistory===!1&&!h.isChangeOrigin){const d=qe.getState(c.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{h.doc.transact(d=>{d.meta.set("addToHistory",h.addToHistory),a._prosemirrorChanged(c.state.doc)},q)})}},destroy:()=>{a.destroy()}})});return u},Km=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type==="all")e.setSelection(new D.AllSelection(e.doc));else if(t.type==="node"){const r=Lt(n.doc,n.type,t.anchor,n.mapping);e.setSelection(D.NodeSelection.create(e.doc,r))}else{const r=Lt(n.doc,n.type,t.anchor,n.mapping),i=Lt(n.doc,n.type,t.head,n.mapping);if(r!==null&&i!==null){const s=D.TextSelection.between(e.doc.resolve(r),e.doc.resolve(i));e.setSelection(s)}}},Ds=(e,t)=>({type:t.selection.jsonID,anchor:er(t.selection.anchor,e.type,e.mapping),head:er(t.selection.head,e.type,e.mapping)});class Xm{constructor(t,n=new Map){this.type=t,this.prosemirrorView=null,this.mux=Dm(),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=Ds(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()?(zc&&this._domSelectionInView===null&&(ho(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 i=n.getBoundingClientRect(),s=Z0.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(t,n){n||(n=ul(Jc(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(q,{snapshot:t,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const t=this.type.toArray().map(r=>vr(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ot.Slice(ot.Fragment.from(t),0,0));n.setMeta(q,{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(i=>vr(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ot.Slice(ot.Fragment.from(n),0,0));if(t){const i=tt(He(t.anchor,0),r.doc.content.size),s=tt(He(t.head,0),r.doc.content.size);r.setSelection(D.TextSelection.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(q,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(t,n,r){let i=this.doc,s=this.type;if(t||(t=Fi(this.doc)),t instanceof Uint8Array||n instanceof Uint8Array)if((!(t instanceof Uint8Array)||!(n instanceof Uint8Array))&&Ie(),i=new _t({gc:!1}),zr(i,n),n=Fi(i),zr(i,t),t=Fi(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],a=Re(o,s._item.id.clock);s=o[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Et(o,d,f=>{})});const u=(d,f)=>{const p=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:p,type:d,color:qm(r.colorMapping,r.colors,p)}},c=Tl(s,new Eo(n.ds,t.sv)).map(d=>!d._item.deleted||Xr(d._item,t)||Xr(d._item,n)?vr(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},t,n,u):null).filter(d=>d!==null),h=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ot.Slice(ot.Fragment.from(c),0,0));this.prosemirrorView.dispatch(h.setMeta(q,{isChangeOrigin:!0}))},q)})}_typeChanged(t,n){if(this.prosemirrorView==null)return;const r=q.getState(this.prosemirrorView.state);if(t.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,u)=>this.mapping.delete(u);Et(n,n.deleteSet,a=>{if(a.constructor===$){const u=a.content.type;u&&this.mapping.delete(u)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>Pl(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ot.Slice(ot.Fragment.from(s),0,0));Km(o,this.beforeTransactionSelection,this),o=o.setMeta(q,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof fl}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(t){this.doc.transact(()=>{Rs(this.doc,this.type,t,this),this.beforeTransactionSelection=Ds(this,this.prosemirrorView.state)},q)}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 Pl=(e,t,n,r,i,s)=>{const o=n.mapping.get(e);if(o===void 0){if(e instanceof le)return vr(e,t,n,r,i,s);throw Ue()}return o},vr=(e,t,n,r,i,s)=>{const o=[],a=u=>{var c,h;if(u instanceof le){const d=Pl(u,t,n,r,i,s);d!==null&&o.push(d)}else{const d=(h=(c=u._item.right)==null?void 0:c.content)==null?void 0:h.type;d instanceof Tt&&!d._item.deleted&&d._item.id.client===d.doc.clientID&&(u.applyDelta([{retain:u.length},...d.toDelta()]),d.doc.transact(p=>{d._item.delete(p)}));const f=Qm(u,t,n,r,i,s);f!==null&&f.forEach(p=>{p!==null&&o.push(p)})}};r===void 0||i===void 0?e.toArray().forEach(a):Tl(e,new Eo(i.ds,r.sv)).forEach(a);try{const u=e.getAttributes(r);r!==void 0&&(Xr(e._item,r)?Xr(e._item,i)||(u.ychange=s?s("added",e._item.id):{type:"added"}):u.ychange=s?s("removed",e._item.id):{type:"removed"});const c=t.node(e.nodeName,u,o);return n.mapping.set(e,c),c}catch{return e.doc.transact(c=>{e._item.delete(c)},q),n.mapping.delete(e),null}},Qm=(e,t,n,r,i,s)=>{const o=[],a=e.toDelta(r,i,s);try{for(let u=0;u<a.length;u++){const c=a[u];o.push(t.text(c.insert,rg(c.attributes,t)))}}catch{return e.doc.transact(c=>{e._item.delete(c)},q),null}return o},Jm=(e,t)=>{const n=new Se,r=e.map(i=>({insert:i.text,attributes:Hl(i.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},Zm=(e,t)=>{const n=new le(e.type.name);for(const r in e.attrs){const i=e.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,bi(e).map(r=>Os(r,t))),t.mapping.set(n,e),n},Os=(e,t)=>e instanceof Array?Jm(e,t):Zm(e,t),Ua=e=>typeof e=="object"&&e!==null,Io=(e,t)=>{const n=Object.keys(e).filter(i=>e[i]!==null);let r=n.length===(t==null?0:Object.keys(t).filter(i=>t[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=e[s],a=t[s];r=s==="ychange"||o===a||Ua(o)&&Ua(a)&&Io(o,a)}return r},bi=e=>{const t=e.content.content,n=[];for(let r=0;r<t.length;r++){const i=t[r];if(i.isText){const s=[];for(let o=t[r];r<t.length&&o.isText;o=t[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},Bl=(e,t)=>{const n=e.toDelta();return n.length===t.length&&n.every((r,i)=>r.insert===t[i].text&&Fc(r.attributes||{}).length===t[i].marks.length&&Vc(r.attributes,(s,o)=>{var c;const a=Ul(o),u=t[i].marks;return Io(s,(c=u.find(h=>h.type.name===a))==null?void 0:c.attrs)}))},Zn=(e,t)=>{if(e instanceof le&&!(t instanceof Array)&&Ms(e,t)){const n=bi(t);return e._length===n.length&&Io(e.getAttributes(),t.attrs)&&e.toArray().every((r,i)=>Zn(r,n[i]))}return e instanceof Se&&t instanceof Array&&Bl(e,t)},Qr=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((n,r)=>t[r]===n),Ha=(e,t,n)=>{const r=e.toArray(),i=bi(t),s=i.length,o=r.length,a=tt(o,s);let u=0,c=0,h=!1;for(;u<a;u++){const d=r[u],f=i[u];if(Qr(n.mapping.get(d),f))h=!0;else if(!Zn(d,f))break}for(;u+c<a;c++){const d=r[o-c-1],f=i[s-c-1];if(Qr(n.mapping.get(d),f))h=!0;else if(!Zn(d,f))break}return{equalityFactor:u+c,foundMappedChild:h}},eg=e=>{let t="",n=e._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Fe?t+=n.content.str:n.content instanceof ee&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},tg=(e,t,n)=>{n.mapping.set(e,t);const{nAttrs:r,str:i}=eg(e),s=t.map(c=>({insert:c.text,attributes:Object.assign({},r,Hl(c.marks,n))})),{insert:o,remove:a,index:u}=vm(i,s.map(c=>c.insert).join(""));e.delete(u,a),e.insert(u,o),e.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},ng=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Ul=e=>{var t;return((t=ng.exec(e))==null?void 0:t[1])??e},rg=(e,t)=>{const n=[];for(const r in e)n.push(t.mark(Ul(r),e[r]));return n},Hl=(e,t)=>{const n={};return e.forEach(r=>{if(r.type.name!=="ychange"){const i=Ke(t.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${Wm(r.toJSON())}`:r.type.name]=r.attrs}}),n},Rs=(e,t,n,r)=>{if(t instanceof le&&t.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(t,n),t instanceof le){const d=t.getAttributes(),f=n.attrs;for(const p in f)f[p]!==null?d[p]!==f[p]&&p!=="ychange"&&t.setAttribute(p,f[p]):t.removeAttribute(p);for(const p in d)f[p]===void 0&&t.removeAttribute(p)}const i=bi(n),s=i.length,o=t.toArray(),a=o.length,u=tt(s,a);let c=0,h=0;for(;c<u;c++){const d=o[c],f=i[c];if(!Qr(r.mapping.get(d),f))if(Zn(d,f))r.mapping.set(d,f);else break}for(;h+c<u;h++){const d=o[a-h-1],f=i[s-h-1];if(!Qr(r.mapping.get(d),f))if(Zn(d,f))r.mapping.set(d,f);else break}e.transact(()=>{for(;a-c-h>0&&s-c-h>0;){const f=o[c],p=i[c],m=o[a-h-1],T=i[s-h-1];if(f instanceof Se&&p instanceof Array)Bl(f,p)||tg(f,p,r),c+=1;else{let _=f instanceof le&&Ms(f,p),C=m instanceof le&&Ms(m,T);if(_&&C){const x=Ha(f,p,r),I=Ha(m,T,r);x.foundMappedChild&&!I.foundMappedChild?C=!1:!x.foundMappedChild&&I.foundMappedChild||x.equalityFactor<I.equalityFactor?_=!1:C=!1}_?(Rs(e,f,p,r),c+=1):C?(Rs(e,m,T,r),h+=1):(r.mapping.delete(t.get(c)),t.delete(c,1),t.insert(c,[Os(p,r)]),c+=1)}}const d=a-c-h;if(a===1&&s===0&&o[0]instanceof Se?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(t.slice(c,c+d).forEach(f=>r.mapping.delete(f)),t.delete(c,d)),c+h<s){const f=[];for(let p=c;p<s-h;p++)f.push(Os(i[p],r));t.insert(c,f)}},q)},Ms=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name;let On=null;const ig=()=>{const e=On;On=null,e.forEach((t,n)=>{const r=n.state.tr,i=q.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(t.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},sg=(e,t,n)=>{On||(On=new Map,ho(0,ig)),Ke(On,e,Oe).set(t,n)},er=(e,t,n)=>{if(e===0)return Hi(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 Se){if(r._length>=e)return Hi(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 i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new Kn(r._item===null?null:r._item.id,r._item===null?qn(r):null,null);if(e-=i,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 Kn(r._item===null?null:r._item.id,r._item===null?qn(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 Ie();if(e===0&&r.constructor!==Se&&r!==t)return og(r._item.parent,r._item)}return Hi(t,t._length,t.length===0?-1:0)},og=(e,t)=>{let n=null,r=null;return e._item===null?r=qn(e):n=O(e._item.id.client,e._item.id.clock),new Kn(n,r,t.id)},Lt=(e,t,n,r)=>{const i=Lp(n,e);if(i===null||i.type!==t&&!Gn(t,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Se)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,u=0;for(;u<s._length&&u<i.index&&a!==null;){if(!a.deleted){const c=a.content.type;u++,c instanceof Se?o+=c._length:o+=r.get(c).nodeSize}a=a.right}o+=1}for(;s!==t&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let u=a._first;for(;u!==null;){const c=u.content.type;if(c===s)break;u.deleted||(c instanceof Se?o+=c._length:o+=r.get(c).nodeSize),u=u.right}}s=a}return o-1},ag=(e,t,n)=>e!==t,ug=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(""),i=document.createTextNode("");return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},Fl=e=>({style:`background-color: ${e.color}70`,class:"ProseMirror-yjs-selection"}),cg=/^#[0-9a-fA-F]{6}$/,Fa=(e,t,n,r,i)=>{const s=q.getState(e),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?K.DecorationSet.create(e.doc,[]):(t.getStates().forEach((u,c)=>{if(n(o.clientID,c,u)&&u.cursor!=null){const h=u.user||{};h.color==null?h.color="#ffa500":cg.test(h.color)||console.warn("A user uses an unsupported color format",h),h.name==null&&(h.name=`User: ${c}`);let d=Lt(o,s.type,Dn(u.cursor.anchor),s.binding.mapping),f=Lt(o,s.type,Dn(u.cursor.head),s.binding.mapping);if(d!==null&&f!==null){const p=He(e.doc.content.size-1,0);d=tt(d,p),f=tt(f,p),a.push(K.Decoration.widget(f,()=>r(h,c),{key:c+"",side:10}));const m=tt(d,f),T=He(d,f);a.push(K.Decoration.inline(m,T,i(h,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),K.DecorationSet.create(e.doc,a))},lg=(e,{awarenessStateFilter:t=ag,cursorBuilder:n=ug,selectionBuilder:r=Fl,getSelection:i=o=>o.selection}={},s="cursor")=>new D.Plugin({key:Cr,state:{init(o,a){return Fa(a,e,t,n,r)},apply(o,a,u,c){const h=q.getState(c),d=o.getMeta(Cr);return h&&h.isChangeOrigin||d&&d.awarenessUpdated?Fa(c,e,t,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Cr.getState(o)},view:o=>{const a=()=>{o.docView&&sg(o,Cr,{awarenessUpdated:!0})},u=()=>{const c=q.getState(o.state),h=e.getLocalState()||{};if(o.hasFocus()){const d=i(o.state),f=er(d.anchor,c.type,c.binding.mapping),p=er(d.head,c.type,c.binding.mapping);(h.cursor==null||!Ia(Dn(h.cursor.anchor),f)||!Ia(Dn(h.cursor.head),p))&&e.setLocalStateField(s,{anchor:f,head:p})}else h.cursor!=null&&Lt(c.doc,c.type,Dn(h.cursor.anchor),c.binding.mapping)!==null&&e.setLocalStateField(s,null)};return e.on("change",a),o.dom.addEventListener("focusin",u),o.dom.addEventListener("focusout",u),{update:u,destroy:()=>{o.dom.removeEventListener("focusin",u),o.dom.removeEventListener("focusout",u),e.off("change",a),e.setLocalStateField(s,null)}}}}),dg=e=>{var t,n;return((n=(t=qe.getState(e))==null?void 0:t.undoManager)==null?void 0:n.undo())!=null},hg=e=>{var t,n;return((n=(t=qe.getState(e))==null?void 0:t.undoManager)==null?void 0:n.redo())!=null},fg=(e,t)=>{var n,r;return t==null?(r=(n=qe.getState(e))==null?void 0:n.undoManager)==null?void 0:r.canUndo():dg(e)},pg=(e,t)=>{var n,r;return t==null?(r=(n=qe.getState(e))==null?void 0:n.undoManager)==null?void 0:r.canRedo():hg(e)},mg=new Set(["paragraph"]),gg=(e,t)=>!(e instanceof $)||!(e.content instanceof Ve)||!(e.content.type instanceof Tt||e.content.type instanceof le&&t.has(e.content.type.nodeName))||e.content.type._length===0,bg=({protectedNodes:e=mg,trackedOrigins:t=[],undoManager:n=null}={})=>new D.Plugin({key:qe,state:{init:(r,i)=>{const s=q.getState(i),o=n||new fl(s.type,{trackedOrigins:new Set([q].concat(t)),deleteFilter:a=>gg(a,e),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=q.getState(o).binding,u=i.undoManager,c=u.undoStack.length>0,h=u.redoStack.length>0;return a?{undoManager:u,prevSel:Ds(a,s),hasUndoOps:c,hasRedoOps:h}:c!==i.hasUndoOps||h!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:u.undoStack.length>0,hasRedoOps:u.redoStack.length>0}):i}},view:r=>{const i=q.getState(r.state),s=qe.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,qe.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),tn=new WeakMap,Pr=new WeakMap,Jr={current:[]};let zi=!1;const yr=new Set,Va=new Map;function Vl(e){const t=Array.from(e).sort((n,r)=>n instanceof nn&&n.options.deps.includes(r)?1:r instanceof nn&&r.options.deps.includes(n)?-1:0);for(const n of t){if(Jr.current.includes(n))continue;Jr.current.push(n),n.recompute();const r=Pr.get(n);if(r)for(const i of r){const s=tn.get(i);s&&Vl(s)}}}function Eg(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Tg(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Cg(e){if(yr.add(e),!zi)try{for(zi=!0;yr.size>0;){const t=Array.from(yr);yr.clear();for(const n of t){const r=Va.get(n)??n.prevState;n.prevState=r,Eg(n)}for(const n of t){const r=tn.get(n);r&&(Jr.current.push(n),Vl(r))}for(const n of t){const r=tn.get(n);if(r)for(const i of r)Tg(i)}}}finally{zi=!1,Jr.current=[],Va.clear()}}function yg(e){return typeof e=="function"}class vs{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var i,s;this.listeners.add(r);const o=(s=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:s.call(i,r,this);return()=>{this.listeners.delete(r),o==null||o()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):yg(t)?this.state=t(this.prevState):this.state=t,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),Cg(this)}}class nn{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let s=0;s<n;s++){const o=this.options.deps[s];r[s]=o.prevState,i[s]=o.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof nn&&s.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let s=0;s<i.length;s++)if(i[s]!==r[s]){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,i;this.listeners.add(n);const s=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),s==null||s()}},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 nn)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof vs){let r=tn.get(n);r||(r=new Set,tn.set(n,r)),r.add(this);let i=Pr.get(this);i||(i=new Set,Pr.set(this,i)),i.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof nn)this.unregisterFromGraph(n.options.deps);else if(n instanceof vs){const r=tn.get(n);r&&r.delete(this);const i=Pr.get(this);i&&i.delete(n)}}}const Ya=Symbol("originalFactory");function z(e){if(typeof e=="object"&&"key"in e)return function t(){return e[Ya]=t,e};if(typeof e!="function")throw new Error("factory must be a function");return function t(n){return r=>{const i=e({editor:r.editor,options:n});return i[Ya]=t,i}}}function Tn(e,t){return new vs(e,t)}var za=(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]},_g=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ag=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,kg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,wg=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Sg=L.Mark.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 za("strong",{...L.mergeAttributes(this.options.HTMLAttributes,e),children:za("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[L.markInputRule({find:_g,type:this.type}),L.markInputRule({find:kg,type:this.type})]},addPasteRules(){return[L.markPasteRule({find:Ag,type:this.type}),L.markPasteRule({find:wg,type:this.type})]}}),Ig=Sg,xg=/(^|[^`])`([^`]+)`(?!`)$/,Ng=/(^|[^`])`([^`]+)`(?!`)/g,Lg=L.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",L.mergeAttributes(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[L.markInputRule({find:xg,type:this.type})]},addPasteRules(){return[L.markPasteRule({find:Ng,type:this.type})]}}),Dg=Lg,Og=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Rg=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Mg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,vg=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Pg=L.Mark.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",L.mergeAttributes(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[L.markInputRule({find:Og,type:this.type}),L.markInputRule({find:Mg,type:this.type})]},addPasteRules(){return[L.markPasteRule({find:Rg,type:this.type}),L.markPasteRule({find:vg,type:this.type})]}}),Bg=Pg,Ug=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hg=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Fg=L.Mark.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",L.mergeAttributes(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[L.markInputRule({find:Ug,type:this.type})]},addPasteRules(){return[L.markPasteRule({find:Hg,type:this.type})]}}),Vg=Fg,Yg=L.Mark.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",L.mergeAttributes(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},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()}}}),zg=Yg,$g=Object.defineProperty,Wg=(e,t,n)=>t in e?$g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,At=(e,t,n)=>Wg(e,typeof t!="symbol"?t+"":t,n);function tr(...e){return[...new Set(e.filter(t=>t).join(" ").split(" "))].join(" ")}function jg(e,t,n,r){const i=document.createElement("div");i.className=tr("bn-block-content",n.class),i.setAttribute("data-content-type",e);for(const[o,a]of Object.entries(n))o!=="class"&&i.setAttribute(o,a);const s=document.createElement(t);s.className=tr("bn-inline-content",r.class);for(const[o,a]of Object.entries(r))o!=="class"&&s.setAttribute(o,a);return i.appendChild(s),{dom:i,contentDOM:s}}const $a=(e,t)=>{let n=li(e,t.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);const r=t.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r(n);if(typeof i!="object"||!("dom"in i))throw new 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 i};function qg(e){return"data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Wa(e,t,n,r,i=!1,s){const o=document.createElement("div");if(s!==void 0)for(const[a,u]of Object.entries(s))a!=="class"&&o.setAttribute(a,u);o.className=tr("bn-block-content",(s==null?void 0:s.class)||""),o.setAttribute("data-content-type",t);for(const[a,u]of Object.entries(n)){const c=r[a].default;u!==c&&o.setAttribute(qg(a),u)}return i&&o.setAttribute("data-file-block",""),o.appendChild(e.dom),e.contentDOM&&(e.contentDOM.className=tr("bn-inline-content",e.contentDOM.className)),{...e,dom:o}}function Gg(e,t,n){return{config:{type:e.type,content:e.content,propSchema:t},implementation:{node:e.node,render:$a,toExternalHTML:$a},extensions:n}}function xe(e,t,n){return(r={})=>{const i=typeof e=="function"?e(r):e,s=typeof t=="function"?t(r):t,o=n?typeof n=="function"?n(r):n:void 0;return{config:i,implementation:{...s,toExternalHTML(a,u){var c,h;const d=(c=s.toExternalHTML)==null?void 0:c.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,u);if(d!==void 0)return Wa(d,a.type,a.props,i.propSchema,((h=s.meta)==null?void 0:h.fileBlockAccept)!==void 0)},render(a,u){var c;const h=s.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,u);return Wa(h,a.type,a.props,i.propSchema,((c=s.meta)==null?void 0:c.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:o}}}function Kg(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.config]))}function Xg(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 _r(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 Yl(e,t){return{config:e,implementation:t}}function An(e,t){return Yl({type:e.name,propSchema:t},{mark:e,render(n,r){const i=r.pmSchema.marks[e.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(e.name,{stringValue:n}),o=ne.DOMSerializer.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new 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 o},toExternalHTML(n,r){const i=r.pmSchema.marks[e.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(e.name,{stringValue:n}),o=ne.DOMSerializer.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new 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 o}})}function Qg(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.config]))}function Jg(e,t){const n=[{tag:`[data-style-type="${e.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return t&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;const i=t==null?void 0:t(r);return i===void 0?!1:{stringValue:i}}}),n}function zl(e,t){const n=L.Mark.create({name:e.type,addAttributes(){return Xg(e.propSchema)},parseHTML(){return Jg(e,t.parse)},renderHTML({mark:r}){const i=(t.toExternalHTML||t.render)(r.attrs.stringValue);return _r(i,e.type,r.attrs.stringValue,e.propSchema)},addMarkView(){return({mark:r})=>{const i=t.render(r.attrs.stringValue);return _r(i,e.type,r.attrs.stringValue,e.propSchema)}}});return Yl(e,{...t,mark:n,render:r=>{const i=t.render(r);return _r(i,e.type,r,e.propSchema)},toExternalHTML:r=>{const i=(t.toExternalHTML||t.render)(r);return _r(i,e.type,r,e.propSchema)}})}function $l(e,t){let n,r;if(t.firstChild.descendants((i,s)=>n?!1:!xo(i)||i.attrs.id!==e?!0:(n=i,r=s+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function xo(e){return e.type.isInGroup("bnBlock")}function Zg(e,t,n,r,i){const s=Rf(e.doc.resolve(t));let o=null;s.blockNoteType==="table"&&(o=t1(e));const a=pt(e),u=a.nodes[s.blockNoteType],c=a.nodes[n.type||s.blockNoteType],h=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(s.isBlockContainer&&c.isInGroup("blockContent"))ja(n,e,s),e1(n,e,u,c,s);else if(!s.isBlockContainer&&c.isInGroup("bnBlock"))ja(n,e,s);else{const d=sn(s.bnBlock.node,a);e.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,li({children:d.children,...n},a));return}e.setNodeMarkup(s.bnBlock.beforePos,h,{...s.bnBlock.node.attrs,...n.props}),o&&n1(e,s,o)}function e1(e,t,n,r,i,s,o){const a=pt(t);let u="keep";if(e.content)if(typeof e.content=="string")u=mt([e.content],a,r.name);else if(Array.isArray(e.content))u=mt(e.content,a,r.name);else if(e.content.type==="tableContent")u=so(e.content,a);else throw new fn(e.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(u=[]);u==="keep"?t.setNodeMarkup(i.blockContent.beforePos,r,{...i.blockContent.node.attrs,...e.props}):t.replaceWith(i.blockContent.beforePos,i.blockContent.afterPos,r.createChecked({...i.blockContent.node.attrs,...e.props},u))}function ja(e,t,n){const r=pt(t);if(e.children!==void 0&&e.children.length>0){const i=e.children.map(s=>li(s,r));if(n.childContainer)t.step(new Js.ReplaceStep(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new ne.Slice(ne.Fragment.from(i),0,0)));else{if(!n.isBlockContainer)throw new Error("impossible");t.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},i))}}}function t1(e){const t="selection"in e?e.selection:null;if(!(t instanceof D.TextSelection))return null;const n=e.doc.resolve(t.head);let r=-1,i=-1;for(let T=n.depth;T>=0;T--){const _=n.node(T).type.name;if(r<0&&(_==="tableCell"||_==="tableHeader")&&(r=T),_==="table"){i=T;break}}if(r<0||i<0)return null;const s=n.before(r),o=n.before(i),a=e.doc.nodeAt(o);if(!a||a.type.name!=="table")return null;const u=oe.TableMap.get(a),c=s-(o+1),h=u.map.indexOf(c);if(h<0)return null;const d=Math.floor(h/u.width),f=h%u.width,p=s+1+1,m=Math.max(0,t.head-p);return{row:d,col:f,offset:m}}function n1(e,t,n){var r;if(t.blockNoteType!=="table")return!1;let i=-1;if(t.isBlockContainer)i=e.mapping.map(t.blockContent.beforePos);else{const _=e.mapping.map(t.bnBlock.beforePos),C=_+(((r=e.doc.nodeAt(_))==null?void 0:r.nodeSize)||0);e.doc.nodesBetween(_,C,(x,I)=>x.type.name==="table"?(i=I,!1):!0)}const s=i>=0?e.doc.nodeAt(i):null;if(!s||s.type.name!=="table")return!1;const o=oe.TableMap.get(s),a=Math.max(0,Math.min(n.row,o.height-1)),u=Math.max(0,Math.min(n.col,o.width-1)),c=a*o.width+u,h=o.map[c];if(h==null)return!1;const d=i+1+h+1,f=e.doc.nodeAt(d),p=d+1,m=f?f.content.size:0,T=p+Math.max(0,Math.min(n.offset,m));return"selection"in e&&e.setSelection(D.TextSelection.create(e.doc,T)),!0}const ht={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"}},X={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},Ce=e=>{const 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=X.textAlignment.values.includes(e.style.textAlign)?e.style.textAlign:void 0,t},Vt=(e,t)=>{e.backgroundColor&&e.backgroundColor!==X.backgroundColor.default&&(t.style.backgroundColor=e.backgroundColor in ht?ht[e.backgroundColor].background:e.backgroundColor),e.textColor&&e.textColor!==X.textColor.default&&(t.style.color=e.textColor in ht?ht[e.textColor].text:e.textColor),e.textAlignment&&e.textAlignment!==X.textAlignment.default&&(t.style.textAlign=e.textAlignment)},Ei=(e,t)=>{const n=e.querySelector(t);if(!n)return;const r=e.querySelector("figcaption"),i=(r==null?void 0:r.textContent)??void 0;return{targetElement:n,caption:i}},r1=z(({editor:e})=>{const t=Tn(void 0);function n(){t.setState(void 0)}return{key:"filePanel",store:t,mount({signal:r}){const i=e.onChange(n,!1),s=e.onSelectionChange(n,!1);r.addEventListener("abort",()=>{i(),s()})},closeMenu:n,showMenu(r){t.setState(r)}}}),i1=(e,t,n)=>{const r=document.createElement("div");r.className="bn-add-file-button";const i=document.createElement("div");i.className="bn-add-file-button-icon",n?i.appendChild(n):i.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(i);const s=document.createElement("p");s.className="bn-add-file-button-text",s.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(s);const o=u=>{u.preventDefault(),u.stopPropagation()},a=()=>{var u;t.isEditable&&((u=t.getExtension(r1))==null||u.showMenu(e.id))};return r.addEventListener("mousedown",o,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",o,!0),r.removeEventListener("click",a,!0)}}},s1='<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>',o1=e=>{const t=document.createElement("div");t.className="bn-file-name-with-icon";const n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=s1,t.appendChild(n);const r=document.createElement("p");return r.className="bn-file-name",r.textContent=e.props.name,t.appendChild(r),{dom:t}},No=(e,t,n,r)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",e.props.url===""){const o=i1(e,t,r);i.appendChild(o.dom);const a=t.onUploadStart(u=>{if(u===e.id){i.removeChild(o.dom);const c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",i.appendChild(c)}});return{dom:i,destroy:()=>{a(),o.destroy()}}}const s={dom:i};if(e.props.showPreview===!1||!n){const o=o1(e);i.appendChild(o.dom),s.destroy=()=>{var a;(a=o.destroy)==null||a.call(o)}}else i.appendChild(n.dom);if(e.props.caption){const o=document.createElement("p");o.className="bn-file-caption",o.textContent=e.props.caption,i.appendChild(o)}return s},Lo=(e,t)=>{const n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=t,n.appendChild(e),n.appendChild(r),{dom:n}},Ti=(e,t)=>{const n=document.createElement("div"),r=document.createElement("p");return r.textContent=t,n.appendChild(e),n.appendChild(r),{dom:n}},qa=e=>({url:e.src||void 0}),a1='<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>',u1=e=>({type:"audio",propSchema:{backgroundColor:X.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),c1=(e={})=>t=>{if(t.tagName==="AUDIO"){if(t.closest("figure"))return;const{backgroundColor:n}=Ce(t);return{...qa(t),backgroundColor:n}}if(t.tagName==="FIGURE"){const n=Ei(t,"audio");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Ce(t);return{...qa(r),backgroundColor:s,caption:i}}},l1=(e={})=>(t,n)=>{const r=document.createElement("div");r.innerHTML=e.icon??a1;const i=document.createElement("audio");return i.className="bn-audio",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,No(t,n,{dom:i},r.firstElementChild)},d1=(e={})=>(t,n)=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add audio",{dom:i}}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?Lo(r,t.props.caption):Ti(r,t.props.caption):{dom:r}},h1=xe(u1,e=>({meta:{fileBlockAccept:["audio/*"]},parse:c1(e),render:l1(e),toExternalHTML:d1(e),runsBefore:["file"]})),Ga=Symbol.for("blocknote.shikiParser"),$i=Symbol.for("blocknote.shikiHighlighterPromise");function f1(e){const t=globalThis;let n,r,i=!1;return tf.createHighlightPlugin({parser:s=>{if(!e.createHighlighter)return process.env.NODE_ENV==="development"&&!i&&(console.log("For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"),i=!0),[];if(!n)return t[$i]=t[$i]||e.createHighlighter(),t[$i].then(a=>{n=a});const o=Wl(e,s.language);return!o||o==="text"||o==="none"||o==="plaintext"||o==="txt"?[]:n.getLoadedLanguages().includes(o)?(r||(r=t[Ga]||nf.createParser(n),t[Ga]=r),r(s)):n.loadLanguage(o)},languageExtractor:s=>s.attrs.language,nodeTypes:["codeBlock"]})}const p1=({defaultLanguage:e="text"})=>({type:"codeBlock",propSchema:{language:{default:e}},content:"inline"}),m1=xe(p1,e=>({meta:{code:!0,defining:!0,isolating:!1},parse:t=>{var n,r;if(t.tagName!=="PRE"||t.childElementCount!==1||((n=t.firstElementChild)==null?void 0:n.tagName)!=="CODE")return;const i=t.firstElementChild;return{language:i.getAttribute("data-language")||((r=i.className.split(" ").find(s=>s.includes("language-")))==null?void 0:r.replace("language-",""))}},parseContent:({el:t,schema:n})=>{const r=ne.DOMParser.fromSchema(n),i=t.firstElementChild;return r.parse(i,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(t,n){const r=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");i.appendChild(s);let o;if(e.supportedLanguages){const a=document.createElement("select");Object.entries(e.supportedLanguages??{}).forEach(([h,{name:d}])=>{const f=document.createElement("option");f.value=h,f.text=d,a.appendChild(f)}),a.value=t.props.language||e.defaultLanguage||"text";const u=h=>{const d=h.target.value;n.updateBlock(t.id,{props:{language:d}})};a.addEventListener("change",u),o=()=>a.removeEventListener("change",u);const c=document.createElement("div");c.contentEditable="false",c.appendChild(a),r.appendChild(c)}return r.appendChild(i),{dom:r,contentDOM:s,destroy:()=>{o==null||o()}}},toExternalHTML(t){const 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=>[z({key:"code-block-highlighter",prosemirrorPlugins:[f1(e)]}),z({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:t})=>t.transact(n=>{const{block:r}=t.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:i}=n.selection;return i.parent.textContent?!1:(t.removeBlocks([r]),!0)}),Tab:({editor:t})=>e.indentLineWithTab===!1?!1:t.transact(n=>{const{block:r}=t.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:t})=>t.transact(n=>{const{block:r,nextBlock:i}=t.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:s}=n.selection,o=s.parentOffset===s.parent.nodeSize-2,a=s.parent.textContent.endsWith(`
|
|
9
|
-
|
|
10
|
-
`);if(o&&a){if(n.delete(s.pos-2,s.pos),i)return t.setTextCursorPosition(i,"start"),!0;const[u]=t.insertBlocks([{type:"paragraph"}],r,"after");return t.setTextCursorPosition(u,"start"),!0}return n.insertText(`
|
|
11
|
-
`),!0}),"Shift-Enter":({editor:t})=>t.transact(()=>{const{block:n}=t.getTextCursorPosition();if(n.type!=="codeBlock")return!1;const[r]=t.insertBlocks([{type:"paragraph"}],n,"after");return t.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:t})=>{const n=t[1].trim();return{type:"codeBlock",props:{language:{language:Wl(e,n)??n}.language},content:[]}}}]})]);function Wl(e,t){var n;return(n=Object.entries(e.supportedLanguages??{}).find(([r,{aliases:i}])=>(i==null?void 0:i.includes(t))||r===t))==null?void 0:n[0]}const g1=()=>({type:"divider",propSchema:{},content:"none"}),b1=xe(g1,{meta:{isolating:!1},parse(e){if(e.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[z({key:"divider-block-shortcuts",inputRules:[{find:new RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),Ka=e=>({url:e.src||void 0}),E1=()=>({type:"file",propSchema:{backgroundColor:X.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),T1=()=>e=>{if(e.tagName==="EMBED"){if(e.closest("figure"))return;const{backgroundColor:t}=Ce(e);return{...Ka(e),backgroundColor:t}}if(e.tagName==="FIGURE"){const t=Ei(e,"embed");if(!t)return;const{targetElement:n,caption:r}=t,{backgroundColor:i}=Ce(e);return{...Ka(n),backgroundColor:i,caption:r}}},C1=xe(E1,{meta:{fileBlockAccept:["*/*"]},parse:T1(),render(e,t){return No(e,t)},toExternalHTML(e){if(!e.props.url){const n=document.createElement("p");return n.textContent="Add file",{dom:n}}const t=document.createElement("a");return t.href=e.props.url,t.textContent=e.props.name||e.props.url,e.props.caption?Ti(t,e.props.caption):{dom:t}}}),y1={set:(e,t)=>window.localStorage.setItem(`toggle-${e.id}`,t?"true":"false"),get:e=>window.localStorage.getItem(`toggle-${e.id}`)==="true"},jl=(e,t,n,r=y1)=>{if("isToggleable"in e.props&&!e.props.isToggleable)return{dom:n};const i=document.createElement("div"),s=document.createElement("div");s.className="bn-toggle-wrapper";const o=document.createElement("button");o.className="bn-toggle-button",o.type="button",o.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>';const a=m=>m.preventDefault();o.addEventListener("mousedown",a);const u=()=>{var m;s.getAttribute("data-show-children")==="true"?(s.setAttribute("data-show-children","false"),r.set(t.getBlock(e),!1),i.contains(c)&&i.removeChild(c)):(s.setAttribute("data-show-children","true"),r.set(t.getBlock(e),!0),t.isEditable&&((m=t.getBlock(e))==null?void 0:m.children.length)===0&&!i.contains(c)&&i.appendChild(c))};o.addEventListener("click",u),s.appendChild(o),s.appendChild(n);const c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=t.dictionary.toggle_blocks.add_block_button;const h=m=>m.preventDefault();c.addEventListener("mousedown",h);const d=()=>{t.transact(()=>{const m=t.updateBlock(e,{children:[{}]});t.setTextCursorPosition(m.children[0].id,"end"),t.focus()})};c.addEventListener("click",d),i.appendChild(s);let f=e.children.length;const p=t.onChange(()=>{var m;const T=((m=t.getBlock(e))==null?void 0:m.children.length)??0;T>f?(s.getAttribute("data-show-children")==="false"&&(s.setAttribute("data-show-children","true"),r.set(t.getBlock(e),!0)),i.contains(c)&&i.removeChild(c)):T===0&&T<f&&(s.getAttribute("data-show-children")==="true"&&(s.setAttribute("data-show-children","false"),r.set(t.getBlock(e),!1)),i.contains(c)&&i.removeChild(c)),f=T});return r.get(e)?(s.setAttribute("data-show-children","true"),t.isEditable&&e.children.length===0&&i.appendChild(c)):s.setAttribute("data-show-children","false"),{dom:i,ignoreMutation:m=>m instanceof MutationRecord&&(m.type==="attributes"&&m.target===s&&m.attributeName==="data-show-children"||m.type==="childList"&&(m.addedNodes[0]===c||m.removedNodes[0]===c)),destroy:()=>{o.removeEventListener("mousedown",a),o.removeEventListener("click",u),c.removeEventListener("mousedown",h),c.removeEventListener("click",d),p==null||p()}}},ql=[1,2,3,4,5,6],_1=e=>({editor:t})=>{const n=t.getTextCursorPosition();return t.schema.blockSchema[n.block.type].content!=="inline"?!1:(t.updateBlock(n.block,{type:"heading",props:{level:e}}),!0)},A1=({defaultLevel:e=1,levels:t=ql,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...X,level:{default:e,values:t},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),k1=xe(A1,({allowToggleHeadings:e=!0}={})=>({meta:{isolating:!1},parse(t){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{...Ce(t),level:n}},render(t,n){const r=document.createElement(`h${t.props.level}`);return e?{...jl(t,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(t){const n=document.createElement(`h${t.props.level}`);return Vt(t.props,n),{dom:n,contentDOM:n}}}),({levels:e=ql}={})=>[z({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(e.map(t=>[`Mod-Alt-${t}`,_1(t)])??[]),inputRules:e.map(t=>({find:new RegExp(`^(#{${t}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),Gl=(e,t,n,r,i)=>{const{dom:s,destroy:o}=No(e,t,n,i),a=s;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");const u=document.createElement("div");u.className="bn-resize-handle",u.style.left="4px";const c=document.createElement("div");c.className="bn-resize-handle",c.style.right="4px";const h=document.createElement("div");h.style.position="absolute",h.style.height="100%",h.style.width="100%";let d,f=e.props.previewWidth;const p=I=>{var R,V;if(!d){!t.isEditable&&r.contains(u)&&r.contains(c)&&(r.removeChild(u),r.removeChild(c));return}let v;const te="touches"in I?I.touches[0].clientX:I.clientX;e.props.textAlignment==="center"?d.handleUsed==="left"?v=d.initialWidth+(d.initialClientX-te)*2:v=d.initialWidth+(te-d.initialClientX)*2:d.handleUsed==="left"?v=d.initialWidth+d.initialClientX-te:v=d.initialWidth+te-d.initialClientX,f=Math.min(Math.max(v,64),((V=(R=t.domElement)==null?void 0:R.firstElementChild)==null?void 0:V.clientWidth)||Number.MAX_VALUE),a.style.width=`${f}px`},m=I=>{(!I.target||!a.contains(I.target)||!t.isEditable)&&r.contains(u)&&r.contains(c)&&(r.removeChild(u),r.removeChild(c)),d&&(d=void 0,a.contains(h)&&a.removeChild(h),t.updateBlock(e,{props:{previewWidth:f}}))},T=()=>{t.isEditable&&(r.appendChild(u),r.appendChild(c))},_=I=>{I.relatedTarget===u||I.relatedTarget===c||d||t.isEditable&&r.contains(u)&&r.contains(c)&&(r.removeChild(u),r.removeChild(c))},C=I=>{I.preventDefault(),a.contains(h)||a.appendChild(h);const R="touches"in I?I.touches[0].clientX:I.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:R}},x=I=>{I.preventDefault(),a.contains(h)||a.appendChild(h);const R="touches"in I?I.touches[0].clientX:I.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:R}};return window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",m),window.addEventListener("touchend",m),a.addEventListener("mouseenter",T),a.addEventListener("mouseleave",_),u.addEventListener("mousedown",C),u.addEventListener("touchstart",C),c.addEventListener("mousedown",x),c.addEventListener("touchstart",x),{dom:a,destroy:()=>{o==null||o(),window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),a.removeEventListener("mouseenter",T),a.removeEventListener("mouseleave",_),u.removeEventListener("mousedown",C),u.removeEventListener("touchstart",C),c.removeEventListener("mousedown",x),c.removeEventListener("touchstart",x)}}},Xa=e=>{const t=e.src||void 0,n=e.width||void 0,r=e.alt||void 0;return{url:t,previewWidth:n,name:r}},w1='<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>',S1=(e={})=>({type:"image",propSchema:{textAlignment:X.textAlignment,backgroundColor:X.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),I1=(e={})=>t=>{if(t.tagName==="IMG"){if(t.closest("figure"))return;const{backgroundColor:n}=Ce(t);return{...Xa(t),backgroundColor:n}}if(t.tagName==="FIGURE"){const n=Ei(t,"img");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Ce(t);return{...Xa(r),backgroundColor:s,caption:i}}},x1=(e={})=>(t,n)=>{const r=document.createElement("div");r.innerHTML=e.icon??w1;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("img");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(t.props.url).then(o=>{s.src=o}):s.src=t.props.url,s.alt=t.props.name||t.props.caption||"BlockNote image",s.contentEditable="false",s.draggable=!1,i.appendChild(s),Gl(t,n,{dom:i},i,r.firstElementChild)},N1=(e={})=>(t,n)=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add image",{dom:i}}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?Lo(r,t.props.caption):Ti(r,t.props.caption):{dom:r}},L1=xe(S1,e=>({meta:{fileBlockAccept:["image/*"]},parse:I1(e),render:x1(e),toExternalHTML:N1(e),runsBefore:["file"]})),D1=(e,t,n,r)=>{const i=eo(e.doc,t),s=Vn(i);if(!s.isBlockContainer)return!1;pt(e);const o=[{type:s.bnBlock.node.type,attrs:{}},{type:s.blockContent.node.type,attrs:{}}];return e.split(t,2,o),!0},Ci=(e,t)=>{const{blockInfo:n,selectionEmpty:r}=e.transact(o=>({blockInfo:Mf(o),selectionEmpty:o.selection.anchor===o.selection.head}));if(!n.isBlockContainer)return!1;const{bnBlock:i,blockContent:s}=n;return s.node.type.name!==t||!r?!1:s.node.childCount===0?(e.transact(o=>{Zg(o,i.beforePos,{type:"paragraph",props:{}})}),!0):s.node.childCount>0?e.transact(o=>(o.deleteSelection(),D1(o,o.selection.from))):!1};function Do(e,t,n){var r,i,s;const o=ne.DOMParser.fromSchema(t),a=e,u=document.createElement("div");u.setAttribute("data-node-type","blockGroup");for(const p of Array.from(a.childNodes))u.appendChild(p.cloneNode(!0));let c=o.parse(u,{topNode:t.nodes.blockGroup.create()});((i=(r=c.firstChild)==null?void 0:r.firstChild)==null?void 0:i.type.name)==="checkListItem"&&(c=c.copy(c.content.cut(c.firstChild.firstChild.nodeSize+2)));const h=(s=c.firstChild)==null?void 0:s.firstChild;if(!(h!=null&&h.isTextblock))return ne.Fragment.from(c);const d=t.nodes[n].create({},h.content),f=c.content.cut(h.nodeSize+2);if(f.size>0){const p=c.copy(f);return d.content.addToEnd(p)}return d.content}const O1=()=>({type:"bulletListItem",propSchema:{...X},content:"inline"}),R1=xe(O1,{meta:{isolating:!1},parse(e){var t;if(e.tagName!=="LI")return;const n=e.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((t=n.parentElement)==null?void 0:t.tagName)==="UL"))return Ce(e)},parseContent:({el:e,schema:t})=>Do(e,t,"bulletListItem"),render(){const e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){const t=document.createElement("li"),n=document.createElement("p");return Vt(e.props,t),t.appendChild(n),{dom:t,contentDOM:n}}},[z({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>Ci(e,"bulletListItem"),"Mod-Shift-8":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"bulletListItem",props:{}}),!0)}},inputRules:[{find:new RegExp("^[-+*]\\s$"),replace({editor:e}){if(Sc(e.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),M1=()=>({type:"checkListItem",propSchema:{...X,checked:{default:!1,type:"boolean"}},content:"inline"}),v1=xe(M1,{meta:{isolating:!1},parse(e){var t;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;const n=e.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((t=n.parentElement)==null?void 0:t.tagName)==="UL")){const r=e.querySelector("input[type=checkbox]")||null;return r===null?void 0:{...Ce(e),checked:r.checked}}},parseContent:({el:e,schema:t})=>Do(e,t,"checkListItem"),render(e,t){const n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=e.props.checked,e.props.checked&&r.setAttribute("checked",""),r.addEventListener("change",()=>{t.updateBlock(e,{props:{checked:!e.props.checked}})});const i=document.createElement("p");return n.appendChild(r),n.appendChild(i),{dom:n,contentDOM:i}},toExternalHTML(e){const t=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=e.props.checked,e.props.checked&&n.setAttribute("checked","");const r=document.createElement("p");return Vt(e.props,t),t.appendChild(n),t.appendChild(r),{dom:t,contentDOM:r}},runsBefore:["bulletListItem"]},[z({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>Ci(e,"checkListItem"),"Mod-Shift-9":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"checkListItem",props:{}}),!0)}},inputRules:[{find:new RegExp("\\[\\s*\\]\\s$"),replace(){return{type:"checkListItem",props:{checked:!1},content:[]}}},{find:new RegExp("\\[[Xx]\\]\\s$"),replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function Kl(e,t,n,r){let i=e.firstChild.attrs.start||1,s=!0;const o=!!e.firstChild.attrs.start,a=Vn({posBeforeNode:t,node:e});if(!a.isBlockContainer)throw new Error("impossible");const u=n.doc.resolve(a.bnBlock.beforePos).nodeBefore,c=u?r.get(u):void 0;return c!==void 0?(i=c+1,s=!1):u&&Vn({posBeforeNode:a.bnBlock.beforePos-u.nodeSize,node:u}).blockNoteType==="numberedListItem"&&(i=Kl(u,a.bnBlock.beforePos-u.nodeSize,n,r).index+1,s=!1),r.set(e,i),{index:i,isFirst:s,hasStart:o}}function Qa(e,t){const n=new Map,r=t.decorations.map(e.mapping,e.doc),i=[];e.doc.nodesBetween(0,e.doc.nodeSize-2,(o,a)=>{if(o.type.name==="blockContainer"&&o.firstChild.type.name==="numberedListItem"){const{index:u,isFirst:c,hasStart:h}=Kl(o,a,e,n);if(r.find(a,a+o.nodeSize,d=>d.index===u&&d.isFirst===c&&d.hasStart===h).length===0){const d=e.doc.nodeAt(a+1);i.push(K.Decoration.node(a+1,a+1+d.nodeSize,{"data-index":u.toString()}))}}});const s=i.flatMap(o=>r.find(o.from,o.to));return{decorations:r.remove(s).add(e.doc,i)}}const P1=()=>new D.Plugin({key:new D.PluginKey("numbered-list-indexing-decorations"),state:{init(e,t){return Qa(t.tr,{decorations:K.DecorationSet.empty})},apply(e,t){return!e.docChanged&&!e.selectionSet&&t.decorations?t:Qa(e,t)}},props:{decorations(e){var t;return((t=this.getState(e))==null?void 0:t.decorations)??K.DecorationSet.empty}}}),B1=()=>({type:"numberedListItem",propSchema:{...X,start:{default:void 0,type:"number"}},content:"inline"}),U1=xe(B1,{meta:{isolating:!1},parse(e){var t;if(e.tagName!=="LI")return;const n=e.parentElement;if(n!==null&&(n.tagName==="OL"||n.tagName==="DIV"&&((t=n.parentElement)==null?void 0:t.tagName)==="OL")){const r=parseInt(n.getAttribute("start")||"1"),i=Ce(e);return e.previousElementSibling||r===1?i:{...i,start:r}}},parseContent:({el:e,schema:t})=>Do(e,t,"numberedListItem"),render(){const e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){const t=document.createElement("li"),n=document.createElement("p");return Vt(e.props,t),t.appendChild(n),{dom:t,contentDOM:n}}},[z({key:"numbered-list-item-shortcuts",inputRules:[{find:new RegExp("^(\\d+)\\.\\s$"),replace({match:e,editor:t}){if(Sc(t.prosemirrorState).blockNoteType==="heading")return;const n=parseInt(e[1]);return{type:"numberedListItem",props:{start:n!==1?n:void 0}}}}],keyboardShortcuts:{Enter:({editor:e})=>Ci(e,"numberedListItem"),"Mod-Shift-7":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"numberedListItem",props:{}}),!0)}},prosemirrorPlugins:[P1()]})]),H1=()=>({type:"toggleListItem",propSchema:{...X},content:"inline"}),F1=xe(H1,{meta:{isolating:!1},render(e,t){const n=document.createElement("p");return{...jl(e,t,n),contentDOM:n}},toExternalHTML(e){const t=document.createElement("li"),n=document.createElement("p");return Vt(e.props,t),t.appendChild(n),{dom:t,contentDOM:n}}},[z({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>Ci(e,"toggleListItem"),"Mod-Shift-6":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"toggleListItem",props:{}}),!0)}}})]),V1=()=>({type:"paragraph",propSchema:X,content:"inline"}),Y1=xe(V1,{meta:{isolating:!1},parse:e=>{var t;if(e.tagName==="P"&&(t=e.textContent)!=null&&t.trim())return Ce(e)},render:()=>{const e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML:e=>{const t=document.createElement("p");return Vt(e.props,t),{dom:t,contentDOM:t}},runsBefore:["default"]},[z({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"paragraph",props:{}}),!0)}}})]),z1=()=>({type:"quote",propSchema:{backgroundColor:X.backgroundColor,textColor:X.textColor},content:"inline"}),$1=xe(z1,{meta:{isolating:!1},parse(e){if(e.tagName==="BLOCKQUOTE"){const{backgroundColor:t,textColor:n}=Ce(e);return{backgroundColor:t,textColor:n}}},render(){const e=document.createElement("blockquote");return{dom:e,contentDOM:e}},toExternalHTML(e){const t=document.createElement("blockquote");return Vt(e.props,t),{dom:t,contentDOM:t}}},[z({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:e})=>{const t=e.getTextCursorPosition();return e.schema.blockSchema[t.block.type].content!=="inline"?!1:(e.updateBlock(t.block,{type:"quote",props:{}}),!0)}},inputRules:[{find:new RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}}]})]),W1=35,Xl=120,j1=L.Extension.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[oe.columnResizing({cellMinWidth:W1,defaultCellMinWidth:Xl,View:null}),oe.tableEditing()],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:()=>{const 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})=>oe.goToNextCell(1)(e,t,n)),"Shift-Tab":()=>this.editor.commands.command(({state:e,dispatch:t,view:n})=>oe.goToNextCell(-1)(e,t,n))}},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:L.callOrReturn(L.getExtensionField(e,"tableRole",t))}}}),q1={textColor:X.textColor},G1=L.Node.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const 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)=>Ql(e,t)}]},renderHTML({HTMLAttributes:e}){return["th",L.mergeAttributes(this.options.HTMLAttributes,e),0]}}),K1=L.Node.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const 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)=>Ql(e,t)}]},renderHTML({HTMLAttributes:e}){return["td",L.mergeAttributes(this.options.HTMLAttributes,e),0]}}),X1=L.Node.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){var n,r,i;const s=jg(this.name,"table",{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...t},((r=this.options.domAttributes)==null?void 0:r.inlineContent)||{}),o=document.createElement("colgroup");for(const a of e.children[0].children)if(a.attrs.colwidth)for(const u of a.attrs.colwidth){const c=document.createElement("col");u&&(c.style=`width: ${u}px`),o.appendChild(c)}else o.appendChild(document.createElement("col"));return(i=s.dom.firstChild)==null||i.appendChild(o),s},addNodeView(){return({node:e,HTMLAttributes:t})=>{var n;class r extends oe.TableView{constructor(s,o,a){super(s,o),this.node=s,this.cellMinWidth=o,this.blockContentHTMLAttributes=a;const u=document.createElement("div");u.className=tr("bn-block-content",a.class),u.setAttribute("data-content-type","table");for(const[f,p]of Object.entries(a))f!=="class"&&u.setAttribute(f,p);const c=this.dom,h=document.createElement("div");h.className="tableWrapper-inner",h.appendChild(c.firstChild),c.appendChild(h),u.appendChild(c);const d=document.createElement("div");d.className="table-widgets-container",d.style.position="relative",c.appendChild(d),this.dom=u}ignoreMutation(s){return!s.target.closest(".tableWrapper-inner")||super.ignoreMutation(s)}}return new r(e,Xl,{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...t})}}}),Q1=L.Node.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;const t=e.parentElement;return t===null?!1:t.tagName==="TD"||t.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:e}){return["p",e,0]}}),J1=L.Node.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",L.mergeAttributes(this.options.HTMLAttributes,e),0]}});function Ql(e,t){const n=ne.DOMParser.fromSchema(t).parse(e,{topNode:t.nodes.blockGroup.create()}),r=[];return n.content.descendants(i=>{if(i.isInline)return r.push(i),!1}),ne.Fragment.fromArray(r)}const Z1=()=>Gg({node:X1,type:"table",content:"table"},q1,[z({key:"table-extensions",tiptapExtensions:[j1,Q1,G1,K1,J1]}),z({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:e})=>{if(!(e.prosemirrorState.selection instanceof oe.CellSelection))return!1;const t=e.getTextCursorPosition().block,n=t.content;let r=0;for(const s of n.rows)for(const o of s.cells){if("type"in o&&o.content.length>0||!("type"in o)&&o.length>0)return!1;r++}let i=0;return e.prosemirrorState.selection.forEachCell(()=>{i++}),i<r?!1:(e.transact(()=>{(e.getPrevBlock(t)||e.getNextBlock(t))&&e.setTextCursorPosition(t),e.removeBlocks([t])}),!0)}}})]),Ja=e=>{const t=e.src||void 0,n=e.width||void 0;return{url:t,previewWidth:n}},eb='<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>',tb=e=>({type:"video",propSchema:{textAlignment:X.textAlignment,backgroundColor:X.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),nb=e=>t=>{if(t.tagName==="VIDEO"){if(t.closest("figure"))return;const{backgroundColor:n}=Ce(t);return{...Ja(t),backgroundColor:n}}if(t.tagName==="FIGURE"){const n=Ei(t,"video");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=Ce(t);return{...Ja(r),backgroundColor:s,caption:i}}},rb=xe(tb,e=>({meta:{fileBlockAccept:["video/*"]},parse:nb(),render(t,n){const r=document.createElement("div");r.innerHTML=e.icon??eb;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("video");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(t.props.url).then(o=>{s.src=o}):s.src=t.props.url,s.controls=!0,s.contentEditable="false",s.draggable=!1,s.width=t.props.previewWidth,i.appendChild(s),Gl(t,n,{dom:i},i,r.firstElementChild)},toExternalHTML(t){if(!t.props.url){const 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?Lo(n,t.props.caption):Ti(n,t.props.caption):{dom:n}},runsBefore:["file"]}));function ib(e,t,n){return t in e.schema.blockSpecs}function Za(e){return e instanceof oe.CellSelection}const Ar=new Map;function sb(e){if(Ar.has(e))return Ar.get(e);const t=new Js.Mapping;return e._tiptapEditor.on("transaction",({transaction:n})=>{t.appendMapping(n.mapping)}),e._tiptapEditor.on("destroy",()=>{Ar.delete(e)}),Ar.set(e,t),t}function ob(e,t,n="left"){const r=q.getState(e.prosemirrorState);if(!r){const s=sb(e),o=s.maps.length;return()=>s.slice(o).map(t,n==="left"?-1:1)}const i=er(t+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{const s=q.getState(e.prosemirrorState),o=Lt(s.doc,s.binding.type,i,s.binding.mapping);if(o===null)throw new Error("Position not found, cannot track positions");return o+(n==="right"?-1:1)}}const ab=L.findParentNode(e=>e.type.name==="blockContainer");class ub{constructor(t,n,r){At(this,"state"),At(this,"emitUpdate"),At(this,"rootEl"),At(this,"pluginState"),At(this,"handleScroll",()=>{var s,o;if((s=this.state)!=null&&s.show){const a=(o=this.rootEl)==null?void 0:o.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!a)return;this.state.referencePos=a.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),At(this,"closeMenu",()=>{this.editor.transact(s=>s.setMeta(It,null))}),At(this,"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(s=>s.selection.from)}).run()});var i;this.editor=t,this.pluginState=void 0,this.emitUpdate=s=>{var o;if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");n(s,{...this.state,ignoreQueryLength:(o=this.pluginState)==null?void 0:o.ignoreQueryLength})},this.rootEl=r.root,(i=this.rootEl)==null||i.addEventListener("scroll",this.handleScroll,!0)}update(t,n){var r;const i=It.getState(n),s=It.getState(t.state),o=i===void 0&&s!==void 0,a=i!==void 0&&s===void 0;if(!o&&!(i!==void 0&&s!==void 0)&&!a)return;if(this.pluginState=a?i:s,a||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}const u=(r=this.rootEl)==null?void 0:r.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&u&&(this.state={show:!0,referencePos:u.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){var t;(t=this.rootEl)==null||t.removeEventListener("scroll",this.handleScroll,!0)}}const It=new D.PluginKey("SuggestionMenuPlugin");z(({editor:e})=>{const t=[];let n;const r=Tn(void 0);return{key:"suggestionMenu",store:r,addTriggerCharacter:i=>{t.push(i)},removeTriggerCharacter:i=>{t.splice(t.indexOf(i),1)},closeMenu:()=>{n==null||n.closeMenu()},clearQuery:()=>{n==null||n.clearQuery()},shown:()=>{var i;return((i=n==null?void 0:n.state)==null?void 0:i.show)||!1},openSuggestionMenu:(i,s)=>{e.headless||(e.focus(),e.transact(o=>{s!=null&&s.deleteTriggerCharacter&&o.insertText(i),o.scrollIntoView().setMeta(It,{triggerCharacter:i,deleteTriggerCharacter:(s==null?void 0:s.deleteTriggerCharacter)||!1,ignoreQueryLength:(s==null?void 0:s.ignoreQueryLength)||!1})}))},prosemirrorPlugins:[new D.Plugin({key:It,view:i=>(n=new ub(e,(s,o)=>{r.setState({...o,triggerCharacter:s})},i),n),state:{init(){},apply:(i,s,o,a)=>{if(i.selection.$from.parent.type.spec.code)return s;const u=i.getMeta(It);if(typeof u=="object"&&u!==null){s&&(n==null||n.closeMenu());const h=ob(e,a.selection.from-u.triggerCharacter.length);return{triggerCharacter:u.triggerCharacter,deleteTriggerCharacter:u.deleteTriggerCharacter!==!1,queryStartPos:()=>h()+u.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:u==null?void 0:u.ignoreQueryLength}}if(s===void 0)return s;if(a.selection.from!==a.selection.to||u===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||s.triggerCharacter!==void 0&&a.selection.from<s.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(s.queryStartPos())))return;const c={...s};return c.query=a.doc.textBetween(s.queryStartPos(),a.selection.from),c}},props:{handleTextInput(i,s,o,a){if(s===o){const u=i.state.doc;for(const c of t){const h=c.length>1?u.textBetween(s-c.length,s)+a:a;if(c===h)return i.dispatch(i.state.tr.insertText(a)),i.dispatch(i.state.tr.setMeta(It,{triggerCharacter:h}).scrollIntoView()),!0}}return!1},decorations(i){const s=this.getState(i);if(s===void 0)return null;if(!s.deleteTriggerCharacter){const o=ab(i.selection);if(o)return K.DecorationSet.create(i.doc,[K.Decoration.node(o.pos,o.pos+o.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}return K.DecorationSet.create(i.doc,[K.Decoration.inline(s.queryStartPos()-s.triggerCharacter.length,s.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}}})]}});function cb(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 eu(e,t){const n=e.getTextCursorPosition().block;if(n.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&Rt(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)),cb(e),r}h1(),R1(),v1(),m1(),b1(),C1(),k1(),L1(),U1(),Y1(),$1(),Z1(),F1(),rb();const lb=zl({type:"textColor",propSchema:"string"},{render:()=>{const e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{const t=document.createElement("span");return e!==X.textColor.default&&(t.style.color=e in ht?ht[e].text:e),{dom:t,contentDOM:t}},parse:e=>{if(e.tagName==="SPAN"&&e.style.color)return e.style.color}}),db=zl({type:"backgroundColor",propSchema:"string"},{render:()=>{const e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{const t=document.createElement("span");return e!==X.backgroundColor.default&&(t.style.backgroundColor=e in ht?ht[e].background:e),{dom:t,contentDOM:t}},parse:e=>{if(e.tagName==="SPAN"&&e.style.backgroundColor)return e.style.backgroundColor}}),hb={bold:An(Ig,"boolean"),italic:An(Bg,"boolean"),underline:An(zg,"boolean"),strike:An(Vg,"boolean"),code:An(Dg,"boolean"),textColor:lb,backgroundColor:db};Qg(hb);const fb={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}};Kg(fb);class dr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}dr.prototype.normal={};dr.prototype.property={};dr.prototype.space=void 0;function Jl(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new dr(n,r,t)}function nr(e){return e.toLowerCase()}class _e{constructor(t,n){this.attribute=n,this.property=t}}_e.prototype.attribute="";_e.prototype.booleanish=!1;_e.prototype.boolean=!1;_e.prototype.commaOrSpaceSeparated=!1;_e.prototype.commaSeparated=!1;_e.prototype.defined=!1;_e.prototype.mustUseProperty=!1;_e.prototype.number=!1;_e.prototype.overloadedBoolean=!1;_e.prototype.property="";_e.prototype.spaceSeparated=!1;_e.prototype.space=void 0;let pb=0;const M=Yt(),Z=Yt(),Ps=Yt(),N=Yt(),j=Yt(),rn=Yt(),Ae=Yt();function Yt(){return 2**++pb}const Bs=Object.freeze(Object.defineProperty({__proto__:null,boolean:M,booleanish:Z,commaOrSpaceSeparated:Ae,commaSeparated:rn,number:N,overloadedBoolean:Ps,spaceSeparated:j},Symbol.toStringTag,{value:"Module"})),Wi=Object.keys(Bs);class Oo extends _e{constructor(t,n,r,i){let s=-1;if(super(t,n),tu(this,"space",i),typeof r=="number")for(;++s<Wi.length;){const o=Wi[s];tu(this,Wi[s],(r&Bs[o])===Bs[o])}}}Oo.prototype.defined=!0;function tu(e,t,n){n&&(e[t]=n)}function Cn(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Oo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[nr(r)]=r,n[nr(s.attribute)]=r}return new dr(t,n,e.space)}const Zl=Cn({properties:{ariaActiveDescendant:null,ariaAtomic:Z,ariaAutoComplete:null,ariaBusy:Z,ariaChecked:Z,ariaColCount:N,ariaColIndex:N,ariaColSpan:N,ariaControls:j,ariaCurrent:null,ariaDescribedBy:j,ariaDetails:null,ariaDisabled:Z,ariaDropEffect:j,ariaErrorMessage:null,ariaExpanded:Z,ariaFlowTo:j,ariaGrabbed:Z,ariaHasPopup:null,ariaHidden:Z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:j,ariaLevel:N,ariaLive:null,ariaModal:Z,ariaMultiLine:Z,ariaMultiSelectable:Z,ariaOrientation:null,ariaOwns:j,ariaPlaceholder:null,ariaPosInSet:N,ariaPressed:Z,ariaReadOnly:Z,ariaRelevant:null,ariaRequired:Z,ariaRoleDescription:j,ariaRowCount:N,ariaRowIndex:N,ariaRowSpan:N,ariaSelected:Z,ariaSetSize:N,ariaSort:null,ariaValueMax:N,ariaValueMin:N,ariaValueNow:N,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ed(e,t){return t in e?e[t]:t}function td(e,t){return ed(e,t.toLowerCase())}const mb=Cn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:rn,acceptCharset:j,accessKey:j,action:null,allow:null,allowFullScreen:M,allowPaymentRequest:M,allowUserMedia:M,alt:null,as:null,async:M,autoCapitalize:null,autoComplete:j,autoFocus:M,autoPlay:M,blocking:j,capture:null,charSet:null,checked:M,cite:null,className:j,cols:N,colSpan:null,content:null,contentEditable:Z,controls:M,controlsList:j,coords:N|rn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:M,defer:M,dir:null,dirName:null,disabled:M,download:Ps,draggable:Z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:M,formTarget:null,headers:j,height:N,hidden:Ps,high:N,href:null,hrefLang:null,htmlFor:j,httpEquiv:j,id:null,imageSizes:null,imageSrcSet:null,inert:M,inputMode:null,integrity:null,is:null,isMap:M,itemId:null,itemProp:j,itemRef:j,itemScope:M,itemType:j,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:M,low:N,manifest:null,max:null,maxLength:N,media:null,method:null,min:null,minLength:N,multiple:M,muted:M,name:null,nonce:null,noModule:M,noValidate:M,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:M,optimum:N,pattern:null,ping:j,placeholder:null,playsInline:M,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:M,referrerPolicy:null,rel:j,required:M,reversed:M,rows:N,rowSpan:N,sandbox:j,scope:null,scoped:M,seamless:M,selected:M,shadowRootClonable:M,shadowRootDelegatesFocus:M,shadowRootMode:null,shape:null,size:N,sizes:null,slot:null,span:N,spellCheck:Z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:N,step:null,style:null,tabIndex:N,target:null,title:null,translate:null,type:null,typeMustMatch:M,useMap:null,value:Z,width:N,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:j,axis:null,background:null,bgColor:null,border:N,borderColor:null,bottomMargin:N,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:M,declare:M,event:null,face:null,frame:null,frameBorder:null,hSpace:N,leftMargin:N,link:null,longDesc:null,lowSrc:null,marginHeight:N,marginWidth:N,noResize:M,noHref:M,noShade:M,noWrap:M,object:null,profile:null,prompt:null,rev:null,rightMargin:N,rules:null,scheme:null,scrolling:Z,standby:null,summary:null,text:null,topMargin:N,valueType:null,version:null,vAlign:null,vLink:null,vSpace:N,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:M,disableRemotePlayback:M,prefix:null,property:null,results:N,security:null,unselectable:null},space:"html",transform:td}),gb=Cn({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:Ae,accentHeight:N,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:N,amplitude:N,arabicForm:null,ascent:N,attributeName:null,attributeType:null,azimuth:N,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:N,by:null,calcMode:null,capHeight:N,className:j,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:N,diffuseConstant:N,direction:null,display:null,dur:null,divisor:N,dominantBaseline:null,download:M,dx:null,dy:null,edgeMode:null,editable:null,elevation:N,enableBackground:null,end:null,event:null,exponent:N,externalResourcesRequired:null,fill:null,fillOpacity:N,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:rn,g2:rn,glyphName:rn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:N,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:N,horizOriginX:N,horizOriginY:N,id:null,ideographic:N,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:N,k:N,k1:N,k2:N,k3:N,k4:N,kernelMatrix:Ae,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:N,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:N,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:N,overlineThickness:N,paintOrder:null,panose1:null,path:null,pathLength:N,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:j,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:N,pointsAtY:N,pointsAtZ:N,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ae,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ae,rev:Ae,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ae,requiredFeatures:Ae,requiredFonts:Ae,requiredFormats:Ae,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:N,specularExponent:N,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:N,strikethroughThickness:N,string:null,stroke:null,strokeDashArray:Ae,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:N,strokeOpacity:N,strokeWidth:null,style:null,surfaceScale:N,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ae,tabIndex:N,tableValues:null,target:null,targetX:N,targetY:N,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ae,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:N,underlineThickness:N,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:N,values:null,vAlphabetic:N,vMathematical:N,vectorEffect:null,vHanging:N,vIdeographic:N,version:null,vertAdvY:N,vertOriginX:N,vertOriginY:N,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:N,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ed}),nd=Cn({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()}}),rd=Cn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:td}),id=Cn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bb=/[A-Z]/g,nu=/-[a-z]/g,Eb=/^data[-\w.:]+$/i;function sd(e,t){const n=nr(t);let r=t,i=_e;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Eb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(nu,Cb);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!nu.test(s)){let o=s.replace(bb,Tb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Oo}return new i(r,t)}function Tb(e){return"-"+e.toLowerCase()}function Cb(e){return e.charAt(1).toUpperCase()}const Ro=Jl([Zl,mb,nd,rd,id],"html"),Mo=Jl([Zl,gb,nd,rd,id],"svg");function ru(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&t.push(o),i=r+1,r=n.indexOf(",",i)}return t}const iu=/[#.]/g;function yb(e,t){const n=e||"",r={};let i=0,s,o;for(;i<n.length;){iu.lastIndex=i;const a=iu.exec(n),u=n.slice(i,a?a.index:n.length);u&&(s?s==="#"?r.id=u:Array.isArray(r.className)?r.className.push(u):r.className=[u]:o=u,i+=u.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function su(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function od(e,t,n){const r=n?wb(n):void 0;function i(s,o,...a){let u;if(s==null){u={type:"root",children:[]};const c=o;a.unshift(c)}else{u=yb(s,t);const c=u.tagName.toLowerCase(),h=r?r.get(c):void 0;if(u.tagName=h||c,_b(o))a.unshift(o);else for(const[d,f]of Object.entries(o))Ab(e,u.properties,d,f)}for(const c of a)Us(u.children,c);return u.type==="element"&&u.tagName==="template"&&(u.content={type:"root",children:u.children},u.children=[]),u}return i}function _b(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 i=t[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Ab(e,t,n,r){const i=sd(e,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=su(r):i.commaSeparated?s=ru(r):i.commaOrSpaceSeparated?s=su(ru(r).join(" ")):s=ou(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?kb(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(ou(i,i.property,a));s=o}i.property==="className"&&Array.isArray(t.className)&&(s=t.className.concat(s)),t[i.property]=s}}function Us(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)Us(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Us(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function ou(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||nr(n)===nr(t)))return!0}return n}function kb(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function wb(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Sb=["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"],ad=od(Ro,"div"),ud=od(Mo,"g",Sb);function Ib(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=t.length){let o=0;for(;;){let a=n[o];if(a===void 0){const u=au(t,n[o-1]);a=u===-1?t.length+1:u+1,n[o]=a}if(a>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const a=n[n.length-1],u=au(t,a),c=u===-1?t.length+1:u+1;if(a===c)break;n.push(c)}const o=(s.line>1?n[s.line-2]:0)+s.column-1;if(o<n[s.line-1])return o}}}function au(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
12
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Br={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},cd={}.hasOwnProperty,xb=Object.prototype;function Nb(e,t){const n=t||{};return vo({file:n.file||void 0,location:!1,schema:n.space==="svg"?Mo:Ro,verbose:n.verbose||!1},e)}function vo(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Ur(e,r,n),n}case"#document":case"#document-fragment":{const r=t,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:ld(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){const s=String(e.file),o=Ib(s),a=o.toPoint(0),u=o.toPoint(s.length);n.position={start:a,end:u}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Ur(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Ur(e,r,n),n}default:return n=Lb(e,t),n}}function ld(e,t){let n=-1;const r=[];for(;++n<t.length;){const i=vo(e,t[n]);r.push(i)}return r}function Lb(e,t){const n=e.schema;e.schema=t.namespaceURI===Br.svg?Mo:Ro;let r=-1;const i={};for(;++r<t.attrs.length;){const a=t.attrs[r],u=(a.prefix?a.prefix+":":"")+a.name;cd.call(xb,u)||(i[u]=a.value)}const o=(e.schema.space==="svg"?ud:ad)(t.tagName,i,ld(e,t.childNodes));if(Ur(e,t,o),o.tagName==="template"){const a=t,u=a.sourceCodeLocation,c=u&&u.startTag&&Gt(u.startTag),h=u&&u.endTag&&Gt(u.endTag),d=vo(e,a.content);c&&h&&e.file&&(d.position={start:c.end,end:h.start}),o.content=d}return e.schema=n,o}function Ur(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=Db(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function Db(e,t,n){const r=Gt(n);if(t.type==="element"){const i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){const s={};let o;if(n.attrs)for(o in n.attrs)cd.call(n.attrs,o)&&(s[sd(e.schema,o).property]=Gt(n.attrs[o]));n.startTag;const a=Gt(n.startTag),u=n.endTag?Gt(n.endTag):void 0,c={opening:a};u&&(c.closing=u),c.properties=s,t.data={position:c}}}return r}function Gt(e){const t=uu({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=uu({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function uu(e){return e.line&&e.column?e:void 0}const Ob=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]),G="�";var g;(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"})(g||(g={}));const ge={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function dd(e){return e>=55296&&e<=57343}function Rb(e){return e>=56320&&e<=57343}function Mb(e,t){return(e-55296)*1024+9216+t}function hd(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function fd(e){return e>=64976&&e<=65007||Ob.has(e)}var A;(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"})(A||(A={}));const vb=65536;class Pb{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=vb,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:i,offset:s}=this,o=i+n,a=s+n;return{code:t,startLine:r,endLine:r,startCol:o,endCol:o,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(Rb(n))return this.pos++,this._addGap(),Mb(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,g.EOF;return this._err(A.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,g.EOF;const r=this.html.charCodeAt(n);return r===g.CARRIAGE_RETURN?g.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,g.EOF;let t=this.html.charCodeAt(this.pos);return t===g.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,g.LINE_FEED):t===g.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,dd(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===g.LINE_FEED||t===g.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){hd(t)?this._err(A.controlCharacterInInputStream):fd(t)&&this._err(A.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var F;(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"})(F||(F={}));function pd(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 Bb=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୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢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;怳Ādpuct;戏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ǣጓ\0y;䐎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Ā;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀ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Ā;elƀ;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\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»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ↄⅪ←ٖ↛ǰ↉\0proø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;䅓Ācrir;榿;쀀𝔬ͯ\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\0m;櫳;櫽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))),Ub=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 Hb(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Ub.get(e))!==null&&t!==void 0?t:e}var ae;(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"})(ae||(ae={}));const Fb=32;var ft;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(ft||(ft={}));function Hs(e){return e>=ae.ZERO&&e<=ae.NINE}function Vb(e){return e>=ae.UPPER_A&&e<=ae.UPPER_F||e>=ae.LOWER_A&&e<=ae.LOWER_F}function Yb(e){return e>=ae.UPPER_A&&e<=ae.UPPER_Z||e>=ae.LOWER_A&&e<=ae.LOWER_Z||Hs(e)}function zb(e){return e===ae.EQUALS||Yb(e)}var ie;(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"})(ie||(ie={}));var Je;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Je||(Je={}));class $b{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=ie.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Je.Strict}startEntity(t){this.decodeMode=t,this.state=ie.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case ie.EntityStart:return t.charCodeAt(n)===ae.NUM?(this.state=ie.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ie.NamedEntity,this.stateNamedEntity(t,n));case ie.NumericStart:return this.stateNumericStart(t,n);case ie.NumericDecimal:return this.stateNumericDecimal(t,n);case ie.NumericHex:return this.stateNumericHex(t,n);case ie.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Fb)===ae.LOWER_X?(this.state=ie.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ie.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(t.substr(n,s),i),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(Hs(i)||Vb(i))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(Hs(i))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(i,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===ae.SEMI)this.consumed+=1;else if(this.decodeMode===Je.Strict)return 0;return this.emitCodePoint(Hb(this.result),this.consumed),this.errors&&(t!==ae.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&ft.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const o=t.charCodeAt(n);if(this.treeIndex=Wb(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===Je.Attribute&&(s===0||zb(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&ft.VALUE_LENGTH)>>14,s!==0){if(o===ae.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Je.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&ft.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~ft.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case ie.NamedEntity:return this.result!==0&&(this.decodeMode!==Je.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ie.NumericDecimal:return this.emitNumericEntity(0,2);case ie.NumericHex:return this.emitNumericEntity(0,3);case ie.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ie.EntityStart:return 0}}}function Wb(e,t,n,r){const i=(t&ft.BRANCH_LENGTH)>>7,s=t&ft.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=i?-1:e[n+u]-1}let o=n,a=o+i-1;for(;o<=a;){const u=o+a>>>1,c=e[u];if(c<r)o=u+1;else if(c>r)a=u-1;else return e[u+i]}return-1}var w;(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/"})(w||(w={}));var Dt;(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"})(Dt||(Dt={}));var Ne;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Ne||(Ne={}));var y;(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"})(y||(y={}));var l;(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"})(l||(l={}));const jb=new Map([[y.A,l.A],[y.ADDRESS,l.ADDRESS],[y.ANNOTATION_XML,l.ANNOTATION_XML],[y.APPLET,l.APPLET],[y.AREA,l.AREA],[y.ARTICLE,l.ARTICLE],[y.ASIDE,l.ASIDE],[y.B,l.B],[y.BASE,l.BASE],[y.BASEFONT,l.BASEFONT],[y.BGSOUND,l.BGSOUND],[y.BIG,l.BIG],[y.BLOCKQUOTE,l.BLOCKQUOTE],[y.BODY,l.BODY],[y.BR,l.BR],[y.BUTTON,l.BUTTON],[y.CAPTION,l.CAPTION],[y.CENTER,l.CENTER],[y.CODE,l.CODE],[y.COL,l.COL],[y.COLGROUP,l.COLGROUP],[y.DD,l.DD],[y.DESC,l.DESC],[y.DETAILS,l.DETAILS],[y.DIALOG,l.DIALOG],[y.DIR,l.DIR],[y.DIV,l.DIV],[y.DL,l.DL],[y.DT,l.DT],[y.EM,l.EM],[y.EMBED,l.EMBED],[y.FIELDSET,l.FIELDSET],[y.FIGCAPTION,l.FIGCAPTION],[y.FIGURE,l.FIGURE],[y.FONT,l.FONT],[y.FOOTER,l.FOOTER],[y.FOREIGN_OBJECT,l.FOREIGN_OBJECT],[y.FORM,l.FORM],[y.FRAME,l.FRAME],[y.FRAMESET,l.FRAMESET],[y.H1,l.H1],[y.H2,l.H2],[y.H3,l.H3],[y.H4,l.H4],[y.H5,l.H5],[y.H6,l.H6],[y.HEAD,l.HEAD],[y.HEADER,l.HEADER],[y.HGROUP,l.HGROUP],[y.HR,l.HR],[y.HTML,l.HTML],[y.I,l.I],[y.IMG,l.IMG],[y.IMAGE,l.IMAGE],[y.INPUT,l.INPUT],[y.IFRAME,l.IFRAME],[y.KEYGEN,l.KEYGEN],[y.LABEL,l.LABEL],[y.LI,l.LI],[y.LINK,l.LINK],[y.LISTING,l.LISTING],[y.MAIN,l.MAIN],[y.MALIGNMARK,l.MALIGNMARK],[y.MARQUEE,l.MARQUEE],[y.MATH,l.MATH],[y.MENU,l.MENU],[y.META,l.META],[y.MGLYPH,l.MGLYPH],[y.MI,l.MI],[y.MO,l.MO],[y.MN,l.MN],[y.MS,l.MS],[y.MTEXT,l.MTEXT],[y.NAV,l.NAV],[y.NOBR,l.NOBR],[y.NOFRAMES,l.NOFRAMES],[y.NOEMBED,l.NOEMBED],[y.NOSCRIPT,l.NOSCRIPT],[y.OBJECT,l.OBJECT],[y.OL,l.OL],[y.OPTGROUP,l.OPTGROUP],[y.OPTION,l.OPTION],[y.P,l.P],[y.PARAM,l.PARAM],[y.PLAINTEXT,l.PLAINTEXT],[y.PRE,l.PRE],[y.RB,l.RB],[y.RP,l.RP],[y.RT,l.RT],[y.RTC,l.RTC],[y.RUBY,l.RUBY],[y.S,l.S],[y.SCRIPT,l.SCRIPT],[y.SEARCH,l.SEARCH],[y.SECTION,l.SECTION],[y.SELECT,l.SELECT],[y.SOURCE,l.SOURCE],[y.SMALL,l.SMALL],[y.SPAN,l.SPAN],[y.STRIKE,l.STRIKE],[y.STRONG,l.STRONG],[y.STYLE,l.STYLE],[y.SUB,l.SUB],[y.SUMMARY,l.SUMMARY],[y.SUP,l.SUP],[y.TABLE,l.TABLE],[y.TBODY,l.TBODY],[y.TEMPLATE,l.TEMPLATE],[y.TEXTAREA,l.TEXTAREA],[y.TFOOT,l.TFOOT],[y.TD,l.TD],[y.TH,l.TH],[y.THEAD,l.THEAD],[y.TITLE,l.TITLE],[y.TR,l.TR],[y.TRACK,l.TRACK],[y.TT,l.TT],[y.U,l.U],[y.UL,l.UL],[y.SVG,l.SVG],[y.VAR,l.VAR],[y.WBR,l.WBR],[y.XMP,l.XMP]]);function yi(e){var t;return(t=jb.get(e))!==null&&t!==void 0?t:l.UNKNOWN}const S=l,qb={[w.HTML]:new Set([S.ADDRESS,S.APPLET,S.AREA,S.ARTICLE,S.ASIDE,S.BASE,S.BASEFONT,S.BGSOUND,S.BLOCKQUOTE,S.BODY,S.BR,S.BUTTON,S.CAPTION,S.CENTER,S.COL,S.COLGROUP,S.DD,S.DETAILS,S.DIR,S.DIV,S.DL,S.DT,S.EMBED,S.FIELDSET,S.FIGCAPTION,S.FIGURE,S.FOOTER,S.FORM,S.FRAME,S.FRAMESET,S.H1,S.H2,S.H3,S.H4,S.H5,S.H6,S.HEAD,S.HEADER,S.HGROUP,S.HR,S.HTML,S.IFRAME,S.IMG,S.INPUT,S.LI,S.LINK,S.LISTING,S.MAIN,S.MARQUEE,S.MENU,S.META,S.NAV,S.NOEMBED,S.NOFRAMES,S.NOSCRIPT,S.OBJECT,S.OL,S.P,S.PARAM,S.PLAINTEXT,S.PRE,S.SCRIPT,S.SECTION,S.SELECT,S.SOURCE,S.STYLE,S.SUMMARY,S.TABLE,S.TBODY,S.TD,S.TEMPLATE,S.TEXTAREA,S.TFOOT,S.TH,S.THEAD,S.TITLE,S.TR,S.TRACK,S.UL,S.WBR,S.XMP]),[w.MATHML]:new Set([S.MI,S.MO,S.MN,S.MS,S.MTEXT,S.ANNOTATION_XML]),[w.SVG]:new Set([S.TITLE,S.FOREIGN_OBJECT,S.DESC]),[w.XLINK]:new Set,[w.XML]:new Set,[w.XMLNS]:new Set},Fs=new Set([S.H1,S.H2,S.H3,S.H4,S.H5,S.H6]);y.STYLE,y.SCRIPT,y.XMP,y.IFRAME,y.NOEMBED,y.NOFRAMES,y.PLAINTEXT;var b;(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"})(b||(b={}));const Te={DATA:b.DATA,RCDATA:b.RCDATA,RAWTEXT:b.RAWTEXT,SCRIPT_DATA:b.SCRIPT_DATA,PLAINTEXT:b.PLAINTEXT,CDATA_SECTION:b.CDATA_SECTION};function Gb(e){return e>=g.DIGIT_0&&e<=g.DIGIT_9}function xn(e){return e>=g.LATIN_CAPITAL_A&&e<=g.LATIN_CAPITAL_Z}function Kb(e){return e>=g.LATIN_SMALL_A&&e<=g.LATIN_SMALL_Z}function at(e){return Kb(e)||xn(e)}function cu(e){return at(e)||Gb(e)}function kr(e){return e+32}function md(e){return e===g.SPACE||e===g.LINE_FEED||e===g.TABULATION||e===g.FORM_FEED}function lu(e){return md(e)||e===g.SOLIDUS||e===g.GREATER_THAN_SIGN}function Xb(e){return e===g.NULL?A.nullCharacterReference:e>1114111?A.characterReferenceOutsideUnicodeRange:dd(e)?A.surrogateCharacterReference:fd(e)?A.noncharacterCharacterReference:hd(e)||e===g.CARRIAGE_RETURN?A.controlCharacterReference:null}class Qb{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=b.DATA,this.returnState=b.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Pb(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new $b(Bb,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(A.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(A.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=Xb(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.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==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||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:F.START_TAG,tagName:"",tagID:l.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:F.END_TAG,tagName:"",tagID:l.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:F.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:F.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(pd(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(A.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=yi(t.tagName),t.type===F.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(A.endTagWithAttributes),t.selfClosing&&this._err(A.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 F.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case F.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case F.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:F.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=md(t)?F.WHITESPACE_CHARACTER:t===g.NULL?F.NULL_CHARACTER:F.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(F.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=b.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Je.Attribute:Je.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===b.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===b.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===b.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case b.DATA:{this._stateData(t);break}case b.RCDATA:{this._stateRcdata(t);break}case b.RAWTEXT:{this._stateRawtext(t);break}case b.SCRIPT_DATA:{this._stateScriptData(t);break}case b.PLAINTEXT:{this._statePlaintext(t);break}case b.TAG_OPEN:{this._stateTagOpen(t);break}case b.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case b.TAG_NAME:{this._stateTagName(t);break}case b.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case b.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case b.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case b.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case b.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case b.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case b.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case b.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case b.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case b.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case b.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case b.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case b.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case b.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case b.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case b.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case b.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case b.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case b.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case b.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case b.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case b.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case b.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case b.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case b.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case b.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case b.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case b.BOGUS_COMMENT:{this._stateBogusComment(t);break}case b.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case b.COMMENT_START:{this._stateCommentStart(t);break}case b.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case b.COMMENT:{this._stateComment(t);break}case b.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case b.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case b.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case b.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case b.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case b.COMMENT_END:{this._stateCommentEnd(t);break}case b.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case b.DOCTYPE:{this._stateDoctype(t);break}case b.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case b.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case b.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case b.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case b.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case b.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case b.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case b.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case b.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case b.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case b.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case b.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case b.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case b.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case b.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case b.CDATA_SECTION:{this._stateCdataSection(t);break}case b.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case b.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case b.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case b.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case g.LESS_THAN_SIGN:{this.state=b.TAG_OPEN;break}case g.AMPERSAND:{this._startCharacterReference();break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitCodePoint(t);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case g.AMPERSAND:{this._startCharacterReference();break}case g.LESS_THAN_SIGN:{this.state=b.RCDATA_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case g.LESS_THAN_SIGN:{this.state=b.RAWTEXT_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(at(t))this._createStartTagToken(),this.state=b.TAG_NAME,this._stateTagName(t);else switch(t){case g.EXCLAMATION_MARK:{this.state=b.MARKUP_DECLARATION_OPEN;break}case g.SOLIDUS:{this.state=b.END_TAG_OPEN;break}case g.QUESTION_MARK:{this._err(A.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=b.BOGUS_COMMENT,this._stateBogusComment(t);break}case g.EOF:{this._err(A.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(A.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=b.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(at(t))this._createEndTagToken(),this.state=b.TAG_NAME,this._stateTagName(t);else switch(t){case g.GREATER_THAN_SIGN:{this._err(A.missingEndTagName),this.state=b.DATA;break}case g.EOF:{this._err(A.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(A.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=b.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.BEFORE_ATTRIBUTE_NAME;break}case g.SOLIDUS:{this.state=b.SELF_CLOSING_START_TAG;break}case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentTagToken();break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.tagName+=G;break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(xn(t)?kr(t):t)}}_stateRcdataLessThanSign(t){t===g.SOLIDUS?this.state=b.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=b.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){at(t)?(this.state=b.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=b.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 g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=b.BEFORE_ATTRIBUTE_NAME,!1;case g.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=b.SELF_CLOSING_START_TAG,!1;case g.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=b.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=b.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===g.SOLIDUS?this.state=b.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=b.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){at(t)?(this.state=b.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=b.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=b.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case g.SOLIDUS:{this.state=b.SCRIPT_DATA_END_TAG_OPEN;break}case g.EXCLAMATION_MARK:{this.state=b.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=b.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){at(t)?(this.state=b.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=b.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=b.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===g.HYPHEN_MINUS?(this.state=b.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=b.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===g.HYPHEN_MINUS?(this.state=b.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=b.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case g.HYPHEN_MINUS:{this.state=b.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case g.HYPHEN_MINUS:{this.state=b.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.state=b.SCRIPT_DATA_ESCAPED,this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=b.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case g.HYPHEN_MINUS:{this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case g.GREATER_THAN_SIGN:{this.state=b.SCRIPT_DATA,this._emitChars(">");break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.state=b.SCRIPT_DATA_ESCAPED,this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=b.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===g.SOLIDUS?this.state=b.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:at(t)?(this._emitChars("<"),this.state=b.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=b.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){at(t)?(this.state=b.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=b.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=b.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(ge.SCRIPT,!1)&&lu(this.preprocessor.peek(ge.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<ge.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=b.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case g.HYPHEN_MINUS:{this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case g.NULL:{this._err(A.unexpectedNullCharacter),this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case g.HYPHEN_MINUS:{this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case g.HYPHEN_MINUS:{this._emitChars("-");break}case g.LESS_THAN_SIGN:{this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case g.GREATER_THAN_SIGN:{this.state=b.SCRIPT_DATA,this._emitChars(">");break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(G);break}case g.EOF:{this._err(A.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===g.SOLIDUS?(this.state=b.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(ge.SCRIPT,!1)&&lu(this.preprocessor.peek(ge.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<ge.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=b.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=b.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.SOLIDUS:case g.GREATER_THAN_SIGN:case g.EOF:{this.state=b.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case g.EQUALS_SIGN:{this._err(A.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=b.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=b.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:case g.SOLIDUS:case g.GREATER_THAN_SIGN:case g.EOF:{this._leaveAttrName(),this.state=b.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case g.EQUALS_SIGN:{this._leaveAttrName(),this.state=b.BEFORE_ATTRIBUTE_VALUE;break}case g.QUOTATION_MARK:case g.APOSTROPHE:case g.LESS_THAN_SIGN:{this._err(A.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.currentAttr.name+=G;break}default:this.currentAttr.name+=String.fromCodePoint(xn(t)?kr(t):t)}}_stateAfterAttributeName(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.SOLIDUS:{this.state=b.SELF_CLOSING_START_TAG;break}case g.EQUALS_SIGN:{this.state=b.BEFORE_ATTRIBUTE_VALUE;break}case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentTagToken();break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=b.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.QUOTATION_MARK:{this.state=b.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case g.APOSTROPHE:{this.state=b.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case g.GREATER_THAN_SIGN:{this._err(A.missingAttributeValue),this.state=b.DATA,this.emitCurrentTagToken();break}default:this.state=b.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case g.QUOTATION_MARK:{this.state=b.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case g.AMPERSAND:{this._startCharacterReference();break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.currentAttr.value+=G;break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case g.APOSTROPHE:{this.state=b.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case g.AMPERSAND:{this._startCharacterReference();break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.currentAttr.value+=G;break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this._leaveAttrValue(),this.state=b.BEFORE_ATTRIBUTE_NAME;break}case g.AMPERSAND:{this._startCharacterReference();break}case g.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=b.DATA,this.emitCurrentTagToken();break}case g.NULL:{this._err(A.unexpectedNullCharacter),this.currentAttr.value+=G;break}case g.QUOTATION_MARK:case g.APOSTROPHE:case g.LESS_THAN_SIGN:case g.EQUALS_SIGN:case g.GRAVE_ACCENT:{this._err(A.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this._leaveAttrValue(),this.state=b.BEFORE_ATTRIBUTE_NAME;break}case g.SOLIDUS:{this._leaveAttrValue(),this.state=b.SELF_CLOSING_START_TAG;break}case g.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=b.DATA,this.emitCurrentTagToken();break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this._err(A.missingWhitespaceBetweenAttributes),this.state=b.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case g.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=b.DATA,this.emitCurrentTagToken();break}case g.EOF:{this._err(A.eofInTag),this._emitEOFToken();break}default:this._err(A.unexpectedSolidusInTag),this.state=b.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentComment(n);break}case g.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.data+=G;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(ge.DASH_DASH,!0)?(this._createCommentToken(ge.DASH_DASH.length+1),this.state=b.COMMENT_START):this._consumeSequenceIfMatch(ge.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(ge.DOCTYPE.length+1),this.state=b.DOCTYPE):this._consumeSequenceIfMatch(ge.CDATA_START,!0)?this.inForeignNode?this.state=b.CDATA_SECTION:(this._err(A.cdataInHtmlContent),this._createCommentToken(ge.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=b.BOGUS_COMMENT):this._ensureHibernation()||(this._err(A.incorrectlyOpenedComment),this._createCommentToken(2),this.state=b.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case g.HYPHEN_MINUS:{this.state=b.COMMENT_START_DASH;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptClosingOfEmptyComment),this.state=b.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=b.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case g.HYPHEN_MINUS:{this.state=b.COMMENT_END;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptClosingOfEmptyComment),this.state=b.DATA,this.emitCurrentComment(n);break}case g.EOF:{this._err(A.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=b.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case g.HYPHEN_MINUS:{this.state=b.COMMENT_END_DASH;break}case g.LESS_THAN_SIGN:{n.data+="<",this.state=b.COMMENT_LESS_THAN_SIGN;break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.data+=G;break}case g.EOF:{this._err(A.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case g.EXCLAMATION_MARK:{n.data+="!",this.state=b.COMMENT_LESS_THAN_SIGN_BANG;break}case g.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=b.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===g.HYPHEN_MINUS?this.state=b.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=b.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===g.HYPHEN_MINUS?this.state=b.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=b.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==g.GREATER_THAN_SIGN&&t!==g.EOF&&this._err(A.nestedComment),this.state=b.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case g.HYPHEN_MINUS:{this.state=b.COMMENT_END;break}case g.EOF:{this._err(A.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=b.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentComment(n);break}case g.EXCLAMATION_MARK:{this.state=b.COMMENT_END_BANG;break}case g.HYPHEN_MINUS:{n.data+="-";break}case g.EOF:{this._err(A.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=b.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case g.HYPHEN_MINUS:{n.data+="--!",this.state=b.COMMENT_END_DASH;break}case g.GREATER_THAN_SIGN:{this._err(A.incorrectlyClosedComment),this.state=b.DATA,this.emitCurrentComment(n);break}case g.EOF:{this._err(A.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=b.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.BEFORE_DOCTYPE_NAME;break}case g.GREATER_THAN_SIGN:{this.state=b.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case g.EOF:{this._err(A.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingWhitespaceBeforeDoctypeName),this.state=b.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(xn(t))this._createDoctypeToken(String.fromCharCode(kr(t))),this.state=b.DOCTYPE_NAME;else switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.NULL:{this._err(A.unexpectedNullCharacter),this._createDoctypeToken(G),this.state=b.DOCTYPE_NAME;break}case g.GREATER_THAN_SIGN:{this._err(A.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.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=b.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.AFTER_DOCTYPE_NAME;break}case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.name+=G;break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(xn(t)?kr(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(ge.PUBLIC,!1)?this.state=b.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(ge.SYSTEM,!1)?this.state=b.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(A.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case g.QUOTATION_MARK:{this._err(A.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=b.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{this._err(A.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=b.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case g.GREATER_THAN_SIGN:{this._err(A.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.QUOTATION_MARK:{n.publicId="",this.state=b.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{n.publicId="",this.state=b.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case g.GREATER_THAN_SIGN:{this._err(A.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case g.QUOTATION_MARK:{this.state=b.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.publicId+=G;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.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 g.APOSTROPHE:{this.state=b.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.publicId+=G;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.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 g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case g.GREATER_THAN_SIGN:{this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.QUOTATION_MARK:{this._err(A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{this._err(A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.QUOTATION_MARK:{n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:{this.state=b.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case g.QUOTATION_MARK:{this._err(A.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{this._err(A.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case g.GREATER_THAN_SIGN:{this._err(A.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.QUOTATION_MARK:{n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case g.APOSTROPHE:{n.systemId="",this.state=b.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case g.GREATER_THAN_SIGN:{this._err(A.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.DATA,this.emitCurrentDoctype(n);break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case g.QUOTATION_MARK:{this.state=b.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.systemId+=G;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.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 g.APOSTROPHE:{this.state=b.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case g.NULL:{this._err(A.unexpectedNullCharacter),n.systemId+=G;break}case g.GREATER_THAN_SIGN:{this._err(A.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.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 g.SPACE:case g.LINE_FEED:case g.TABULATION:case g.FORM_FEED:break;case g.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.EOF:{this._err(A.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(A.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=b.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case g.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=b.DATA;break}case g.NULL:{this._err(A.unexpectedNullCharacter);break}case g.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case g.RIGHT_SQUARE_BRACKET:{this.state=b.CDATA_SECTION_BRACKET;break}case g.EOF:{this._err(A.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===g.RIGHT_SQUARE_BRACKET?this.state=b.CDATA_SECTION_END:(this._emitChars("]"),this.state=b.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case g.GREATER_THAN_SIGN:{this.state=b.DATA;break}case g.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=b.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(g.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&cu(this.preprocessor.peek(1))?b.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){cu(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===g.SEMICOLON&&this._err(A.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const gd=new Set([l.DD,l.DT,l.LI,l.OPTGROUP,l.OPTION,l.P,l.RB,l.RP,l.RT,l.RTC]),du=new Set([...gd,l.CAPTION,l.COLGROUP,l.TBODY,l.TD,l.TFOOT,l.TH,l.THEAD,l.TR]),Zr=new Set([l.APPLET,l.CAPTION,l.HTML,l.MARQUEE,l.OBJECT,l.TABLE,l.TD,l.TEMPLATE,l.TH]),Jb=new Set([...Zr,l.OL,l.UL]),Zb=new Set([...Zr,l.BUTTON]),hu=new Set([l.ANNOTATION_XML,l.MI,l.MN,l.MO,l.MS,l.MTEXT]),fu=new Set([l.DESC,l.FOREIGN_OBJECT,l.TITLE]),eE=new Set([l.TR,l.TEMPLATE,l.HTML]),tE=new Set([l.TBODY,l.TFOOT,l.THEAD,l.TEMPLATE,l.HTML]),nE=new Set([l.TABLE,l.TEMPLATE,l.HTML]),rE=new Set([l.TD,l.TH]);class iE{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=l.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===l.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===w.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 i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===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])!==w.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(Fs,w.HTML)}popUntilTableCellPopped(){this.popUntilPopped(rE,w.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(nE,w.HTML)}clearBackToTableBodyContext(){this.clearBackTo(tE,w.HTML)}clearBackToTableRowContext(){this.clearBackTo(eE,w.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]===l.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]===l.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case w.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case w.SVG:{if(fu.has(i))return!1;break}case w.MATHML:{if(hu.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Zr)}hasInListItemScope(t){return this.hasInDynamicScope(t,Jb)}hasInButtonScope(t){return this.hasInDynamicScope(t,Zb)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case w.HTML:{if(Fs.has(n))return!0;if(Zr.has(n))return!1;break}case w.SVG:{if(fu.has(n))return!1;break}case w.MATHML:{if(hu.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===w.HTML)switch(this.tagIDs[n]){case t:return!0;case l.TABLE:case l.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===w.HTML)switch(this.tagIDs[t]){case l.TBODY:case l.THEAD:case l.TFOOT:return!0;case l.TABLE:case l.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===w.HTML)switch(this.tagIDs[n]){case t:return!0;case l.OPTION:case l.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&gd.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&du.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&du.has(this.currentTagId);)this.pop()}}const ji=3;var je;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(je||(je={}));const pu={type:je.Marker};class sE{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let a=0;a<this.entries.length;a++){const u=this.entries[a];if(u.type===je.Marker)break;const{element:c}=u;if(this.treeAdapter.getTagName(c)===s&&this.treeAdapter.getNamespaceURI(c)===o){const h=this.treeAdapter.getAttrList(c);h.length===i&&r.push({idx:a,attrs:h})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<ji)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<ji)return;const i=new Map(n.map(o=>[o.name,o.value]));let s=0;for(let o=0;o<r.length;o++){const a=r[o];a.attrs.every(u=>i.get(u.name)===u.value)&&(s+=1,s>=ji&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(pu)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:je.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:je.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(pu);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===je.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===je.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===je.Element&&n.element===t)}}const ut={createDocument(){return{nodeName:"#document",mode:Ne.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 i=e.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};ut.appendChild(e,s)}},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(ut.isTextNode(n)){n.value+=t;return}}ut.appendChild(e,ut.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&ut.isTextNode(r)?r.value+=t:ut.insertBefore(e,ut.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}}},bd="html",oE="about:legacy-compat",aE="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Ed=["+//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//"],uE=[...Ed,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],cE=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Td=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],lE=[...Td,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function mu(e,t){return t.some(n=>e.startsWith(n))}function dE(e){return e.name===bd&&e.publicId===null&&(e.systemId===null||e.systemId===oE)}function hE(e){if(e.name!==bd)return Ne.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===aE)return Ne.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),cE.has(n))return Ne.QUIRKS;let r=t===null?uE:Ed;if(mu(n,r))return Ne.QUIRKS;if(r=t===null?Td:lE,mu(n,r))return Ne.LIMITED_QUIRKS}return Ne.NO_QUIRKS}const gu={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},fE="definitionurl",pE="definitionURL",mE=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])),gE=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:w.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:w.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:w.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:w.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:w.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:w.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:w.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:w.XML}],["xml:space",{prefix:"xml",name:"space",namespace:w.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:w.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:w.XMLNS}]]),bE=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])),EE=new Set([l.B,l.BIG,l.BLOCKQUOTE,l.BODY,l.BR,l.CENTER,l.CODE,l.DD,l.DIV,l.DL,l.DT,l.EM,l.EMBED,l.H1,l.H2,l.H3,l.H4,l.H5,l.H6,l.HEAD,l.HR,l.I,l.IMG,l.LI,l.LISTING,l.MENU,l.META,l.NOBR,l.OL,l.P,l.PRE,l.RUBY,l.S,l.SMALL,l.SPAN,l.STRONG,l.STRIKE,l.SUB,l.SUP,l.TABLE,l.TT,l.U,l.UL,l.VAR]);function TE(e){const t=e.tagID;return t===l.FONT&&e.attrs.some(({name:r})=>r===Dt.COLOR||r===Dt.SIZE||r===Dt.FACE)||EE.has(t)}function Cd(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===fE){e.attrs[t].name=pE;break}}function yd(e){for(let t=0;t<e.attrs.length;t++){const n=mE.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Po(e){for(let t=0;t<e.attrs.length;t++){const n=gE.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 CE(e){const t=bE.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=yi(e.tagName))}function yE(e,t){return t===w.MATHML&&(e===l.MI||e===l.MO||e===l.MN||e===l.MS||e===l.MTEXT)}function _E(e,t,n){if(t===w.MATHML&&e===l.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Dt.ENCODING){const i=n[r].value.toLowerCase();return i===gu.TEXT_HTML||i===gu.APPLICATION_XML}}return t===w.SVG&&(e===l.FOREIGN_OBJECT||e===l.DESC||e===l.TITLE)}function AE(e,t,n,r){return(!r||r===w.HTML)&&_E(e,t,n)||(!r||r===w.MATHML)&&yE(e,t)}const kE="hidden",wE=8,SE=3;var E;(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"})(E||(E={}));const IE={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},_d=new Set([l.TABLE,l.TBODY,l.TFOOT,l.THEAD,l.TR]),bu={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:ut,onParseError:null};class Ad{constructor(t,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=E.INITIAL,this.originalInsertionMode=E.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={...bu,...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 Qb(this.options,this),this.activeFormattingElements=new sE(this.treeAdapter),this.fragmentContextID=r?yi(this.treeAdapter.getTagName(r)):l.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new iE(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={...bu,...n};t??(t=r.treeAdapter.createElement(y.TEMPLATE,w.HTML,[]));const i=r.treeAdapter.createElement("documentmock",w.HTML,[]),s=new this(r,i,t);return s.fragmentContextID===l.TEMPLATE&&s.tmplInsertionModeStack.unshift(E.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var i;if(!this.onParseError)return;const s=(i=t.location)!==null&&i!==void 0?i:IE,o={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(o)}onItemPush(t,n,r){var i,s;(s=(i=this.treeAdapter).onItemPush)===null||s===void 0||s.call(i,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===w.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,w.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=E.TEXT}switchToPlaintextParsing(){this.insertionMode=E.TEXT,this.originalInsertionMode=E.IN_BODY,this.tokenizer.state=Te.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)===y.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==w.HTML))switch(this.fragmentContextID){case l.TITLE:case l.TEXTAREA:{this.tokenizer.state=Te.RCDATA;break}case l.STYLE:case l.XMP:case l.IFRAME:case l.NOEMBED:case l.NOFRAMES:case l.NOSCRIPT:{this.tokenizer.state=Te.RAWTEXT;break}case l.SCRIPT:{this.tokenizer.state=Te.SCRIPT_DATA;break}case l.PLAINTEXT:{this.tokenizer.state=Te.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const o=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));o&&this.treeAdapter.setNodeSourceCodeLocation(o,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,w.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,w.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(y.HTML,w.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,l.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 i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,o=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:u,endCol:c,endOffset:h}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:u,endCol:c,endOffset:h})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,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,i=this.treeAdapter.getTagName(t),s=n.type===F.END_TAG&&i===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,s)}}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===l.SVG&&this.treeAdapter.getTagName(n)===y.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===w.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===l.MGLYPH||t.tagID===l.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,w.HTML)}_processToken(t){switch(t.type){case F.CHARACTER:{this.onCharacter(t);break}case F.NULL_CHARACTER:{this.onNullCharacter(t);break}case F.COMMENT:{this.onComment(t);break}case F.DOCTYPE:{this.onDoctype(t);break}case F.START_TAG:{this._processStartTag(t);break}case F.END_TAG:{this.onEndTag(t);break}case F.EOF:{this.onEof(t);break}case F.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return AE(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===je.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=E.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(l.P),this.openElements.popUntilTagNamePopped(l.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case l.TR:{this.insertionMode=E.IN_ROW;return}case l.TBODY:case l.THEAD:case l.TFOOT:{this.insertionMode=E.IN_TABLE_BODY;return}case l.CAPTION:{this.insertionMode=E.IN_CAPTION;return}case l.COLGROUP:{this.insertionMode=E.IN_COLUMN_GROUP;return}case l.TABLE:{this.insertionMode=E.IN_TABLE;return}case l.BODY:{this.insertionMode=E.IN_BODY;return}case l.FRAMESET:{this.insertionMode=E.IN_FRAMESET;return}case l.SELECT:{this._resetInsertionModeForSelect(t);return}case l.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case l.HTML:{this.insertionMode=this.headElement?E.AFTER_HEAD:E.BEFORE_HEAD;return}case l.TD:case l.TH:{if(t>0){this.insertionMode=E.IN_CELL;return}break}case l.HEAD:{if(t>0){this.insertionMode=E.IN_HEAD;return}break}}this.insertionMode=E.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===l.TEMPLATE)break;if(r===l.TABLE){this.insertionMode=E.IN_SELECT_IN_TABLE;return}}this.insertionMode=E.IN_SELECT}_isElementCausesFosterParenting(t){return _d.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 l.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===w.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case l.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 qb[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){r2(this,t);return}switch(this.insertionMode){case E.INITIAL:{kn(this,t);break}case E.BEFORE_HTML:{Rn(this,t);break}case E.BEFORE_HEAD:{Mn(this,t);break}case E.IN_HEAD:{vn(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Pn(this,t);break}case E.AFTER_HEAD:{Bn(this,t);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:{wd(this,t);break}case E.TEXT:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{qi(this,t);break}case E.IN_TABLE_TEXT:{Dd(this,t);break}case E.IN_COLUMN_GROUP:{ei(this,t);break}case E.AFTER_BODY:{ti(this,t);break}case E.AFTER_AFTER_BODY:{Hr(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){n2(this,t);return}switch(this.insertionMode){case E.INITIAL:{kn(this,t);break}case E.BEFORE_HTML:{Rn(this,t);break}case E.BEFORE_HEAD:{Mn(this,t);break}case E.IN_HEAD:{vn(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Pn(this,t);break}case E.AFTER_HEAD:{Bn(this,t);break}case E.TEXT:{this._insertCharacters(t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{qi(this,t);break}case E.IN_COLUMN_GROUP:{ei(this,t);break}case E.AFTER_BODY:{ti(this,t);break}case E.AFTER_AFTER_BODY:{Hr(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Vs(this,t);return}switch(this.insertionMode){case E.INITIAL:case E.BEFORE_HTML:case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:case E.IN_BODY:case E.IN_TABLE:case E.IN_CAPTION:case E.IN_COLUMN_GROUP:case E.IN_TABLE_BODY:case E.IN_ROW:case E.IN_CELL:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:case E.IN_TEMPLATE:case E.IN_FRAMESET:case E.AFTER_FRAMESET:{Vs(this,t);break}case E.IN_TABLE_TEXT:{wn(this,t);break}case E.AFTER_BODY:{ME(this,t);break}case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{vE(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case E.INITIAL:{PE(this,t);break}case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:{this._err(t,A.misplacedDoctype);break}case E.IN_TABLE_TEXT:{wn(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,A.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?i2(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{kn(this,t);break}case E.BEFORE_HTML:{BE(this,t);break}case E.BEFORE_HEAD:{HE(this,t);break}case E.IN_HEAD:{Ye(this,t);break}case E.IN_HEAD_NO_SCRIPT:{YE(this,t);break}case E.AFTER_HEAD:{$E(this,t);break}case E.IN_BODY:{fe(this,t);break}case E.IN_TABLE:{dn(this,t);break}case E.IN_TABLE_TEXT:{wn(this,t);break}case E.IN_CAPTION:{FT(this,t);break}case E.IN_COLUMN_GROUP:{Ho(this,t);break}case E.IN_TABLE_BODY:{ki(this,t);break}case E.IN_ROW:{wi(this,t);break}case E.IN_CELL:{zT(this,t);break}case E.IN_SELECT:{Md(this,t);break}case E.IN_SELECT_IN_TABLE:{WT(this,t);break}case E.IN_TEMPLATE:{qT(this,t);break}case E.AFTER_BODY:{KT(this,t);break}case E.IN_FRAMESET:{XT(this,t);break}case E.AFTER_FRAMESET:{JT(this,t);break}case E.AFTER_AFTER_BODY:{e2(this,t);break}case E.AFTER_AFTER_FRAMESET:{t2(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?s2(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{kn(this,t);break}case E.BEFORE_HTML:{UE(this,t);break}case E.BEFORE_HEAD:{FE(this,t);break}case E.IN_HEAD:{VE(this,t);break}case E.IN_HEAD_NO_SCRIPT:{zE(this,t);break}case E.AFTER_HEAD:{WE(this,t);break}case E.IN_BODY:{Ai(this,t);break}case E.TEXT:{LT(this,t);break}case E.IN_TABLE:{rr(this,t);break}case E.IN_TABLE_TEXT:{wn(this,t);break}case E.IN_CAPTION:{VT(this,t);break}case E.IN_COLUMN_GROUP:{YT(this,t);break}case E.IN_TABLE_BODY:{Ys(this,t);break}case E.IN_ROW:{Rd(this,t);break}case E.IN_CELL:{$T(this,t);break}case E.IN_SELECT:{vd(this,t);break}case E.IN_SELECT_IN_TABLE:{jT(this,t);break}case E.IN_TEMPLATE:{GT(this,t);break}case E.AFTER_BODY:{Bd(this,t);break}case E.IN_FRAMESET:{QT(this,t);break}case E.AFTER_FRAMESET:{ZT(this,t);break}case E.AFTER_AFTER_BODY:{Hr(this,t);break}}}onEof(t){switch(this.insertionMode){case E.INITIAL:{kn(this,t);break}case E.BEFORE_HTML:{Rn(this,t);break}case E.BEFORE_HEAD:{Mn(this,t);break}case E.IN_HEAD:{vn(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Pn(this,t);break}case E.AFTER_HEAD:{Bn(this,t);break}case E.IN_BODY:case E.IN_TABLE:case E.IN_CAPTION:case E.IN_COLUMN_GROUP:case E.IN_TABLE_BODY:case E.IN_ROW:case E.IN_CELL:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:{Nd(this,t);break}case E.TEXT:{DT(this,t);break}case E.IN_TABLE_TEXT:{wn(this,t);break}case E.IN_TEMPLATE:{Pd(this,t);break}case E.AFTER_BODY:case E.IN_FRAMESET:case E.AFTER_FRAMESET:case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{Uo(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===g.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 E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:case E.TEXT:case E.IN_COLUMN_GROUP:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:case E.IN_FRAMESET:case E.AFTER_FRAMESET:{this._insertCharacters(t);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:case E.AFTER_BODY:case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{kd(this,t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{qi(this,t);break}case E.IN_TABLE_TEXT:{Ld(this,t);break}}}}function xE(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):xd(e,t),n}function NE(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function LE(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,o=i;o!==n;s++,o=i){i=e.openElements.getCommonAncestor(o);const a=e.activeFormattingElements.getElementEntry(o),u=a&&s>=SE;!a||u?(u&&e.activeFormattingElements.removeEntry(a),e.openElements.remove(o)):(o=DE(e,a),r===t&&(e.activeFormattingElements.bookmark=a),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function DE(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 OE(e,t,n){const r=e.treeAdapter.getTagName(t),i=yi(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===l.TEMPLATE&&s===w.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function RE(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}function Bo(e,t){for(let n=0;n<wE;n++){const r=xE(e,t);if(!r)break;const i=NE(e,r);if(!i)break;e.activeFormattingElements.bookmark=r;const s=LE(e,i,r.element),o=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(s),o&&OE(e,o,s),RE(e,i,r)}}function Vs(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function ME(e,t){e._appendCommentNode(t,e.openElements.items[0])}function vE(e,t){e._appendCommentNode(t,e.document)}function Uo(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],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&e._setEndLocation(s,t)}}}}function PE(e,t){e._setDocumentType(t);const n=t.forceQuirks?Ne.QUIRKS:hE(t);dE(t)||e._err(t,A.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=E.BEFORE_HTML}function kn(e,t){e._err(t,A.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ne.QUIRKS),e.insertionMode=E.BEFORE_HTML,e._processToken(t)}function BE(e,t){t.tagID===l.HTML?(e._insertElement(t,w.HTML),e.insertionMode=E.BEFORE_HEAD):Rn(e,t)}function UE(e,t){const n=t.tagID;(n===l.HTML||n===l.HEAD||n===l.BODY||n===l.BR)&&Rn(e,t)}function Rn(e,t){e._insertFakeRootElement(),e.insertionMode=E.BEFORE_HEAD,e._processToken(t)}function HE(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.HEAD:{e._insertElement(t,w.HTML),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD;break}default:Mn(e,t)}}function FE(e,t){const n=t.tagID;n===l.HEAD||n===l.BODY||n===l.HTML||n===l.BR?Mn(e,t):e._err(t,A.endTagWithoutMatchingOpenElement)}function Mn(e,t){e._insertFakeElement(y.HEAD,l.HEAD),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD,e._processToken(t)}function Ye(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.BASE:case l.BASEFONT:case l.BGSOUND:case l.LINK:case l.META:{e._appendElement(t,w.HTML),t.ackSelfClosing=!0;break}case l.TITLE:{e._switchToTextParsing(t,Te.RCDATA);break}case l.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Te.RAWTEXT):(e._insertElement(t,w.HTML),e.insertionMode=E.IN_HEAD_NO_SCRIPT);break}case l.NOFRAMES:case l.STYLE:{e._switchToTextParsing(t,Te.RAWTEXT);break}case l.SCRIPT:{e._switchToTextParsing(t,Te.SCRIPT_DATA);break}case l.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=E.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(E.IN_TEMPLATE);break}case l.HEAD:{e._err(t,A.misplacedStartTagForHeadElement);break}default:vn(e,t)}}function VE(e,t){switch(t.tagID){case l.HEAD:{e.openElements.pop(),e.insertionMode=E.AFTER_HEAD;break}case l.BODY:case l.BR:case l.HTML:{vn(e,t);break}case l.TEMPLATE:{zt(e,t);break}default:e._err(t,A.endTagWithoutMatchingOpenElement)}}function zt(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==l.TEMPLATE&&e._err(t,A.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(l.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,A.endTagWithoutMatchingOpenElement)}function vn(e,t){e.openElements.pop(),e.insertionMode=E.AFTER_HEAD,e._processToken(t)}function YE(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.BASEFONT:case l.BGSOUND:case l.HEAD:case l.LINK:case l.META:case l.NOFRAMES:case l.STYLE:{Ye(e,t);break}case l.NOSCRIPT:{e._err(t,A.nestedNoscriptInHead);break}default:Pn(e,t)}}function zE(e,t){switch(t.tagID){case l.NOSCRIPT:{e.openElements.pop(),e.insertionMode=E.IN_HEAD;break}case l.BR:{Pn(e,t);break}default:e._err(t,A.endTagWithoutMatchingOpenElement)}}function Pn(e,t){const n=t.type===F.EOF?A.openElementsLeftAfterEof:A.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=E.IN_HEAD,e._processToken(t)}function $E(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.BODY:{e._insertElement(t,w.HTML),e.framesetOk=!1,e.insertionMode=E.IN_BODY;break}case l.FRAMESET:{e._insertElement(t,w.HTML),e.insertionMode=E.IN_FRAMESET;break}case l.BASE:case l.BASEFONT:case l.BGSOUND:case l.LINK:case l.META:case l.NOFRAMES:case l.SCRIPT:case l.STYLE:case l.TEMPLATE:case l.TITLE:{e._err(t,A.abandonedHeadElementChild),e.openElements.push(e.headElement,l.HEAD),Ye(e,t),e.openElements.remove(e.headElement);break}case l.HEAD:{e._err(t,A.misplacedStartTagForHeadElement);break}default:Bn(e,t)}}function WE(e,t){switch(t.tagID){case l.BODY:case l.HTML:case l.BR:{Bn(e,t);break}case l.TEMPLATE:{zt(e,t);break}default:e._err(t,A.endTagWithoutMatchingOpenElement)}}function Bn(e,t){e._insertFakeElement(y.BODY,l.BODY),e.insertionMode=E.IN_BODY,_i(e,t)}function _i(e,t){switch(t.type){case F.CHARACTER:{wd(e,t);break}case F.WHITESPACE_CHARACTER:{kd(e,t);break}case F.COMMENT:{Vs(e,t);break}case F.START_TAG:{fe(e,t);break}case F.END_TAG:{Ai(e,t);break}case F.EOF:{Nd(e,t);break}}}function kd(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function wd(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function jE(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function qE(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function GE(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_FRAMESET)}function KE(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML)}function XE(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Fs.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,w.HTML)}function QE(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function JE(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML),n||(e.formElement=e.openElements.current))}function ZE(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===l.LI&&i===l.LI||(n===l.DD||n===l.DT)&&(i===l.DD||i===l.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==l.ADDRESS&&i!==l.DIV&&i!==l.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML)}function eT(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML),e.tokenizer.state=Te.PLAINTEXT}function tT(e,t){e.openElements.hasInScope(l.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(l.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML),e.framesetOk=!1}function nT(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(y.A);n&&(Bo(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function rT(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function iT(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(l.NOBR)&&(Bo(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,w.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function sT(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function oT(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ne.QUIRKS&&e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._insertElement(t,w.HTML),e.framesetOk=!1,e.insertionMode=E.IN_TABLE}function Sd(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,w.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Id(e){const t=pd(e,Dt.TYPE);return t!=null&&t.toLowerCase()===kE}function aT(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,w.HTML),Id(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function uT(e,t){e._appendElement(t,w.HTML),t.ackSelfClosing=!0}function cT(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._appendElement(t,w.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function lT(e,t){t.tagName=y.IMG,t.tagID=l.IMG,Sd(e,t)}function dT(e,t){e._insertElement(t,w.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Te.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=E.TEXT}function hT(e,t){e.openElements.hasInButtonScope(l.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Te.RAWTEXT)}function fT(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Te.RAWTEXT)}function Eu(e,t){e._switchToTextParsing(t,Te.RAWTEXT)}function pT(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===E.IN_TABLE||e.insertionMode===E.IN_CAPTION||e.insertionMode===E.IN_TABLE_BODY||e.insertionMode===E.IN_ROW||e.insertionMode===E.IN_CELL?E.IN_SELECT_IN_TABLE:E.IN_SELECT}function mT(e,t){e.openElements.currentTagId===l.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML)}function gT(e,t){e.openElements.hasInScope(l.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,w.HTML)}function bT(e,t){e.openElements.hasInScope(l.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(l.RTC),e._insertElement(t,w.HTML)}function ET(e,t){e._reconstructActiveFormattingElements(),Cd(t),Po(t),t.selfClosing?e._appendElement(t,w.MATHML):e._insertElement(t,w.MATHML),t.ackSelfClosing=!0}function TT(e,t){e._reconstructActiveFormattingElements(),yd(t),Po(t),t.selfClosing?e._appendElement(t,w.SVG):e._insertElement(t,w.SVG),t.ackSelfClosing=!0}function Tu(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,w.HTML)}function fe(e,t){switch(t.tagID){case l.I:case l.S:case l.B:case l.U:case l.EM:case l.TT:case l.BIG:case l.CODE:case l.FONT:case l.SMALL:case l.STRIKE:case l.STRONG:{rT(e,t);break}case l.A:{nT(e,t);break}case l.H1:case l.H2:case l.H3:case l.H4:case l.H5:case l.H6:{XE(e,t);break}case l.P:case l.DL:case l.OL:case l.UL:case l.DIV:case l.DIR:case l.NAV:case l.MAIN:case l.MENU:case l.ASIDE:case l.CENTER:case l.FIGURE:case l.FOOTER:case l.HEADER:case l.HGROUP:case l.DIALOG:case l.DETAILS:case l.ADDRESS:case l.ARTICLE:case l.SEARCH:case l.SECTION:case l.SUMMARY:case l.FIELDSET:case l.BLOCKQUOTE:case l.FIGCAPTION:{KE(e,t);break}case l.LI:case l.DD:case l.DT:{ZE(e,t);break}case l.BR:case l.IMG:case l.WBR:case l.AREA:case l.EMBED:case l.KEYGEN:{Sd(e,t);break}case l.HR:{cT(e,t);break}case l.RB:case l.RTC:{gT(e,t);break}case l.RT:case l.RP:{bT(e,t);break}case l.PRE:case l.LISTING:{QE(e,t);break}case l.XMP:{hT(e,t);break}case l.SVG:{TT(e,t);break}case l.HTML:{jE(e,t);break}case l.BASE:case l.LINK:case l.META:case l.STYLE:case l.TITLE:case l.SCRIPT:case l.BGSOUND:case l.BASEFONT:case l.TEMPLATE:{Ye(e,t);break}case l.BODY:{qE(e,t);break}case l.FORM:{JE(e,t);break}case l.NOBR:{iT(e,t);break}case l.MATH:{ET(e,t);break}case l.TABLE:{oT(e,t);break}case l.INPUT:{aT(e,t);break}case l.PARAM:case l.TRACK:case l.SOURCE:{uT(e,t);break}case l.IMAGE:{lT(e,t);break}case l.BUTTON:{tT(e,t);break}case l.APPLET:case l.OBJECT:case l.MARQUEE:{sT(e,t);break}case l.IFRAME:{fT(e,t);break}case l.SELECT:{pT(e,t);break}case l.OPTION:case l.OPTGROUP:{mT(e,t);break}case l.NOEMBED:case l.NOFRAMES:{Eu(e,t);break}case l.FRAMESET:{GE(e,t);break}case l.TEXTAREA:{dT(e,t);break}case l.NOSCRIPT:{e.options.scriptingEnabled?Eu(e,t):Tu(e,t);break}case l.PLAINTEXT:{eT(e,t);break}case l.COL:case l.TH:case l.TD:case l.TR:case l.HEAD:case l.FRAME:case l.TBODY:case l.TFOOT:case l.THEAD:case l.CAPTION:case l.COLGROUP:break;default:Tu(e,t)}}function CT(e,t){if(e.openElements.hasInScope(l.BODY)&&(e.insertionMode=E.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function yT(e,t){e.openElements.hasInScope(l.BODY)&&(e.insertionMode=E.AFTER_BODY,Bd(e,t))}function _T(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function AT(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(l.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(l.FORM):n&&e.openElements.remove(n))}function kT(e){e.openElements.hasInButtonScope(l.P)||e._insertFakeElement(y.P,l.P),e._closePElement()}function wT(e){e.openElements.hasInListItemScope(l.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(l.LI),e.openElements.popUntilTagNamePopped(l.LI))}function ST(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function IT(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function xT(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function NT(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(y.BR,l.BR),e.openElements.pop(),e.framesetOk=!1}function xd(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const s=e.openElements.items[i],o=e.openElements.tagIDs[i];if(r===o&&(r!==l.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(s,o))break}}function Ai(e,t){switch(t.tagID){case l.A:case l.B:case l.I:case l.S:case l.U:case l.EM:case l.TT:case l.BIG:case l.CODE:case l.FONT:case l.NOBR:case l.SMALL:case l.STRIKE:case l.STRONG:{Bo(e,t);break}case l.P:{kT(e);break}case l.DL:case l.UL:case l.OL:case l.DIR:case l.DIV:case l.NAV:case l.PRE:case l.MAIN:case l.MENU:case l.ASIDE:case l.BUTTON:case l.CENTER:case l.FIGURE:case l.FOOTER:case l.HEADER:case l.HGROUP:case l.DIALOG:case l.ADDRESS:case l.ARTICLE:case l.DETAILS:case l.SEARCH:case l.SECTION:case l.SUMMARY:case l.LISTING:case l.FIELDSET:case l.BLOCKQUOTE:case l.FIGCAPTION:{_T(e,t);break}case l.LI:{wT(e);break}case l.DD:case l.DT:{ST(e,t);break}case l.H1:case l.H2:case l.H3:case l.H4:case l.H5:case l.H6:{IT(e);break}case l.BR:{NT(e);break}case l.BODY:{CT(e,t);break}case l.HTML:{yT(e,t);break}case l.FORM:{AT(e);break}case l.APPLET:case l.OBJECT:case l.MARQUEE:{xT(e,t);break}case l.TEMPLATE:{zt(e,t);break}default:xd(e,t)}}function Nd(e,t){e.tmplInsertionModeStack.length>0?Pd(e,t):Uo(e,t)}function LT(e,t){var n;t.tagID===l.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function DT(e,t){e._err(t,A.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function qi(e,t){if(e.openElements.currentTagId!==void 0&&_d.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=E.IN_TABLE_TEXT,t.type){case F.CHARACTER:{Dd(e,t);break}case F.WHITESPACE_CHARACTER:{Ld(e,t);break}}else hr(e,t)}function OT(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_CAPTION}function RT(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_COLUMN_GROUP}function MT(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(y.COLGROUP,l.COLGROUP),e.insertionMode=E.IN_COLUMN_GROUP,Ho(e,t)}function vT(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_TABLE_BODY}function PT(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(y.TBODY,l.TBODY),e.insertionMode=E.IN_TABLE_BODY,ki(e,t)}function BT(e,t){e.openElements.hasInTableScope(l.TABLE)&&(e.openElements.popUntilTagNamePopped(l.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function UT(e,t){Id(t)?e._appendElement(t,w.HTML):hr(e,t),t.ackSelfClosing=!0}function HT(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,w.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function dn(e,t){switch(t.tagID){case l.TD:case l.TH:case l.TR:{PT(e,t);break}case l.STYLE:case l.SCRIPT:case l.TEMPLATE:{Ye(e,t);break}case l.COL:{MT(e,t);break}case l.FORM:{HT(e,t);break}case l.TABLE:{BT(e,t);break}case l.TBODY:case l.TFOOT:case l.THEAD:{vT(e,t);break}case l.INPUT:{UT(e,t);break}case l.CAPTION:{OT(e,t);break}case l.COLGROUP:{RT(e,t);break}default:hr(e,t)}}function rr(e,t){switch(t.tagID){case l.TABLE:{e.openElements.hasInTableScope(l.TABLE)&&(e.openElements.popUntilTagNamePopped(l.TABLE),e._resetInsertionMode());break}case l.TEMPLATE:{zt(e,t);break}case l.BODY:case l.CAPTION:case l.COL:case l.COLGROUP:case l.HTML:case l.TBODY:case l.TD:case l.TFOOT:case l.TH:case l.THEAD:case l.TR:break;default:hr(e,t)}}function hr(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,_i(e,t),e.fosterParentingEnabled=n}function Ld(e,t){e.pendingCharacterTokens.push(t)}function Dd(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function wn(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)hr(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Od=new Set([l.CAPTION,l.COL,l.COLGROUP,l.TBODY,l.TD,l.TFOOT,l.TH,l.THEAD,l.TR]);function FT(e,t){const n=t.tagID;Od.has(n)?e.openElements.hasInTableScope(l.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(l.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,dn(e,t)):fe(e,t)}function VT(e,t){const n=t.tagID;switch(n){case l.CAPTION:case l.TABLE:{e.openElements.hasInTableScope(l.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(l.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,n===l.TABLE&&rr(e,t));break}case l.BODY:case l.COL:case l.COLGROUP:case l.HTML:case l.TBODY:case l.TD:case l.TFOOT:case l.TH:case l.THEAD:case l.TR:break;default:Ai(e,t)}}function Ho(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.COL:{e._appendElement(t,w.HTML),t.ackSelfClosing=!0;break}case l.TEMPLATE:{Ye(e,t);break}default:ei(e,t)}}function YT(e,t){switch(t.tagID){case l.COLGROUP:{e.openElements.currentTagId===l.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case l.TEMPLATE:{zt(e,t);break}case l.COL:break;default:ei(e,t)}}function ei(e,t){e.openElements.currentTagId===l.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE,e._processToken(t))}function ki(e,t){switch(t.tagID){case l.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_ROW;break}case l.TH:case l.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(y.TR,l.TR),e.insertionMode=E.IN_ROW,wi(e,t);break}case l.CAPTION:case l.COL:case l.COLGROUP:case l.TBODY:case l.TFOOT:case l.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,dn(e,t));break}default:dn(e,t)}}function Ys(e,t){const n=t.tagID;switch(t.tagID){case l.TBODY:case l.TFOOT:case l.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case l.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,rr(e,t));break}case l.BODY:case l.CAPTION:case l.COL:case l.COLGROUP:case l.HTML:case l.TD:case l.TH:case l.TR:break;default:rr(e,t)}}function wi(e,t){switch(t.tagID){case l.TH:case l.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,w.HTML),e.insertionMode=E.IN_CELL,e.activeFormattingElements.insertMarker();break}case l.CAPTION:case l.COL:case l.COLGROUP:case l.TBODY:case l.TFOOT:case l.THEAD:case l.TR:{e.openElements.hasInTableScope(l.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,ki(e,t));break}default:dn(e,t)}}function Rd(e,t){switch(t.tagID){case l.TR:{e.openElements.hasInTableScope(l.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY);break}case l.TABLE:{e.openElements.hasInTableScope(l.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Ys(e,t));break}case l.TBODY:case l.TFOOT:case l.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(l.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Ys(e,t));break}case l.BODY:case l.CAPTION:case l.COL:case l.COLGROUP:case l.HTML:case l.TD:case l.TH:break;default:rr(e,t)}}function zT(e,t){const n=t.tagID;Od.has(n)?(e.openElements.hasInTableScope(l.TD)||e.openElements.hasInTableScope(l.TH))&&(e._closeTableCell(),wi(e,t)):fe(e,t)}function $T(e,t){const n=t.tagID;switch(n){case l.TD:case l.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_ROW);break}case l.TABLE:case l.TBODY:case l.TFOOT:case l.THEAD:case l.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Rd(e,t));break}case l.BODY:case l.CAPTION:case l.COL:case l.COLGROUP:case l.HTML:break;default:Ai(e,t)}}function Md(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.OPTION:{e.openElements.currentTagId===l.OPTION&&e.openElements.pop(),e._insertElement(t,w.HTML);break}case l.OPTGROUP:{e.openElements.currentTagId===l.OPTION&&e.openElements.pop(),e.openElements.currentTagId===l.OPTGROUP&&e.openElements.pop(),e._insertElement(t,w.HTML);break}case l.HR:{e.openElements.currentTagId===l.OPTION&&e.openElements.pop(),e.openElements.currentTagId===l.OPTGROUP&&e.openElements.pop(),e._appendElement(t,w.HTML),t.ackSelfClosing=!0;break}case l.INPUT:case l.KEYGEN:case l.TEXTAREA:case l.SELECT:{e.openElements.hasInSelectScope(l.SELECT)&&(e.openElements.popUntilTagNamePopped(l.SELECT),e._resetInsertionMode(),t.tagID!==l.SELECT&&e._processStartTag(t));break}case l.SCRIPT:case l.TEMPLATE:{Ye(e,t);break}}}function vd(e,t){switch(t.tagID){case l.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===l.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===l.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===l.OPTGROUP&&e.openElements.pop();break}case l.OPTION:{e.openElements.currentTagId===l.OPTION&&e.openElements.pop();break}case l.SELECT:{e.openElements.hasInSelectScope(l.SELECT)&&(e.openElements.popUntilTagNamePopped(l.SELECT),e._resetInsertionMode());break}case l.TEMPLATE:{zt(e,t);break}}}function WT(e,t){const n=t.tagID;n===l.CAPTION||n===l.TABLE||n===l.TBODY||n===l.TFOOT||n===l.THEAD||n===l.TR||n===l.TD||n===l.TH?(e.openElements.popUntilTagNamePopped(l.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Md(e,t)}function jT(e,t){const n=t.tagID;n===l.CAPTION||n===l.TABLE||n===l.TBODY||n===l.TFOOT||n===l.THEAD||n===l.TR||n===l.TD||n===l.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(l.SELECT),e._resetInsertionMode(),e.onEndTag(t)):vd(e,t)}function qT(e,t){switch(t.tagID){case l.BASE:case l.BASEFONT:case l.BGSOUND:case l.LINK:case l.META:case l.NOFRAMES:case l.SCRIPT:case l.STYLE:case l.TEMPLATE:case l.TITLE:{Ye(e,t);break}case l.CAPTION:case l.COLGROUP:case l.TBODY:case l.TFOOT:case l.THEAD:{e.tmplInsertionModeStack[0]=E.IN_TABLE,e.insertionMode=E.IN_TABLE,dn(e,t);break}case l.COL:{e.tmplInsertionModeStack[0]=E.IN_COLUMN_GROUP,e.insertionMode=E.IN_COLUMN_GROUP,Ho(e,t);break}case l.TR:{e.tmplInsertionModeStack[0]=E.IN_TABLE_BODY,e.insertionMode=E.IN_TABLE_BODY,ki(e,t);break}case l.TD:case l.TH:{e.tmplInsertionModeStack[0]=E.IN_ROW,e.insertionMode=E.IN_ROW,wi(e,t);break}default:e.tmplInsertionModeStack[0]=E.IN_BODY,e.insertionMode=E.IN_BODY,fe(e,t)}}function GT(e,t){t.tagID===l.TEMPLATE&&zt(e,t)}function Pd(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(l.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Uo(e,t)}function KT(e,t){t.tagID===l.HTML?fe(e,t):ti(e,t)}function Bd(e,t){var n;if(t.tagID===l.HTML){if(e.fragmentContext||(e.insertionMode=E.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===l.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 ti(e,t)}function ti(e,t){e.insertionMode=E.IN_BODY,_i(e,t)}function XT(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.FRAMESET:{e._insertElement(t,w.HTML);break}case l.FRAME:{e._appendElement(t,w.HTML),t.ackSelfClosing=!0;break}case l.NOFRAMES:{Ye(e,t);break}}}function QT(e,t){t.tagID===l.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==l.FRAMESET&&(e.insertionMode=E.AFTER_FRAMESET))}function JT(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.NOFRAMES:{Ye(e,t);break}}}function ZT(e,t){t.tagID===l.HTML&&(e.insertionMode=E.AFTER_AFTER_FRAMESET)}function e2(e,t){t.tagID===l.HTML?fe(e,t):Hr(e,t)}function Hr(e,t){e.insertionMode=E.IN_BODY,_i(e,t)}function t2(e,t){switch(t.tagID){case l.HTML:{fe(e,t);break}case l.NOFRAMES:{Ye(e,t);break}}}function n2(e,t){t.chars=G,e._insertCharacters(t)}function r2(e,t){e._insertCharacters(t),e.framesetOk=!1}function Ud(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==w.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function i2(e,t){if(TE(t))Ud(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===w.MATHML?Cd(t):r===w.SVG&&(CE(t),yd(t)),Po(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function s2(e,t){if(t.tagID===l.P||t.tagID===l.BR){Ud(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)===w.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}y.AREA,y.BASE,y.BASEFONT,y.BGSOUND,y.BR,y.COL,y.EMBED,y.FRAME,y.HR,y.IMG,y.INPUT,y.KEYGEN,y.LINK,y.META,y.PARAM,y.SOURCE,y.TRACK,y.WBR;function o2(e,t){return Ad.parse(e,t)}function a2(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);const r=Ad.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}function u2(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Cu(e.position):"start"in e||"end"in e?Cu(e):"line"in e||"column"in e?zs(e):""}function zs(e){return yu(e&&e.line)+":"+yu(e&&e.column)}function Cu(e){return zs(e&&e.start)+"-"+zs(e&&e.end)}function yu(e){return e&&typeof e=="number"?e:1}class me extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=u2(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}me.prototype.file="";me.prototype.name="";me.prototype.reason="";me.prototype.message="";me.prototype.stack="";me.prototype.column=void 0;me.prototype.line=void 0;me.prototype.ancestors=void 0;me.prototype.cause=void 0;me.prototype.fatal=void 0;me.prototype.place=void 0;me.prototype.ruleId=void 0;me.prototype.source=void 0;const We={basename:c2,dirname:l2,extname:d2,join:h2,sep:"/"};function c2(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fr(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function l2(e){if(fr(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 d2(e){fr(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function h2(...e){let t=-1,n;for(;++t<e.length;)fr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":f2(n)}function f2(e){fr(e);const t=e.codePointAt(0)===47;let n=p2(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p2(e,t){let n="",r=0,i=-1,s=0,o=-1,a,u;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function fr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m2={cwd:g2};function g2(){return"/"}function $s(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function b2(e){if(typeof e=="string")e=new URL(e);else if(!$s(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 E2(e)}function E2(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Gi=["history","path","basename","stem","extname","dirname"];class Ws{constructor(t){let n;t?$s(t)?n={path:t}:typeof t=="string"||T2(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":m2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Gi.length;){const s=Gi[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Gi.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?We.basename(this.path):void 0}set basename(t){Xi(t,"basename"),Ki(t,"basename"),this.path=We.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?We.dirname(this.path):void 0}set dirname(t){_u(this.basename,"dirname"),this.path=We.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?We.extname(this.path):void 0}set extname(t){if(Ki(t,"extname"),_u(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=We.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){$s(t)&&(t=b2(t)),Xi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?We.basename(this.path,this.extname):void 0}set stem(t){Xi(t,"stem"),Ki(t,"stem"),this.path=We.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new me(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ki(e,t){if(e&&e.includes(We.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+We.sep+"`")}function Xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _u(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function T2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const C2={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"}},y2="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",_2=/-[a-z]/g,A2=/%c(?:([-+])(\d+))?/g,k2=/%x/g,w2={2:!0,1:!1,0:null},S2={};function I2(e,t){const n=t||S2,r=n.onerror,i=e instanceof Ws?e:new Ws(e),s=n.fragment?a2:o2,o=String(i),a=s(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?u:null,scriptingEnabled:!1});return Nb(a,{file:i,space:n.space,verbose:n.verbose});function u(c){const h=c.code,d=x2(h),f=n[d],p=f??!0,m=typeof p=="number"?p:p?1:0;if(m){const _=C2[d],C=new me(T(_.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:h,source:"hast-util-from-html"});i.path&&(C.file=i.path,C.name=i.path+":"+C.name),C.fatal=w2[m],C.note=T(_.description),C.url=_.url===!1?void 0:y2+h,r(C)}function T(_){return _.replace(A2,C).replace(k2,x);function C(I,R,V){const v=(V?Number.parseInt(V,10):0)*(R==="-"?-1:1),te=o.charAt(c.startOffset+v);return L2(te)}function x(){return D2(o.charCodeAt(c.startOffset))}}}}function x2(e){return e.replace(_2,N2)}function N2(e){return e.charAt(1).toUpperCase()}function L2(e){return e==="`"?"` ` `":e}function D2(e){return"0x"+e.toString(16).toUpperCase()}function O2(e){const t=this,{emitParseErrors:n,...r}={...t.data("settings"),...e};t.parser=i;function i(s,o){return I2(s,{...r,onerror:n?function(a){o.path&&(a.name=o.path+":"+a.name,a.file=o.path),o.messages.push(a)}:void 0})}}const Hd=-1,Si=0,Un=1,ni=2,Fo=3,Vo=4,Yo=5,zo=6,Fd=7,Vd=8,Au=typeof self=="object"?self:globalThis,R2=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Si:case Hd:return n(o,i);case Un:{const a=n([],i);for(const u of o)a.push(r(u));return a}case ni:{const a=n({},i);for(const[u,c]of o)a[r(u)]=r(c);return a}case Fo:return n(new Date(o),i);case Vo:{const{source:a,flags:u}=o;return n(new RegExp(a,u),i)}case Yo:{const a=n(new Map,i);for(const[u,c]of o)a.set(r(u),r(c));return a}case zo:{const a=n(new Set,i);for(const u of o)a.add(r(u));return a}case Fd:{const{name:a,message:u}=o;return n(new Au[a](u),i)}case Vd:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Au[s](o),i)};return r},ku=e=>R2(new Map,e)(0),$t="",{toString:M2}={},{keys:v2}=Object,Sn=e=>{const t=typeof e;if(t!=="object"||!e)return[Si,t];const n=M2.call(e).slice(8,-1);switch(n){case"Array":return[Un,$t];case"Object":return[ni,$t];case"Date":return[Fo,$t];case"RegExp":return[Vo,$t];case"Map":return[Yo,$t];case"Set":return[zo,$t];case"DataView":return[Un,n]}return n.includes("Array")?[Un,n]:n.includes("Error")?[Fd,n]:[ni,n]},wr=([e,t])=>e===Si&&(t==="function"||t==="symbol"),P2=(e,t,n,r)=>{const i=(o,a)=>{const u=r.push(o)-1;return n.set(a,u),u},s=o=>{if(n.has(o))return n.get(o);let[a,u]=Sn(o);switch(a){case Si:{let h=o;switch(u){case"bigint":a=Vd,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([Hd],o)}return i([a,h],o)}case Un:{if(u){let f=o;return u==="DataView"?f=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(o)),i([u,[...f]],o)}const h=[],d=i([a,h],o);for(const f of o)h.push(s(f));return d}case ni:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const h=[],d=i([a,h],o);for(const f of v2(o))(e||!wr(Sn(o[f])))&&h.push([s(f),s(o[f])]);return d}case Fo:return i([a,o.toISOString()],o);case Vo:{const{source:h,flags:d}=o;return i([a,{source:h,flags:d}],o)}case Yo:{const h=[],d=i([a,h],o);for(const[f,p]of o)(e||!(wr(Sn(f))||wr(Sn(p))))&&h.push([s(f),s(p)]);return d}case zo:{const h=[],d=i([a,h],o);for(const f of o)(e||!wr(Sn(f)))&&h.push(s(f));return d}}const{message:c}=o;return i([a,{name:u,message:c}],o)};return s},wu=(e,{json:t,lossy:n}={})=>{const r=[];return P2(!(t||n),!!t,new Map,r)(e),r},Yd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ku(wu(e,t)):structuredClone(e):(e,t)=>ku(wu(e,t)),$o=function(e,t,n,r,i){const s=ze(t);return zd(e)?s.call(i,e,n,r):!1},ze=function(e){if(e==null)return H2;if(typeof e=="string")return U2(e);if(typeof e=="object")return B2(e);if(typeof e=="function")return Wo(e);throw new Error("Expected function, string, or array as `test`")};function B2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ze(e[n]);return Wo(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function U2(e){return Wo(t);function t(n){return n.tagName===e}}function Wo(e){return t;function t(n,r,i){return!!(zd(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function H2(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function zd(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const $d=ze(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"}),F2=/[ \t\n\f\r]/g;function Wd(e){return typeof e=="object"?e.type==="text"?Su(e.value):!1:Su(e)}function Su(e){return e.replace(F2,"")===""}const yn=function(e){if(e==null)return $2;if(typeof e=="function")return Ii(e);if(typeof e=="object")return Array.isArray(e)?V2(e):Y2(e);if(typeof e=="string")return z2(e);throw new Error("Expected function, string, or object as test")};function V2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yn(e[n]);return Ii(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function Y2(e){const t=e;return Ii(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function z2(e){return Ii(t);function t(n){return n&&n.type===e}}function Ii(e){return t;function t(n,r,i){return!!(W2(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function $2(){return!0}function W2(e){return e!==null&&typeof e=="object"&&"type"in e}const j2=["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"],q2=["button","input","select","textarea"],G2=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],K2={},jo=yn(["comment","doctype"]);function X2(e,t){jd(e,{collapse:rC((t||K2).newlines?tC:nC),whitespace:"normal"})}function jd(e,t){if("children"in e){const n={...t};return(e.type==="root"||Kd(e))&&(n.before=!0,n.after=!0),n.whitespace=iC(e,t),J2(e,n)}if(e.type==="text"){if(t.whitespace==="normal")return Q2(e,t);t.whitespace==="nowrap"&&(e.value=t.collapse(e.value))}return{ignore:jo(e),stripAtStart:!1,remove:!1}}function Q2(e,t){const n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1};let i=0,s=n.length;return t.before&&Iu(n.charAt(0))&&i++,i!==s&&Iu(n.charAt(s-1))&&(t.after?s--:r.stripAtStart=!0),i===s?r.remove=!0:e.value=n.slice(i,s),r}function J2(e,t){let n=t.before;const r=t.after,i=e.children;let s=i.length,o=-1;for(;++o<s;){const a=jd(i[o],{...t,after:qd(i,o,r),before:n});a.remove?(i.splice(o,1),o--,s--):a.ignore||(n=a.stripAtStart),Gd(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function qd(e,t,n){for(;++t<e.length;){const r=e[t];let i=Z2(r);if(i===void 0&&"children"in r&&!eC(r)&&(i=qd(r.children,-1)),typeof i=="boolean")return i}return n}function Z2(e){if(e.type==="element"){if(Gd(e))return!1;if(Kd(e))return!0}else if(e.type==="text"){if(!Wd(e))return!1}else if(!jo(e))return!1}function Gd(e){return $d(e)||$o(e,q2)}function Kd(e){return $o(e,j2)}function eC(e){return!!(e.type==="element"&&e.properties.hidden)||jo(e)||$o(e,G2)}function Iu(e){return e===" "||e===`
|
|
13
|
-
`}function tC(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function nC(){return" "}function rC(e){return t;function t(n){return String(n).replace(/[\t\n\v\f\r ]+/g,e)}}function iC(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 sC(e){return function(t){X2(t,e)}}const Xd=[],oC=!0,ri=!1,Qd="skip";function Jd(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=yn(i),o=r?-1:1;a(e,void 0,[])();function a(u,c,h){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Xd,m,T,_;if((!t||s(u,c,h[h.length-1]||void 0))&&(p=aC(n(u,h)),p[0]===ri))return p;if("children"in u&&u.children){const C=u;if(C.children&&p[0]!==Qd)for(T=(r?C.children.length:-1)+o,_=h.concat(C);T>-1&&T<C.children.length;){const x=C.children[T];if(m=a(x,T,_)(),m[0]===ri)return m;T=typeof m[1]=="number"?m[1]:T+o}}return p}}}function aC(e){return Array.isArray(e)?e:typeof e=="number"?[oC,e]:e==null?Xd:[e]}function hn(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Jd(e,s,a,i);function a(u,c){const h=c[c.length-1],d=h?h.children.indexOf(u):void 0;return o(u,d,h)}}const uC=Zd("end"),cC=Zd("start");function Zd(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 lC(e){const t=cC(e),n=uC(e);if(t&&n)return{start:t,end:n}}function dC(e,t){const n=t.properties||{},r=e.all(t),i={type:"link",url:e.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return e.patch(t,i),i}function hC(e,t){e.baseFound||(e.frozenBaseUrl=String(t.properties&&t.properties.href||"")||void 0,e.baseFound=!0)}function fC(e,t){const n={type:"blockquote",children:e.toFlow(e.all(t))};return e.patch(t,n),n}function pC(e,t){const n={type:"break"};return e.patch(t,n),n}const xu=function(e,t,n){const r=yn(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]},Nu=/\n/g,Lu=/[\t ]+/g,js=ze("br"),Du=ze(yC),mC=ze("p"),Ou=ze("tr"),gC=ze(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",CC,_C]),eh=ze(["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 pr(e,t){const n={},r="children"in e?e.children:[],i=eh(e),s=rh(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...nh(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...th(r[a],e,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?js(r[a+1]):i}));const u=[];let c;for(a=-1;++a<o.length;){const h=o[a];typeof h=="number"?c!==void 0&&h>c&&(c=h):h&&(c!==void 0&&c>-1&&u.push(`
|
|
14
|
-
`.repeat(c)||" "),c=-1,u.push(h))}return u.join("")}function th(e,t,n){return e.type==="element"?bC(e,t,n):e.type==="text"?n.whitespace==="normal"?nh(e,n):EC(e):[]}function bC(e,t,n){const r=rh(e,n),i=e.children||[];let s=-1,o=[];if(gC(e))return o;let a,u;for(js(e)||Ou(e)&&xu(t,e,Ou)?u=`
|
|
15
|
-
`:mC(e)?(a=2,u=2):eh(e)&&(a=1,u=1);++s<i.length;)o=o.concat(th(i[s],e,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?js(i[s+1]):u}));return Du(e)&&xu(t,e,Du)&&o.push(" "),a&&o.unshift(a),u&&o.push(u),o}function nh(e,t){const n=String(e.value),r=[],i=[];let s=0;for(;s<=n.length;){Nu.lastIndex=s;const u=Nu.exec(n),c=u&&"index"in u?u.index:n.length;r.push(TC(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),s=c+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function EC(e){return[String(e.value)]}function TC(e,t,n){const r=[];let i=0,s;for(;i<e.length;){Lu.lastIndex=i;const o=Lu.exec(e);s=o?o.index:e.length,!i&&!s&&o&&!t&&r.push(""),i!==s&&r.push(e.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function rh(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 CC(e){return!!(e.properties||{}).hidden}function yC(e){return e.tagName==="td"||e.tagName==="th"}function _C(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function AC(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 Qi="language-";function Sr(e,t){const n=t.children;let r=-1,i,s;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)){i=a.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,Qi.length)===Qi){s=String(i[r]).slice(Qi.length);break}}const o={type:"code",lang:s||null,meta:null,value:AC(pr(t))};return e.patch(t,o),o}function kC(e,t){const n={type:"html",value:"<!--"+t.value+"-->"};return e.patch(t,n),n}function Ji(e,t){const r={type:"delete",children:e.all(t)};return e.patch(t,r),r}function qo(e){let t=-1;if(e.length>1){for(;++t<e.length;)if(e[t].spread)return!0}return!1}function wC(e,t){const n=[],r=[];let i=-1;for(;++i<t.children.length;){const a=t.children[i];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let s={definitions:[],titles:[]};for(i=-1;++i<n.length;){const a=n[i];if(a.type==="element"&&a.tagName==="dt"){const u=n[i-1];u&&u.type==="element"&&u.tagName==="dd"&&(r.push(s),s={definitions:[],titles:[]}),s.titles.push(a)}else s.definitions.push(a)}r.push(s),i=-1;const o=[];for(;++i<r.length;){const a=[...Ru(e,r[i].titles),...Ru(e,r[i].definitions)];a.length>0&&o.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(o.length>0){const a={type:"list",ordered:!1,start:null,spread:qo(o),children:o};return e.patch(t,a),a}}function Ru(e,t){const n=e.all({type:"root",children:t}),r=e.toSpecificContent(n,SC);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:qo(r),children:r}]}function SC(){return{type:"listItem",spread:!1,checked:null,children:[]}}function Ir(e,t){const r={type:"emphasis",children:e.all(t)};return e.patch(t,r),r}function Go(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 Wt(e,t){const n=Number(t.tagName.charAt(1))||1,r=Go(e.all(t)),i={type:"heading",depth:n,children:r};return e.patch(t,i),i}function IC(e,t){const n={type:"thematicBreak"};return e.patch(t,n),n}function xC(e,t){const n=t.properties||{},r=String(n.src||""),i=String(n.title||"");if(r&&i){const s={type:"link",title:null,url:e.resolve(r),children:[{type:"text",value:i}]};return e.patch(t,s),s}}function Mu(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 In(e,t){const n={type:"inlineCode",value:pr(t)};return e.patch(t,n),n}function ih(e,t){const n=[],r=[],i=t||e.properties||{},s=sh(e),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1);let a=-1;for(;++a<s.length;){const h=s[a];h&&h.properties&&h.properties.selected&&n.push(h)}const u=n.length>0?n:s,c=Math.min(u.length,o);for(a=-1;++a<c;){const h=u[a],d=h.properties||{},f=pr(h),p=f||String(d.label||""),m=String(d.value||"")||f;r.push([m,p===m?void 0:p])}return r}function sh(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(...sh(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&t.push(r)}return t}const NC="[x]",LC="[ ]";function DC(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 u={type:"text",value:n.checked?e.options.checked||NC:e.options.unchecked||LC};return e.patch(t,u),u}if(n.type==="image"){const u=n.alt||r;if(u){const c={type:"image",url:e.resolve(String(n.src||"")||null),title:String(n.title||"")||null,alt:String(u)};return e.patch(t,c),c}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!=="button"&&n.type!=="file"&&n.type!=="password"&&n.type!=="reset"&&n.type!=="submit"&&n.list){const u=String(n.list),c=e.elementById.get(u);c&&c.tagName==="datalist"&&(i=ih(c,n))}if(i.length===0)return;if(n.type==="password"&&(i[0]=["•".repeat(i[0][0].length),void 0]),n.type==="email"||n.type==="url"){const u=[];let c=-1;for(;++c<i.length;){const h=e.resolve(i[c][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+h:h,children:[{type:"text",value:i[c][1]||h}]};u.push(d),c!==i.length-1&&u.push({type:"text",value:", "})}return u}const s=[];let o=-1;for(;++o<i.length;)s.push(i[o][1]?i[o][1]+" ("+i[o][0]+")":i[o][0]);const a={type:"text",value:s.join(", ")};return e.patch(t,a),a}const OC={}.hasOwnProperty;function RC(e,t){const n=e.type==="element"&&OC.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const MC=new Set(["pingback","prefetch","stylesheet"]);function vC(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(!MC.has(String(t[n])))return!1;return!0}const PC=ze(["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"]),BC=ze("meta");function oh(e){return!!(e.type==="text"||PC(e)||$d(e)||vC(e)||BC(e)&&RC(e,"itemProp"))}function Zi(e,t){const{rest:n,checkbox:r}=uh(t),i=r?!!r.properties.checked:null,s=ah(n),o=e.toFlow(e.all(n)),a={type:"listItem",spread:s,checked:i,children:o};return e.patch(t,a),a}function ah(e){let t=-1,n=!1;for(;++t<e.children.length;){const r=e.children[t];if(r.type==="element"){if(oh(r))continue;if(r.tagName==="p"||n||ah(r))return!0;n=!0}}return!1}function uh(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}=uh(t);if(n){const i={...e,children:[r,...e.children.slice(1)]};return{checkbox:n,rest:i}}}return{checkbox:void 0,rest:e}}function es(e,t){const n=t.tagName==="ol",r=e.toSpecificContent(e.all(t),UC);let i=null;n&&(i=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);const s={type:"list",ordered:n,start:i,spread:qo(r),children:r};return e.patch(t,s),s}function UC(){return{type:"listItem",spread:!1,checked:null,children:[]}}const HC={};function Ko(e,t){const n=HC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ch(e,r,i)}function ch(e,t,n){if(FC(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 vu(e.children,t,n)}return Array.isArray(e)?vu(e,t,n):""}function vu(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ch(e[i],t,n);return r.join("")}function FC(e){return!!(e&&typeof e=="object")}const lh=yn(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xi(e){let t=-1;for(;++t<e.length;){const n=e[t];if(!fh(n)||"children"in n&&xi(n.children))return!0}return!1}function dh(e){return hh(e,t,function(n){return n});function t(n){return n.every(function(r){return r.type==="text"?Wd(r.value):!1})?[]:[{type:"paragraph",children:Go(n)}]}}function VC(e){return hh(e.children,t,n);function t(r){const i=ts(e);return i.children=r,[i]}function n(r){if("children"in r&&"children"in e){const i=ts(e),s=ts(r);return i.children=r.children,s.children.push(i),s}return{...r}}}function hh(e,t,n){const r=YC(e),i=[];let s=[],o=-1;for(;++o<r.length;){const a=r[o];fh(a)?s.push(a):(s.length>0&&(i.push(...t(s)),s=[]),i.push(n(a)))}return s.length>0&&(i.push(...t(s)),s=[]),i}function YC(e){const t=[];let n=-1;for(;++n<e.length;){const r=e[n];(r.type==="delete"||r.type==="link")&&xi(r.children)?t.push(...VC(r)):t.push(r)}return t}function fh(e){const t=e.data&&e.data.hName;return t?oh({type:"element",tagName:t,properties:{},children:[]}):lh(e)}function ts(e){return Yd({...e,children:[]})}function Pu(e,t){const n=t.properties||{},r=t.tagName==="video"?String(n.poster||""):"";let i=String(n.src||""),s=-1,o=!1,a=e.all(t);if(hn({type:"root",children:a},function(d){if(d.type==="link")return o=!0,ri}),o||xi(a))return a;for(;!i&&++s<t.children.length;){const d=t.children[s];d.type==="element"&&d.tagName==="source"&&d.properties&&(i=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:e.resolve(r),alt:Ko(a)};e.patch(t,d),a=[d]}const c=a,h={type:"link",title:n.title?String(n.title):null,url:e.resolve(i),children:c};return e.patch(t,h),h}function Bu(e,t){const n=Go(e.all(t));if(n.length>0){const r={type:"paragraph",children:n};return e.patch(t,r),r}}const zC=['"'];function $C(e,t){const n=e.options.quotes||zC;e.qNesting++;const r=e.all(t);e.qNesting--;const i=n[e.qNesting%n.length],s=r[0],o=r[r.length-1],a=i.charAt(0),u=i.length>1?i.charAt(1):i;return s&&s.type==="text"?s.value=a+s.value:r.unshift({type:"text",value:a}),o&&o.type==="text"?o.value+=u:r.push({type:"text",value:u}),r}function WC(e,t){let n=e.all(t);(e.options.document||xi(n))&&(n=dh(n));const r={type:"root",children:n};return e.patch(t,r),r}function jC(e,t){const n=ih(t);let r=-1;const i=[];for(;++r<n.length;){const s=n[r];i.push(s[1]?s[1]+" ("+s[0]+")":s[0])}if(i.length>0){const s={type:"text",value:i.join(", ")};return e.patch(t,s),s}}function Uu(e,t){const r={type:"strong",children:e.all(t)};return e.patch(t,r),r}function Hu(e,t){const r={type:"tableCell",children:e.all(t)};if(e.patch(t,r),t.properties){const i=t.properties.rowSpan,s=t.properties.colSpan;if(i||s){const o=r.data||(r.data={});i&&(o.hastUtilToMdastTemporaryRowSpan=i),s&&(o.hastUtilToMdastTemporaryColSpan=s)}}return r}function qC(e,t){const r={type:"tableRow",children:e.toSpecificContent(e.all(t),GC)};return e.patch(t,r),r}function GC(){return{type:"tableCell",children:[]}}function KC(e,t){if(e.inTable){const c={type:"text",value:pr(t)};return e.patch(t,c),c}e.inTable=!0;const{align:n,headless:r}=XC(t),i=e.toSpecificContent(e.all(t),Fu);r&&i.unshift(Fu());let s=-1;for(;++s<i.length;){const c=i[s],h=e.toSpecificContent(c.children,QC);c.children=h}let o=1;for(s=-1;++s<i.length;){const c=i[s].children;let h=-1;for(;++h<c.length;){const d=c[h];if(d.data){const f=d.data,p=Number.parseInt(String(f.hastUtilToMdastTemporaryColSpan),10)||1,m=Number.parseInt(String(f.hastUtilToMdastTemporaryRowSpan),10)||1;if(p>1||m>1){let T=s-1;for(;++T<s+m;){let _=h-1;for(;++_<h+p&&i[T];){const C=[];(T!==s||_!==h)&&C.push({type:"tableCell",children:[]}),i[T].children.splice(_,0,...C)}}}"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>o&&(o=c.length)}for(s=-1;++s<i.length;){const c=i[s].children;let h=c.length-1;for(;++h<o;)c.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<o;)n.push(null);e.inTable=!1;const u={type:"table",align:n,children:i};return e.patch(t,u),u}function XC(e){const t={align:[null],headless:!0};let n=0,r=0;return hn(e,function(i){if(i.type==="element"){if(i.tagName==="table"&&e!==i)return Qd;if((i.tagName==="th"||i.tagName==="td")&&i.properties){if(!t.align[r]){const s=String(i.properties.align||"")||null;(s==="center"||s==="left"||s==="right"||s===null)&&(t.align[r]=s)}t.headless&&n<2&&i.tagName==="th"&&(t.headless=!1),r++}else i.tagName==="thead"?t.headless=!1:i.tagName==="tr"&&(n++,r=0)}}),t}function QC(){return{type:"tableCell",children:[]}}function Fu(){return{type:"tableRow",children:[]}}function JC(e,t){const n={type:"text",value:t.value};return e.patch(t,n),n}function ZC(e,t){const n={type:"text",value:pr(t)};return e.patch(t,n),n}function ey(e,t){const n={type:"text",value:""};return e.patch(t,n),n}const ty={comment:kC,doctype:B,root:WC,text:JC},ny={applet:B,area:B,basefont:B,bgsound:B,caption:B,col:B,colgroup:B,command:B,content:B,datalist:B,dialog:B,element:B,embed:B,frame:B,frameset:B,isindex:B,keygen:B,link:B,math:B,menu:B,menuitem:B,meta:B,nextid:B,noembed:B,noframes:B,optgroup:B,option:B,param:B,script:B,shadow:B,source:B,spacer:B,style:B,svg:B,template:B,title:B,track:B,abbr:P,acronym:P,bdi:P,bdo:P,big:P,blink:P,button:P,canvas:P,cite:P,data:P,details:P,dfn:P,font:P,ins:P,label:P,map:P,marquee:P,meter:P,nobr:P,noscript:P,object:P,output:P,progress:P,rb:P,rbc:P,rp:P,rt:P,rtc:P,ruby:P,slot:P,small:P,span:P,sup:P,sub:P,tbody:P,tfoot:P,thead:P,time:P,address:J,article:J,aside:J,body:J,center:J,div:J,fieldset:J,figcaption:J,figure:J,form:J,footer:J,header:J,hgroup:J,html:J,legend:J,main:J,multicol:J,nav:J,picture:J,section:J,a:dC,audio:Pu,b:Uu,base:hC,blockquote:fC,br:pC,code:In,dir:es,dl:wC,dt:Zi,dd:Zi,del:Ji,em:Ir,h1:Wt,h2:Wt,h3:Wt,h4:Wt,h5:Wt,h6:Wt,hr:IC,i:Ir,iframe:xC,img:Mu,image:Mu,input:DC,kbd:In,li:Zi,listing:Sr,mark:Ir,ol:es,p:Bu,plaintext:Sr,pre:Sr,q:$C,s:Ji,samp:In,select:jC,strike:Ji,strong:Uu,summary:Bu,table:KC,td:Hu,textarea:ZC,th:Hu,tr:qC,tt:In,u:Ir,ul:es,var:In,video:Pu,wbr:ey,xmp:Sr};function P(e,t){return e.all(t)}function J(e,t){return e.toFlow(e.all(t))}function B(){}const Vu={}.hasOwnProperty;function ry(e){return{all:iy,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...ny,...e.handlers},inTable:!1,nodeHandlers:{...ty,...e.nodeHandlers},one:sy,options:e,patch:oy,qNesting:0,resolve:ay,toFlow:uy,toSpecificContent:cy}}function iy(e){const t=e.children||[],n=[];let r=-1;for(;++r<t.length;){const i=t[r],s=this.one(i,e);Array.isArray(s)?n.push(...s):s&&n.push(s)}return n}function sy(e,t){if(e.type==="element"){if(e.properties&&e.properties.dataMdast==="ignore")return;if(Vu.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(Vu.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 oy(e,t){e.position&&(t.position=lC(e))}function ay(e){const t=this.frozenBaseUrl;return e==null?"":t?String(new URL(e,t)):e}function uy(e){return dh(e)}function cy(e,t){const n=t(),r=[];let i=[],s=-1;for(;++s<e.length;){const a=e[s];if(o(a))i.length>0&&(a.children.unshift(...i),i=[]),r.push(a);else{const u=a;i.push(u)}}if(i.length>0){let a=r[r.length-1];a||(a=t(),r.push(a)),a.children.push(...i),i=[]}return r;function o(a){return a.type===n.type}}const ly={};function Yu(e,t){const n=Yd(e),r=t||ly,i=sC({newlines:r.newlines===!0}),s=ry(r);let o;i(n),hn(n,function(u){if(u&&u.type==="element"&&u.properties){const c=String(u.properties.id||"")||void 0;c&&!s.elementById.has(c)&&s.elementById.set(c,u)}});const a=s.one(n,void 0);return a?Array.isArray(a)?o={type:"root",children:a}:o=a:o={type:"root",children:[]},hn(o,function(u,c,h){if(u.type==="text"&&c!==void 0&&h){const d=h.children[c-1];if(d&&d.type===u.type)return d.value+=u.value,h.children.splice(c,1),d.position&&u.position&&(d.position.end=u.position.end),c-1;if(u.value=u.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),h&&(h.type==="heading"||h.type==="paragraph"||h.type==="root")&&(c||(u.value=u.value.replace(/^[\t ]+/,"")),c===h.children.length-1&&(u.value=u.value.replace(/[\t ]+$/,""))),!u.value)return h.children.splice(c,1),c}}),o}const zu={document:!0};function dy(e,t){return e&&"run"in e?async function(n,r){const i=Yu(n,{...zu,...t});await e.run(i,r)}:function(n){return Yu(n,{...zu,...e})}}function $u(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const ir=Li(/[A-Za-z]/),Xo=Li(/[\dA-Za-z]/);function hy(e){return e!==null&&(e<32||e===127)}function Kt(e){return e!==null&&e<-2}function ye(e){return e!==null&&(e<0||e===32)}function Ze(e){return e===-2||e===-1||e===32}const Ni=Li(new RegExp("\\p{P}|\\p{S}","u")),Ht=Li(/\s/);function Li(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fy(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function py(e,t,n){const i=yn((n||{}).ignore||[]),s=my(t);let o=-1;for(;++o<s.length;)Jd(e,"text",a);function a(c,h){let d=-1,f;for(;++d<h.length;){const p=h[d],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return u(c,h)}function u(c,h){const d=h[h.length-1],f=s[o][0],p=s[o][1];let m=0;const _=d.children.indexOf(c);let C=!1,x=[];f.lastIndex=0;let I=f.exec(c.value);for(;I;){const R=I.index,V={index:I.index,input:I.input,stack:[...h,c]};let v=p(...I,V);if(typeof v=="string"&&(v=v.length>0?{type:"text",value:v}:void 0),v===!1?f.lastIndex=R+1:(m!==R&&x.push({type:"text",value:c.value.slice(m,R)}),Array.isArray(v)?x.push(...v):v&&x.push(v),m=R+I[0].length,C=!0),!f.global)break;I=f.exec(c.value)}return C?(m<c.value.length&&x.push({type:"text",value:c.value.slice(m)}),d.children.splice(_,1,...x)):x=[c],_+x.length}}function my(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 i=n[r];t.push([gy(i[0]),by(i[1])])}return t}function gy(e){return typeof e=="string"?new RegExp(fy(e),"g"):e}function by(e){return typeof e=="function"?e:function(){return e}}const ns="phrasing",rs=["autolink","link","image","label"];function Ey(){return{transforms:[wy],enter:{literalAutolink:Cy,literalAutolinkEmail:is,literalAutolinkHttp:is,literalAutolinkWww:is},exit:{literalAutolink:ky,literalAutolinkEmail:Ay,literalAutolinkHttp:yy,literalAutolinkWww:_y}}}function Ty(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ns,notInConstruct:rs},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ns,notInConstruct:rs},{character:":",before:"[ps]",after:"\\/",inConstruct:ns,notInConstruct:rs}]}}function Cy(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function is(e){this.config.enter.autolinkProtocol.call(this,e)}function yy(e){this.config.exit.autolinkProtocol.call(this,e)}function _y(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 Ay(e){this.config.exit.autolinkEmail.call(this,e)}function ky(e){this.exit(e)}function wy(e){py(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Sy],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Iy]],{ignore:["link","linkReference"]})}function Sy(e,t,n,r,i){let s="";if(!ph(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!xy(n)))return!1;const o=Ny(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function Iy(e,t,n,r){return!ph(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function xy(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 Ny(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 i=$u(e,"(");let s=$u(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function ph(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ht(n)||Ni(n))&&(!t||n!==47)}function mr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}mh.peek=Uy;function Ly(){this.buffer()}function Dy(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Oy(){this.buffer()}function Ry(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function My(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vy(e){this.exit(e)}function Py(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function By(e){this.exit(e)}function Uy(){return"["}function mh(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function Hy(){return{enter:{gfmFootnoteCallString:Ly,gfmFootnoteCall:Dy,gfmFootnoteDefinitionLabelString:Oy,gfmFootnoteDefinition:Ry},exit:{gfmFootnoteCallString:My,gfmFootnoteCall:vy,gfmFootnoteDefinitionLabelString:Py,gfmFootnoteDefinition:By}}}function Fy(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:mh},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let u=a.move("[^");const c=s.enter("footnoteDefinition"),h=s.enter("label");return u+=a.move(s.safe(s.associationId(r),{before:u,after:"]"})),h(),u+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),u+=a.move((t?`
|
|
16
|
-
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?gh:Vy))),c(),u}}function Vy(e,t,n){return t===0?e:gh(e,t,n)}function gh(e,t,n){return(n?"":" ")+e}const Yy=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];bh.peek=qy;function zy(){return{canContainEols:["delete"],enter:{strikethrough:Wy},exit:{strikethrough:jy}}}function $y(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yy}],handlers:{delete:bh}}}function Wy(e){this.enter({type:"delete",children:[]},e)}function jy(e){this.exit(e)}function bh(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function qy(){return"~"}function Gy(e){return e.length}function Ky(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Gy,s=[],o=[],a=[],u=[];let c=0,h=-1;for(;++h<e.length;){const T=[],_=[];let C=-1;for(e[h].length>c&&(c=e[h].length);++C<e[h].length;){const x=Xy(e[h][C]);if(n.alignDelimiters!==!1){const I=i(x);_[C]=I,(u[C]===void 0||I>u[C])&&(u[C]=I)}T.push(x)}o[h]=T,a[h]=_}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)s[d]=Wu(r[d]);else{const T=Wu(r);for(;++d<c;)s[d]=T}d=-1;const f=[],p=[];for(;++d<c;){const T=s[d];let _="",C="";T===99?(_=":",C=":"):T===108?_=":":T===114&&(C=":");let x=n.alignDelimiters===!1?1:Math.max(1,u[d]-_.length-C.length);const I=_+"-".repeat(x)+C;n.alignDelimiters!==!1&&(x=_.length+x+C.length,x>u[d]&&(u[d]=x),p[d]=x),f[d]=I}o.splice(1,0,f),a.splice(1,0,p),h=-1;const m=[];for(;++h<o.length;){const T=o[h],_=a[h];d=-1;const C=[];for(;++d<c;){const x=T[d]||"";let I="",R="";if(n.alignDelimiters!==!1){const V=u[d]-(_[d]||0),v=s[d];v===114?I=" ".repeat(V):v===99?V%2?(I=" ".repeat(V/2+.5),R=" ".repeat(V/2-.5)):(I=" ".repeat(V/2),R=I):R=" ".repeat(V)}n.delimiterStart!==!1&&!d&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||d)&&C.push(" "),n.alignDelimiters!==!1&&C.push(I),C.push(x),n.alignDelimiters!==!1&&C.push(R),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&C.push("|")}m.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return m.join(`
|
|
17
|
-
`)}function Xy(e){return e==null?"":String(e)}function Wu(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 ju={}.hasOwnProperty;function Qy(e,t){const n=t||{};function r(i,...s){let o=r.invalid;const a=r.handlers;if(i&&ju.call(i,e)){const u=String(i[e]);o=ju.call(a,u)?a[u]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Jy={}.hasOwnProperty;function Eh(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)Eh(e,t.extensions[n]);for(r in t)if(Jy.call(t,r))switch(r){case"extensions":break;case"unsafe":{qu(e[r],t[r]);break}case"join":{qu(e[r],t[r]);break}case"handlers":{Zy(e[r],t[r]);break}default:e.options[r]=t[r]}return e}function qu(e,t){t&&e.push(...t)}function Zy(e,t){t&&Object.assign(e,t)}function e_(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),t_);return i(),o}function t_(e,t,n){return">"+(n?"":" ")+e}function Th(e,t){return Gu(e,t.inConstruct,!0)&&!Gu(e,t.notInConstruct,!1)}function Gu(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 Ku(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
18
|
-
`&&Th(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
19
|
-
`}function n_(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function qs(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 r_(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 i_(e,t,n,r){const i=r_(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(qs(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(s,s_);return d(),f}const a=n.createTracker(r),u=i.repeat(Math.max(n_(s,i)+1,3)),c=n.enter("codeFenced");let h=a.move(u);if(e.lang){const d=n.enter(`codeFencedLang${o}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:`
|
|
20
|
-
`,encode:["`"],...a.current()})),d()}return h+=a.move(`
|
|
21
|
-
`),s&&(h+=a.move(s+`
|
|
22
|
-
`)),h+=a.move(u),c(),h}function s_(e,t,n){return(n?"":" ")+e}function Qo(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 o_(e,t,n,r){const i=Qo(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("[");return c+=u.move(n.safe(n.associationId(e),{before:c,after:"]",...u.current()})),c+=u.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(a=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
23
|
-
`,...u.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),a()),o(),c}function a_(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 Ct(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ii(e){if(e===null||ye(e)||Ht(e))return 1;if(Ni(e))return 2}function si(e,t,n){const r=ii(e),i=ii(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ch.peek=u_;function Ch(e,t,n,r){const i=a_(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let u=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=u.charCodeAt(0),h=si(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(u=Ct(c)+u.slice(1));const d=u.charCodeAt(u.length-1),f=si(r.after.charCodeAt(0),d,i);f.inside&&(u=u.slice(0,-1)+Ct(d));const p=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},a+u+p}function u_(e,t,n){return n.options.emphasis||"*"}function yh(e,t){let n=!1;return hn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ri}),!!((!e.depth||e.depth<3)&&Ko(e)&&(t.options.setext||n))}function c_(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(yh(e,n)){const h=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...s.current(),before:`
|
|
24
|
-
`,after:`
|
|
25
|
-
`});return d(),h(),f+`
|
|
26
|
-
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
27
|
-
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),u=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
28
|
-
`,...s.current()});return/^[\t ]/.test(c)&&(c=Ct(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),u(),a(),c}_h.peek=l_;function _h(e){return e.value||""}function l_(){return"<"}Ah.peek=d_;function Ah(e,t,n,r){const i=Qo(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("![");return c+=u.move(n.safe(e.alt,{before:c,after:"]",...u.current()})),c+=u.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(a=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":")",...u.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),a()),c+=u.move(")"),o(),c}function d_(){return"!"}kh.peek=h_;function kh(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let u=a.move("![");const c=n.safe(e.alt,{before:u,after:"]",...a.current()});u+=a.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...a.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==d?u+=a.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function h_(){return"!"}wh.peek=f_;function wh(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let u;if(o.atBreak)for(;u=a.exec(r);){let c=u.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(u.index+1)}}return i+r+i}function f_(){return"`"}function Sh(e,t){const n=Ko(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))}Ih.peek=p_;function Ih(e,t,n,r){const i=Qo(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,u;if(Sh(e,n)){const h=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=h,d}a=n.enter("link"),u=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(u=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),u(),e.title&&(u=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),u()),c+=o.move(")"),a(),c}function p_(e,t,n){return Sh(e,n)?"<":"["}xh.peek=m_;function xh(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let u=a.move("[");const c=n.containerPhrasing(e,{before:u,after:"]",...a.current()});u+=a.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...a.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==d?u+=a.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function m_(){return"["}function Jo(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 g_(e){const t=Jo(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 b_(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 Nh(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 E_(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?b_(n):Jo(n);const a=e.ordered?o==="."?")":".":g_(n);let u=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.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&&(u=!0),Nh(n)===o&&h){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"){u=!0;break}}}}u&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function T_(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 C_(e,t,n,r){const i=T_(n);let s=n.bulletCurrent||Jo(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const u=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),h);return u(),c;function h(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function y_(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}function __(e,t,n,r){return(e.children.some(function(o){return lh(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function A_(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Lh.peek=k_;function Lh(e,t,n,r){const i=A_(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let u=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=u.charCodeAt(0),h=si(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(u=Ct(c)+u.slice(1));const d=u.charCodeAt(u.length-1),f=si(r.after.charCodeAt(0),d,i);f.inside&&(u=u.slice(0,-1)+Ct(d));const p=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},a+u+p}function k_(e,t,n){return n.options.strong||"*"}function w_(e,t,n,r){return n.safe(e.value,r)}function S_(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 I_(e,t,n){const r=(Nh(n)+(n.options.ruleSpaces?" ":"")).repeat(S_(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Zo={blockquote:e_,break:Ku,code:i_,definition:o_,emphasis:Ch,hardBreak:Ku,heading:c_,html:_h,image:Ah,imageReference:kh,inlineCode:wh,link:Ih,linkReference:xh,list:E_,listItem:C_,paragraph:y_,root:__,strong:Lh,text:w_,thematicBreak:I_},x_=[N_];function N_(e,t,n,r){if(t.type==="code"&&qs(t,r)&&(e.type==="list"||e.type===t.type&&qs(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"&&yh(t,r))?void 0:n.spread?1:0}const kt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],L_=[{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:`
|
|
29
|
-
`,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:kt},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
30
|
-
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:kt},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
31
|
-
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:kt},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
32
|
-
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
33
|
-
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
34
|
-
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:kt},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:kt},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:kt},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:kt},{atBreak:!0,character:"~"}],Xu=document.createElement("i");function D_(e){const t="&"+e+";";Xu.innerHTML=t;const n=Xu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function O_(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 R_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function M_(e){return e.replace(R_,v_)}function v_(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return O_(n.slice(s?2:1),s?16:10)}return D_(n)||e}function P_(e){return e.label||!e.identifier?e.label||"":M_(e.identifier)}function B_(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 U_(e,t,n){const r=t.indexStack,i=e.children||[],s=[];let o=-1,a=n.before,u;r.push(-1);let c=t.createTracker(n);for(;++o<i.length;){const h=i[o];let d;if(r[r.length-1]=o,o+1<i.length){let m=t.handle.handlers[i[o+1].type];m&&m.peek&&(m=m.peek),d=m?m(i[o+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;s.length>0&&(a==="\r"||a===`
|
|
35
|
-
`)&&h.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=t.createTracker(n),c.move(s.join("")));let f=t.handle(h,e,t,{...c.current(),after:d,before:a});u&&u===f.slice(0,1)&&(f=Ct(u.charCodeAt(0))+f.slice(1));const p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,u=void 0,p&&(s.length>0&&p.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Ct(a.charCodeAt(0))),p.after&&(u=d)),c.move(f),s.push(f),a=f.slice(-1)}return r.pop(),s.join("")}function H_(e,t,n){const r=t.indexStack,i=e.children||[],s=t.createTracker(n),o=[];let a=-1;for(r.push(-1);++a<i.length;){const u=i[a];r[r.length-1]=a,o.push(s.move(t.handle(u,e,t,{before:`
|
|
36
|
-
`,after:`
|
|
37
|
-
`,...s.current()}))),u.type!=="list"&&(t.bulletLastUsed=void 0),a<i.length-1&&o.push(s.move(F_(u,i[a+1],e,t)))}return r.pop(),o.join("")}function F_(e,t,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](e,t,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
|
|
38
|
-
`.repeat(1+s);if(s===!1)return`
|
|
39
|
-
|
|
40
|
-
<!---->
|
|
41
|
-
|
|
42
|
-
`}return`
|
|
43
|
-
|
|
44
|
-
`}const V_=/\r?\n|\r/g;function Y_(e,t){const n=[];let r=0,i=0,s;for(;s=V_.exec(e);)o(e.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(e.slice(r)),n.join("");function o(a){n.push(t(a,i,!a))}}function z_(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),i=[],s=[],o={};let a=-1;for(;++a<e.unsafe.length;){const h=e.unsafe[a];if(!Th(e.stack,h))continue;const d=e.compilePattern(h);let f;for(;f=d.exec(r);){const p="before"in h||!!h.atBreak,m="after"in h,T=f.index+(p?f[1].length:0);i.includes(T)?(o[T].before&&!p&&(o[T].before=!1),o[T].after&&!m&&(o[T].after=!1)):(i.push(T),o[T]={before:p,after:m})}}i.sort($_);let u=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const h=i[a];h<u||h>=c||h+1<c&&i[a+1]===h+1&&o[h].after&&!o[h+1].before&&!o[h+1].after||i[a-1]===h-1&&o[h].before&&!o[h-1].before&&!o[h-1].after||(u!==h&&s.push(Qu(r.slice(u,h),"\\")),u=h,/[!-/:-@[-`{-~]/.test(r.charAt(h))&&(!n.encode||!n.encode.includes(r.charAt(h)))?s.push("\\"):(s.push(Ct(r.charCodeAt(h))),u++))}return s.push(Qu(r.slice(u,c),n.after)),s.join("")}function $_(e,t){return e-t}function Qu(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=e+t;let o=-1,a=0,u;for(;u=n.exec(s);)r.push(u.index);for(;++o<r.length;)a!==r[o]&&i.push(e.slice(a,r[o])),i.push("\\"),a=r[o];return i.push(e.slice(a)),i.join("")}function W_(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,i=n.line||1,s=n.column||1;return{move:u,current:o,shift:a};function o(){return{now:{line:i,column:s},lineShift:r}}function a(c){r+=c}function u(c){const h=c||"",d=h.split(/\r?\n|\r/g),f=d[d.length-1];return i+=d.length-1,s=d.length===1?s+f.length:1+f.length+r,h}}function j_(e,t){const n=t||{},r={associationId:P_,containerPhrasing:X_,containerFlow:Q_,createTracker:W_,compilePattern:B_,enter:s,handlers:{...Zo},handle:void 0,indentLines:Y_,indexStack:[],join:[...x_],options:{},safe:J_,stack:[],unsafe:[...L_]};Eh(r,n),r.options.tightDefinitions&&r.join.push(K_),r.handle=Qy("type",{invalid:q_,unknown:G_,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
|
|
45
|
-
`,after:`
|
|
46
|
-
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
47
|
-
`),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function q_(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function G_(e){const t=e;throw new Error("Cannot handle unknown node `"+t.type+"`")}function K_(e,t){if(e.type==="definition"&&e.type===t.type)return 0}function X_(e,t){return U_(e,this,t)}function Q_(e,t){return H_(e,this,t)}function J_(e,t){return z_(this,e,t)}function Z_(){return{enter:{table:eA,tableData:Ju,tableHeader:Ju,tableRow:nA},exit:{codeText:rA,table:tA,tableData:ss,tableHeader:ss,tableRow:ss}}}function eA(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 tA(e){this.exit(e),this.data.inTable=void 0}function nA(e){this.enter({type:"tableRow",children:[]},e)}function ss(e){this.exit(e)}function Ju(e){this.enter({type:"tableCell",children:[]},e)}function rA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,iA));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function iA(e,t){return t==="|"?t:e}function sA(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
48
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:u,tableRow:a}};function o(p,m,T,_){return c(h(p,T,_),p.align)}function a(p,m,T,_){const C=d(p,T,_),x=c([C]);return x.slice(0,x.indexOf(`
|
|
49
|
-
`))}function u(p,m,T,_){const C=T.enter("tableCell"),x=T.enter("phrasing"),I=T.containerPhrasing(p,{..._,before:s,after:s});return x(),C(),I}function c(p,m){return Ky(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function h(p,m,T){const _=p.children;let C=-1;const x=[],I=m.enter("table");for(;++C<_.length;)x[C]=d(_[C],m,T);return I(),x}function d(p,m,T){const _=p.children;let C=-1;const x=[],I=m.enter("tableRow");for(;++C<_.length;)x[C]=u(_[C],p,m,T);return I(),x}function f(p,m,T){let _=Zo.inlineCode(p,m,T);return T.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function oA(){return{exit:{taskListCheckValueChecked:Zu,taskListCheckValueUnchecked:Zu,paragraph:uA}}}function aA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:cA}}}function Zu(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function uA(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 i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===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 cA(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let u=Zo.listItem(e,t,n,{...r,...a.current()});return s&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),u;function c(h){return h+o}}function lA(){return[Ey(),Hy(),zy(),Z_(),oA()]}function dA(e){return{extensions:[Ty(),Fy(e),$y(),sA(e),aA()]}}function Fr(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}const ec={}.hasOwnProperty;function hA(e){const t={};let n=-1;for(;++n<e.length;)fA(t,e[n]);return t}function fA(e,t){let n;for(n in t){const i=(ec.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){ec.call(i,o)||(i[o]=[]);const a=s[o];pA(i[o],Array.isArray(a)?a:a?[a]:[])}}}function pA(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Fr(e,0,0,r)}const mA={tokenize:yA,partial:!0},Dh={tokenize:_A,partial:!0},Oh={tokenize:AA,partial:!0},Rh={tokenize:kA,partial:!0},gA={tokenize:wA,partial:!0},Mh={name:"wwwAutolink",tokenize:TA,previous:Ph},vh={name:"protocolAutolink",tokenize:CA,previous:Bh},st={name:"emailAutolink",tokenize:EA,previous:Uh},Xe={};function bA(){return{text:Xe}}let wt=48;for(;wt<123;)Xe[wt]=st,wt++,wt===58?wt=65:wt===91&&(wt=97);Xe[43]=st;Xe[45]=st;Xe[46]=st;Xe[95]=st;Xe[72]=[st,vh];Xe[104]=[st,vh];Xe[87]=[st,Mh];Xe[119]=[st,Mh];function EA(e,t,n){const r=this;let i,s;return o;function o(d){return!Gs(d)||!Uh.call(r,r.previous)||ea(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Gs(d)?(e.consume(d),a):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(gA,h,c)(d):d===45||d===95||Xo(d)?(s=!0,e.consume(d),u):h(d)}function c(d){return e.consume(d),i=!0,u}function h(d){return s&&i&&ir(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function TA(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!Ph.call(r,r.previous)||ea(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(mA,e.attempt(Dh,e.attempt(Oh,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function CA(e,t,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&Bh.call(r,r.previous)&&!ea(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(ir(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),u}return n(d)}function u(d){return d===47?(e.consume(d),s?c:(s=!0,u)):n(d)}function c(d){return d===null||hy(d)||ye(d)||Ht(d)||Ni(d)?n(d):e.attempt(Dh,e.attempt(Oh,h),n)(d)}function h(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function yA(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function _A(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(Rh,u,a)(c):c===null||ye(c)||Ht(c)||c!==45&&Ni(c)?u(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function u(c){return i||r||!s?n(c):t(c)}}function AA(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Rh,t,s)(o):o===null||ye(o)||Ht(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function kA(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),s):a===93?(e.consume(a),i):a===60||a===null||ye(a)||Ht(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||ye(a)||Ht(a)?t(a):r(a)}function s(a){return ir(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):ir(a)?(e.consume(a),o):n(a)}}function wA(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Xo(s)?n(s):t(s)}}function Ph(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ye(e)}function Bh(e){return!ir(e)}function Uh(e){return!(e===47||Gs(e))}function Gs(e){return e===43||e===45||e===46||e===95||Xo(e)}function ea(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 SA(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}function et(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return Ze(u)?(e.enter(n),a(u)):t(u)}function a(u){return Ze(u)&&s++<i?(e.consume(u),a):(e.exit(n),t(u))}}const IA={partial:!0,tokenize:xA};function xA(e,t,n){return r;function r(s){return Ze(s)?et(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Kt(s)?t(s):n(s)}}const NA={tokenize:BA,partial:!0};function LA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:MA,continuation:{tokenize:vA},exit:PA}},text:{91:{name:"gfmFootnoteCall",tokenize:RA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:DA,resolveTo:OA}}}}function DA(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){o=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return a;function a(u){if(!o||!o._balanced)return n(u);const c=mr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function OA(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function RA(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(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(s>999||d===93&&!o||d===null||d===91||ye(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(mr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return ye(d)||(o=!0),s++,e.consume(d),d===92?h:c}function h(d){return d===91||d===92||d===93?(e.consume(d),s++,c):c(d)}}function MA(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return u;function u(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(m)}function h(m){if(o>999||m===93&&!a||m===null||m===91||ye(m))return n(m);if(m===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return s=mr(r.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ye(m)||(a=!0),o++,e.consume(m),m===92?d:h}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),et(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function vA(e,t,n){return e.check(IA,t,e.attempt(NA,t,n))}function PA(e){e.exit("gfmFootnoteDefinition")}function BA(e,t,n){const r=this;return et(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function UA(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let u=-1;for(;++u<o.length;)if(o[u][0]==="enter"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._close){let c=u;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[u][1].end.offset-o[u][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[u][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[u][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[u][1].start)},f=[["enter",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&Fr(f,f.length,0,SA(p,o.slice(c+1,u),a)),Fr(f,f.length,0,[["exit",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["exit",h,a]]),Fr(o,c-1,u-c+3,f),u=c+f.length-2;break}}for(u=-1;++u<o.length;)o[u][1].type==="strikethroughSequenceTemporary"&&(o[u][1].type="data");return o}function s(o,a,u){const c=this.previous,h=this.events;let d=0;return f;function f(m){return c===126&&h[h.length-1][1].type!=="characterEscape"?u(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const T=ii(c);if(m===126)return d>1?u(m):(o.consume(m),d++,p);if(d<2&&!n)return u(m);const _=o.exit("strikethroughSequenceTemporary"),C=ii(m);return _._open=!C||C===2&&!!T,_._close=!T||T===2&&!!C,a(m)}}}class HA{constructor(){this.map=[]}add(t,n,r){FA(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[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 i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function FA(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function VA(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function YA(){return{flow:{null:{name:"table",tokenize:zA,resolveAll:$A}}}}function zA(e,t,n){const r=this;let i=0,s=0,o;return a;function a(k){let _n=r.events.length-1;for(;_n>-1;){const oa=r.events[_n][1].type;if(oa==="lineEnding"||oa==="linePrefix")_n--;else break}const ia=_n>-1?r.events[_n][1].type:null,sa=ia==="tableHead"||ia==="tableRow"?v:u;return sa===v&&r.parser.lazy[r.now().line]?n(k):sa(k)}function u(k){return e.enter("tableHead"),e.enter("tableRow"),c(k)}function c(k){return k===124||(o=!0,s+=1),h(k)}function h(k){return k===null?n(k):Kt(k)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),p):n(k):Ze(k)?et(e,h,"whitespace")(k):(s+=1,o&&(o=!1,i+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),d(k)))}function d(k){return k===null||k===124||ye(k)?(e.exit("data"),h(k)):(e.consume(k),k===92?f:d)}function f(k){return k===92||k===124?(e.consume(k),d):d(k)}function p(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(k):(e.enter("tableDelimiterRow"),o=!1,Ze(k)?et(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):m(k))}function m(k){return k===45||k===58?_(k):k===124?(o=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),T):V(k)}function T(k){return Ze(k)?et(e,_,"whitespace")(k):_(k)}function _(k){return k===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),C):k===45?(s+=1,C(k)):k===null||Kt(k)?R(k):V(k)}function C(k){return k===45?(e.enter("tableDelimiterFiller"),x(k)):V(k)}function x(k){return k===45?(e.consume(k),x):k===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(k))}function I(k){return Ze(k)?et(e,R,"whitespace")(k):R(k)}function R(k){return k===124?m(k):k===null||Kt(k)?!o||i!==s?V(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(k)):V(k)}function V(k){return n(k)}function v(k){return e.enter("tableRow"),te(k)}function te(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),te):k===null||Kt(k)?(e.exit("tableRow"),t(k)):Ze(k)?et(e,te,"whitespace")(k):(e.enter("data"),Me(k))}function Me(k){return k===null||k===124||ye(k)?(e.exit("data"),te(k)):(e.consume(k),k===92?re:Me)}function re(k){return k===92||k===124?(e.consume(k),Me):Me(k)}}function $A(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,u=0,c,h,d;const f=new HA;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,u!==0&&(tc(f,t,u,c,h),h=void 0,u=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=xr(f,t,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=xr(f,t,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):m.type==="tableHead"?(a=!0,u=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(u=n,s[1]!==0?(o[0]=o[1],d=xr(f,t,s,i,n,d)):o[1]!==0&&(d=xr(f,t,o,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(u!==0&&tc(f,t,u,c,h),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=VA(t.events,n))}return e}function xr(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},jt(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const u=jt(t.events,n[1]);if(s={type:o,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=jt(t.events,n[2]),h=jt(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,T=n[3]-n[2]-1;e.add(m,T,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(s.end=Object.assign({},jt(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function tc(e,t,n,r,i){const s=[],o=jt(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function jt(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const WA={name:"tasklistCheck",tokenize:qA};function jA(){return{text:{91:WA}}}function qA(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return ye(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),o):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),o):n(u)}function o(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(u)}function a(u){return Kt(u)?t(u):Ze(u)?e.check({tokenize:GA},t,n)(u):n(u)}}function GA(e,t,n){return et(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function KA(e){return hA([bA(),LA(),UA(e),YA(),jA()])}const XA={};function QA(e){const t=this,n=e||XA,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(KA(n)),s.push(lA()),o.push(dA(n))}function JA(e){const t=this;t.compiler=n;function n(r){return j_(r,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function nc(e){if(e)throw e}var Vr=Object.prototype.hasOwnProperty,Hh=Object.prototype.toString,rc=Object.defineProperty,ic=Object.getOwnPropertyDescriptor,sc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Hh.call(t)==="[object Array]"},oc=function(t){if(!t||Hh.call(t)!=="[object Object]")return!1;var n=Vr.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Vr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Vr.call(t,i)},ac=function(t,n){rc&&n.name==="__proto__"?rc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},uc=function(t,n){if(n==="__proto__")if(Vr.call(t,n)){if(ic)return ic(t,n).value}else return;return t[n]},ZA=function e(){var t,n,r,i,s,o,a=arguments[0],u=1,c=arguments.length,h=!1;for(typeof a=="boolean"&&(h=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=uc(a,n),i=uc(t,n),a!==i&&(h&&i&&(oc(i)||(s=sc(i)))?(s?(s=!1,o=r&&sc(r)?r:[]):o=r&&oc(r)?r:{},ac(a,{name:n,newValue:e(h,o,i)})):typeof i<"u"&&ac(a,{name:n,newValue:i}));return a};const os=_c(ZA);function Ks(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 ek(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(u,...c){const h=e[++s];let d=-1;if(u){o(u);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,h?tk(h,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function tk(e,t){let n;return r;function r(...o){const a=e.length>o.length;let u;a&&o.push(i);try{u=e.apply(this,o)}catch(c){const h=c;if(a&&n)throw h;return i(h)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const nk=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},rk={}.hasOwnProperty;class ta extends nk{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=ek()}copy(){const t=new ta;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(os(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(cs("data",this.frozen),this.namespace[t]=n,this):rk.call(this.namespace,t)&&this.namespace[t]||void 0:t?(cs("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Nr(t),r=this.parser||this.Parser;return as("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),as("process",this.parser||this.Parser),us("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=Nr(t),u=r.parse(a);r.run(u,a,function(h,d,f){if(h||!d||!f)return c(h);const p=d,m=r.stringify(p,f);ok(m)?f.value=m:f.result=m,c(h,f)});function c(h,d){h||!d?o(h):s?s(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),as("processSync",this.parser||this.Parser),us("processSync",this.compiler||this.Compiler),this.process(t,i),lc("processSync","process",n),r;function i(s,o){n=!0,nc(s),r=o}}run(t,n,r){cc(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const u=Nr(n);i.run(t,u,c);function c(h,d,f){const p=d||t;h?a(h):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),lc("runSync","run",r),i;function s(o,a){nc(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=Nr(n),i=this.compiler||this.Compiler;return us("stringify",i),cc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(cs("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...d]=c;u(h,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=os(!0,i.settings,c.settings))}function a(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const d=c[h];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,h){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...h]);else if(h.length>0){let[p,...m]=h;const T=r[f][1];Ks(T)&&Ks(p)&&(p=os(!0,T,p)),r[f]=[c,p,...m]}}}}const ik=new ta().freeze();function as(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function us(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function cs(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 cc(e){if(!Ks(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Nr(e){return sk(e)?e:new Ws(e)}function sk(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ok(e){return typeof e=="string"||ak(e)}function ak(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}function uk(e,t){return Fh(e,{})||{type:"root",children:[]}}function Fh(e,t){const n=ck(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function ck(e,t){switch(e.nodeType){case 1:return fk(e,t);case 3:return dk(e);case 8:return hk(e);case 9:return dc(e,t);case 10:return lk();case 11:return dc(e,t);default:return}}function dc(e,t){return{type:"root",children:Vh(e,t)}}function lk(){return{type:"doctype"}}function dk(e){return{type:"text",value:e.nodeValue||""}}function hk(e){return{type:"comment",value:e.nodeValue||""}}function fk(e,t){const n=e.namespaceURI,r=n===Br.svg?ud:ad,i=n===Br.html?e.tagName.toLowerCase():e.tagName,s=n===Br.html&&i==="template"?e.content:e,o=e.getAttributeNames(),a={};let u=-1;for(;++u<o.length;)a[o[u]]=e.getAttribute(o[u])||"";return r(i,a,Vh(s,t))}function Vh(e,t){const n=e.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=Fh(n[i],t);s!==void 0&&r.push(s)}return r}var pk=Object.defineProperty,mk=(e,t,n)=>t in e?pk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>mk(e,typeof t!="symbol"?t+"":t,n);function Yh(e){const t=Array.from(e.classList).filter(n=>!n.startsWith("bn-"))||[];t.length>0?e.className=t.join(" "):e.removeAttribute("class")}function zh(e,t,n,r){var i;let s;if(t)if(typeof t=="string")s=mt([t],e.pmSchema);else if(Array.isArray(t))s=mt(t,e.pmSchema);else if(t.type==="tableContent")s=so(t,e.pmSchema);else throw new fn(t.type);else throw new Error("blockContent is required");const o=((r==null?void 0:r.document)??document).createDocumentFragment();for(const a of s)if(a.type.name!=="text"&&e.schema.inlineContentSchema[a.type.name]){const u=e.schema.inlineContentSpecs[a.type.name].implementation;if(u){const c=xc(a,e.schema.inlineContentSchema,e.schema.styleSchema),h=u.toExternalHTML?u.toExternalHTML(c,e):u.render.call({renderType:"dom",props:void 0},c,()=>{},e);if(h){if(o.appendChild(h.dom),h.contentDOM){const d=n.serializeFragment(a.content,r);h.contentDOM.dataset.editable="",h.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let u=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in e.schema.styleSpecs){const h=(e.schema.styleSpecs[c.type.name].implementation.toExternalHTML??e.schema.styleSpecs[c.type.name].implementation.render)(c.attrs.stringValue,e);h.contentDOM.appendChild(u),u=h.dom}else{const h=c.type.spec.toDOM(c,!0),d=ne.DOMSerializer.renderSpec(document,h);d.contentDOM.appendChild(u),u=d.dom}o.appendChild(u)}else{const u=n.serializeFragment(ne.Fragment.from([a]),r);o.appendChild(u)}return o.childNodes.length===1&&((i=o.firstChild)==null?void 0:i.nodeType)===1&&Yh(o.firstChild),o}function gk(e,t,n,r,i,s,o){var a,u,c,h,d,f,p,m,T;const _=(o==null?void 0:o.document)??document,C=t.pmSchema.nodes.blockContainer,x=n.props||{};for(const[re,k]of Object.entries(t.schema.blockSchema[n.type].propSchema))!(re in x)&&k.default!==void 0&&(x[re]=k.default);const I=(u=(a=C.spec)==null?void 0:a.toDOM)==null?void 0:u.call(a,C.create({id:n.id,...x})),R=Array.from(I.dom.attributes),V=t.blockImplementations[n.type].implementation,v=((c=V.toExternalHTML)==null?void 0:c.call({},{...n,props:x},t))||V.render.call({},{...n,props:x},t),te=_.createDocumentFragment();if(v.dom.classList.contains("bn-block-content")){const re=[...R,...Array.from(v.dom.attributes)].filter(k=>k.name.startsWith("data")&&k.name!=="data-content-type"&&k.name!=="data-file-block"&&k.name!=="data-node-view-wrapper"&&k.name!=="data-node-type"&&k.name!=="data-id"&&k.name!=="data-editable");for(const k of re)v.dom.firstChild.setAttribute(k.name,k.value);Yh(v.dom.firstChild),te.append(...Array.from(v.dom.childNodes))}else te.append(v.dom);if(v.contentDOM&&n.content){const re=zh(t,n.content,r,o);v.contentDOM.appendChild(re)}let Me;if(i.has(n.type)?Me="OL":s.has(n.type)&&(Me="UL"),Me){if(((h=e.lastChild)==null?void 0:h.nodeName)!==Me){const re=_.createElement(Me);Me==="OL"&&"start"in x&&x.start&&(x==null?void 0:x.start)!==1&&re.setAttribute("start",x.start+""),e.append(re)}e.lastChild.appendChild(te)}else e.append(te);if(n.children&&n.children.length>0){const re=_.createDocumentFragment();if($h(re,t,n.children,r,i,s,o),((d=e.lastChild)==null?void 0:d.nodeName)==="UL"||((f=e.lastChild)==null?void 0:f.nodeName)==="OL")for(;((p=re.firstChild)==null?void 0:p.nodeName)==="UL"||((m=re.firstChild)==null?void 0:m.nodeName)==="OL";)e.lastChild.lastChild.appendChild(re.firstChild);t.pmSchema.nodes[n.type].isInGroup("blockContent")?e.append(re):(T=v.contentDOM)==null||T.append(re)}}const $h=(e,t,n,r,i,s,o)=>{for(const a of n)gk(e,t,a,r,i,s,o)},bk=(e,t,n,r,i,s)=>{const o=((s==null?void 0:s.document)??document).createDocumentFragment();return $h(o,e,t,n,r,i,s),o},Ek=(e,t)=>{const n=ne.DOMSerializer.fromSchema(e);return{exportBlocks:(r,i)=>{const s=bk(t,r,n,new Set(["numberedListItem"]),new Set(["bulletListItem","checkListItem","toggleListItem"]),i),o=document.createElement("div");return o.append(s),o.innerHTML},exportInlineContent:(r,i)=>{const s=zh(t,r,n,i),o=document.createElement("div");return o.append(s.cloneNode(!0)),o.innerHTML}}};function Tk(e,t){if(t===0)return;const n=e.resolve(t);for(let r=n.depth;r>0;r--){const i=n.node(r);if(xo(i))return i.attrs.id}}function Ck(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 hc(e){const t="__root__",n={},r={},i=pt(e);return e.descendants((s,o)=>{if(!xo(s))return!0;const a=Tk(e,o),u=a??t;r[u]||(r[u]=[]);const c=sn(s,i);return n[s.attrs.id]={block:c,parentId:a},r[u].push(s.attrs.id),!0}),{byId:n,childrenByParent:r}}function yk(e,t){const n=new Set;if(!e||!t)return n;const r=new Set(e),i=t.filter(T=>r.has(T)),s=e.filter(T=>i.includes(T));if(s.length<=1||i.length<=1)return n;const o={};for(let T=0;T<s.length;T++)o[s[T]]=T;const a=i.map(T=>o[T]),u=a.length,c=[],h=[],d=new Array(u).fill(-1),f=(T,_)=>{let C=0,x=T.length;for(;C<x;){const I=C+x>>>1;T[I]<_?C=I+1:x=I}return C};for(let T=0;T<u;T++){const _=a[T],C=f(c,_);C>0&&(d[T]=h[C-1]),C===c.length?(c.push(_),h.push(T)):(c[C]=_,h[C]=T)}const p=new Set;let m=h[h.length-1]??-1;for(;m!==-1;)p.add(m),m=d[m];for(let T=0;T<i.length;T++)p.has(T)||n.add(i[T]);return n}function _k(e,t=[]){const n=Ck(e),r=L.combineTransactionSteps(e.before,[e,...t]),i=hc(r.before),s=hc(r.doc),o=[],a=new Set;Object.keys(s.byId).filter(p=>!(p in i.byId)).forEach(p=>{o.push({type:"insert",block:s.byId[p].block,source:n,prevBlock:void 0}),a.add(p)}),Object.keys(i.byId).filter(p=>!(p in s.byId)).forEach(p=>{o.push({type:"delete",block:i.byId[p].block,source:n,prevBlock:void 0}),a.add(p)}),Object.keys(s.byId).filter(p=>p in i.byId).forEach(p=>{var m,T;const _=i.byId[p],C=s.byId[p];_.parentId!==C.parentId?(o.push({type:"move",block:C.block,prevBlock:_.block,source:n,prevParent:_.parentId?(m=i.byId[_.parentId])==null?void 0:m.block:void 0,currentParent:C.parentId?(T=s.byId[C.parentId])==null?void 0:T.block:void 0}),a.add(p)):wf({..._.block,children:void 0},{...C.block,children:void 0})||(o.push({type:"update",block:C.block,prevBlock:_.block,source:n}),a.add(p))});const u=i.childrenByParent,c=s.childrenByParent,h="__root__",d=new Set([...Object.keys(u),...Object.keys(c)]),f=new Set;return d.forEach(p=>{const m=yk(u[p],c[p]);m.size!==0&&m.forEach(T=>{var _,C;const x=i.byId[T],I=s.byId[T];!x||!I||x.parentId!==I.parentId||a.has(T)||(x.parentId??h)!==p||f.has(T)||(f.add(T),o.push({type:"move",block:I.block,prevBlock:x.block,source:n,prevParent:x.parentId?(_=i.byId[x.parentId])==null?void 0:_.block:void 0,currentParent:I.parentId?(C=s.byId[I.parentId])==null?void 0:C.block:void 0}),a.add(T))})}),o}function Ak(){const e=t=>{let n=t.children.length;for(let r=0;r<n;r++){const i=t.children[r];if(i.type==="element"&&(e(i),i.tagName==="u"))if(i.children.length>0){t.children.splice(r,1,...i.children);const s=i.children.length-1;n+=s,r+=s}else t.children.splice(r,1),n--,r--}};return e}function kk(){const e=t=>{var n;if(t.children&&"length"in t.children&&t.children.length)for(let r=t.children.length-1;r>=0;r--){const i=t.children[r],s=r+1<t.children.length?t.children[r+1]:void 0;i.type==="element"&&i.tagName==="input"&&((n=i.properties)==null?void 0:n.type)==="checkbox"&&(s==null?void 0:s.type)==="element"&&s.tagName==="p"?(s.tagName="span",s.children.splice(0,0,uk(document.createTextNode(" ")))):e(i)}};return e}function wk(){return e=>{hn(e,"element",(t,n,r)=>{var i,s,o,a;if(r&&t.tagName==="video"){const u=((i=t.properties)==null?void 0:i.src)||((s=t.properties)==null?void 0:s["data-url"])||"",c=((o=t.properties)==null?void 0:o.title)||((a=t.properties)==null?void 0:a["data-name"])||"";r.children[n]={type:"text",value:``}}})}}function Sk(e){return ik().use(O2,{fragment:!0}).use(wk).use(Ak).use(kk).use(dy).use(QA).use(JA,{handlers:{text:t=>t.value}}).processSync(e).value}function Ik(e){const t=[];return e.descendants(n=>{var r,i;const s=pt(n);return n.type.name==="blockContainer"&&((r=n.firstChild)==null?void 0:r.type.name)==="blockGroup"?!0:n.type.name==="columnList"&&n.childCount===1?((i=n.firstChild)==null||i.forEach(o=>{t.push(sn(o,s))}),!1):n.type.isInGroup("bnBlock")?(t.push(sn(n,s)),!1):!0}),t}z(()=>{const e=[];return{key:"blockChange",prosemirrorPlugins:[new D.Plugin({key:new D.PluginKey("blockChange"),filterTransaction:t=>{let n;return e.reduce((r,i)=>r===!1?r:i({getChanges(){return n||(n=_k(t),n)},tr:t})!==!1,!0)}})],subscribe(t){return e.push(t),()=>{e.splice(e.indexOf(t),1)}}}});function fc(e){const t=e.charAt(0)==="#"?e.substring(1,7):e,n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16),s=[n/255,r/255,i/255].map(o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4));return .2126*s[0]+.7152*s[1]+.0722*s[2]<=.179}function xk(e){const t=document.createElement("span");t.classList.add("bn-collaboration-cursor__base");const n=document.createElement("span");n.setAttribute("contentedEditable","false"),n.classList.add("bn-collaboration-cursor__caret"),n.setAttribute("style",`background-color: ${e.color}; color: ${fc(e.color)?"white":"black"}`);const r=document.createElement("span");return r.classList.add("bn-collaboration-cursor__label"),r.setAttribute("style",`background-color: ${e.color}; color: ${fc(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}const pc=z(({options:e})=>{const t=new Map;return e.provider&&"awareness"in e.provider&&typeof e.provider.awareness=="object"&&("setLocalStateField"in e.provider.awareness&&typeof e.provider.awareness.setLocalStateField=="function"&&e.provider.awareness.setLocalStateField("user",e.user),"on"in e.provider.awareness&&typeof e.provider.awareness.on=="function"&&e.showCursorLabels!=="always"&&e.provider.awareness.on("change",({updated:n})=>{for(const r of n){const i=t.get(r);i&&(i.element.setAttribute("data-active",""),i.hideTimeout&&clearTimeout(i.hideTimeout),t.set(r,{element:i.element,hideTimeout:setTimeout(()=>{i.element.removeAttribute("data-active")},2e3)}))}})),{key:"yCursor",prosemirrorPlugins:[lg(e.provider.awareness,{selectionBuilder:Fl,cursorBuilder(n,r){let i=t.get(r);if(!i){const s=(e.renderCursor??xk)(n);e.showCursorLabels!=="always"&&(s.addEventListener("mouseenter",()=>{const o=t.get(r);o.element.setAttribute("data-active",""),o.hideTimeout&&(clearTimeout(o.hideTimeout),t.set(r,{element:o.element,hideTimeout:void 0}))}),s.addEventListener("mouseleave",()=>{const o=t.get(r);t.set(r,{element:o.element,hideTimeout:setTimeout(()=>{o.element.removeAttribute("data-active")},2e3)})})),i={element:s,hideTimeout:void 0},t.set(r,i)}return i.element}})],dependsOn:["ySync"],updateUser(n){e.provider.awareness.setLocalStateField("user",n)}}}),ls=z(({options:e})=>({key:"ySync",prosemirrorPlugins:[Gm(e.fragment)],runsBefore:["default"]})),ds=z(({editor:e})=>({key:"yUndo",prosemirrorPlugins:[bg({trackedOrigins:[e]})],dependsOn:["yCursor","ySync"],undoCommand:fg,redoCommand:pg}));function Nk(e,t){const n=e.doc;if(e._item===null){const r=Array.from(n.share.keys()).find(i=>n.share.get(i)===e);if(r==null)throw new Error("type does not exist in other ydoc");return t.get(r,e.constructor)}else{const r=e._item,i=t.store.clients.get(r.id.client)??[],s=Re(i,r.id.clock);return i[s].content.type}}z(({editor:e,options:t})=>{let n;const r=Tn({isForked:!1});return{key:"yForkDoc",store:r,fork(){if(n)return;const i=t.fragment;if(!i)throw new Error("No fragment to fork from");const s=new _t;_a(s,Aa(i.doc));const o=Nk(i,s);n={undoStack:qe.getState(e.prosemirrorState).undoManager.undoStack,originalFragment:i,forkedFragment:o},e.unregisterExtension([ds,pc,ls]);const a={...t,fragment:o};e.registerExtension([ls(a),ds({})]),r.setState({isForked:!0})},merge({keepChanges:i}){if(!n)return;e.unregisterExtension(["ySync","yCursor","yUndo"]);const{originalFragment:s,forkedFragment:o,undoStack:a}=n;if(e.registerExtension([ls(t),pc(t),ds({})]),qe.getState(e.prosemirrorState).undoManager.undoStack=a,i){const u=Aa(o.doc,wp(s.doc));_a(s.doc,u,e)}n=void 0,r.setState({isForked:!1})}}});const Wh=(e,t)=>{t(e),e.forEach(n=>{n instanceof le&&Wh(n,t)})},Lk=(e,t)=>{const n=new Map;return e.forEach(r=>{r instanceof le&&Wh(r,i=>{if(i.nodeName==="blockContainer"&&i.hasAttribute("id")){const s=i.getAttribute("textColor"),o=i.getAttribute("backgroundColor"),a={textColor:s===X.textColor.default?void 0:s,backgroundColor:o===X.backgroundColor.default?void 0:o};(a.textColor||a.backgroundColor)&&n.set(i.getAttribute("id"),a)}})}),n.size===0?!1:(t.doc.descendants((r,i)=>{if(r.type.name==="blockContainer"&&n.has(r.attrs.id)){const s=t.doc.nodeAt(i+1);if(!s)throw new Error("No element found");t.setNodeMarkup(i+1,void 0,{...s.attrs,...n.get(r.attrs.id)})}}),!0)},Dk=[Lk];z(({options:e})=>{let t=!1;const n=new D.PluginKey("schemaMigration");return{key:"schemaMigration",prosemirrorPlugins:[new D.Plugin({key:n,appendTransaction:(r,i,s)=>{if(t||!r.some(a=>a.getMeta("y-sync$"))||r.every(a=>!a.docChanged)||!e.fragment.firstChild)return;const o=s.tr;for(const a of Dk)a(e.fragment,o);if(t=!0,!!o.docChanged)return o}})]}});z(({editor:e,options:t})=>({key:"dropCursor",prosemirrorPlugins:[(t.dropCursor??rf.dropCursor)({width:5,color:"#ddeeff",editor:e})]}));z(({editor:e})=>{const t=Tn(!1),n=()=>e.transact(r=>{var i;if(r.selection.empty||r.selection instanceof D.NodeSelection&&(r.selection.node.type.spec.content==="inline*"||((i=r.selection.node.firstChild)==null?void 0:i.type.spec.content)==="inline*")||r.selection instanceof D.TextSelection&&r.doc.textBetween(r.selection.from,r.selection.to).length===0)return!1;let s=!1;return r.selection.content().content.descendants(o=>(o.type.spec.code&&(s=!0),!s)),!s});return{key:"formattingToolbar",store:t,mount({dom:r,signal:i}){let s=!1;const o=e.onChange(()=>{s||t.setState(n())}),a=e.onSelectionChange(()=>{s||t.setState(n())});r.addEventListener("pointerdown",()=>{s=!0,t.setState(!1)},{signal:i}),e.prosemirrorView.root.addEventListener("pointerup",()=>{s=!1,e.isFocused()&&t.setState(n())},{signal:i,capture:!0}),r.addEventListener("pointercancel",()=>{s=!1},{signal:i,capture:!0}),i.addEventListener("abort",()=>{o(),a()})}}});z(()=>({key:"history",prosemirrorPlugins:[Di.history()],undoCommand:Di.undo,redoCommand:Di.redo}));z(({editor:e})=>{function t(i){let s=e.prosemirrorView.nodeDOM(i);for(;s&&s.parentElement;){if(s.nodeName==="A")return s;s=s.parentElement}return null}function n(i,s){return e.transact(o=>{const a=o.doc.resolve(i),u=a.marks().find(h=>h.type.name===s);if(!u)return;const c=L.getMarkRange(a,u.type);if(c)return{range:c,mark:u,get text(){return o.doc.textBetween(c.from,c.to)},get position(){return L.posToDOMRect(e.prosemirrorView,c.from,c.to).toJSON()}}})}function r(){return e.transact(i=>{const s=i.selection;if(s.empty)return n(s.anchor,"link")})}return{key:"linkToolbar",getLinkAtSelection:r,getLinkElementAtPos:t,getMarkAtPos:n,getLinkAtElement(i){return e.transact(()=>{const s=e.prosemirrorView.posAtDOM(i,0)+1;return n(s,"link")})},editLink(i,s,o=e.transact(a=>a.selection.anchor)){e.transact(a=>{const u=pt(a),{range:c}=n(o+1,"link")||{range:{from:a.selection.from,to:a.selection.to}};c&&(a.insertText(s,c.from,c.to),a.addMark(c.from,c.from+s.length,u.mark("link",{href:i})))}),e.prosemirrorView.focus()},deleteLink(i=e.transact(s=>s.selection.anchor)){e.transact(s=>{const o=pt(s),{range:a}=n(i+1,"link")||{range:{from:s.selection.from,to:s.selection.to}};a&&s.removeMark(a.from,a.to,o.marks.link).setMeta("preventAutolink",!0)}),e.prosemirrorView.focus()}}});const Ok=new D.PluginKey("node-selection-keyboard");z(()=>({key:"nodeSelectionKeyboard",prosemirrorPlugins:[new D.Plugin({key:Ok,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.shiftKey&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const n=e.state.tr;return e.dispatch(n.insert(e.state.tr.selection.$to.after(),e.state.schema.nodes.paragraph.createChecked()).setSelection(new D.TextSelection(n.doc.resolve(e.state.tr.selection.$to.after()+1)))),!0}}return!1}}})]}));const Rk=new D.PluginKey("blocknote-placeholder");z(({editor:e,options:t})=>{const n=t.placeholders;return{key:"placeholder",prosemirrorPlugins:[new D.Plugin({key:Rk,view:r=>{const i=`placeholder-selector-${Ac()}`;r.dom.classList.add(i);const s=document.createElement("style"),o=e._tiptapEditor.options.injectNonce;o&&s.setAttribute("nonce",o),r.root instanceof window.ShadowRoot?r.root.append(s):r.root.head.appendChild(s);const a=s.sheet,u=(c="")=>`.${i} .bn-block-content${c} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;try{const{default:c,emptyDocument:h,...d}=n||{};for(const[m,T]of Object.entries(d)){const _=`[data-content-type="${m}"]`;a.insertRule(`${u(_)} { content: ${JSON.stringify(T)}; }`)}a.insertRule(`${u("[data-is-only-empty-block]")} { content: ${JSON.stringify(h)}; }`),a.insertRule(`${u("[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(s):r.root.head.removeChild(s)}}},props:{decorations:r=>{const{doc:i,selection:s}=r;if(!e.isEditable||!s.empty||s.$from.parent.type.spec.code)return;const o=[];r.doc.content.size===6&&o.push(K.Decoration.node(2,4,{"data-is-only-empty-block":"true"}));const a=s.$anchor,u=a.parent;if(u.content.size===0){const c=a.before();o.push(K.Decoration.node(c,c+u.nodeSize,{"data-is-empty-and-focused":"true"}))}return K.DecorationSet.create(i,o)}}})]}});const mc=new D.PluginKey("previous-blocks"),Mk={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"};z(()=>{let e;return{key:"previousBlockType",prosemirrorPlugins:[new D.Plugin({key:mc,view(t){return{update:async(n,r)=>{var i;((i=this.key)==null?void 0:i.getState(n.state).updatedBlocks.size)>0&&(e=setTimeout(()=>{n.dispatch(n.state.tr.setMeta(mc,{clearUpdate:!0}))},0))},destroy:()=>{e&&clearTimeout(e)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(t,n,r,i){if(n.currentTransactionOldBlockAttrs={},n.updatedBlocks.clear(),!t.docChanged||r.doc.eq(i.doc))return n;const s={},o=L.findChildren(r.doc,c=>c.attrs.id),a=new Map(o.map(c=>[c.node.attrs.id,c])),u=L.findChildren(i.doc,c=>c.attrs.id);for(const c of u){const h=a.get(c.node.attrs.id),d=h==null?void 0:h.node.firstChild,f=c.node.firstChild;if(h&&d&&f){const p={index:f.attrs.index,level:f.attrs.level,type:f.type.name,depth:i.doc.resolve(c.pos).depth},m={index:d.attrs.index,level:d.attrs.level,type:d.type.name,depth:r.doc.resolve(h.pos).depth};s[c.node.attrs.id]=m,n.currentTransactionOldBlockAttrs[c.node.attrs.id]=m,JSON.stringify(m)!==JSON.stringify(p)&&(m["depth-change"]=m.depth-p.depth,n.updatedBlocks.add(c.node.attrs.id))}}return n.prevTransactionOldBlockAttrs=s,n}},props:{decorations(t){const n=this.getState(t);if(n.updatedBlocks.size===0)return;const r=[];return t.doc.descendants((i,s)=>{if(!i.attrs.id||!n.updatedBlocks.has(i.attrs.id))return;const o=n.currentTransactionOldBlockAttrs[i.attrs.id],a={};for(const[c,h]of Object.entries(o))a["data-prev-"+Mk[c]]=h||"none";const u=K.Decoration.node(s,s+i.nodeSize,{...a});r.push(u)}),K.DecorationSet.create(t.doc,r)}}})]}});function jh(e,t){for(var n,r;e&&e.parentElement&&e.parentElement!==t.dom&&((n=e.getAttribute)==null?void 0:n.call(e,"data-node-type"))!=="blockContainer";)e=e.parentElement;if(((r=e.getAttribute)==null?void 0:r.call(e,"data-node-type"))==="blockContainer")return{node:e,id:e.getAttribute("data-id")}}class Ot extends D.Selection{constructor(t,n){super(t,n),Y(this,"nodes");const r=t.node();this.nodes=[],t.doc.nodesBetween(t.pos,n.pos,(i,s,o)=>{if(o!==null&&o.eq(r))return this.nodes.push(i),!1})}static create(t,n,r=n){return new Ot(t.resolve(n),t.resolve(r))}content(){return new ne.Slice(ne.Fragment.from(this.nodes),0,0)}eq(t){if(!(t instanceof Ot)||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){const r=n.mapResult(this.from),i=n.mapResult(this.to);return i.deleted?D.Selection.near(t.resolve(r.pos)):r.deleted?D.Selection.near(t.resolve(i.pos)):new Ot(t.resolve(r.pos),t.resolve(i.pos))}toJSON(){return{type:"multiple-node",anchor:this.anchor,head:this.head}}}D.Selection.jsonID("multiple-node",Ot);let ve;function vk(e,t){let n,r;const i=t.resolve(e.from).node().type.spec.group==="blockContent",s=t.resolve(e.to).node().type.spec.group==="blockContent",o=Math.min(e.$anchor.depth,e.$head.depth);if(i&&s){const a=e.$from.start(o-1),u=e.$to.end(o-1);n=t.resolve(a-1).pos,r=t.resolve(u+1).pos}else n=e.from,r=e.to;return{from:n,to:r}}function gc(e,t,n=t){t===n&&(n+=e.state.doc.resolve(t+1).node().nodeSize);const r=e.domAtPos(t).node.cloneNode(!0),i=e.domAtPos(t).node,s=(h,d)=>Array.prototype.indexOf.call(h.children,d),o=s(i,e.domAtPos(t+1).node.parentElement),a=s(i,e.domAtPos(n-1).node.parentElement);for(let h=i.childElementCount-1;h>=0;h--)(h>a||h<o)&&r.removeChild(r.children[h]);qh(e.root),ve=r;const u=ve.getElementsByTagName("iframe");for(let h=0;h<u.length;h++){const d=u[h],f=d.parentElement;f&&f.removeChild(d)}const c=e.dom.className.split(" ").filter(h=>h!=="ProseMirror"&&h!=="bn-root"&&h!=="bn-editor").join(" ");ve.className=ve.className+" bn-drag-preview "+c,e.root instanceof ShadowRoot?e.root.appendChild(ve):e.root.body.appendChild(ve)}function qh(e){ve!==void 0&&(e instanceof ShadowRoot?e.removeChild(ve):e.body.removeChild(ve),ve=void 0)}function Pk(e,t,n){if(!e.dataTransfer||n.headless)return;const r=n.prosemirrorView,i=$l(t.id,r.state.doc);if(!i)throw new Error(`Block with ID ${t.id} not found`);const s=i.posBeforeNode;if(s!=null){const o=r.state.selection,a=r.state.doc,{from:u,to:c}=vk(o,a),h=u<=s&&s<c,d=o.$anchor.node()!==o.$head.node()||o instanceof Ot;h&&d?(r.dispatch(r.state.tr.setSelection(Ot.create(a,u,c))),gc(r,u,c)):(r.dispatch(r.state.tr.setSelection(D.NodeSelection.create(r.state.doc,s))),gc(r,s));const f=r.state.selection.content(),p=n.pmSchema,m=r.serializeForClipboard(f).dom.innerHTML,T=Ek(p,n),_=Ik(f.content),C=T.exportBlocks(_,{}),x=Sk(C);e.dataTransfer.clearData(),e.dataTransfer.setData("blocknote/html",m),e.dataTransfer.setData("text/html",C),e.dataTransfer.setData("text/plain",x),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(ve,0,0)}}const bc=250;function Xs(e,t,n=!0){const r=e.root.elementsFromPoint(t.left,t.top);for(const i of r)if(e.dom.contains(i))return n&&i.closest("[data-node-type=columnList]")?Xs(e,{left:t.left+50,top:t.top},!1):jh(i,e)}function Bk(e,t){if(!t.dom.firstChild)return;const n=t.dom.firstChild.getBoundingClientRect(),r={left:Math.min(Math.max(n.left+10,e.x),n.right-10),top:e.y},i=Xs(t,r);if(!i)return;const s=i.node.getBoundingClientRect();return Xs(t,{left:s.right-10,top:e.y},!1)}class Uk{constructor(t,n,r){Y(this,"state"),Y(this,"emitUpdate"),Y(this,"mousePos"),Y(this,"hoveredBlock"),Y(this,"menuFrozen",!1),Y(this,"isDragOrigin",!1),Y(this,"updateState",i=>{this.state=i,this.emitUpdate(this.state)}),Y(this,"updateStateFromMousePos",()=>{var i,s,o,a,u;if(this.menuFrozen||!this.mousePos)return;const c=this.findClosestEditorElement({clientX:this.mousePos.x,clientY:this.mousePos.y});if((c==null?void 0:c.element)!==this.pmView.dom||c.distance>bc){(i=this.state)!=null&&i.show&&(this.state.show=!1,this.updateState(this.state));return}const h=Bk(this.mousePos,this.pmView);if(!h||!this.editor.isEditable){(s=this.state)!=null&&s.show&&(this.state.show=!1,this.updateState(this.state));return}if(!((o=this.state)!=null&&o.show&&(a=this.hoveredBlock)!=null&&a.hasAttribute("data-id")&&((u=this.hoveredBlock)==null?void 0:u.getAttribute("data-id"))===h.id)&&(this.hoveredBlock=h.node,this.editor.isEditable)){const d=h.node.getBoundingClientRect(),f=h.node.closest("[data-node-type=column]");this.state={show:!0,referencePos:new DOMRect(f?f.firstElementChild.getBoundingClientRect().x:this.pmView.dom.firstChild.getBoundingClientRect().x,d.y,d.width,d.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.updateState(this.state)}}),Y(this,"onDragStart",i=>{var s;const o=(s=i.dataTransfer)==null?void 0:s.getData("blocknote/html");if(!o||this.pmView.dragging)return;const a=document.createElement("div");a.innerHTML=o;const u=ne.DOMParser.fromSchema(this.pmView.state.schema).parse(a,{topNode:this.pmView.state.schema.nodes.blockGroup.create()});this.pmView.dragging={slice:new ne.Slice(u.content,0,0),move:!0}}),Y(this,"findClosestEditorElement",i=>{const s=Array.from(this.pmView.root.querySelectorAll(".bn-editor"));if(s.length===0)return null;let o=s[0],a=Number.MAX_VALUE;return s.forEach(u=>{const c=u.querySelector(".bn-block-group").getBoundingClientRect(),h=i.clientX<c.left?c.left-i.clientX:i.clientX>c.right?i.clientX-c.right:0,d=i.clientY<c.top?c.top-i.clientY:i.clientY>c.bottom?i.clientY-c.bottom:0,f=Math.sqrt(Math.pow(h,2)+Math.pow(d,2));f<a&&(a=f,o=u)}),{element:o,distance:a}}),Y(this,"onDragOver",i=>{if(i.synthetic)return;const s=this.getDragEventContext(i);if(!s||!s.isDropPoint){this.closeDropCursor();return}s.isDropPoint&&!s.isDropWithinEditorBounds&&this.dispatchSyntheticEvent(i)}),Y(this,"closeDropCursor",()=>{const i=new Event("dragleave",{bubbles:!1});i.synthetic=!0,this.pmView.dom.dispatchEvent(i)}),Y(this,"getDragEventContext",i=>{var s;const o=!((s=i.dataTransfer)!=null&&s.types.includes("blocknote/html"))&&!!this.pmView.dragging,a=!!this.isDragOrigin,u=o||a,c=this.findClosestEditorElement(i);if(!c||c.distance>bc)return;const h=c.element===this.pmView.dom,d=h&&c.distance===0;if(!(!h&&!u))return{isDropPoint:h,isDropWithinEditorBounds:d,isDragOrigin:u}}),Y(this,"onDrop",i=>{if(i.synthetic)return;const s=this.getDragEventContext(i);if(!s){this.closeDropCursor();return}const{isDropPoint:o,isDropWithinEditorBounds:a,isDragOrigin:u}=s;if(!a&&o&&this.dispatchSyntheticEvent(i),o){if(this.pmView.dragging)return;this.pmView.dispatch(this.pmView.state.tr.setSelection(D.TextSelection.create(this.pmView.state.tr.doc,this.pmView.state.tr.selection.anchor)));return}else if(u){setTimeout(()=>this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),0);return}}),Y(this,"onDragEnd",i=>{i.synthetic||(this.pmView.dragging=null)}),Y(this,"onKeyDown",i=>{var s;(s=this.state)!=null&&s.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state))}),Y(this,"onMouseMove",i=>{var s;if(this.menuFrozen)return;this.mousePos={x:i.clientX,y:i.clientY};const o=this.pmView.dom.getBoundingClientRect(),a=this.mousePos.x>o.left&&this.mousePos.x<o.right&&this.mousePos.y>o.top&&this.mousePos.y<o.bottom,u=this.pmView.dom.parentElement;if(a&&i&&i.target&&!(u===i.target||u.contains(i.target))){(s=this.state)!=null&&s.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.updateStateFromMousePos()}),this.editor=t,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw new 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)}dispatchSyntheticEvent(t){const 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){var r;!n.doc.eq(this.pmView.state.doc)&&(r=this.state)!=null&&r.show&&this.updateStateFromMousePos()}destroy(){var t;(t=this.state)!=null&&t.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)}}const Hk=new D.PluginKey("SideMenuPlugin"),hs=z(({editor:e})=>{let t;const n=Tn(void 0);return{key:"sideMenu",store:n,prosemirrorPlugins:[new D.Plugin({key:Hk,view:r=>(t=new Uk(e,r,i=>{n.setState({...i})}),t)})],blockDragStart(r,i){t&&(t.isDragOrigin=!0),Pk(r,i,e)},blockDragEnd(){qh(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)}}});let be;function Ec(e){be||(be=document.createElement("div"),be.innerHTML="_",be.style.opacity="0",be.style.height="1px",be.style.width="1px",e instanceof Document?e.body.appendChild(be):e.appendChild(be))}function Fk(e){be&&(e instanceof Document?e.body.removeChild(be):e.removeChild(be),be=void 0)}function Lr(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}function Vk(e){let t=e;for(;t&&t.nodeName!=="TD"&&t.nodeName!=="TH"&&!t.classList.contains("tableWrapper");){if(t.classList.contains("ProseMirror"))return;const 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 Yk(e,t){const n=t.querySelectorAll(e);for(let r=0;r<n.length;r++)n[r].style.visibility="hidden"}class zk{constructor(t,n,r){Y(this,"state"),Y(this,"emitUpdate"),Y(this,"tableId"),Y(this,"tablePos"),Y(this,"tableElement"),Y(this,"menuFrozen",!1),Y(this,"mouseState","up"),Y(this,"prevWasEditable",null),Y(this,"viewMousedownHandler",()=>{this.mouseState="down"}),Y(this,"mouseUpHandler",i=>{this.mouseState="up",this.mouseMoveHandler(i)}),Y(this,"mouseMoveHandler",i=>{var s,o,a,u,c,h,d;if(this.menuFrozen||this.mouseState==="selecting"||!(i.target instanceof Element)||!this.pmView.dom.contains(i.target))return;const f=Vk(i.target);if((f==null?void 0:f.type)==="cell"&&this.mouseState==="down"&&!((s=this.state)!=null&&s.draggingState)){this.mouseState="selecting",(o=this.state)!=null&&o.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!f||!this.editor.isEditable){(a=this.state)!=null&&a.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!f.tbodyNode)return;const p=f.tbodyNode.getBoundingClientRect(),m=jh(f.domNode,this.pmView);if(!m)return;this.tableElement=m.node;let T;const _=this.editor.transact(I=>$l(m.id,I.doc));if(!_)throw new Error(`Block with ID ${m.id} not found`);const C=sn(_.node,this.editor.pmSchema,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema);if(ib(this.editor,"table")&&(this.tablePos=_.posBeforeNode+1,T=C),!T)return;this.tableId=m.id;const x=(u=f.domNode.closest(".tableWrapper"))==null?void 0:u.querySelector(".table-widgets-container");if((f==null?void 0:f.type)==="wrapper"){const I=i.clientY>=p.bottom-1&&i.clientY<p.bottom+20,R=i.clientX>=p.right-1&&i.clientX<p.right+20,V=i.clientX>p.right||i.clientY>p.bottom;this.state={...this.state,show:!0,showAddOrRemoveRowsButton:I,showAddOrRemoveColumnsButton:R,referencePosTable:p,block:T,widgetContainer:x,colIndex:V||(c=this.state)==null?void 0:c.colIndex,rowIndex:V||(h=this.state)==null?void 0:h.rowIndex,referencePosCell:V||(d=this.state)==null?void 0:d.referencePosCell}}else{const I=Lr(f.domNode),R=Lr(f.domNode.parentElement),V=f.domNode.getBoundingClientRect();if(this.state!==void 0&&this.state.show&&this.tableId===m.id&&this.state.rowIndex===R&&this.state.colIndex===I)return;this.state={show:!0,showAddOrRemoveColumnsButton:I===T.content.rows[0].cells.length-1,showAddOrRemoveRowsButton:R===T.content.rows.length-1,referencePosTable:p,block:T,draggingState:void 0,referencePosCell:V,colIndex:I,rowIndex:R,widgetContainer:x}}return this.emitUpdate(),!1}),Y(this,"dragOverHandler",i=>{var s;if(((s=this.state)==null?void 0:s.draggingState)===void 0)return;i.preventDefault(),i.dataTransfer.dropEffect="move",Yk(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",this.pmView.root);const o={left:Math.min(Math.max(i.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(i.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},a=this.pmView.root.elementsFromPoint(o.left,o.top).filter(T=>T.tagName==="TD"||T.tagName==="TH");if(a.length===0)return;const u=a[0];let c=!1;const h=Lr(u.parentElement),d=Lr(u),f=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,p=(this.state.draggingState.draggedCellOrientation==="row"?h:d)!==f;(this.state.rowIndex!==h||this.state.colIndex!==d)&&(this.state.rowIndex=h,this.state.colIndex=d,this.state.referencePosCell=u.getBoundingClientRect(),c=!0);const m=this.state.draggingState.draggedCellOrientation==="row"?o.top:o.left;this.state.draggingState.mousePos!==m&&(this.state.draggingState.mousePos=m,c=!0),c&&this.emitUpdate(),p&&this.editor.transact(T=>T.setMeta(Nn,!0))}),Y(this,"dropHandler",i=>{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 new Error("Attempted to drop table row or column, but no table block was hovered prior.");i.preventDefault();const{draggingState:s,colIndex:o,rowIndex:a}=this.state,u=this.state.block.content.columnWidths;if(s.draggedCellOrientation==="row"){if(!Lc(this.state.block,s.originalIndex,a))return!1;const c=Ff(this.state.block,s.originalIndex,a);this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,rows:c}})}else{if(!Dc(this.state.block,s.originalIndex,o))return!1;const c=Hf(this.state.block,s.originalIndex,o),[h]=u.splice(s.originalIndex,1);u.splice(o,0,h),this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,columnWidths:u,rows:c}})}return this.editor.setTextCursorPosition(this.state.block.id),!0}),this.editor=t,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw new 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)}update(){var t;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"||!((t=this.tableElement)!=null&&t.isConnected)){this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate();return}const{height:n,width:r}=io(this.state.block);this.state.rowIndex!==void 0&&this.state.colIndex!==void 0&&(this.state.rowIndex>=n&&(this.state.rowIndex=n-1),this.state.colIndex>=r&&(this.state.colIndex=r-1));const i=this.tableElement.querySelector("tbody");if(!i)throw new 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){const s=i.children[this.state.rowIndex].children[this.state.colIndex];s?this.state.referencePosCell=s.getBoundingClientRect():(this.state.rowIndex=void 0,this.state.colIndex=void 0)}this.state.referencePosTable=i.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)}}const Nn=new D.PluginKey("TableHandlesPlugin");z(({editor:e})=>{let t;const n=Tn(void 0);return{key:"tableHandles",store:n,prosemirrorPlugins:[new D.Plugin({key:Nn,view:r=>(t=new zk(e,r,i=>{n.setState({...i,draggingState:i.draggingState?{...i.draggingState}:void 0})}),t),props:{decorations:r=>{if(t===void 0||t.state===void 0||t.state.draggingState===void 0||t.tablePos===void 0)return;const i=t.state.draggingState.draggedCellOrientation==="row"?t.state.rowIndex:t.state.colIndex;if(i===void 0)return;const s=[],{block:o,draggingState:a}=t.state,{originalIndex:u,draggedCellOrientation:c}=a;if(i===u||!o||c==="row"&&!Lc(o,u,i)||c==="col"&&!Dc(o,u,i))return K.DecorationSet.create(r.doc,s);const h=r.doc.resolve(t.tablePos+1);return t.state.draggingState.draggedCellOrientation==="row"?gs(t.state.block,i).forEach(({row:d,col:f})=>{const p=r.doc.resolve(h.posAtIndex(d)+1),m=r.doc.resolve(p.posAtIndex(f)+1),T=m.node(),_=m.pos+(i>u?T.nodeSize-2:0);s.push(K.Decoration.widget(_,()=>{const C=document.createElement("div");return C.className="bn-table-drop-cursor",C.style.left="0",C.style.right="0",i>u?C.style.bottom="-2px":C.style.top="-3px",C.style.height="4px",C}))}):bs(t.state.block,i).forEach(({row:d,col:f})=>{const p=r.doc.resolve(h.posAtIndex(d)+1),m=r.doc.resolve(p.posAtIndex(f)+1),T=m.node(),_=m.pos+(i>u?T.nodeSize-2:0);s.push(K.Decoration.widget(_,()=>{const C=document.createElement("div");return C.className="bn-table-drop-cursor",C.style.top="0",C.style.bottom="0",i>u?C.style.right="-2px":C.style.left="-3px",C.style.width="4px",C}))}),K.DecorationSet.create(r.doc,s)}}})],colDragStart(r){if(t===void 0||t.state===void 0||t.state.colIndex===void 0)throw new 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(i=>i.setMeta(Nn,{draggedCellOrientation:t.state.draggingState.draggedCellOrientation,originalIndex:t.state.colIndex,newIndex:t.state.colIndex,tablePos:t.tablePos})),!e.headless&&(Ec(e.prosemirrorView.root),r.dataTransfer.setDragImage(be,0,0),r.dataTransfer.effectAllowed="move")},rowDragStart(r){if(t.state===void 0||t.state.rowIndex===void 0)throw new 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(i=>i.setMeta(Nn,{draggedCellOrientation:t.state.draggingState.draggedCellOrientation,originalIndex:t.state.rowIndex,newIndex:t.state.rowIndex,tablePos:t.tablePos})),!e.headless&&(Ec(e.prosemirrorView.root),r.dataTransfer.setDragImage(be,0,0),r.dataTransfer.effectAllowed="copyMove")},dragEnd(){if(t.state===void 0)throw new 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(Nn,null)),!e.headless&&Fk(e.prosemirrorView.root)},freezeHandles(){t.menuFrozen=!0},unfreezeHandles(){t.menuFrozen=!1},getCellsAtRowHandle(r,i){return gs(r,i)},getCellsAtColumnHandle(r,i){return bs(r,i)},setCellSelection(r,i,s=i){if(!t)throw new Error("Table handles view not initialized");const o=r.doc.resolve(t.tablePos+1),a=r.doc.resolve(o.posAtIndex(i.row)+1),u=r.doc.resolve(a.posAtIndex(i.col)),c=r.doc.resolve(o.posAtIndex(s.row)+1),h=r.doc.resolve(c.posAtIndex(s.col)),d=r.tr;return d.setSelection(new oe.CellSelection(u,h)),r.apply(d)},addRowOrColumn(r,i){e.exec((s,o)=>{const a=this.setCellSelection(s,i.orientation==="row"?{row:r,col:0}:{row:0,col:r});return i.orientation==="row"?i.side==="above"?oe.addRowBefore(a,o):oe.addRowAfter(a,o):i.side==="left"?oe.addColumnBefore(a,o):oe.addColumnAfter(a,o)})},removeRowOrColumn(r,i){return i==="row"?e.exec((s,o)=>{const a=this.setCellSelection(s,{row:r,col:0});return oe.deleteRow(a,o)}):e.exec((s,o)=>{const a=this.setCellSelection(s,{row:0,col:r});return oe.deleteColumn(a,o)})},mergeCells(r){return e.exec((i,s)=>{const o=r?this.setCellSelection(i,r.relativeStartCell,r.relativeEndCell):i;return oe.mergeCells(o,s)})},splitCell(r){return e.exec((i,s)=>{const o=r?this.setCellSelection(i,r):i;return oe.splitCell(o,s)})},getCellSelection(){return e.transact(r=>{const i=r.selection;let s=i.$from,o=i.$to;if(Za(i)){const{ranges:T}=i;T.forEach(_=>{s=_.$from.min(s??_.$from),o=_.$to.max(o??_.$to)})}else if(s=r.doc.resolve(i.$from.pos-i.$from.parentOffset-1),o=r.doc.resolve(i.$to.pos-i.$to.parentOffset-1),s.pos===0||o.pos===0)return;const a=r.doc.resolve(s.pos-s.parentOffset-1),u=r.doc.resolve(o.pos-o.parentOffset-1),c=r.doc.resolve(a.pos-a.parentOffset-1),h=s.index(a.depth),d=a.index(c.depth),f=o.index(u.depth),p=u.index(c.depth),m=[];for(let T=d;T<=p;T++)for(let _=h;_<=f;_++)m.push({row:T,col:_});return{from:{row:d,col:h},to:{row:p,col:f},cells:m}})},getMergeDirection(r){return e.transact(i=>{const s=Za(i.selection)?i.selection:void 0;if(!s||!r||s.ranges.length<=1)return;const o=this.getCellSelection();if(o)return zf(o.from,o.to,r)?"vertical":"horizontal"})},cropEmptyRowsOrColumns(r,i){return Vf(r,i)},addRowsOrColumns(r,i,s){return Yf(r,i,s)}}});const Tc=new D.PluginKey("trailingNode");z(()=>({key:"trailingNode",prosemirrorPlugins:[new D.Plugin({key:Tc,appendTransaction:(e,t,n)=>{const{doc:r,tr:i,schema:s}=n,o=Tc.getState(n),a=r.content.size-2,u=s.nodes.blockContainer,c=s.nodes.paragraph;if(o)return i.insert(a,u.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 new Error("Expected blockGroup");if(n=n.lastChild,!n||n.type.name!=="blockContainer")return!0;const r=n.firstChild;if(!r)throw new Error("Expected blockContent");return n.nodeSize>4||r.type.spec.content!=="inline*"}}})]}));const lt=new D.PluginKey("ColumnResizePlugin");class $k{constructor(t,n){de(this,"editor");de(this,"view");de(this,"RESIZE_MARGIN_WIDTH_PX",20);de(this,"COLUMN_MIN_WIDTH_PERCENT",.5);de(this,"getColumnHoverOrDefaultState",t=>{if(!this.editor.isEditable)return{type:"default"};const n=t.target;if(!this.view.dom.contains(n))return{type:"default"};const r=n.closest(".bn-block-column");if(!r)return{type:"default"};const i=t.clientX,s=r.getBoundingClientRect(),o=i<s.left+this.RESIZE_MARGIN_WIDTH_PX?"left":i>s.right-this.RESIZE_MARGIN_WIDTH_PX?"right":"none",a=o==="left"?r.previousElementSibling:o==="right"?r.nextElementSibling:void 0;if(!a)return{type:"default"};const u=o==="left"?a:r,c=o==="left"?r:a,h=u.getAttribute("data-id"),d=c.getAttribute("data-id"),f=Pe.getNodeById(h,this.view.state.doc),p=Pe.getNodeById(d,this.view.state.doc);if(!f||!p||!f.posBeforeNode)throw new Error("Column not found");return{type:"hover",leftColumn:{element:u,id:h,...f},rightColumn:{element:c,id:d,...p}}});de(this,"mouseDownHandler",t=>{var u;let n=this.getColumnHoverOrDefaultState(t);if(n.type==="default")return;t.preventDefault();const r=t.clientX,i=n.leftColumn.element.getBoundingClientRect().width,s=n.rightColumn.element.getBoundingClientRect().width,o=n.leftColumn.node.attrs.width,a=n.rightColumn.node.attrs.width;n={type:"resize",startPos:r,leftColumn:{...n.leftColumn,widthPx:i,widthPercent:o},rightColumn:{...n.rightColumn,widthPx:s,widthPercent:a}},this.view.dispatch(this.view.state.tr.setMeta(lt,n)),(u=this.editor.getExtension(hs))==null||u.freezeMenu()});de(this,"mouseMoveHandler",t=>{var u,c;const n=lt.getState(this.view.state);if(!n)return;if(n.type!=="resize"){const h=this.getColumnHoverOrDefaultState(t),d=n.type==="default"&&h.type==="default",f=n.type!=="default"&&h.type!=="default"&&n.leftColumn.id===h.leftColumn.id&&n.rightColumn.id===h.rightColumn.id;if(d||f||h.type==="hover"&&((c=(u=this.editor.getExtension(hs))==null?void 0:u.store.state)!=null&&c.show))return;this.view.dispatch(this.view.state.tr.setMeta(lt,h));return}const i=(t.clientX-n.startPos)*n.leftColumn.widthPercent,s=(n.leftColumn.widthPx+i)/n.leftColumn.widthPx-1;let o=n.leftColumn.widthPercent+s,a=n.rightColumn.widthPercent-s;o<this.COLUMN_MIN_WIDTH_PERCENT?(a-=this.COLUMN_MIN_WIDTH_PERCENT-o,o=this.COLUMN_MIN_WIDTH_PERCENT):a<this.COLUMN_MIN_WIDTH_PERCENT&&(o-=this.COLUMN_MIN_WIDTH_PERCENT-a,a=this.COLUMN_MIN_WIDTH_PERCENT),this.view.dispatch(this.view.state.tr.setNodeAttribute(n.leftColumn.posBeforeNode,"width",o).setNodeAttribute(n.rightColumn.posBeforeNode,"width",a).setMeta("addToHistory",!1))});de(this,"mouseUpHandler",t=>{var i;const n=lt.getState(this.view.state);if(!n||n.type!=="resize")return;const r=this.getColumnHoverOrDefaultState(t);this.view.dispatch(this.view.state.tr.setMeta(lt,r)),(i=this.editor.getExtension(hs))==null||i.unfreezeMenu()});this.editor=t,this.view=n,this.view.dom.addEventListener("mousedown",this.mouseDownHandler),document.body.addEventListener("mousemove",this.mouseMoveHandler),document.body.addEventListener("mouseup",this.mouseUpHandler)}destroy(){this.view.dom.removeEventListener("mousedown",this.mouseDownHandler),document.body.removeEventListener("mousemove",this.mouseMoveHandler),document.body.removeEventListener("mouseup",this.mouseUpHandler)}}const Wk=e=>new D.Plugin({key:lt,props:{decorations:t=>{const n=lt.getState(t);return!n||n.type==="default"?K.DecorationSet.empty:K.DecorationSet.create(t.doc,[K.Decoration.node(n.leftColumn.posBeforeNode,n.leftColumn.posBeforeNode+n.leftColumn.node.nodeSize,{style:"box-shadow: 4px 0 0 #ccc; cursor: col-resize"}),K.Decoration.node(n.rightColumn.posBeforeNode,n.rightColumn.posBeforeNode+n.rightColumn.node.nodeSize,{style:"cursor: col-resize"})])}},state:{init:()=>({type:"default"}),apply:(t,n)=>{const r=t.getMeta(lt);return r===void 0?n:r}},view:t=>new $k(e,t)}),jk=e=>L.Extension.create({name:"columnResize",addProseMirrorPlugins(){return[Wk(e)]}}),qk=L.Node.create({name:"column",group:"bnBlock childContainer",content:"blockContainer+",priority:40,defining:!0,marks:"deletion insertion modification",addAttributes(){return{width:{default:1,parseHTML:e=>{const t=e.getAttribute("data-width");if(t===null)return null;const n=parseFloat(t);return isFinite(n)?n:null},renderHTML:e=>({"data-width":e.width.toString(),style:`flex-grow: ${e.width};`})}}},parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:e}){const t=document.createElement("div");t.className="bn-block-column",t.setAttribute("data-node-type",this.name);for(const[n,r]of Object.entries(e))t.setAttribute(n,r);return{dom:t,contentDOM:t}},addExtensions(){return[jk(this.options.editor)]}}),Gk=L.Node.create({name:"columnList",group:"childContainer bnBlock blockGroupChild",content:"column column+",priority:40,defining:!0,marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:e}){const t=document.createElement("div");t.className="bn-block-column-list",t.setAttribute("data-node-type",this.name);for(const[n,r]of Object.entries(e))t.setAttribute(n,r);return t.style.display="flex",{dom:t,contentDOM:t}}}),na=Pe.createBlockSpecFromTiptapNode({node:qk,type:"column",content:"none"},{width:{default:1}}),ra=Pe.createBlockSpecFromTiptapNode({node:Gk,type:"columnList",content:"none"},{}),Qs=Pe.BlockNoteSchema.create({blockSpecs:{column:na,columnList:ra}}),Kk=e=>e.extend({blockSpecs:{column:na,columnList:ra}}),oi=.1;function Xk(e){return{left:e.clientX,top:e.clientY}}function Qk(e){const t=e.editor;return new D.Plugin({view(n){return new Jk(n,e)},props:{handleDrop(n,r,i,s){const o=n.posAtCoords(Xk(r));if(!o)throw new Error("Could not get event position");const a=Gh(n.state,o),u=Pe.getBlockInfo(a),h=n.nodeDOM(a.posBeforeNode).getBoundingClientRect();let d="regular";if(r.clientX<=h.left+h.width*oi&&(d="left"),r.clientX>=h.right-h.width*oi&&(d="right"),d==="regular")return!1;const f=Pe.nodeToBlock(i.content.child(0),t.pmSchema);if(u.blockNoteType==="column"){const p=n.state.doc.resolve(u.bnBlock.beforePos).node(),m=Pe.nodeToBlock(p,t.pmSchema);let T=0;m.children.forEach(I=>{T+=I.props.width});const _=T/m.children.length;if(_<.99||_>1.01){const I=1/_;m.children.forEach(R=>{R.props.width=R.props.width*I})}const C=m.children.findIndex(I=>I.id===u.bnBlock.node.attrs.id),x=m.children.map(I=>({...I,children:I.children.filter(R=>R.id!==f.id)})).filter(I=>I.children.length>0).toSpliced(d==="left"?C:C+1,0,{type:"column",children:[f],props:{},content:void 0,id:Pe.UniqueID.options.generateID()});t.getBlock(f.id)&&t.removeBlocks([f]),t.updateBlock(m,{children:x})}else{const p=Pe.nodeToBlock(u.bnBlock.node,t.pmSchema);if(p.id===f.id)return;const m=d==="left"?[f,p]:[p,f];t.getBlock(f.id)&&t.removeBlocks([f]),t.replaceBlocks([p],[{type:"columnList",children:m.map(T=>({type:"column",children:[T]}))}])}return!0}}})}class Jk{constructor(t,n){de(this,"width");de(this,"color");de(this,"class");de(this,"cursorPos");de(this,"element",null);de(this,"timeout");de(this,"handlers");this.editorView=t,this.width=n.width??1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{const i=s=>{this[r](s)};return t.dom.addEventListener(r,i,r==="drop"?!0:void 0),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n,t==="drop"?!0:void 0))}update(t,n){this.cursorPos!=null&&n.doc!==t.state.doc&&(this.cursorPos.pos>t.state.doc.content.size?this.setCursor(void 0):this.updateOverlay())}setCursor(t){var n,r;t===this.cursorPos||(t==null?void 0:t.pos)===((n=this.cursorPos)==null?void 0:n.pos)&&(t==null?void 0:t.position)===((r=this.cursorPos)==null?void 0:r.position)||(this.cursorPos=t,t?this.updateOverlay():(this.element.parentNode.removeChild(this.element),this.element=null))}updateOverlay(){if(!this.cursorPos)throw new Error("updateOverlay called with no cursor position");const t=this.editorView.state.doc.resolve(this.cursorPos.pos),n=!t.parent.inlineContent;let r;const i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){const d=t.nodeBefore,f=t.nodeAfter;if(d||f)if(this.cursorPos.position==="left"||this.cursorPos.position==="right"){const p=this.editorView.nodeDOM(this.cursorPos.pos);if(!p)throw new Error("nodeDOM returned null in updateOverlay");const m=p.getBoundingClientRect(),T=this.width/2*a,_=this.cursorPos.position==="left"?m.left:m.right;r={left:_-T,right:_+T,top:m.top,bottom:m.bottom}}else{const p=this.editorView.nodeDOM(this.cursorPos.pos-(d?d.nodeSize:0));if(p){const m=p.getBoundingClientRect();let T=d?m.bottom:m.top;d&&f&&(T=(T+this.editorView.nodeDOM(this.cursorPos.pos).getBoundingClientRect().top)/2);const _=this.width/2*a;this.cursorPos.position==="regular"&&(r={left:m.left,right:m.right,top:T-_,bottom:T+_})}}}if(!r){const d=this.editorView.coordsAtPos(this.cursorPos.pos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}const u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-vertical",this.cursorPos.position!=="regular"),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,h;if(!u||u===document.body&&getComputedStyle(u).position==="static")c=-window.scrollX,h=-window.scrollY;else{const d=u.getBoundingClientRect(),f=d.width/u.offsetWidth,p=d.height/u.offsetHeight;c=d.left-u.scrollLeft*f,h=d.top-u.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-h)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(void 0),t)}dragover(t){if(!this.editorView.editable)return;const n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,t):i;if(n&&!s){let o="regular",a=n.pos;const u=Gh(this.editorView.state,n),h=this.editorView.nodeDOM(u.posBeforeNode).getBoundingClientRect();if(t.clientX<=h.left+h.width*oi&&(o="left",a=u.posBeforeNode),t.clientX>=h.right-h.width*oi&&(o="right",a=u.posBeforeNode),o==="regular"&&this.editorView.dragging&&this.editorView.dragging.slice){const d=Js.dropPoint(this.editorView.state.doc,a,this.editorView.dragging.slice);d!=null&&(a=d)}this.setCursor({pos:a,position:o}),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.setCursor(void 0)}dragleave(t){(t.target===this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(void 0)}}function Gh(e,t){const n=Pe.getNearestBlockPos(e.doc,t.pos);let r=e.doc.resolve(n.posBeforeNode);return r.parent.type.name==="column"&&(r=e.doc.resolve(r.before())),{posBeforeNode:r.pos,node:r.nodeAfter}}var Kh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Cc=xt.default.createContext&&xt.default.createContext(Kh),Zk=["attr","size","title"];function ew(e,t){if(e==null)return{};var n=tw(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tw(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 ai(){return ai=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},ai.apply(this,arguments)}function yc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ui(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yc(Object(n),!0).forEach(function(r){nw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nw(e,t,n){return t=rw(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rw(e){var t=iw(e,"string");return typeof t=="symbol"?t:t+""}function iw(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 Xh(e){return e&&e.map((t,n)=>xt.default.createElement(t.tag,ui({key:n},t.attr),Xh(t.child)))}function Qh(e){return t=>xt.default.createElement(sw,ai({attr:ui({},e.attr)},t),Xh(e.child))}function sw(e){var t=n=>{var{attr:r,size:i,title:s}=e,o=ew(e,Zk),a=i||n.size||"1em",u;return n.className&&(u=n.className),e.className&&(u=(u?u+" ":"")+e.className),xt.default.createElement("svg",ai({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:u,style:ui(ui({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&xt.default.createElement("title",null,s),e.children)};return Cc!==void 0?xt.default.createElement(Cc.Consumer,null,n=>t(n)):t(Kh)}function ow(e){return Qh({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18"},child:[]}]})(e)}function aw(e){return Qh({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm6 -1v18m6 -18v18"},child:[]}]})(e)}function Jh(e){return"column"in e.schema.blockSchema&&e.schema.blockSchema.columnList===Qs.blockSchema.columnList&&"column"in e.schema.blockSchema&&e.schema.blockSchema.column===Qs.blockSchema.column}function uw(e){const t=[];return Jh(e)&&t.push({...fs(e).slash_menu.two_columns,icon:aa.jsx(ow,{size:18}),onItemClick:()=>{eu(e,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}},{...fs(e).slash_menu.three_columns,icon:aa.jsx(aw,{size:18}),onItemClick:()=>{eu(e,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}}),t}exports.ColumnBlock=na;exports.ColumnListBlock=ra;exports.checkMultiColumnBlocksInSchema=Jh;exports.getMultiColumnDictionary=fs;exports.getMultiColumnSlashMenuItems=uw;exports.locales=Af;exports.multiColumnDropCursor=Qk;exports.multiColumnSchema=Qs;exports.withMultiColumn=Kk;
|
|
1
|
+
"use strict";var U=Object.defineProperty;var q=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var p=(o,e,t)=>q(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@tiptap/core"),b=require("@blocknote/core"),k=require("@blocknote/core/extensions"),M=require("prosemirror-state"),P=require("prosemirror-view"),G=require("prosemirror-transform"),L=require("react/jsx-runtime"),K=require("react"),F=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},y=F(K),Y={slash_menu:{two_columns:{title:"عمودان",subtext:"عمودان جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"},three_columns:{title:"ثلاثة أعمدة",subtext:"ثلاثة أعمدة جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"}}},Z={slash_menu:{two_columns:{title:"Zwei Spalten",subtext:"Zwei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende Blöcke"},three_columns:{title:"Drei Spalten",subtext:"Drei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende Blöcke"}}},$={slash_menu:{two_columns:{title:"Two Columns",subtext:"Two columns side by side",aliases:["columns","row","split"],group:"Basic blocks"},three_columns:{title:"Three Columns",subtext:"Three columns side by side",aliases:["columns","row","split"],group:"Basic blocks"}}},J={slash_menu:{two_columns:{title:"Dos Columnas",subtext:"Dos columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"},three_columns:{title:"Tres Columnas",subtext:"Tres columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"}}},Q={slash_menu:{two_columns:{title:"Deux Colonnes",subtext:"Deux colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"},three_columns:{title:"Trois Colonnes",subtext:"Trois colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"}}},ee={slash_menu:{two_columns:{title:"Dva Stupca",subtext:"Dva stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"},three_columns:{title:"Tri Stupca",subtext:"Tri stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"}}},te={slash_menu:{two_columns:{title:"Tvær Dálkar",subtext:"Tvær dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"},three_columns:{title:"Þrír Dálkar",subtext:"Þrír dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"}}},oe={slash_menu:{two_columns:{title:"二列",subtext:"二列並んで",aliases:["列","行","分割"],group:"基本ブロック"},three_columns:{title:"三列",subtext:"三列並んで",aliases:["列","行","分割"],group:"基本ブロック"}}},ne={slash_menu:{two_columns:{title:"두 열",subtext:"두 열 나란히",aliases:["열","행","분할"],group:"기본 블록"},three_columns:{title:"세 열",subtext:"세 열 나란히",aliases:["열","행","분할"],group:"기본 블록"}}},ie={slash_menu:{two_columns:{title:"Twee Kolommen",subtext:"Twee kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"},three_columns:{title:"Drie Kolommen",subtext:"Drie kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"}}},se={slash_menu:{two_columns:{title:"Dwie Kolumny",subtext:"Dwie kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"},three_columns:{title:"Trzy Kolumny",subtext:"Trzy kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"}}},re={slash_menu:{two_columns:{title:"Duas Colunas",subtext:"Duas colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"},three_columns:{title:"Três Colunas",subtext:"Três colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"}}},le={slash_menu:{two_columns:{title:"Два Столбца",subtext:"Два столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"},three_columns:{title:"Три Столбца",subtext:"Три столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"}}},ce={slash_menu:{two_columns:{title:"Hai Cột",subtext:"Hai cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"},three_columns:{title:"Ba Cột",subtext:"Ba cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"}}},ue={slash_menu:{two_columns:{title:"两列",subtext:"两列并排",aliases:["列","行","分割"],group:"基础"},three_columns:{title:"三列",subtext:"三列并排",aliases:["列","行","分割"],group:"基础"}}},ae=Object.freeze(Object.defineProperty({__proto__:null,ar:Y,de:Z,en:$,es:J,fr:Q,hr:ee,is:te,ja:oe,ko:ne,nl:ie,pl:se,pt:re,ru:le,vi:ce,zh:ue},Symbol.toStringTag,{value:"Module"}));function B(o){if(!o.dictionary.multi_column)throw new Error("Multi-column dictionary not found");return o.dictionary.multi_column}const v=new M.PluginKey("ColumnResizePlugin");class de{constructor(e,t){p(this,"editor");p(this,"view");p(this,"RESIZE_MARGIN_WIDTH_PX",20);p(this,"COLUMN_MIN_WIDTH_PERCENT",.5);p(this,"getColumnHoverOrDefaultState",e=>{if(!this.editor.isEditable)return{type:"default"};const t=e.target;if(!this.view.dom.contains(t))return{type:"default"};const n=t.closest(".bn-block-column");if(!n)return{type:"default"};const s=e.clientX,d=n.getBoundingClientRect(),c=s<d.left+this.RESIZE_MARGIN_WIDTH_PX?"left":s>d.right-this.RESIZE_MARGIN_WIDTH_PX?"right":"none",l=c==="left"?n.previousElementSibling:c==="right"?n.nextElementSibling:void 0;if(!l)return{type:"default"};const i=c==="left"?l:n,g=c==="left"?n:l,u=i.getAttribute("data-id"),r=g.getAttribute("data-id"),a=b.getNodeById(u,this.view.state.doc),m=b.getNodeById(r,this.view.state.doc);if(!a||!m||!a.posBeforeNode)throw new Error("Column not found");return{type:"hover",leftColumn:{element:i,id:u,...a},rightColumn:{element:g,id:r,...m}}});p(this,"mouseDownHandler",e=>{var i;let t=this.getColumnHoverOrDefaultState(e);if(t.type==="default")return;e.preventDefault();const n=e.clientX,s=t.leftColumn.element.getBoundingClientRect().width,d=t.rightColumn.element.getBoundingClientRect().width,c=t.leftColumn.node.attrs.width,l=t.rightColumn.node.attrs.width;t={type:"resize",startPos:n,leftColumn:{...t.leftColumn,widthPx:s,widthPercent:c},rightColumn:{...t.rightColumn,widthPx:d,widthPercent:l}},this.view.dispatch(this.view.state.tr.setMeta(v,t)),(i=this.editor.getExtension(k.SideMenuExtension))==null||i.freezeMenu()});p(this,"mouseMoveHandler",e=>{var i,g;const t=v.getState(this.view.state);if(!t)return;if(t.type!=="resize"){const u=this.getColumnHoverOrDefaultState(e),r=t.type==="default"&&u.type==="default",a=t.type!=="default"&&u.type!=="default"&&t.leftColumn.id===u.leftColumn.id&&t.rightColumn.id===u.rightColumn.id;if(r||a||u.type==="hover"&&((g=(i=this.editor.getExtension(k.SideMenuExtension))==null?void 0:i.store.state)!=null&&g.show))return;this.view.dispatch(this.view.state.tr.setMeta(v,u));return}const s=(e.clientX-t.startPos)*t.leftColumn.widthPercent,d=(t.leftColumn.widthPx+s)/t.leftColumn.widthPx-1;let c=t.leftColumn.widthPercent+d,l=t.rightColumn.widthPercent-d;c<this.COLUMN_MIN_WIDTH_PERCENT?(l-=this.COLUMN_MIN_WIDTH_PERCENT-c,c=this.COLUMN_MIN_WIDTH_PERCENT):l<this.COLUMN_MIN_WIDTH_PERCENT&&(c-=this.COLUMN_MIN_WIDTH_PERCENT-l,l=this.COLUMN_MIN_WIDTH_PERCENT),this.view.dispatch(this.view.state.tr.setNodeAttribute(t.leftColumn.posBeforeNode,"width",c).setNodeAttribute(t.rightColumn.posBeforeNode,"width",l).setMeta("addToHistory",!1))});p(this,"mouseUpHandler",e=>{var s;const t=v.getState(this.view.state);if(!t||t.type!=="resize")return;const n=this.getColumnHoverOrDefaultState(e);this.view.dispatch(this.view.state.tr.setMeta(v,n)),(s=this.editor.getExtension(k.SideMenuExtension))==null||s.unfreezeMenu()});this.editor=e,this.view=t,this.view.dom.addEventListener("mousedown",this.mouseDownHandler),document.body.addEventListener("mousemove",this.mouseMoveHandler),document.body.addEventListener("mouseup",this.mouseUpHandler)}destroy(){this.view.dom.removeEventListener("mousedown",this.mouseDownHandler),document.body.removeEventListener("mousemove",this.mouseMoveHandler),document.body.removeEventListener("mouseup",this.mouseUpHandler)}}const he=o=>new M.Plugin({key:v,props:{decorations:e=>{const t=v.getState(e);return!t||t.type==="default"?P.DecorationSet.empty:P.DecorationSet.create(e.doc,[P.Decoration.node(t.leftColumn.posBeforeNode,t.leftColumn.posBeforeNode+t.leftColumn.node.nodeSize,{style:"box-shadow: 4px 0 0 #ccc; cursor: col-resize"}),P.Decoration.node(t.rightColumn.posBeforeNode,t.rightColumn.posBeforeNode+t.rightColumn.node.nodeSize,{style:"cursor: col-resize"})])}},state:{init:()=>({type:"default"}),apply:(e,t)=>{const n=e.getMeta(v);return n===void 0?t:n}},view:e=>new de(o,e)}),me=o=>O.Extension.create({name:"columnResize",addProseMirrorPlugins(){return[he(o)]}}),pe=O.Node.create({name:"column",group:"bnBlock childContainer",content:"blockContainer+",priority:40,defining:!0,marks:"deletion insertion modification",addAttributes(){return{width:{default:1,parseHTML:o=>{const e=o.getAttribute("data-width");if(e===null)return null;const t=parseFloat(e);return isFinite(t)?t:null},renderHTML:o=>({"data-width":o.width.toString(),style:`flex-grow: ${o.width};`})}}},parseHTML(){return[{tag:"div",getAttrs:o=>typeof o=="string"?!1:o.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:o}){const e=document.createElement("div");e.className="bn-block-column",e.setAttribute("data-node-type",this.name);for(const[t,n]of Object.entries(o))e.setAttribute(t,n);return{dom:e,contentDOM:e}},addExtensions(){return[me(this.options.editor)]}}),fe=O.Node.create({name:"columnList",group:"childContainer bnBlock blockGroupChild",content:"column column+",priority:40,defining:!0,marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:o=>typeof o=="string"?!1:o.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:o}){const e=document.createElement("div");e.className="bn-block-column-list",e.setAttribute("data-node-type",this.name);for(const[t,n]of Object.entries(o))e.setAttribute(t,n);return e.style.display="flex",{dom:e,contentDOM:e}}}),N=b.createBlockSpecFromTiptapNode({node:pe,type:"column",content:"none"},{width:{default:1}}),T=b.createBlockSpecFromTiptapNode({node:fe,type:"columnList",content:"none"},{}),D=b.BlockNoteSchema.create({blockSpecs:{column:N,columnList:T}}),ge=o=>o.extend({blockSpecs:{column:N,columnList:T}}),x=.1;function be(o){return{left:o.clientX,top:o.clientY}}function we(o){const e=o.editor;return new M.Plugin({view(t){return new Ce(t,o)},props:{handleDrop(t,n,s,d){const c=t.posAtCoords(be(n));if(!c)throw new Error("Could not get event position");const l=z(t.state,c),i=b.getBlockInfo(l),u=t.nodeDOM(l.posBeforeNode).getBoundingClientRect();let r="regular";if(n.clientX<=u.left+u.width*x&&(r="left"),n.clientX>=u.right-u.width*x&&(r="right"),r==="regular")return!1;const a=b.nodeToBlock(s.content.child(0),e.pmSchema);if(i.blockNoteType==="column"){const m=t.state.doc.resolve(i.bnBlock.beforePos).node(),h=b.nodeToBlock(m,e.pmSchema);let f=0;h.children.forEach(w=>{f+=w.props.width});const C=f/h.children.length;if(C<.99||C>1.01){const w=1/C;h.children.forEach(_=>{_.props.width=_.props.width*w})}const I=h.children.findIndex(w=>w.id===i.bnBlock.node.attrs.id),X=h.children.map(w=>({...w,children:w.children.filter(_=>_.id!==a.id)})).filter(w=>w.children.length>0).toSpliced(r==="left"?I:I+1,0,{type:"column",children:[a],props:{},content:void 0,id:b.UniqueID.options.generateID()});e.getBlock(a.id)&&e.removeBlocks([a]),e.updateBlock(h,{children:X})}else{const m=b.nodeToBlock(i.bnBlock.node,e.pmSchema);if(m.id===a.id)return;const h=r==="left"?[a,m]:[m,a];e.getBlock(a.id)&&e.removeBlocks([a]),e.replaceBlocks([m],[{type:"columnList",children:h.map(f=>({type:"column",children:[f]}))}])}return!0}}})}class Ce{constructor(e,t){p(this,"width");p(this,"color");p(this,"class");p(this,"cursorPos");p(this,"element",null);p(this,"timeout");p(this,"handlers");this.editorView=e,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(n=>{const s=d=>{this[n](d)};return e.dom.addEventListener(n,s,n==="drop"?!0:void 0),{name:n,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t,e==="drop"?!0:void 0))}update(e,t){this.cursorPos!=null&&t.doc!==e.state.doc&&(this.cursorPos.pos>e.state.doc.content.size?this.setCursor(void 0):this.updateOverlay())}setCursor(e){var t,n;e===this.cursorPos||(e==null?void 0:e.pos)===((t=this.cursorPos)==null?void 0:t.pos)&&(e==null?void 0:e.position)===((n=this.cursorPos)==null?void 0:n.position)||(this.cursorPos=e,e?this.updateOverlay():(this.element.parentNode.removeChild(this.element),this.element=null))}updateOverlay(){if(!this.cursorPos)throw new Error("updateOverlay called with no cursor position");const e=this.editorView.state.doc.resolve(this.cursorPos.pos),t=!e.parent.inlineContent;let n;const s=this.editorView.dom,d=s.getBoundingClientRect(),c=d.width/s.offsetWidth,l=d.height/s.offsetHeight;if(t){const r=e.nodeBefore,a=e.nodeAfter;if(r||a)if(this.cursorPos.position==="left"||this.cursorPos.position==="right"){const m=this.editorView.nodeDOM(this.cursorPos.pos);if(!m)throw new Error("nodeDOM returned null in updateOverlay");const h=m.getBoundingClientRect(),f=this.width/2*l,C=this.cursorPos.position==="left"?h.left:h.right;n={left:C-f,right:C+f,top:h.top,bottom:h.bottom}}else{const m=this.editorView.nodeDOM(this.cursorPos.pos-(r?r.nodeSize:0));if(m){const h=m.getBoundingClientRect();let f=r?h.bottom:h.top;r&&a&&(f=(f+this.editorView.nodeDOM(this.cursorPos.pos).getBoundingClientRect().top)/2);const C=this.width/2*l;this.cursorPos.position==="regular"&&(n={left:h.left,right:h.right,top:f-C,bottom:f+C})}}}if(!n){const r=this.editorView.coordsAtPos(this.cursorPos.pos),a=this.width/2*c;n={left:r.left-a,right:r.left+a,top:r.top,bottom:r.bottom}}const i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-vertical",this.cursorPos.position!=="regular"),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let g,u;if(!i||i===document.body&&getComputedStyle(i).position==="static")g=-window.scrollX,u=-window.scrollY;else{const r=i.getBoundingClientRect(),a=r.width/i.offsetWidth,m=r.height/i.offsetHeight;g=r.left-i.scrollLeft*a,u=r.top-i.scrollTop*m}this.element.style.left=(n.left-g)/c+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/c+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(void 0),e)}dragover(e){if(!this.editorView.editable)return;const t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=n&&n.type.spec.disableDropCursor,d=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!d){let c="regular",l=t.pos;const i=z(this.editorView.state,t),u=this.editorView.nodeDOM(i.posBeforeNode).getBoundingClientRect();if(e.clientX<=u.left+u.width*x&&(c="left",l=i.posBeforeNode),e.clientX>=u.right-u.width*x&&(c="right",l=i.posBeforeNode),c==="regular"&&this.editorView.dragging&&this.editorView.dragging.slice){const r=G.dropPoint(this.editorView.state.doc,l,this.editorView.dragging.slice);r!=null&&(l=r)}this.setCursor({pos:l,position:c}),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.setCursor(void 0)}dragleave(e){(e.target===this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(void 0)}}function z(o,e){const t=b.getNearestBlockPos(o.doc,e.pos);let n=o.doc.resolve(t.posBeforeNode);return n.parent.type.name==="column"&&(n=o.doc.resolve(n.before())),{posBeforeNode:n.pos,node:n.nodeAfter}}var H={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},R=y.default.createContext&&y.default.createContext(H),ve=["attr","size","title"];function ye(o,e){if(o==null)return{};var t=ke(o,e),n,s;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(o);for(s=0;s<d.length;s++)n=d[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(o,n)&&(t[n]=o[n])}return t}function ke(o,e){if(o==null)return{};var t={};for(var n in o)if(Object.prototype.hasOwnProperty.call(o,n)){if(e.indexOf(n)>=0)continue;t[n]=o[n]}return t}function S(){return S=Object.assign?Object.assign.bind():function(o){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},S.apply(this,arguments)}function j(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable})),t.push.apply(t,n)}return t}function E(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?j(Object(t),!0).forEach(function(n){_e(o,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(t,n))})}return o}function _e(o,e,t){return e=Pe(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Pe(o){var e=xe(o,"string");return typeof e=="symbol"?e:e+""}function xe(o,e){if(typeof o!="object"||!o)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var n=t.call(o,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function W(o){return o&&o.map((e,t)=>y.default.createElement(e.tag,E({key:t},e.attr),W(e.child)))}function A(o){return e=>y.default.createElement(Se,S({attr:E({},o.attr)},e),W(o.child))}function Se(o){var e=t=>{var{attr:n,size:s,title:d}=o,c=ye(o,ve),l=s||t.size||"1em",i;return t.className&&(i=t.className),o.className&&(i=(i?i+" ":"")+o.className),y.default.createElement("svg",S({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,c,{className:i,style:E(E({color:o.color||t.color},t.style),o.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),d&&y.default.createElement("title",null,d),o.children)};return R!==void 0?y.default.createElement(R.Consumer,null,t=>e(t)):e(H)}function Ee(o){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18"},child:[]}]})(o)}function Be(o){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm6 -1v18m6 -18v18"},child:[]}]})(o)}function V(o){return"column"in o.schema.blockSchema&&o.schema.blockSchema.columnList===D.blockSchema.columnList&&"column"in o.schema.blockSchema&&o.schema.blockSchema.column===D.blockSchema.column}function De(o){const e=[];return V(o)&&e.push({...B(o).slash_menu.two_columns,icon:L.jsx(Ee,{size:18}),onItemClick:()=>{k.insertOrUpdateBlockForSlashMenu(o,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}},{...B(o).slash_menu.three_columns,icon:L.jsx(Be,{size:18}),onItemClick:()=>{k.insertOrUpdateBlockForSlashMenu(o,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}}),e}exports.ColumnBlock=N;exports.ColumnListBlock=T;exports.checkMultiColumnBlocksInSchema=V;exports.getMultiColumnDictionary=B;exports.getMultiColumnSlashMenuItems=De;exports.locales=ae;exports.multiColumnDropCursor=we;exports.multiColumnSchema=D;exports.withMultiColumn=ge;
|
|
50
2
|
//# sourceMappingURL=blocknote-xl-multi-column.cjs.map
|