gp-designer 1.0.28 → 1.0.29

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.
@@ -10343,7 +10343,7 @@ const Wt = /* @__PURE__ */ ft(Pd, [["render", Fd], ["__scopeId", "data-v-68b8f27
10343
10343
  return;
10344
10344
  }
10345
10345
  if (s.value.type === z.Text) {
10346
- if (s.value.rule.minText > s.value.rule.maxText) {
10346
+ if (Number(s.value.rule.minText) > Number(s.value.rule.maxText)) {
10347
10347
  Z.error("最小文本长度不能大于最大文本长度");
10348
10348
  return;
10349
10349
  }
@@ -10353,7 +10353,7 @@ const Wt = /* @__PURE__ */ ft(Pd, [["render", Fd], ["__scopeId", "data-v-68b8f27
10353
10353
  }
10354
10354
  }
10355
10355
  if (s.value.type === z.Block) {
10356
- if (s.value.rule.minBlock > s.value.rule.maxBlock) {
10356
+ if (Number(s.value.rule.minBlock) > Number(s.value.rule.maxBlock)) {
10357
10357
  Z.error("最小块数量不能大于最大块数量");
10358
10358
  return;
10359
10359
  }
@@ -10511,7 +10511,7 @@ const Wt = /* @__PURE__ */ ft(Pd, [["render", Fd], ["__scopeId", "data-v-68b8f27
10511
10511
  }, " 保存 ")
10512
10512
  ]));
10513
10513
  }
10514
- }), tf = /* @__PURE__ */ ft(ef, [["__scopeId", "data-v-0d892d0b"]]);
10514
+ }), tf = /* @__PURE__ */ ft(ef, [["__scopeId", "data-v-7395db8a"]]);
10515
10515
  /*!
10516
10516
  * Cropper.js v1.6.2
10517
10517
  * https://fengyuanchen.github.io/cropperjs
@@ -5,7 +5,7 @@
5
5
  fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
6
6
  )`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"},ki={};function co(e,t){return e===H.falseFunc?H.falseFunc:a=>t.isTag(a)&&e(a)}function Mi(e,t){const a=t.getSiblings(e);if(a.length<=1)return[];const n=a.indexOf(e);return n<0||n===a.length-1?[]:a.slice(n+1).filter(t.isTag)}function on(e){return{xmlMode:!!e.xmlMode,lowerCaseAttributeNames:!!e.lowerCaseAttributeNames,lowerCaseTags:!!e.lowerCaseTags,quirksMode:!!e.quirksMode,cacheResults:!!e.cacheResults,pseudos:e.pseudos,adapter:e.adapter,equals:e.equals}}const cn=(e,t,a,n,i)=>{const r=i(t,on(a),n);return r===H.trueFunc?e:r===H.falseFunc?H.falseFunc:u=>r(u)&&e(u)},ln={is:cn,matches:cn,where:cn,not(e,t,a,n,i){const r=i(t,on(a),n);return r===H.falseFunc?e:r===H.trueFunc?H.falseFunc:u=>!r(u)&&e(u)},has(e,t,a,n,i){const{adapter:r}=a,u=on(a);u.relativeSelector=!0;const o=t.some(m=>m.some(sn))?[ki]:void 0,l=i(t,u,o);if(l===H.falseFunc)return H.falseFunc;const h=co(l,r);if(o&&l!==H.trueFunc){const{shouldTestNextSiblings:m=!1}=l;return p=>{if(!e(p))return!1;o[0]=p;const T=r.getChildren(p),N=m?[...T,...Mi(p,r)]:T;return r.existsOne(h,N)}}return m=>e(m)&&r.existsOne(h,r.getChildren(m))}};function lo(e,t,a,n,i){var r;const{name:u,data:o}=t;if(Array.isArray(o)){if(!(u in ln))throw new Error(`Unknown pseudo-class :${u}(${o})`);return ln[u](e,o,a,n,i)}const l=(r=a.pseudos)===null||r===void 0?void 0:r[u],h=typeof l=="string"?l:oo[u];if(typeof h=="string"){if(o!=null)throw new Error(`Pseudo ${u} doesn't have any arguments`);const m=Ea(h);return ln.is(e,m,a,n,i)}if(typeof l=="function")return Ri(l,u,o,1),m=>l(m,o)&&e(m);if(u in rn)return rn[u](e,o,a,n);if(u in yi){const m=yi[u];return Ri(m,u,o,2),p=>m(p,a,o)&&e(p)}throw new Error(`Unknown pseudo-class :${u}`)}function dn(e,t){const a=t.getParent(e);return a&&t.isTag(a)?a:null}function ho(e,t,a,n,i){const{adapter:r,equals:u}=a;switch(t.type){case k.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case k.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case k.Attribute:{if(t.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!a.xmlMode||a.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),no[t.action](e,t,a)}case k.Pseudo:return lo(e,t,a,n,i);case k.Tag:{if(t.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:o}=t;return(!a.xmlMode||a.lowerCaseTags)&&(o=o.toLowerCase()),function(h){return r.getName(h)===o&&e(h)}}case k.Descendant:{if(a.cacheResults===!1||typeof WeakSet>"u")return function(h){let m=h;for(;m=dn(m,r);)if(e(m))return!0;return!1};const o=new WeakSet;return function(h){let m=h;for(;m=dn(m,r);)if(!o.has(m)){if(r.isTag(m)&&e(m))return!0;o.add(m)}return!1}}case"_flexibleDescendant":return function(l){let h=l;do if(e(h))return!0;while(h=dn(h,r));return!1};case k.Parent:return function(l){return r.getChildren(l).some(h=>r.isTag(h)&&e(h))};case k.Child:return function(l){const h=r.getParent(l);return h!=null&&r.isTag(h)&&e(h)};case k.Sibling:return function(l){const h=r.getSiblings(l);for(let m=0;m<h.length;m++){const p=h[m];if(u(l,p))break;if(r.isTag(p)&&e(p))return!0}return!1};case k.Adjacent:return r.prevElementSibling?function(l){const h=r.prevElementSibling(l);return h!=null&&e(h)}:function(l){const h=r.getSiblings(l);let m;for(let p=0;p<h.length;p++){const T=h[p];if(u(l,T))break;r.isTag(T)&&(m=T)}return!!m&&e(m)};case k.Universal:{if(t.namespace!=null&&t.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return e}}}function Pi(e){return e.type===k.Pseudo&&(e.name==="scope"||Array.isArray(e.data)&&e.data.some(t=>t.some(Pi)))}const fo={type:k.Descendant},mo={type:"_flexibleDescendant"},Eo={type:k.Pseudo,name:"scope",data:null};function po(e,{adapter:t},a){const n=!!(a!=null&&a.every(i=>{const r=t.isTag(i)&&t.getParent(i);return i===ki||r&&t.isTag(r)}));for(const i of e){if(!(i.length>0&&sn(i[0])&&i[0].type!==k.Descendant))if(n&&!i.some(Pi))i.unshift(fo);else continue;i.unshift(Eo)}}function vi(e,t,a){var n;e.forEach(eo),a=(n=t.context)!==null&&n!==void 0?n:a;const i=Array.isArray(a),r=a&&(Array.isArray(a)?a:[a]);if(t.relativeSelector!==!1)po(e,t,r);else if(e.some(l=>l.length>0&&sn(l[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let u=!1;const o=e.map(l=>{if(l.length>=2){const[h,m]=l;h.type!==k.Pseudo||h.name!=="scope"||(i&&m.type===k.Descendant?l[1]=mo:(m.type===k.Adjacent||m.type===k.Sibling)&&(u=!0))}return To(l,t,r)}).reduce(bo,H.falseFunc);return o.shouldTestNextSiblings=u,o}function To(e,t,a){var n;return e.reduce((i,r)=>i===H.falseFunc?H.falseFunc:ho(i,r,t,a,vi),(n=t.rootFunc)!==null&&n!==void 0?n:H.trueFunc)}function bo(e,t){return t===H.falseFunc||e===H.trueFunc?e:e===H.falseFunc||t===H.trueFunc?t:function(n){return e(n)||t(n)}}const Bi=(e,t)=>e===t,go={adapter:ha,equals:Bi};function _o(e){var t,a,n,i;const r=e??go;return(t=r.adapter)!==null&&t!==void 0||(r.adapter=ha),(a=r.equals)!==null&&a!==void 0||(r.equals=(i=(n=r.adapter)===null||n===void 0?void 0:n.equals)!==null&&i!==void 0?i:Bi),r}function Ao(e){return function(a,n,i){const r=_o(n);return e(a,r,i)}}const hn=Ao(vi);function wi(e,t,a=!1){return a&&(e=No(e,t)),Array.isArray(e)?t.removeSubsets(e):t.getChildren(e)}function No(e,t){const a=Array.isArray(e)?e.slice(0):[e],n=a.length;for(let i=0;i<n;i++){const r=Mi(a[i],t);a.push(...r)}return a}const Co=new Set(["first","last","eq","gt","nth","lt","even","odd"]);function ga(e){return e.type!=="pseudo"?!1:Co.has(e.name)?!0:e.name==="not"&&Array.isArray(e.data)?e.data.some(t=>t.some(ga)):!1}function Io(e,t,a){const n=t!=null?parseInt(t,10):NaN;switch(e){case"first":return 1;case"nth":case"eq":return isFinite(n)?n>=0?n+1:1/0:0;case"lt":return isFinite(n)?n>=0?Math.min(n,a):1/0:0;case"gt":return isFinite(n)?1/0:0;case"odd":return 2*a;case"even":return 2*a-1;case"last":case"not":return 1/0}}function So(e){for(;e.parent;)e=e.parent;return e}function fn(e){const t=[],a=[];for(const n of e)n.some(ga)?t.push(n):a.push(n);return[a,t]}const xo={type:k.Universal,namespace:null},Oo={type:k.Pseudo,name:"scope",data:null};function Ui(e,t,a={}){return Fi([e],t,a)}function Fi(e,t,a={}){if(typeof t=="function")return e.some(t);const[n,i]=fn(Ea(t));return n.length>0&&e.some(hn(n,a))||i.some(r=>Yi(r,e,a).length>0)}function Do(e,t,a,n){const i=typeof a=="string"?parseInt(a,10):NaN;switch(e){case"first":case"lt":return t;case"last":return t.length>0?[t[t.length-1]]:t;case"nth":case"eq":return isFinite(i)&&Math.abs(i)<t.length?[i<0?t[t.length+i]:t[i]]:[];case"gt":return isFinite(i)?t.slice(i+1):[];case"even":return t.filter((r,u)=>u%2===0);case"odd":return t.filter((r,u)=>u%2===1);case"not":{const r=new Set(Vi(a,t,n));return t.filter(u=>!r.has(u))}}}function Hi(e,t,a={}){return Vi(Ea(e),t,a)}function Vi(e,t,a){if(t.length===0)return[];const[n,i]=fn(e);let r;if(n.length){const u=En(t,n,a);if(i.length===0)return u;u.length&&(r=new Set(u))}for(let u=0;u<i.length&&(r==null?void 0:r.size)!==t.length;u++){const o=i[u];if((r?t.filter(m=>v(m)&&!r.has(m)):t).length===0)break;const h=Yi(o,t,a);if(h.length)if(r)h.forEach(m=>r.add(m));else{if(u===i.length-1)return h;r=new Set(h)}}return typeof r<"u"?r.size===t.length?t:t.filter(u=>r.has(u)):[]}function Yi(e,t,a){var n;if(e.some(Mt)){const i=(n=a.root)!==null&&n!==void 0?n:So(t[0]),r={...a,context:t,relativeSelector:!1};return e.push(Oo),_a(i,e,r,!0,t.length)}return _a(t,e,a,!1,t.length)}function Lo(e,t,a={},n=1/0){if(typeof e=="function")return qi(t,e);const[i,r]=fn(Ea(e)),u=r.map(o=>_a(t,o,a,!0,n));return i.length&&u.push(mn(t,i,a,n)),u.length===0?[]:u.length===1?u[0]:Tt(u.reduce((o,l)=>[...o,...l]))}function _a(e,t,a,n,i){const r=t.findIndex(ga),u=t.slice(0,r),o=t[r],l=t.length-1===r?i:1/0,h=Io(o.name,o.data,l);if(h===0)return[];const p=(u.length===0&&!Array.isArray(e)?oa(e).filter(v):u.length===0?(Array.isArray(e)?e:[e]).filter(v):n||u.some(Mt)?mn(e,[u],a,h):En(e,[u],a)).slice(0,h);let T=Do(o.name,p,o.data,a);if(T.length===0||t.length===r+1)return T;const N=t.slice(r+1),I=N.some(Mt);if(I){if(Mt(N[0])){const{type:y}=N[0];(y===k.Sibling||y===k.Adjacent)&&(T=wi(T,ha,!0)),N.unshift(xo)}a={...a,relativeSelector:!1,rootFunc:y=>T.includes(y)}}else a.rootFunc&&a.rootFunc!==pa.trueFunc&&(a={...a,rootFunc:pa.trueFunc});return N.some(ga)?_a(T,N,a,!1,i):I?mn(T,[N],a,i):En(T,[N],a)}function mn(e,t,a,n){const i=hn(t,a,e);return qi(e,i,n)}function qi(e,t,a=1/0){const n=wi(e,ha,t.shouldTestNextSiblings);return za(i=>v(i)&&t(i),n,!0,a)}function En(e,t,a){const n=(Array.isArray(e)?e:[e]).filter(v);if(n.length===0)return n;const i=hn(t,a);return i===pa.trueFunc?n:n.filter(i)}const yo=/^\s*[+~]/;function Ro(e){if(!e)return this._make([]);if(typeof e!="string"){const t=$e(e)?e.toArray():[e],a=this.toArray();return this._make(t.filter(n=>a.some(i=>mi(i,n))))}return this._findBySelector(e,Number.POSITIVE_INFINITY)}function ko(e,t){var a;const n=this.toArray(),i=yo.test(e)?n:this.children().toArray(),r={context:n,root:(a=this._root)===null||a===void 0?void 0:a[0],xmlMode:this.options.xmlMode,lowerCaseTags:this.options.lowerCaseTags,lowerCaseAttributeNames:this.options.lowerCaseAttributeNames,pseudos:this.options.pseudos,quirksMode:this.options.quirksMode};return this._make(Lo(e,i,r,t))}function pn(e){return function(t,...a){return function(n){var i;let r=e(t,this);return n&&(r=gn(r,n,this.options.xmlMode,(i=this._root)===null||i===void 0?void 0:i[0])),this._make(this.length>1&&r.length>1?a.reduce((u,o)=>o(u),r):r)}}}const vt=pn((e,t)=>{let a=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i.length>0&&(a=a.concat(i))}return a}),Tn=pn((e,t)=>{const a=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i!==null&&a.push(i)}return a});function bn(e,...t){let a=null;const n=pn((i,r)=>{const u=[];return ee(r,o=>{for(let l;(l=i(o))&&!(a!=null&&a(l,u.length));o=l)u.push(l)}),u})(e,...t);return function(i,r){a=typeof i=="string"?o=>Ui(o,i,this.options):i?Bt(i):null;const u=n.call(this,r);return a=null,u}}function gt(e){return e.length>1?Array.from(new Set(e)):e}const Mo=Tn(({parent:e})=>e&&!Qe(e)?e:null,gt),Po=vt(e=>{const t=[];for(;e.parent&&!Qe(e.parent);)t.push(e.parent),e=e.parent;return t},Tt,e=>e.reverse()),vo=bn(({parent:e})=>e&&!Qe(e)?e:null,Tt,e=>e.reverse());function Bo(e){var t;const a=[];if(!e)return this._make(a);const n={xmlMode:this.options.xmlMode,root:(t=this._root)===null||t===void 0?void 0:t[0]},i=typeof e=="string"?r=>Ui(r,e,n):Bt(e);return ee(this,r=>{for(r&&!Qe(r)&&!v(r)&&(r=r.parent);r&&v(r);){if(i(r,0)){a.includes(r)||a.push(r);break}r=r.parent}}),this._make(a)}const wo=Tn(e=>Qa(e)),Uo=vt(e=>{const t=[];for(;e.next;)e=e.next,v(e)&&t.push(e);return t},gt),Fo=bn(e=>Qa(e),gt),Ho=Tn(e=>ja(e)),Vo=vt(e=>{const t=[];for(;e.prev;)e=e.prev,v(e)&&t.push(e);return t},gt),Yo=bn(e=>ja(e),gt),qo=vt(e=>ui(e).filter(t=>v(t)&&t!==e),Tt),$o=vt(e=>oa(e).filter(v),gt);function Wo(){const e=this.toArray().reduce((t,a)=>le(a)?t.concat(a.children):t,[]);return this._make(e)}function Go(e){let t=0;const a=this.length;for(;t<a&&e.call(this[t],t,this[t])!==!1;)++t;return this}function Xo(e){let t=[];for(let a=0;a<this.length;a++){const n=this[a],i=e.call(n,a,n);i!=null&&(t=t.concat(i))}return this._make(t)}function Bt(e){return typeof e=="function"?(t,a)=>e.call(t,a,t):$e(e)?t=>Array.prototype.includes.call(e,t):function(t){return e===t}}function Qo(e){var t;return this._make(gn(this.toArray(),e,this.options.xmlMode,(t=this._root)===null||t===void 0?void 0:t[0]))}function gn(e,t,a,n){return typeof t=="string"?Hi(t,e,{xmlMode:a,root:n}):e.filter(Bt(t))}function jo(e){const t=this.toArray();return typeof e=="string"?Fi(t.filter(v),e,this.options):e?t.some(Bt(e)):!1}function zo(e){let t=this.toArray();if(typeof e=="string"){const a=new Set(Hi(e,t,this.options));t=t.filter(n=>!a.has(n))}else{const a=Bt(e);t=t.filter((n,i)=>!a(n,i))}return this._make(t)}function Ko(e){return this.filter(typeof e=="string"?`:has(${e})`:(t,a)=>this._make(a).find(e).length>0)}function Zo(){return this.length>1?this._make(this[0]):this}function Jo(){return this.length>0?this._make(this[this.length-1]):this}function ec(e){var t;return e=+e,e===0&&this.length<=1?this:(e<0&&(e=this.length+e),this._make((t=this[e])!==null&&t!==void 0?t:[]))}function tc(e){return e==null?this.toArray():this[e<0?this.length+e:e]}function ac(){return Array.prototype.slice.call(this)}function nc(e){let t,a;return e==null?(t=this.parent().children(),a=this[0]):typeof e=="string"?(t=this._make(e),a=this[0]):(t=this,a=$e(e)?e[0]:e),Array.prototype.indexOf.call(t,a)}function ic(e,t){return this._make(Array.prototype.slice.call(this,e,t))}function sc(){var e;return(e=this.prevObject)!==null&&e!==void 0?e:this._make([])}function rc(e,t){const a=this._make(e,t),n=Tt([...this.get(),...a.get()]);return this._make(n)}function uc(e){return this.prevObject?this.add(e?this.prevObject.filter(e):this.prevObject):this}const oc=Object.freeze(Object.defineProperty({__proto__:null,_findBySelector:ko,add:rc,addBack:uc,children:$o,closest:Bo,contents:Wo,each:Go,end:sc,eq:ec,filter:Qo,filterArray:gn,find:Ro,first:Zo,get:tc,has:Ko,index:nc,is:jo,last:Jo,map:Xo,next:wo,nextAll:Uo,nextUntil:Fo,not:zo,parent:Mo,parents:Po,parentsUntil:vo,prev:Ho,prevAll:Vo,prevUntil:Yo,siblings:qo,slice:ic,toArray:ac},Symbol.toStringTag,{value:"Module"}));function cc(e){return function(a,n,i,r){if(typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=a.toString()),typeof a=="string")return e(a,n,i,r);const u=a;if(!Array.isArray(u)&&Qe(u))return u;const o=new it([]);return ot(u,o),o}}function ot(e,t){const a=Array.isArray(e)?e:[e];t?t.children=a:t=null;for(let n=0;n<a.length;n++){const i=a[n];i.parent&&i.parent.children!==a&&st(i),t?(i.prev=a[n-1]||null,i.next=a[n+1]||null):i.prev=i.next=null,i.parent=t}return t}function lc(e,t){if(e==null)return[];if(typeof e=="string")return this._parse(e,this.options,!1,null).children.slice(0);if("length"in e){if(e.length===1)return this._makeDomArray(e[0],t);const a=[];for(let n=0;n<e.length;n++){const i=e[n];if(typeof i=="object"){if(i==null)continue;if(!("length"in i)){a.push(t?Lt(i,!0):i);continue}}a.push(...this._makeDomArray(i,t))}return a}return[t?Lt(e,!0):e]}function $i(e){return function(...t){const a=this.length-1;return ee(this,(n,i)=>{if(!le(n))return;const r=typeof t[0]=="function"?t[0].call(n,i,this._render(n.children)):t,u=this._makeDomArray(r,i<a);e(u,n.children,n)})}}function Ke(e,t,a,n,i){var r,u;const o=[t,a,...n],l=t===0?null:e[t-1],h=t+a>=e.length?null:e[t+a];for(let m=0;m<n.length;++m){const p=n[m],T=p.parent;if(T){const I=T.children.indexOf(p);I>-1&&(T.children.splice(I,1),i===T&&t>I&&o[0]--)}p.parent=i,p.prev&&(p.prev.next=(r=p.next)!==null&&r!==void 0?r:null),p.next&&(p.next.prev=(u=p.prev)!==null&&u!==void 0?u:null),p.prev=m===0?l:n[m-1],p.next=m===n.length-1?h:n[m+1]}return l&&(l.next=n[0]),h&&(h.prev=n[n.length-1]),e.splice(...o)}function dc(e){return($e(e)?e:this._make(e)).append(this),this}function hc(e){return($e(e)?e:this._make(e)).prepend(this),this}const fc=$i((e,t,a)=>{Ke(t,t.length,0,e,a)}),mc=$i((e,t,a)=>{Ke(t,0,0,e,a)});function Wi(e){return function(t){const a=this.length-1,n=this.parents().last();for(let i=0;i<this.length;i++){const r=this[i],u=typeof t=="function"?t.call(r,i,r):typeof t=="string"&&!Ja(t)?n.find(t).clone():t,[o]=this._makeDomArray(u,i<a);if(!o||!le(o))continue;let l=o,h=0;for(;h<l.children.length;){const m=l.children[h];v(m)?(l=m,h=0):h++}e(r,l,[o])}return this}}const Ec=Wi((e,t,a)=>{const{parent:n}=e;if(!n)return;const i=n.children,r=i.indexOf(e);ot([e],t),Ke(i,r,0,a,n)}),pc=Wi((e,t,a)=>{le(e)&&(ot(e.children,t),ot(a,e))});function Tc(e){return this.parent(e).not("body").each((t,a)=>{this._make(a).replaceWith(a.children)}),this}function bc(e){const t=this[0];if(t){const a=this._make(typeof e=="function"?e.call(t,0,t):e).insertBefore(t);let n;for(let r=0;r<a.length;r++)a[r].type==="tag"&&(n=a[r]);let i=0;for(;n&&i<n.children.length;){const r=n.children[i];r.type==="tag"?(n=r,i=0):i++}n&&this._make(n).append(this)}return this}function gc(...e){const t=this.length-1;return ee(this,(a,n)=>{if(!le(a)||!a.parent)return;const i=a.parent.children,r=i.indexOf(a);if(r<0)return;const u=typeof e[0]=="function"?e[0].call(a,n,this._render(a.children)):e,o=this._makeDomArray(u,n<t);Ke(i,r+1,0,o,a.parent)})}function _c(e){typeof e=="string"&&(e=this._make(e)),this.remove();const t=[];for(const a of this._makeDomArray(e)){const n=this.clone().toArray(),{parent:i}=a;if(!i)continue;const r=i.children,u=r.indexOf(a);u<0||(Ke(r,u+1,0,n,i),t.push(...n))}return this._make(t)}function Ac(...e){const t=this.length-1;return ee(this,(a,n)=>{if(!le(a)||!a.parent)return;const i=a.parent.children,r=i.indexOf(a);if(r<0)return;const u=typeof e[0]=="function"?e[0].call(a,n,this._render(a.children)):e,o=this._makeDomArray(u,n<t);Ke(i,r,0,o,a.parent)})}function Nc(e){const t=this._make(e);this.remove();const a=[];return ee(t,n=>{const i=this.clone().toArray(),{parent:r}=n;if(!r)return;const u=r.children,o=u.indexOf(n);o<0||(Ke(u,o,0,i,r),a.push(...i))}),this._make(a)}function Cc(e){const t=e?this.filter(e):this;return ee(t,a=>{st(a),a.prev=a.next=a.parent=null}),this}function Ic(e){return ee(this,(t,a)=>{const{parent:n}=t;if(!n)return;const i=n.children,r=typeof e=="function"?e.call(t,a,t):e,u=this._makeDomArray(r);ot(u,null);const o=i.indexOf(t);Ke(i,o,1,u,n),u.includes(t)||(t.parent=t.prev=t.next=null)})}function Sc(){return ee(this,e=>{if(le(e)){for(const t of e.children)t.next=t.prev=t.parent=null;e.children.length=0}})}function xc(e){if(e===void 0){const t=this[0];return!t||!le(t)?null:this._render(t.children)}return ee(this,t=>{if(!le(t))return;for(const n of t.children)n.next=n.prev=n.parent=null;const a=$e(e)?e.toArray():this._parse(`${e}`,this.options,!1,t).children;ot(a,t)})}function Oc(){return this._render(this)}function Dc(e){return e===void 0?yt(this):typeof e=="function"?ee(this,(t,a)=>this._make(t).text(e.call(t,a,yt([t])))):ee(this,t=>{if(!le(t))return;for(const n of t.children)n.next=n.prev=n.parent=null;const a=new Dt(`${e}`);ot(a,t)})}function Lc(){const e=Array.prototype.map.call(this.get(),a=>Lt(a,!0)),t=new it(e);for(const a of e)a.parent=t;return this._make(e)}const yc=Object.freeze(Object.defineProperty({__proto__:null,_makeDomArray:lc,after:gc,append:fc,appendTo:dc,before:Ac,clone:Lc,empty:Sc,html:xc,insertAfter:_c,insertBefore:Nc,prepend:mc,prependTo:hc,remove:Cc,replaceWith:Ic,text:Dc,toString:Oc,unwrap:Tc,wrap:Ec,wrapAll:bc,wrapInner:pc},Symbol.toStringTag,{value:"Module"}));function Rc(e,t){if(e!=null&&t!=null||typeof e=="object"&&!Array.isArray(e))return ee(this,(a,n)=>{v(a)&&Gi(a,e,t,n)});if(this.length!==0)return Xi(this[0],e)}function Gi(e,t,a,n){if(typeof t=="string"){const i=Xi(e),r=typeof a=="function"?a.call(e,n,i[t]):a;r===""?delete i[t]:r!=null&&(i[t]=r),e.attribs.style=kc(i)}else if(typeof t=="object"){const i=Object.keys(t);for(let r=0;r<i.length;r++){const u=i[r];Gi(e,u,t[u],r)}}}function Xi(e,t){if(!e||!v(e))return;const a=Mc(e.attribs.style);if(typeof t=="string")return a[t];if(Array.isArray(t)){const n={};for(const i of t)a[i]!=null&&(n[i]=a[i]);return n}return a}function kc(e){return Object.keys(e).reduce((t,a)=>`${t}${t?" ":""}${a}: ${e[a]};`,"")}function Mc(e){if(e=(e||"").trim(),!e)return{};const t={};let a;for(const n of e.split(";")){const i=n.indexOf(":");if(i<1||i===n.length-1){const r=n.trimEnd();r.length>0&&a!==void 0&&(t[a]+=`;${r}`)}else a=n.slice(0,i).trim(),t[a]=n.slice(i+1).trim()}return t}const Pc=Object.freeze(Object.defineProperty({__proto__:null,css:Rc},Symbol.toStringTag,{value:"Module"})),Qi="input,select,textarea,keygen",vc=/%20/g,ji=/\r?\n/g;function Bc(){return this.serializeArray().map(a=>`${encodeURIComponent(a.name)}=${encodeURIComponent(a.value)}`).join("&").replace(vc,"+")}function wc(){return this.map((e,t)=>{const a=this._make(t);return v(t)&&t.name==="form"?a.find(Qi).toArray():a.filter(Qi).toArray()}).filter('[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map((e,t)=>{var a;const n=this._make(t),i=n.attr("name"),r=(a=n.val())!==null&&a!==void 0?a:"";return Array.isArray(r)?r.map(u=>({name:i,value:u.replace(ji,`\r
7
7
  `)})):{name:i,value:r.replace(ji,`\r
8
- `)}}).toArray()}const Uc=Object.freeze(Object.defineProperty({__proto__:null,serialize:Bc,serializeArray:wc},Symbol.toStringTag,{value:"Module"}));function Fc(e){var t;return typeof e=="string"?{selector:e,value:"textContent"}:{selector:e.selector,value:(t=e.value)!==null&&t!==void 0?t:"textContent"}}function Hc(e){const t={};for(const a in e){const n=e[a],i=Array.isArray(n),{selector:r,value:u}=Fc(i?n[0]:n),o=typeof u=="function"?u:typeof u=="string"?l=>this._make(l).prop(u):l=>this._make(l).extract(u);if(i)t[a]=this._findBySelector(r,Number.POSITIVE_INFINITY).map((l,h)=>o(h,a,t)).get();else{const l=this._findBySelector(r,1);t[a]=l.length>0?o(l[0],a,t):void 0}}return t}const Vc=Object.freeze(Object.defineProperty({__proto__:null,extract:Hc},Symbol.toStringTag,{value:"Module"}));class wt{constructor(t,a,n){if(this.length=0,this.options=n,this._root=a,t){for(let i=0;i<t.length;i++)this[i]=t[i];this.length=t.length}}}wt.prototype.cheerio="[cheerio object]",wt.prototype.splice=Array.prototype.splice,wt.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(wt.prototype,Gu,oc,yc,Pc,Uc,Vc);function Yc(e,t){return function a(n,i,r=!0){if(n==null)throw new Error("cheerio.load() expects a string");const u=Za(i),o=e(n,u,r,null);class l extends wt{_make(p,T){const N=h(p,T);return N.prevObject=this,N}_parse(p,T,N,I){return e(p,T,N,I)}_render(p){return t(p,this.options)}}function h(m,p,T=o,N){if(m&&$e(m))return m;const I=Za(N,u),y=typeof T=="string"?[e(T,I,!1,null)]:"length"in T?T:[T],D=$e(y)?y:new l(y,null,I);if(D._root=D,!m)return new l(void 0,D,I);const P=typeof m=="string"&&Ja(m)?e(m,I,!1,null).children:qc(m)?[m]:Array.isArray(m)?m:void 0,$=new l(P,D,I);if(P)return $;if(typeof m!="string")throw new TypeError("Unexpected type of selector");let V=m;const te=p?typeof p=="string"?Ja(p)?new l([e(p,I,!1,null)],D,I):(V=`${p} ${V}`,D):$e(p)?p:new l(Array.isArray(p)?p:[p],D,I):D;return te?te.find(V):$}return Object.assign(h,Pu,{load:a,_root:o,_options:u,fn:l.prototype,prototype:l.prototype}),h}}function qc(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}const $c=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]),K="�";var d;(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"})(d||(d={}));const _e={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function zi(e){return e>=55296&&e<=57343}function Wc(e){return e>=56320&&e<=57343}function Gc(e,t){return(e-55296)*1024+9216+t}function Ki(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Zi(e){return e>=64976&&e<=65007||$c.has(e)}var g;(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"})(g||(g={}));const Xc=65536;class Qc{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=Xc,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,a){const{line:n,col:i,offset:r}=this,u=i+a,o=r+a;return{code:t,startLine:n,endLine:n,startCol:u,endCol:u,startOffset:o,endOffset:o}}_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 a=this.html.charCodeAt(this.pos+1);if(Wc(a))return this.pos++,this._addGap(),Gc(t,a)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,d.EOF;return this._err(g.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,a){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=a}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,a){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(a)return this.html.startsWith(t,this.pos);for(let n=0;n<t.length;n++)if((this.html.charCodeAt(this.pos+n)|32)!==t.charCodeAt(n))return!1;return!0}peek(t){const a=this.pos+t;if(a>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,d.EOF;const n=this.html.charCodeAt(a);return n===d.CARRIAGE_RETURN?d.LINE_FEED:n}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,d.EOF;let t=this.html.charCodeAt(this.pos);return t===d.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,d.LINE_FEED):t===d.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,zi(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===d.LINE_FEED||t===d.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Ki(t)?this._err(g.controlCharacterInInputStream):Zi(t)&&this._err(g.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var W;(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"})(W||(W={}));function Ji(e,t){for(let a=e.attrs.length-1;a>=0;a--)if(e.attrs[a].name===t)return e.attrs[a].value;return null}var C;(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/"})(C||(C={}));var ct;(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"})(ct||(ct={}));var Ie;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Ie||(Ie={}));var b;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(b||(b={}));var s;(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"})(s||(s={}));const jc=new Map([[b.A,s.A],[b.ADDRESS,s.ADDRESS],[b.ANNOTATION_XML,s.ANNOTATION_XML],[b.APPLET,s.APPLET],[b.AREA,s.AREA],[b.ARTICLE,s.ARTICLE],[b.ASIDE,s.ASIDE],[b.B,s.B],[b.BASE,s.BASE],[b.BASEFONT,s.BASEFONT],[b.BGSOUND,s.BGSOUND],[b.BIG,s.BIG],[b.BLOCKQUOTE,s.BLOCKQUOTE],[b.BODY,s.BODY],[b.BR,s.BR],[b.BUTTON,s.BUTTON],[b.CAPTION,s.CAPTION],[b.CENTER,s.CENTER],[b.CODE,s.CODE],[b.COL,s.COL],[b.COLGROUP,s.COLGROUP],[b.DD,s.DD],[b.DESC,s.DESC],[b.DETAILS,s.DETAILS],[b.DIALOG,s.DIALOG],[b.DIR,s.DIR],[b.DIV,s.DIV],[b.DL,s.DL],[b.DT,s.DT],[b.EM,s.EM],[b.EMBED,s.EMBED],[b.FIELDSET,s.FIELDSET],[b.FIGCAPTION,s.FIGCAPTION],[b.FIGURE,s.FIGURE],[b.FONT,s.FONT],[b.FOOTER,s.FOOTER],[b.FOREIGN_OBJECT,s.FOREIGN_OBJECT],[b.FORM,s.FORM],[b.FRAME,s.FRAME],[b.FRAMESET,s.FRAMESET],[b.H1,s.H1],[b.H2,s.H2],[b.H3,s.H3],[b.H4,s.H4],[b.H5,s.H5],[b.H6,s.H6],[b.HEAD,s.HEAD],[b.HEADER,s.HEADER],[b.HGROUP,s.HGROUP],[b.HR,s.HR],[b.HTML,s.HTML],[b.I,s.I],[b.IMG,s.IMG],[b.IMAGE,s.IMAGE],[b.INPUT,s.INPUT],[b.IFRAME,s.IFRAME],[b.KEYGEN,s.KEYGEN],[b.LABEL,s.LABEL],[b.LI,s.LI],[b.LINK,s.LINK],[b.LISTING,s.LISTING],[b.MAIN,s.MAIN],[b.MALIGNMARK,s.MALIGNMARK],[b.MARQUEE,s.MARQUEE],[b.MATH,s.MATH],[b.MENU,s.MENU],[b.META,s.META],[b.MGLYPH,s.MGLYPH],[b.MI,s.MI],[b.MO,s.MO],[b.MN,s.MN],[b.MS,s.MS],[b.MTEXT,s.MTEXT],[b.NAV,s.NAV],[b.NOBR,s.NOBR],[b.NOFRAMES,s.NOFRAMES],[b.NOEMBED,s.NOEMBED],[b.NOSCRIPT,s.NOSCRIPT],[b.OBJECT,s.OBJECT],[b.OL,s.OL],[b.OPTGROUP,s.OPTGROUP],[b.OPTION,s.OPTION],[b.P,s.P],[b.PARAM,s.PARAM],[b.PLAINTEXT,s.PLAINTEXT],[b.PRE,s.PRE],[b.RB,s.RB],[b.RP,s.RP],[b.RT,s.RT],[b.RTC,s.RTC],[b.RUBY,s.RUBY],[b.S,s.S],[b.SCRIPT,s.SCRIPT],[b.SEARCH,s.SEARCH],[b.SECTION,s.SECTION],[b.SELECT,s.SELECT],[b.SOURCE,s.SOURCE],[b.SMALL,s.SMALL],[b.SPAN,s.SPAN],[b.STRIKE,s.STRIKE],[b.STRONG,s.STRONG],[b.STYLE,s.STYLE],[b.SUB,s.SUB],[b.SUMMARY,s.SUMMARY],[b.SUP,s.SUP],[b.TABLE,s.TABLE],[b.TBODY,s.TBODY],[b.TEMPLATE,s.TEMPLATE],[b.TEXTAREA,s.TEXTAREA],[b.TFOOT,s.TFOOT],[b.TD,s.TD],[b.TH,s.TH],[b.THEAD,s.THEAD],[b.TITLE,s.TITLE],[b.TR,s.TR],[b.TRACK,s.TRACK],[b.TT,s.TT],[b.U,s.U],[b.UL,s.UL],[b.SVG,s.SVG],[b.VAR,s.VAR],[b.WBR,s.WBR],[b.XMP,s.XMP]]);function Aa(e){var t;return(t=jc.get(e))!==null&&t!==void 0?t:s.UNKNOWN}const x=s,zc={[C.HTML]:new Set([x.ADDRESS,x.APPLET,x.AREA,x.ARTICLE,x.ASIDE,x.BASE,x.BASEFONT,x.BGSOUND,x.BLOCKQUOTE,x.BODY,x.BR,x.BUTTON,x.CAPTION,x.CENTER,x.COL,x.COLGROUP,x.DD,x.DETAILS,x.DIR,x.DIV,x.DL,x.DT,x.EMBED,x.FIELDSET,x.FIGCAPTION,x.FIGURE,x.FOOTER,x.FORM,x.FRAME,x.FRAMESET,x.H1,x.H2,x.H3,x.H4,x.H5,x.H6,x.HEAD,x.HEADER,x.HGROUP,x.HR,x.HTML,x.IFRAME,x.IMG,x.INPUT,x.LI,x.LINK,x.LISTING,x.MAIN,x.MARQUEE,x.MENU,x.META,x.NAV,x.NOEMBED,x.NOFRAMES,x.NOSCRIPT,x.OBJECT,x.OL,x.P,x.PARAM,x.PLAINTEXT,x.PRE,x.SCRIPT,x.SECTION,x.SELECT,x.SOURCE,x.STYLE,x.SUMMARY,x.TABLE,x.TBODY,x.TD,x.TEMPLATE,x.TEXTAREA,x.TFOOT,x.TH,x.THEAD,x.TITLE,x.TR,x.TRACK,x.UL,x.WBR,x.XMP]),[C.MATHML]:new Set([x.MI,x.MO,x.MN,x.MS,x.MTEXT,x.ANNOTATION_XML]),[C.SVG]:new Set([x.TITLE,x.FOREIGN_OBJECT,x.DESC]),[C.XLINK]:new Set,[C.XML]:new Set,[C.XMLNS]:new Set},_n=new Set([x.H1,x.H2,x.H3,x.H4,x.H5,x.H6]),Kc=new Set([b.STYLE,b.SCRIPT,b.XMP,b.IFRAME,b.NOEMBED,b.NOFRAMES,b.PLAINTEXT]);function Zc(e,t){return Kc.has(e)||t&&e===b.NOSCRIPT}var f;(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"})(f||(f={}));const Ae={DATA:f.DATA,RCDATA:f.RCDATA,RAWTEXT:f.RAWTEXT,SCRIPT_DATA:f.SCRIPT_DATA,PLAINTEXT:f.PLAINTEXT,CDATA_SECTION:f.CDATA_SECTION};function Jc(e){return e>=d.DIGIT_0&&e<=d.DIGIT_9}function Ut(e){return e>=d.LATIN_CAPITAL_A&&e<=d.LATIN_CAPITAL_Z}function el(e){return e>=d.LATIN_SMALL_A&&e<=d.LATIN_SMALL_Z}function Ze(e){return el(e)||Ut(e)}function es(e){return Ze(e)||Jc(e)}function Na(e){return e+32}function ts(e){return e===d.SPACE||e===d.LINE_FEED||e===d.TABULATION||e===d.FORM_FEED}function as(e){return ts(e)||e===d.SOLIDUS||e===d.GREATER_THAN_SIGN}function tl(e){return e===d.NULL?g.nullCharacterReference:e>1114111?g.characterReferenceOutsideUnicodeRange:zi(e)?g.surrogateCharacterReference:Zi(e)?g.noncharacterCharacterReference:Ki(e)||e===d.CARRIAGE_RETURN?g.controlCharacterReference:null}let al=class{constructor(t,a){this.options=t,this.handler=a,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=f.DATA,this.returnState=f.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Qc(a),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Xa(qa,(n,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(n)},a.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(g.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:n=>{this._err(g.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+n)},validateNumericCharacterReference:n=>{const i=tl(n);i&&this._err(i,1)}}:void 0)}_err(t,a=0){var n,i;(i=(n=this.handler).onParseError)===null||i===void 0||i.call(n,this.preprocessor.getError(t,a))}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,a,n){this.active=!0,this.preprocessor.write(t,a),this._runParsingLoop(),this.paused||n==null||n()}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 a=0;a<t;a++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,a){return this.preprocessor.startsWith(t,a)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:W.START_TAG,tagName:"",tagID:s.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:W.END_TAG,tagName:"",tagID:s.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:W.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:W.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,a){this.currentCharacterToken={type:t,chars:a,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,a;const n=this.currentToken;if(Ji(n,this.currentAttr.name)===null){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){const i=(t=(a=n.location).attrs)!==null&&t!==void 0?t:a.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(g.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=Aa(t.tagName),t.type===W.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(g.endTagWithAttributes),t.selfClosing&&this._err(g.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 W.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case W.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case W.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:W.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,a){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=a;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,a)}_emitCodePoint(t){const a=ts(t)?W.WHITESPACE_CHARACTER:t===d.NULL?W.NULL_CHARACTER:W.CHARACTER;this._appendCharToCurrentCharacterToken(a,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(W.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=f.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?xe.Attribute:xe.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===f.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===f.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===f.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case f.DATA:{this._stateData(t);break}case f.RCDATA:{this._stateRcdata(t);break}case f.RAWTEXT:{this._stateRawtext(t);break}case f.SCRIPT_DATA:{this._stateScriptData(t);break}case f.PLAINTEXT:{this._statePlaintext(t);break}case f.TAG_OPEN:{this._stateTagOpen(t);break}case f.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case f.TAG_NAME:{this._stateTagName(t);break}case f.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case f.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case f.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case f.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case f.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case f.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case f.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case f.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case f.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case f.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case f.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case f.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case f.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case f.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case f.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case f.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case f.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case f.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case f.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case f.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case f.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case f.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case f.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case f.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case f.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case f.BOGUS_COMMENT:{this._stateBogusComment(t);break}case f.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case f.COMMENT_START:{this._stateCommentStart(t);break}case f.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case f.COMMENT:{this._stateComment(t);break}case f.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case f.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case f.COMMENT_END:{this._stateCommentEnd(t);break}case f.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case f.DOCTYPE:{this._stateDoctype(t);break}case f.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case f.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case f.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case f.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case f.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case f.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case f.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case f.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case f.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case f.CDATA_SECTION:{this._stateCdataSection(t);break}case f.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case f.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case f.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case f.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.TAG_OPEN;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitCodePoint(t);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case d.AMPERSAND:{this._startCharacterReference();break}case d.LESS_THAN_SIGN:{this.state=f.RCDATA_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.RAWTEXT_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ze(t))this._createStartTagToken(),this.state=f.TAG_NAME,this._stateTagName(t);else switch(t){case d.EXCLAMATION_MARK:{this.state=f.MARKUP_DECLARATION_OPEN;break}case d.SOLIDUS:{this.state=f.END_TAG_OPEN;break}case d.QUESTION_MARK:{this._err(g.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t);break}case d.EOF:{this._err(g.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(g.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=f.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ze(t))this._createEndTagToken(),this.state=f.TAG_NAME,this._stateTagName(t);else switch(t){case d.GREATER_THAN_SIGN:{this._err(g.missingEndTagName),this.state=f.DATA;break}case d.EOF:{this._err(g.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(g.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.SOLIDUS:{this.state=f.SELF_CLOSING_START_TAG;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentTagToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.tagName+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:a.tagName+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateRcdataLessThanSign(t){t===d.SOLIDUS?this.state=f.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=f.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Ze(t)?(this.state=f.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=f.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const a=this.currentToken;switch(a.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=f.BEFORE_ATTRIBUTE_NAME,!1;case d.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=f.SELF_CLOSING_START_TAG,!1;case d.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=f.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===d.SOLIDUS?this.state=f.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Ze(t)?(this.state=f.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case d.SOLIDUS:{this.state=f.SCRIPT_DATA_END_TAG_OPEN;break}case d.EXCLAMATION_MARK:{this.state=f.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=f.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Ze(t)?(this.state=f.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===d.HYPHEN_MINUS?(this.state=f.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===d.HYPHEN_MINUS?(this.state=f.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case d.HYPHEN_MINUS:{this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.GREATER_THAN_SIGN:{this.state=f.SCRIPT_DATA,this._emitChars(">");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===d.SOLIDUS?this.state=f.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ze(t)?(this._emitChars("<"),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ze(t)?(this.state=f.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(_e.SCRIPT,!1)&&as(this.preprocessor.peek(_e.SCRIPT.length))){this._emitCodePoint(t);for(let a=0;a<_e.SCRIPT.length;a++)this._emitCodePoint(this._consume());this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case d.HYPHEN_MINUS:{this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.GREATER_THAN_SIGN:{this.state=f.SCRIPT_DATA,this._emitChars(">");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===d.SOLIDUS?(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(_e.SCRIPT,!1)&&as(this.preprocessor.peek(_e.SCRIPT.length))){this._emitCodePoint(t);for(let a=0;a<_e.SCRIPT.length;a++)this._emitCodePoint(this._consume());this.state=f.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.SOLIDUS:case d.GREATER_THAN_SIGN:case d.EOF:{this.state=f.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case d.EQUALS_SIGN:{this._err(g.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=f.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=f.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:case d.SOLIDUS:case d.GREATER_THAN_SIGN:case d.EOF:{this._leaveAttrName(),this.state=f.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case d.EQUALS_SIGN:{this._leaveAttrName(),this.state=f.BEFORE_ATTRIBUTE_VALUE;break}case d.QUOTATION_MARK:case d.APOSTROPHE:case d.LESS_THAN_SIGN:{this._err(g.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.name+=K;break}default:this.currentAttr.name+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateAfterAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.SOLIDUS:{this.state=f.SELF_CLOSING_START_TAG;break}case d.EQUALS_SIGN:{this.state=f.BEFORE_ATTRIBUTE_VALUE;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=f.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{this.state=f.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this.state=f.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingAttributeValue),this.state=f.DATA,this.emitCurrentTagToken();break}default:this.state=f.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case d.APOSTROPHE:{this.state=f.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this._leaveAttrValue(),this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=f.DATA,this.emitCurrentTagToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.QUOTATION_MARK:case d.APOSTROPHE:case d.LESS_THAN_SIGN:case d.EQUALS_SIGN:case d.GRAVE_ACCENT:{this._err(g.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this._leaveAttrValue(),this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.SOLIDUS:{this._leaveAttrValue(),this.state=f.SELF_CLOSING_START_TAG;break}case d.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._err(g.missingWhitespaceBetweenAttributes),this.state=f.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case d.GREATER_THAN_SIGN:{const a=this.currentToken;a.selfClosing=!0,this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._err(g.unexpectedSolidusInTag),this.state=f.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this.emitCurrentComment(a),this._emitEOFToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.data+=K;break}default:a.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(_e.DASH_DASH,!0)?(this._createCommentToken(_e.DASH_DASH.length+1),this.state=f.COMMENT_START):this._consumeSequenceIfMatch(_e.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(_e.DOCTYPE.length+1),this.state=f.DOCTYPE):this._consumeSequenceIfMatch(_e.CDATA_START,!0)?this.inForeignNode?this.state=f.CDATA_SECTION:(this._err(g.cdataInHtmlContent),this._createCommentToken(_e.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=f.BOGUS_COMMENT):this._ensureHibernation()||(this._err(g.incorrectlyOpenedComment),this._createCommentToken(2),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_START_DASH;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptClosingOfEmptyComment),this.state=f.DATA;const a=this.currentToken;this.emitCurrentComment(a);break}default:this.state=f.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptClosingOfEmptyComment),this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="-",this.state=f.COMMENT,this._stateComment(t)}}_stateComment(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END_DASH;break}case d.LESS_THAN_SIGN:{a.data+="<",this.state=f.COMMENT_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.data+=K;break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const a=this.currentToken;switch(t){case d.EXCLAMATION_MARK:{a.data+="!",this.state=f.COMMENT_LESS_THAN_SIGN_BANG;break}case d.LESS_THAN_SIGN:{a.data+="<";break}default:this.state=f.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===d.HYPHEN_MINUS?this.state=f.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=f.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===d.HYPHEN_MINUS?this.state=f.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=f.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==d.GREATER_THAN_SIGN&&t!==d.EOF&&this._err(g.nestedComment),this.state=f.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END;break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="-",this.state=f.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentComment(a);break}case d.EXCLAMATION_MARK:{this.state=f.COMMENT_END_BANG;break}case d.HYPHEN_MINUS:{a.data+="-";break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="--",this.state=f.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{a.data+="--!",this.state=f.COMMENT_END_DASH;break}case d.GREATER_THAN_SIGN:{this._err(g.incorrectlyClosedComment),this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="--!",this.state=f.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this.state=f.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case d.EOF:{this._err(g.eofInDoctype),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingWhitespaceBeforeDoctypeName),this.state=f.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Ut(t))this._createDoctypeToken(String.fromCharCode(Na(t))),this.state=f.DOCTYPE_NAME;else switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.NULL:{this._err(g.unexpectedNullCharacter),this._createDoctypeToken(K),this.state=f.DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeName),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=f.DOCTYPE_NAME}}_stateDoctypeName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.AFTER_DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.name+=K;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.name+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateAfterDoctypeName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(_e.PUBLIC,!1)?this.state=f.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(_e.SYSTEM,!1)?this.state=f.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(g.invalidCharacterSequenceAfterDoctypeName),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceAfterDoctypePublicKeyword),a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceAfterDoctypePublicKeyword),a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const a=this.currentToken;switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.publicId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypePublicIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const a=this.currentToken;switch(t){case d.APOSTROPHE:{this.state=f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.publicId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypePublicIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.QUOTATION_MARK:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceAfterDoctypeSystemKeyword),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceAfterDoctypeSystemKeyword),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const a=this.currentToken;switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.systemId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypeSystemIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const a=this.currentToken;switch(t){case d.APOSTROPHE:{this.state=f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.systemId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypeSystemIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.NULL:{this._err(g.unexpectedNullCharacter);break}case d.EOF:{this.emitCurrentDoctype(a),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case d.RIGHT_SQUARE_BRACKET:{this.state=f.CDATA_SECTION_BRACKET;break}case d.EOF:{this._err(g.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===d.RIGHT_SQUARE_BRACKET?this.state=f.CDATA_SECTION_END:(this._emitChars("]"),this.state=f.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA;break}case d.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=f.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(d.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&es(this.preprocessor.peek(1))?f.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){es(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===d.SEMICOLON&&this._err(g.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}};const ns=new Set([s.DD,s.DT,s.LI,s.OPTGROUP,s.OPTION,s.P,s.RB,s.RP,s.RT,s.RTC]),is=new Set([...ns,s.CAPTION,s.COLGROUP,s.TBODY,s.TD,s.TFOOT,s.TH,s.THEAD,s.TR]),Ca=new Set([s.APPLET,s.CAPTION,s.HTML,s.MARQUEE,s.OBJECT,s.TABLE,s.TD,s.TEMPLATE,s.TH]),nl=new Set([...Ca,s.OL,s.UL]),il=new Set([...Ca,s.BUTTON]),ss=new Set([s.ANNOTATION_XML,s.MI,s.MN,s.MO,s.MS,s.MTEXT]),rs=new Set([s.DESC,s.FOREIGN_OBJECT,s.TITLE]),sl=new Set([s.TR,s.TEMPLATE,s.HTML]),rl=new Set([s.TBODY,s.TFOOT,s.THEAD,s.TEMPLATE,s.HTML]),ul=new Set([s.TABLE,s.TEMPLATE,s.HTML]),ol=new Set([s.TD,s.TH]);class cl{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,a,n){this.treeAdapter=a,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=s.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===s.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===C.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,a){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=a,this.currentTagId=a,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,a,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,a){const n=this._indexOf(t);this.items[n]=a,n===this.stackTop&&(this.current=a)}insertAfter(t,a,n){const i=this._indexOf(t)+1;this.items.splice(i,0,a),this.tagIDs.splice(i,0,n),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let a=this.stackTop+1;do a=this.tagIDs.lastIndexOf(t,a-1);while(a>0&&this.treeAdapter.getNamespaceURI(this.items[a])!==C.HTML);this.shortenToLength(a<0?0:a)}shortenToLength(t){for(;this.stackTop>=t;){const a=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(a,this.stackTop<t)}}popUntilElementPopped(t){const a=this._indexOf(t);this.shortenToLength(a<0?0:a)}popUntilPopped(t,a){const n=this._indexOfTagNames(t,a);this.shortenToLength(n<0?0:n)}popUntilNumberedHeaderPopped(){this.popUntilPopped(_n,C.HTML)}popUntilTableCellPopped(){this.popUntilPopped(ol,C.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,a){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===a)return n;return-1}clearBackTo(t,a){const n=this._indexOfTagNames(t,a);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(ul,C.HTML)}clearBackToTableBodyContext(){this.clearBackTo(rl,C.HTML)}clearBackToTableRowContext(){this.clearBackTo(sl,C.HTML)}remove(t){const a=this._indexOf(t);a>=0&&(a===this.stackTop?this.pop():(this.items.splice(a,1),this.tagIDs.splice(a,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===s.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const a=this._indexOf(t)-1;return a>=0?this.items[a]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===s.HTML}hasInDynamicScope(t,a){for(let n=this.stackTop;n>=0;n--){const i=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case C.HTML:{if(i===t)return!0;if(a.has(i))return!1;break}case C.SVG:{if(rs.has(i))return!1;break}case C.MATHML:{if(ss.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Ca)}hasInListItemScope(t){return this.hasInDynamicScope(t,nl)}hasInButtonScope(t){return this.hasInDynamicScope(t,il)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const a=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case C.HTML:{if(_n.has(a))return!0;if(Ca.has(a))return!1;break}case C.SVG:{if(rs.has(a))return!1;break}case C.MATHML:{if(ss.has(a))return!1;break}}}return!0}hasInTableScope(t){for(let a=this.stackTop;a>=0;a--)if(this.treeAdapter.getNamespaceURI(this.items[a])===C.HTML)switch(this.tagIDs[a]){case t:return!0;case s.TABLE:case s.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===C.HTML)switch(this.tagIDs[t]){case s.TBODY:case s.THEAD:case s.TFOOT:return!0;case s.TABLE:case s.HTML:return!1}return!0}hasInSelectScope(t){for(let a=this.stackTop;a>=0;a--)if(this.treeAdapter.getNamespaceURI(this.items[a])===C.HTML)switch(this.tagIDs[a]){case t:return!0;case s.OPTION:case s.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;ns.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;is.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==t&&is.has(this.currentTagId);)this.pop()}}const An=3;var Ue;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ue||(Ue={}));const us={type:Ue.Marker};class ll{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,a){const n=[],i=a.length,r=this.treeAdapter.getTagName(t),u=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===Ue.Marker)break;const{element:h}=l;if(this.treeAdapter.getTagName(h)===r&&this.treeAdapter.getNamespaceURI(h)===u){const m=this.treeAdapter.getAttrList(h);m.length===i&&n.push({idx:o,attrs:m})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<An)return;const a=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,a);if(n.length<An)return;const i=new Map(a.map(u=>[u.name,u.value]));let r=0;for(let u=0;u<n.length;u++){const o=n[u];o.attrs.every(l=>i.get(l.name)===l.value)&&(r+=1,r>=An&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(us)}pushElement(t,a){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ue.Element,element:t,token:a})}insertElementAfterBookmark(t,a){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Ue.Element,element:t,token:a})}removeEntry(t){const a=this.entries.indexOf(t);a>=0&&this.entries.splice(a,1)}clearToLastMarker(){const t=this.entries.indexOf(us);t>=0?this.entries.splice(0,t+1):this.entries.length=0}getElementEntryInScopeWithTagName(t){const a=this.entries.find(n=>n.type===Ue.Marker||this.treeAdapter.getTagName(n.element)===t);return a&&a.type===Ue.Element?a:null}getElementEntry(t){return this.entries.find(a=>a.type===Ue.Element&&a.element===t)}}const We={createDocument(){return{nodeName:"#document",mode:Ie.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,a){return{nodeName:e,tagName:e,attrs:a,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,a){const n=e.childNodes.indexOf(a);e.childNodes.splice(n,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,a,n){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=a,i.systemId=n;else{const r={nodeName:"#documentType",name:t,publicId:a,systemId:n,parentNode:null};We.appendChild(e,r)}},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 a=e.childNodes[e.childNodes.length-1];if(We.isTextNode(a)){a.value+=t;return}}We.appendChild(e,We.createTextNode(t))},insertTextBefore(e,t,a){const n=e.childNodes[e.childNodes.indexOf(a)-1];n&&We.isTextNode(n)?n.value+=t:We.insertBefore(e,We.createTextNode(t),a)},adoptAttributes(e,t){const a=new Set(e.attrs.map(n=>n.name));for(let n=0;n<t.length;n++)a.has(t[n].name)||e.attrs.push(t[n])},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}}},os="html",dl="about:legacy-compat",hl="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",cs=["+//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//"],fl=[...cs,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],ml=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ls=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],El=[...ls,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function ds(e,t){return t.some(a=>e.startsWith(a))}function pl(e){return e.name===os&&e.publicId===null&&(e.systemId===null||e.systemId===dl)}function Tl(e){if(e.name!==os)return Ie.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===hl)return Ie.QUIRKS;let{publicId:a}=e;if(a!==null){if(a=a.toLowerCase(),ml.has(a))return Ie.QUIRKS;let n=t===null?fl:cs;if(ds(a,n))return Ie.QUIRKS;if(n=t===null?ls:El,ds(a,n))return Ie.LIMITED_QUIRKS}return Ie.NO_QUIRKS}const hs={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},bl="definitionurl",gl="definitionURL",_l=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])),Al=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:C.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:C.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:C.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:C.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:C.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:C.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:C.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:C.XML}],["xml:space",{prefix:"xml",name:"space",namespace:C.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:C.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:C.XMLNS}]]),Nl=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])),Cl=new Set([s.B,s.BIG,s.BLOCKQUOTE,s.BODY,s.BR,s.CENTER,s.CODE,s.DD,s.DIV,s.DL,s.DT,s.EM,s.EMBED,s.H1,s.H2,s.H3,s.H4,s.H5,s.H6,s.HEAD,s.HR,s.I,s.IMG,s.LI,s.LISTING,s.MENU,s.META,s.NOBR,s.OL,s.P,s.PRE,s.RUBY,s.S,s.SMALL,s.SPAN,s.STRONG,s.STRIKE,s.SUB,s.SUP,s.TABLE,s.TT,s.U,s.UL,s.VAR]);function Il(e){const t=e.tagID;return t===s.FONT&&e.attrs.some(({name:n})=>n===ct.COLOR||n===ct.SIZE||n===ct.FACE)||Cl.has(t)}function fs(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===bl){e.attrs[t].name=gl;break}}function ms(e){for(let t=0;t<e.attrs.length;t++){const a=_l.get(e.attrs[t].name);a!=null&&(e.attrs[t].name=a)}}function Nn(e){for(let t=0;t<e.attrs.length;t++){const a=Al.get(e.attrs[t].name);a&&(e.attrs[t].prefix=a.prefix,e.attrs[t].name=a.name,e.attrs[t].namespace=a.namespace)}}function Sl(e){const t=Nl.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Aa(e.tagName))}function xl(e,t){return t===C.MATHML&&(e===s.MI||e===s.MO||e===s.MN||e===s.MS||e===s.MTEXT)}function Ol(e,t,a){if(t===C.MATHML&&e===s.ANNOTATION_XML){for(let n=0;n<a.length;n++)if(a[n].name===ct.ENCODING){const i=a[n].value.toLowerCase();return i===hs.TEXT_HTML||i===hs.APPLICATION_XML}}return t===C.SVG&&(e===s.FOREIGN_OBJECT||e===s.DESC||e===s.TITLE)}function Dl(e,t,a,n){return(!n||n===C.HTML)&&Ol(e,t,a)||(!n||n===C.MATHML)&&xl(e,t)}const Ll="hidden",yl=8,Rl=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 kl={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Es=new Set([s.TABLE,s.TBODY,s.TFOOT,s.THEAD,s.TR]),ps={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:We,onParseError:null};let Ts=class{constructor(t,a,n=null,i=null){this.fragmentContext=n,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={...ps,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=a??this.treeAdapter.createDocument(),this.tokenizer=new al(this.options,this),this.activeFormattingElements=new ll(this.treeAdapter),this.fragmentContextID=n?Aa(this.treeAdapter.getTagName(n)):s.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new cl(this.document,this.treeAdapter,this)}static parse(t,a){const n=new this(a);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,a){const n={...ps,...a};t??(t=n.treeAdapter.createElement(b.TEMPLATE,C.HTML,[]));const i=n.treeAdapter.createElement("documentmock",C.HTML,[]),r=new this(n,i,t);return r.fragmentContextID===s.TEMPLATE&&r.tmplInsertionModeStack.unshift(E.IN_TEMPLATE),r._initTokenizerForFragmentParsing(),r._insertFakeRootElement(),r._resetInsertionMode(),r._findFormInFragmentContext(),r}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),a=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,a),a}_err(t,a,n){var i;if(!this.onParseError)return;const r=(i=t.location)!==null&&i!==void 0?i:kl,u={code:a,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(u)}onItemPush(t,a,n){var i,r;(r=(i=this.treeAdapter).onItemPush)===null||r===void 0||r.call(i,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,a)}onItemPop(t,a){var n,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(n=this.treeAdapter).onItemPop)===null||i===void 0||i.call(n,t,this.openElements.current),a){let r,u;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,u=this.fragmentContextID):{current:r,currentTagId:u}=this.openElements,this._setContextModes(r,u)}}_setContextModes(t,a){const n=t===this.document||this.treeAdapter.getNamespaceURI(t)===C.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&!this._isIntegrationPoint(a,t)}_switchToTextParsing(t,a){this._insertElement(t,C.HTML),this.tokenizer.state=a,this.originalInsertionMode=this.insertionMode,this.insertionMode=E.TEXT}switchToPlaintextParsing(){this.insertionMode=E.TEXT,this.originalInsertionMode=E.IN_BODY,this.tokenizer.state=Ae.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===b.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==C.HTML))switch(this.fragmentContextID){case s.TITLE:case s.TEXTAREA:{this.tokenizer.state=Ae.RCDATA;break}case s.STYLE:case s.XMP:case s.IFRAME:case s.NOEMBED:case s.NOFRAMES:case s.NOSCRIPT:{this.tokenizer.state=Ae.RAWTEXT;break}case s.SCRIPT:{this.tokenizer.state=Ae.SCRIPT_DATA;break}case s.PLAINTEXT:{this.tokenizer.state=Ae.PLAINTEXT;break}}}_setDocumentType(t){const a=t.name||"",n=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,a,n,i),t.location){const u=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));u&&this.treeAdapter.setNodeSourceCodeLocation(u,t.location)}}_attachElementToTree(t,a){if(this.options.sourceCodeLocationInfo){const n=a&&{...a,startTag:a};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const n=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(n,t)}}_appendElement(t,a){const n=this.treeAdapter.createElement(t.tagName,a,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,a){const n=this.treeAdapter.createElement(t.tagName,a,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,a){const n=this.treeAdapter.createElement(t,C.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,a)}_insertTemplate(t){const a=this.treeAdapter.createElement(t.tagName,C.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(a,n),this._attachElementToTree(a,t.location),this.openElements.push(a,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(b.HTML,C.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,s.HTML)}_appendCommentNode(t,a){const n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(a,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let a,n;if(this._shouldFosterParentOnInsertion()?({parent:a,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(a,t.chars,n):this.treeAdapter.insertText(a,t.chars)):(a=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(a,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(a),r=n?i.lastIndexOf(n):i.length,u=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(u)){const{endLine:l,endCol:h,endOffset:m}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(u,{endLine:l,endCol:h,endOffset:m})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(u,t.location)}_adoptNodes(t,a){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(a,n)}_setEndLocation(t,a){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&a.location){const n=a.location,i=this.treeAdapter.getTagName(t),r=a.type===W.END_TAG&&i===a.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let a,n;return this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,n=this.fragmentContextID):{current:a,currentTagId:n}=this.openElements,t.tagID===s.SVG&&this.treeAdapter.getTagName(a)===b.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(a)===C.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===s.MGLYPH||t.tagID===s.MALIGNMARK)&&!this._isIntegrationPoint(n,a,C.HTML)}_processToken(t){switch(t.type){case W.CHARACTER:{this.onCharacter(t);break}case W.NULL_CHARACTER:{this.onNullCharacter(t);break}case W.COMMENT:{this.onComment(t);break}case W.DOCTYPE:{this.onDoctype(t);break}case W.START_TAG:{this._processStartTag(t);break}case W.END_TAG:{this.onEndTag(t);break}case W.EOF:{this.onEof(t);break}case W.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,a,n){const i=this.treeAdapter.getNamespaceURI(a),r=this.treeAdapter.getAttrList(a);return Dl(t,i,r,n)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const a=this.activeFormattingElements.entries.findIndex(i=>i.type===Ue.Marker||this.openElements.contains(i.element)),n=a<0?t-1:a-1;for(let i=n;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=E.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(s.P),this.openElements.popUntilTagNamePopped(s.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case s.TR:{this.insertionMode=E.IN_ROW;return}case s.TBODY:case s.THEAD:case s.TFOOT:{this.insertionMode=E.IN_TABLE_BODY;return}case s.CAPTION:{this.insertionMode=E.IN_CAPTION;return}case s.COLGROUP:{this.insertionMode=E.IN_COLUMN_GROUP;return}case s.TABLE:{this.insertionMode=E.IN_TABLE;return}case s.BODY:{this.insertionMode=E.IN_BODY;return}case s.FRAMESET:{this.insertionMode=E.IN_FRAMESET;return}case s.SELECT:{this._resetInsertionModeForSelect(t);return}case s.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case s.HTML:{this.insertionMode=this.headElement?E.AFTER_HEAD:E.BEFORE_HEAD;return}case s.TD:case s.TH:{if(t>0){this.insertionMode=E.IN_CELL;return}break}case s.HEAD:{if(t>0){this.insertionMode=E.IN_HEAD;return}break}}this.insertionMode=E.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let a=t-1;a>0;a--){const n=this.openElements.tagIDs[a];if(n===s.TEMPLATE)break;if(n===s.TABLE){this.insertionMode=E.IN_SELECT_IN_TABLE;return}}this.insertionMode=E.IN_SELECT}_isElementCausesFosterParenting(t){return Es.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const a=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case s.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(a)===C.HTML)return{parent:this.treeAdapter.getTemplateContent(a),beforeElement:null};break}case s.TABLE:{const n=this.treeAdapter.getParentNode(a);return n?{parent:n,beforeElement:a}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const a=this._findFosterParentingLocation();a.beforeElement?this.treeAdapter.insertBefore(a.parent,t,a.beforeElement):this.treeAdapter.appendChild(a.parent,t)}_isSpecialElement(t,a){const n=this.treeAdapter.getNamespaceURI(t);return zc[n].has(a)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){od(this,t);return}switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(this,t);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:{gs(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:{xn(this,t);break}case E.IN_TABLE_TEXT:{Os(this,t);break}case E.IN_COLUMN_GROUP:{xa(this,t);break}case E.AFTER_BODY:{La(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){ud(this,t);return}switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(this,t);break}case E.TEXT:{this._insertCharacters(t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{xn(this,t);break}case E.IN_COLUMN_GROUP:{xa(this,t);break}case E.AFTER_BODY:{La(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){In(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:{In(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.AFTER_BODY:{Fl(this,t);break}case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{Hl(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case E.INITIAL:{Vl(this,t);break}case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:{this._err(t,g.misplacedDoctype);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,g.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?cd(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Yl(this,t);break}case E.BEFORE_HEAD:{$l(this,t);break}case E.IN_HEAD:{ke(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Xl(this,t);break}case E.AFTER_HEAD:{jl(this,t);break}case E.IN_BODY:{pe(this,t);break}case E.IN_TABLE:{_t(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_CAPTION:{W0(this,t);break}case E.IN_COLUMN_GROUP:{On(this,t);break}case E.IN_TABLE_BODY:{Oa(this,t);break}case E.IN_ROW:{Da(this,t);break}case E.IN_CELL:{Q0(this,t);break}case E.IN_SELECT:{ys(this,t);break}case E.IN_SELECT_IN_TABLE:{z0(this,t);break}case E.IN_TEMPLATE:{Z0(this,t);break}case E.AFTER_BODY:{ed(this,t);break}case E.IN_FRAMESET:{td(this,t);break}case E.AFTER_FRAMESET:{nd(this,t);break}case E.AFTER_AFTER_BODY:{sd(this,t);break}case E.AFTER_AFTER_FRAMESET:{rd(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?ld(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{ql(this,t);break}case E.BEFORE_HEAD:{Wl(this,t);break}case E.IN_HEAD:{Gl(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Ql(this,t);break}case E.AFTER_HEAD:{zl(this,t);break}case E.IN_BODY:{Sa(this,t);break}case E.TEXT:{v0(this,t);break}case E.IN_TABLE:{Wt(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_CAPTION:{G0(this,t);break}case E.IN_COLUMN_GROUP:{X0(this,t);break}case E.IN_TABLE_BODY:{Dn(this,t);break}case E.IN_ROW:{Ls(this,t);break}case E.IN_CELL:{j0(this,t);break}case E.IN_SELECT:{Rs(this,t);break}case E.IN_SELECT_IN_TABLE:{K0(this,t);break}case E.IN_TEMPLATE:{J0(this,t);break}case E.AFTER_BODY:{Ms(this,t);break}case E.IN_FRAMESET:{ad(this,t);break}case E.AFTER_FRAMESET:{id(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onEof(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(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:{Ss(this,t);break}case E.TEXT:{B0(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_TEMPLATE:{ks(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:{Sn(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===d.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:{bs(this,t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{xn(this,t);break}case E.IN_TABLE_TEXT:{xs(this,t);break}}}};function Ml(e,t){let a=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return a?e.openElements.contains(a.element)?e.openElements.hasInScope(t.tagID)||(a=null):(e.activeFormattingElements.removeEntry(a),a=null):Is(e,t),a}function Pl(e,t){let a=null,n=e.openElements.stackTop;for(;n>=0;n--){const i=e.openElements.items[n];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[n])&&(a=i)}return a||(e.openElements.shortenToLength(n<0?0:n),e.activeFormattingElements.removeEntry(t)),a}function vl(e,t,a){let n=t,i=e.openElements.getCommonAncestor(t);for(let r=0,u=i;u!==a;r++,u=i){i=e.openElements.getCommonAncestor(u);const o=e.activeFormattingElements.getElementEntry(u),l=o&&r>=Rl;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(u)):(u=Bl(e,o),n===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(n),e.treeAdapter.appendChild(u,n),n=u)}return n}function Bl(e,t){const a=e.treeAdapter.getNamespaceURI(t.element),n=e.treeAdapter.createElement(t.token.tagName,a,t.token.attrs);return e.openElements.replace(t.element,n),t.element=n,n}function wl(e,t,a){const n=e.treeAdapter.getTagName(t),i=Aa(n);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(a);else{const r=e.treeAdapter.getNamespaceURI(t);i===s.TEMPLATE&&r===C.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,a)}}function Ul(e,t,a){const n=e.treeAdapter.getNamespaceURI(a.element),{token:i}=a,r=e.treeAdapter.createElement(i.tagName,n,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(a),e.openElements.remove(a.element),e.openElements.insertAfter(t,r,i.tagID)}function Cn(e,t){for(let a=0;a<yl;a++){const n=Ml(e,t);if(!n)break;const i=Pl(e,n);if(!i)break;e.activeFormattingElements.bookmark=n;const r=vl(e,i,n.element),u=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(r),u&&wl(e,u,r),Ul(e,i,n)}}function In(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Fl(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Hl(e,t){e._appendCommentNode(t,e.document)}function Sn(e,t){if(e.stopped=!0,t.location){const a=e.fragmentContext?0:2;for(let n=e.openElements.stackTop;n>=a;n--)e._setEndLocation(e.openElements.items[n],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const n=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(n);if(i&&!i.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],u=e.treeAdapter.getNodeSourceCodeLocation(r);u&&!u.endTag&&e._setEndLocation(r,t)}}}}function Vl(e,t){e._setDocumentType(t);const a=t.forceQuirks?Ie.QUIRKS:Tl(t);pl(t)||e._err(t,g.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,a),e.insertionMode=E.BEFORE_HTML}function Ft(e,t){e._err(t,g.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ie.QUIRKS),e.insertionMode=E.BEFORE_HTML,e._processToken(t)}function Yl(e,t){t.tagID===s.HTML?(e._insertElement(t,C.HTML),e.insertionMode=E.BEFORE_HEAD):Ht(e,t)}function ql(e,t){const a=t.tagID;(a===s.HTML||a===s.HEAD||a===s.BODY||a===s.BR)&&Ht(e,t)}function Ht(e,t){e._insertFakeRootElement(),e.insertionMode=E.BEFORE_HEAD,e._processToken(t)}function $l(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.HEAD:{e._insertElement(t,C.HTML),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD;break}default:Vt(e,t)}}function Wl(e,t){const a=t.tagID;a===s.HEAD||a===s.BODY||a===s.HTML||a===s.BR?Vt(e,t):e._err(t,g.endTagWithoutMatchingOpenElement)}function Vt(e,t){e._insertFakeElement(b.HEAD,s.HEAD),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD,e._processToken(t)}function ke(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.TITLE:{e._switchToTextParsing(t,Ae.RCDATA);break}case s.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Ae.RAWTEXT):(e._insertElement(t,C.HTML),e.insertionMode=E.IN_HEAD_NO_SCRIPT);break}case s.NOFRAMES:case s.STYLE:{e._switchToTextParsing(t,Ae.RAWTEXT);break}case s.SCRIPT:{e._switchToTextParsing(t,Ae.SCRIPT_DATA);break}case s.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=E.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(E.IN_TEMPLATE);break}case s.HEAD:{e._err(t,g.misplacedStartTagForHeadElement);break}default:Yt(e,t)}}function Gl(e,t){switch(t.tagID){case s.HEAD:{e.openElements.pop(),e.insertionMode=E.AFTER_HEAD;break}case s.BODY:case s.BR:case s.HTML:{Yt(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function lt(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==s.TEMPLATE&&e._err(t,g.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(s.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,g.endTagWithoutMatchingOpenElement)}function Yt(e,t){e.openElements.pop(),e.insertionMode=E.AFTER_HEAD,e._processToken(t)}function Xl(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BASEFONT:case s.BGSOUND:case s.HEAD:case s.LINK:case s.META:case s.NOFRAMES:case s.STYLE:{ke(e,t);break}case s.NOSCRIPT:{e._err(t,g.nestedNoscriptInHead);break}default:qt(e,t)}}function Ql(e,t){switch(t.tagID){case s.NOSCRIPT:{e.openElements.pop(),e.insertionMode=E.IN_HEAD;break}case s.BR:{qt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function qt(e,t){const a=t.type===W.EOF?g.openElementsLeftAfterEof:g.disallowedContentInNoscriptInHead;e._err(t,a),e.openElements.pop(),e.insertionMode=E.IN_HEAD,e._processToken(t)}function jl(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BODY:{e._insertElement(t,C.HTML),e.framesetOk=!1,e.insertionMode=E.IN_BODY;break}case s.FRAMESET:{e._insertElement(t,C.HTML),e.insertionMode=E.IN_FRAMESET;break}case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:case s.NOFRAMES:case s.SCRIPT:case s.STYLE:case s.TEMPLATE:case s.TITLE:{e._err(t,g.abandonedHeadElementChild),e.openElements.push(e.headElement,s.HEAD),ke(e,t),e.openElements.remove(e.headElement);break}case s.HEAD:{e._err(t,g.misplacedStartTagForHeadElement);break}default:$t(e,t)}}function zl(e,t){switch(t.tagID){case s.BODY:case s.HTML:case s.BR:{$t(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function $t(e,t){e._insertFakeElement(b.BODY,s.BODY),e.insertionMode=E.IN_BODY,Ia(e,t)}function Ia(e,t){switch(t.type){case W.CHARACTER:{gs(e,t);break}case W.WHITESPACE_CHARACTER:{bs(e,t);break}case W.COMMENT:{In(e,t);break}case W.START_TAG:{pe(e,t);break}case W.END_TAG:{Sa(e,t);break}case W.EOF:{Ss(e,t);break}}}function bs(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function gs(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Kl(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Zl(e,t){const a=e.openElements.tryPeekProperlyNestedBodyElement();a&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(a,t.attrs))}function Jl(e,t){const a=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&a&&(e.treeAdapter.detachNode(a),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_FRAMESET)}function e0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML)}function t0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),_n.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,C.HTML)}function a0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function n0(e,t){const a=e.openElements.tmplCount>0;(!e.formElement||a)&&(e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),a||(e.formElement=e.openElements.current))}function i0(e,t){e.framesetOk=!1;const a=t.tagID;for(let n=e.openElements.stackTop;n>=0;n--){const i=e.openElements.tagIDs[n];if(a===s.LI&&i===s.LI||(a===s.DD||a===s.DT)&&(i===s.DD||i===s.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==s.ADDRESS&&i!==s.DIV&&i!==s.P&&e._isSpecialElement(e.openElements.items[n],i))break}e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML)}function s0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.tokenizer.state=Ae.PLAINTEXT}function r0(e,t){e.openElements.hasInScope(s.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.framesetOk=!1}function u0(e,t){const a=e.activeFormattingElements.getElementEntryInScopeWithTagName(b.A);a&&(Cn(e,t),e.openElements.remove(a.element),e.activeFormattingElements.removeEntry(a)),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function o0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function c0(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(s.NOBR)&&(Cn(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function l0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function d0(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ie.QUIRKS&&e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.framesetOk=!1,e.insertionMode=E.IN_TABLE}function _s(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,C.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function As(e){const t=Ji(e,ct.TYPE);return t!=null&&t.toLowerCase()===Ll}function h0(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,C.HTML),As(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function f0(e,t){e._appendElement(t,C.HTML),t.ackSelfClosing=!0}function m0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._appendElement(t,C.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function E0(e,t){t.tagName=b.IMG,t.tagID=s.IMG,_s(e,t)}function p0(e,t){e._insertElement(t,C.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Ae.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=E.TEXT}function T0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Ae.RAWTEXT)}function b0(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Ae.RAWTEXT)}function Ns(e,t){e._switchToTextParsing(t,Ae.RAWTEXT)}function g0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.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 _0(e,t){e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML)}function A0(e,t){e.openElements.hasInScope(s.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,C.HTML)}function N0(e,t){e.openElements.hasInScope(s.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(s.RTC),e._insertElement(t,C.HTML)}function C0(e,t){e._reconstructActiveFormattingElements(),fs(t),Nn(t),t.selfClosing?e._appendElement(t,C.MATHML):e._insertElement(t,C.MATHML),t.ackSelfClosing=!0}function I0(e,t){e._reconstructActiveFormattingElements(),ms(t),Nn(t),t.selfClosing?e._appendElement(t,C.SVG):e._insertElement(t,C.SVG),t.ackSelfClosing=!0}function Cs(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML)}function pe(e,t){switch(t.tagID){case s.I:case s.S:case s.B:case s.U:case s.EM:case s.TT:case s.BIG:case s.CODE:case s.FONT:case s.SMALL:case s.STRIKE:case s.STRONG:{o0(e,t);break}case s.A:{u0(e,t);break}case s.H1:case s.H2:case s.H3:case s.H4:case s.H5:case s.H6:{t0(e,t);break}case s.P:case s.DL:case s.OL:case s.UL:case s.DIV:case s.DIR:case s.NAV:case s.MAIN:case s.MENU:case s.ASIDE:case s.CENTER:case s.FIGURE:case s.FOOTER:case s.HEADER:case s.HGROUP:case s.DIALOG:case s.DETAILS:case s.ADDRESS:case s.ARTICLE:case s.SEARCH:case s.SECTION:case s.SUMMARY:case s.FIELDSET:case s.BLOCKQUOTE:case s.FIGCAPTION:{e0(e,t);break}case s.LI:case s.DD:case s.DT:{i0(e,t);break}case s.BR:case s.IMG:case s.WBR:case s.AREA:case s.EMBED:case s.KEYGEN:{_s(e,t);break}case s.HR:{m0(e,t);break}case s.RB:case s.RTC:{A0(e,t);break}case s.RT:case s.RP:{N0(e,t);break}case s.PRE:case s.LISTING:{a0(e,t);break}case s.XMP:{T0(e,t);break}case s.SVG:{I0(e,t);break}case s.HTML:{Kl(e,t);break}case s.BASE:case s.LINK:case s.META:case s.STYLE:case s.TITLE:case s.SCRIPT:case s.BGSOUND:case s.BASEFONT:case s.TEMPLATE:{ke(e,t);break}case s.BODY:{Zl(e,t);break}case s.FORM:{n0(e,t);break}case s.NOBR:{c0(e,t);break}case s.MATH:{C0(e,t);break}case s.TABLE:{d0(e,t);break}case s.INPUT:{h0(e,t);break}case s.PARAM:case s.TRACK:case s.SOURCE:{f0(e,t);break}case s.IMAGE:{E0(e,t);break}case s.BUTTON:{r0(e,t);break}case s.APPLET:case s.OBJECT:case s.MARQUEE:{l0(e,t);break}case s.IFRAME:{b0(e,t);break}case s.SELECT:{g0(e,t);break}case s.OPTION:case s.OPTGROUP:{_0(e,t);break}case s.NOEMBED:case s.NOFRAMES:{Ns(e,t);break}case s.FRAMESET:{Jl(e,t);break}case s.TEXTAREA:{p0(e,t);break}case s.NOSCRIPT:{e.options.scriptingEnabled?Ns(e,t):Cs(e,t);break}case s.PLAINTEXT:{s0(e,t);break}case s.COL:case s.TH:case s.TD:case s.TR:case s.HEAD:case s.FRAME:case s.TBODY:case s.TFOOT:case s.THEAD:case s.CAPTION:case s.COLGROUP:break;default:Cs(e,t)}}function S0(e,t){if(e.openElements.hasInScope(s.BODY)&&(e.insertionMode=E.AFTER_BODY,e.options.sourceCodeLocationInfo)){const a=e.openElements.tryPeekProperlyNestedBodyElement();a&&e._setEndLocation(a,t)}}function x0(e,t){e.openElements.hasInScope(s.BODY)&&(e.insertionMode=E.AFTER_BODY,Ms(e,t))}function O0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a))}function D0(e){const t=e.openElements.tmplCount>0,{formElement:a}=e;t||(e.formElement=null),(a||t)&&e.openElements.hasInScope(s.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(s.FORM):a&&e.openElements.remove(a))}function L0(e){e.openElements.hasInButtonScope(s.P)||e._insertFakeElement(b.P,s.P),e._closePElement()}function y0(e){e.openElements.hasInListItemScope(s.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(s.LI),e.openElements.popUntilTagNamePopped(s.LI))}function R0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a))}function k0(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function M0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a),e.activeFormattingElements.clearToLastMarker())}function P0(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(b.BR,s.BR),e.openElements.pop(),e.framesetOk=!1}function Is(e,t){const a=t.tagName,n=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],u=e.openElements.tagIDs[i];if(n===u&&(n!==s.UNKNOWN||e.treeAdapter.getTagName(r)===a)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,u))break}}function Sa(e,t){switch(t.tagID){case s.A:case s.B:case s.I:case s.S:case s.U:case s.EM:case s.TT:case s.BIG:case s.CODE:case s.FONT:case s.NOBR:case s.SMALL:case s.STRIKE:case s.STRONG:{Cn(e,t);break}case s.P:{L0(e);break}case s.DL:case s.UL:case s.OL:case s.DIR:case s.DIV:case s.NAV:case s.PRE:case s.MAIN:case s.MENU:case s.ASIDE:case s.BUTTON:case s.CENTER:case s.FIGURE:case s.FOOTER:case s.HEADER:case s.HGROUP:case s.DIALOG:case s.ADDRESS:case s.ARTICLE:case s.DETAILS:case s.SEARCH:case s.SECTION:case s.SUMMARY:case s.LISTING:case s.FIELDSET:case s.BLOCKQUOTE:case s.FIGCAPTION:{O0(e,t);break}case s.LI:{y0(e);break}case s.DD:case s.DT:{R0(e,t);break}case s.H1:case s.H2:case s.H3:case s.H4:case s.H5:case s.H6:{k0(e);break}case s.BR:{P0(e);break}case s.BODY:{S0(e,t);break}case s.HTML:{x0(e,t);break}case s.FORM:{D0(e);break}case s.APPLET:case s.OBJECT:case s.MARQUEE:{M0(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:Is(e,t)}}function Ss(e,t){e.tmplInsertionModeStack.length>0?ks(e,t):Sn(e,t)}function v0(e,t){var a;t.tagID===s.SCRIPT&&((a=e.scriptHandler)===null||a===void 0||a.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function B0(e,t){e._err(t,g.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function xn(e,t){if(Es.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 W.CHARACTER:{Os(e,t);break}case W.WHITESPACE_CHARACTER:{xs(e,t);break}}else Gt(e,t)}function w0(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_CAPTION}function U0(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_COLUMN_GROUP}function F0(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(b.COLGROUP,s.COLGROUP),e.insertionMode=E.IN_COLUMN_GROUP,On(e,t)}function H0(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_TABLE_BODY}function V0(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(b.TBODY,s.TBODY),e.insertionMode=E.IN_TABLE_BODY,Oa(e,t)}function Y0(e,t){e.openElements.hasInTableScope(s.TABLE)&&(e.openElements.popUntilTagNamePopped(s.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function q0(e,t){As(t)?e._appendElement(t,C.HTML):Gt(e,t),t.ackSelfClosing=!0}function $0(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,C.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function _t(e,t){switch(t.tagID){case s.TD:case s.TH:case s.TR:{V0(e,t);break}case s.STYLE:case s.SCRIPT:case s.TEMPLATE:{ke(e,t);break}case s.COL:{F0(e,t);break}case s.FORM:{$0(e,t);break}case s.TABLE:{Y0(e,t);break}case s.TBODY:case s.TFOOT:case s.THEAD:{H0(e,t);break}case s.INPUT:{q0(e,t);break}case s.CAPTION:{w0(e,t);break}case s.COLGROUP:{U0(e,t);break}default:Gt(e,t)}}function Wt(e,t){switch(t.tagID){case s.TABLE:{e.openElements.hasInTableScope(s.TABLE)&&(e.openElements.popUntilTagNamePopped(s.TABLE),e._resetInsertionMode());break}case s.TEMPLATE:{lt(e,t);break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TBODY:case s.TD:case s.TFOOT:case s.TH:case s.THEAD:case s.TR:break;default:Gt(e,t)}}function Gt(e,t){const a=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Ia(e,t),e.fosterParentingEnabled=a}function xs(e,t){e.pendingCharacterTokens.push(t)}function Os(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Xt(e,t){let a=0;if(e.hasNonWhitespacePendingCharacterToken)for(;a<e.pendingCharacterTokens.length;a++)Gt(e,e.pendingCharacterTokens[a]);else for(;a<e.pendingCharacterTokens.length;a++)e._insertCharacters(e.pendingCharacterTokens[a]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Ds=new Set([s.CAPTION,s.COL,s.COLGROUP,s.TBODY,s.TD,s.TFOOT,s.TH,s.THEAD,s.TR]);function W0(e,t){const a=t.tagID;Ds.has(a)?e.openElements.hasInTableScope(s.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,_t(e,t)):pe(e,t)}function G0(e,t){const a=t.tagID;switch(a){case s.CAPTION:case s.TABLE:{e.openElements.hasInTableScope(s.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,a===s.TABLE&&Wt(e,t));break}case s.BODY:case s.COL:case s.COLGROUP:case s.HTML:case s.TBODY:case s.TD:case s.TFOOT:case s.TH:case s.THEAD:case s.TR:break;default:Sa(e,t)}}function On(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.COL:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.TEMPLATE:{ke(e,t);break}default:xa(e,t)}}function X0(e,t){switch(t.tagID){case s.COLGROUP:{e.openElements.currentTagId===s.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case s.TEMPLATE:{lt(e,t);break}case s.COL:break;default:xa(e,t)}}function xa(e,t){e.openElements.currentTagId===s.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE,e._processToken(t))}function Oa(e,t){switch(t.tagID){case s.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_ROW;break}case s.TH:case s.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(b.TR,s.TR),e.insertionMode=E.IN_ROW,Da(e,t);break}case s.CAPTION:case s.COL:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,_t(e,t));break}default:_t(e,t)}}function Dn(e,t){const a=t.tagID;switch(t.tagID){case s.TBODY:case s.TFOOT:case s.THEAD:{e.openElements.hasInTableScope(a)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case s.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,Wt(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TD:case s.TH:case s.TR:break;default:Wt(e,t)}}function Da(e,t){switch(t.tagID){case s.TH:case s.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_CELL,e.activeFormattingElements.insertMarker();break}case s.CAPTION:case s.COL:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:case s.TR:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Oa(e,t));break}default:_t(e,t)}}function Ls(e,t){switch(t.tagID){case s.TR:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY);break}case s.TABLE:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Dn(e,t));break}case s.TBODY:case s.TFOOT:case s.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(s.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Dn(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TD:case s.TH:break;default:Wt(e,t)}}function Q0(e,t){const a=t.tagID;Ds.has(a)?(e.openElements.hasInTableScope(s.TD)||e.openElements.hasInTableScope(s.TH))&&(e._closeTableCell(),Da(e,t)):pe(e,t)}function j0(e,t){const a=t.tagID;switch(a){case s.TD:case s.TH:{e.openElements.hasInTableScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_ROW);break}case s.TABLE:case s.TBODY:case s.TFOOT:case s.THEAD:case s.TR:{e.openElements.hasInTableScope(a)&&(e._closeTableCell(),Ls(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:break;default:Sa(e,t)}}function ys(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.OPTION:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e._insertElement(t,C.HTML);break}case s.OPTGROUP:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop(),e._insertElement(t,C.HTML);break}case s.HR:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop(),e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.INPUT:case s.KEYGEN:case s.TEXTAREA:case s.SELECT:{e.openElements.hasInSelectScope(s.SELECT)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),t.tagID!==s.SELECT&&e._processStartTag(t));break}case s.SCRIPT:case s.TEMPLATE:{ke(e,t);break}}}function Rs(e,t){switch(t.tagID){case s.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===s.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===s.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop();break}case s.OPTION:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop();break}case s.SELECT:{e.openElements.hasInSelectScope(s.SELECT)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode());break}case s.TEMPLATE:{lt(e,t);break}}}function z0(e,t){const a=t.tagID;a===s.CAPTION||a===s.TABLE||a===s.TBODY||a===s.TFOOT||a===s.THEAD||a===s.TR||a===s.TD||a===s.TH?(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ys(e,t)}function K0(e,t){const a=t.tagID;a===s.CAPTION||a===s.TABLE||a===s.TBODY||a===s.TFOOT||a===s.THEAD||a===s.TR||a===s.TD||a===s.TH?e.openElements.hasInTableScope(a)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Rs(e,t)}function Z0(e,t){switch(t.tagID){case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:case s.NOFRAMES:case s.SCRIPT:case s.STYLE:case s.TEMPLATE:case s.TITLE:{ke(e,t);break}case s.CAPTION:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:{e.tmplInsertionModeStack[0]=E.IN_TABLE,e.insertionMode=E.IN_TABLE,_t(e,t);break}case s.COL:{e.tmplInsertionModeStack[0]=E.IN_COLUMN_GROUP,e.insertionMode=E.IN_COLUMN_GROUP,On(e,t);break}case s.TR:{e.tmplInsertionModeStack[0]=E.IN_TABLE_BODY,e.insertionMode=E.IN_TABLE_BODY,Oa(e,t);break}case s.TD:case s.TH:{e.tmplInsertionModeStack[0]=E.IN_ROW,e.insertionMode=E.IN_ROW,Da(e,t);break}default:e.tmplInsertionModeStack[0]=E.IN_BODY,e.insertionMode=E.IN_BODY,pe(e,t)}}function J0(e,t){t.tagID===s.TEMPLATE&&lt(e,t)}function ks(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(s.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Sn(e,t)}function ed(e,t){t.tagID===s.HTML?pe(e,t):La(e,t)}function Ms(e,t){var a;if(t.tagID===s.HTML){if(e.fragmentContext||(e.insertionMode=E.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===s.HTML){e._setEndLocation(e.openElements.items[0],t);const n=e.openElements.items[1];n&&!(!((a=e.treeAdapter.getNodeSourceCodeLocation(n))===null||a===void 0)&&a.endTag)&&e._setEndLocation(n,t)}}else La(e,t)}function La(e,t){e.insertionMode=E.IN_BODY,Ia(e,t)}function td(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.FRAMESET:{e._insertElement(t,C.HTML);break}case s.FRAME:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.NOFRAMES:{ke(e,t);break}}}function ad(e,t){t.tagID===s.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==s.FRAMESET&&(e.insertionMode=E.AFTER_FRAMESET))}function nd(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.NOFRAMES:{ke(e,t);break}}}function id(e,t){t.tagID===s.HTML&&(e.insertionMode=E.AFTER_AFTER_FRAMESET)}function sd(e,t){t.tagID===s.HTML?pe(e,t):ya(e,t)}function ya(e,t){e.insertionMode=E.IN_BODY,Ia(e,t)}function rd(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.NOFRAMES:{ke(e,t);break}}}function ud(e,t){t.chars=K,e._insertCharacters(t)}function od(e,t){e._insertCharacters(t),e.framesetOk=!1}function Ps(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==C.HTML&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function cd(e,t){if(Il(t))Ps(e),e._startTagOutsideForeignContent(t);else{const a=e._getAdjustedCurrentElement(),n=e.treeAdapter.getNamespaceURI(a);n===C.MATHML?fs(t):n===C.SVG&&(Sl(t),ms(t)),Nn(t),t.selfClosing?e._appendElement(t,n):e._insertElement(t,n),t.ackSelfClosing=!0}}function ld(e,t){if(t.tagID===s.P||t.tagID===s.BR){Ps(e),e._endTagOutsideForeignContent(t);return}for(let a=e.openElements.stackTop;a>0;a--){const n=e.openElements.items[a];if(e.treeAdapter.getNamespaceURI(n)===C.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(n);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(a);break}}}const dd=new Set([b.AREA,b.BASE,b.BASEFONT,b.BGSOUND,b.BR,b.COL,b.EMBED,b.FRAME,b.HR,b.IMG,b.INPUT,b.KEYGEN,b.LINK,b.META,b.PARAM,b.SOURCE,b.TRACK,b.WBR]);function hd(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===C.HTML&&dd.has(t.treeAdapter.getTagName(e))}const fd={treeAdapter:We,scriptingEnabled:!0};function md(e,t){const a={...fd,...t};return vs(e,a)}function Ed(e,t){let a="";const n=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===b.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===C.HTML?t.treeAdapter.getTemplateContent(e):e,i=t.treeAdapter.getChildNodes(n);if(i)for(const r of i)a+=vs(r,t);return a}function vs(e,t){return t.treeAdapter.isElementNode(e)?pd(e,t):t.treeAdapter.isTextNode(e)?bd(e,t):t.treeAdapter.isCommentNode(e)?gd(e,t):t.treeAdapter.isDocumentTypeNode(e)?_d(e,t):""}function pd(e,t){const a=t.treeAdapter.getTagName(e);return`<${a}${Td(e,t)}>${hd(e,t)?"":`${Ed(e,t)}</${a}>`}`}function Td(e,{treeAdapter:t}){let a="";for(const n of t.getAttrList(e)){if(a+=" ",n.namespace)switch(n.namespace){case C.XML:{a+=`xml:${n.name}`;break}case C.XMLNS:{n.name!=="xmlns"&&(a+="xmlns:"),a+=n.name;break}case C.XLINK:{a+=`xlink:${n.name}`;break}default:a+=`${n.prefix}:${n.name}`}else a+=n.name;a+=`="${ai(n.value)}"`}return a}function bd(e,t){const{treeAdapter:a}=t,n=a.getTextNodeContent(e),i=a.getParentNode(e),r=i&&a.isElementNode(i)&&a.getTagName(i);return r&&a.getNamespaceURI(i)===C.HTML&&Zc(r,t.scriptingEnabled)?n:ni(n)}function gd(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function _d(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function Ad(e,t){return Ts.parse(e,t)}function Nd(e,t,a){typeof e=="string"&&(a=t,t=e,e=null);const n=Ts.getFragmentParser(e,a);return n.tokenizer.write(t,!0),n.getFragment()}function Bs(e){const t=e.includes('"')?"'":'"';return t+e+t}function Cd(e,t,a){let n="!DOCTYPE ";return e&&(n+=e),t?n+=` PUBLIC ${Bs(t)}`:a&&(n+=" SYSTEM"),a&&(n+=` ${Bs(a)}`),n}const Je={isCommentNode:ia,isElementNode:v,isTextNode:we,createDocument(){const e=new it([]);return e["x-mode"]=Ie.NO_QUIRKS,e},createDocumentFragment(){return new it([])},createElement(e,t,a){const n=Object.create(null),i=Object.create(null),r=Object.create(null);for(let o=0;o<a.length;o++){const l=a[o].name;n[l]=a[o].value,i[l]=a[o].namespace,r[l]=a[o].prefix}const u=new Ha(e,n,[]);return u.namespace=t,u["x-attribsNamespace"]=i,u["x-attribsPrefix"]=r,u},createCommentNode(e){return new wa(e)},createTextNode(e){return new Dt(e)},appendChild(e,t){const a=e.children[e.children.length-1];a&&(a.next=t,t.prev=a),e.children.push(t),t.parent=e},insertBefore(e,t,a){const n=e.children.indexOf(a),{prev:i}=a;i&&(i.next=t,t.prev=i),a.prev=t,t.next=a,e.children.splice(n,0,t),t.parent=e},setTemplateContent(e,t){Je.appendChild(e,t)},getTemplateContent(e){return e.children[0]},setDocumentType(e,t,a,n){const i=Cd(t,a,n);let r=e.children.find(u=>Va(u)&&u.name==="!doctype");r?r.data=i??null:(r=new Ua("!doctype",i),Je.appendChild(e,r)),r["x-name"]=t,r["x-publicId"]=a,r["x-systemId"]=n},setDocumentMode(e,t){e["x-mode"]=t},getDocumentMode(e){return e["x-mode"]},detachNode(e){if(e.parent){const t=e.parent.children.indexOf(e),{prev:a,next:n}=e;e.prev=null,e.next=null,a&&(a.next=n),n&&(n.prev=a),e.parent.children.splice(t,1),e.parent=null}},insertText(e,t){const a=e.children[e.children.length-1];a&&we(a)?a.data+=t:Je.appendChild(e,Je.createTextNode(t))},insertTextBefore(e,t,a){const n=e.children[e.children.indexOf(a)-1];n&&we(n)?n.data+=t:Je.insertBefore(e,Je.createTextNode(t),a)},adoptAttributes(e,t){for(let a=0;a<t.length;a++){const n=t[a].name;e.attribs[n]===void 0&&(e.attribs[n]=t[a].value,e["x-attribsNamespace"][n]=t[a].namespace,e["x-attribsPrefix"][n]=t[a].prefix)}},getFirstChild(e){return e.children[0]},getChildNodes(e){return e.children},getParentNode(e){return e.parent},getAttrList(e){return e.attributes},getTagName(e){return e.name},getNamespaceURI(e){return e.namespace},getTextNodeContent(e){return e.data},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){var t;return(t=e["x-name"])!==null&&t!==void 0?t:""},getDocumentTypeNodePublicId(e){var t;return(t=e["x-publicId"])!==null&&t!==void 0?t:""},getDocumentTypeNodeSystemId(e){var t;return(t=e["x-systemId"])!==null&&t!==void 0?t:""},isDocumentTypeNode(e){return Va(e)&&e.name==="!doctype"},setNodeSourceCodeLocation(e,t){t&&(e.startIndex=t.startOffset,e.endIndex=t.endOffset),e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){t.endOffset!=null&&(e.endIndex=t.endOffset),e.sourceCodeLocation={...e.sourceCodeLocation,...t}}};function Id(e,t,a,n){var i;return(i=t.treeAdapter)!==null&&i!==void 0||(t.treeAdapter=Je),t.scriptingEnabled!==!1&&(t.scriptingEnabled=!0),a?Ad(e,t):Nd(n,e,t)}const Sd={treeAdapter:Je};function xd(e){const t="length"in e?e:[e];for(let n=0;n<t.length;n+=1){const i=t[n];Qe(i)&&Array.prototype.splice.call(t,n,1,...i.children)}let a="";for(let n=0;n<t.length;n+=1){const i=t[n];a+=md(i,Sd)}return a}var M;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(M||(M={}));var S;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(S||(S={}));function Ge(e){return e===M.Space||e===M.NewLine||e===M.Tab||e===M.FormFeed||e===M.CarriageReturn}function Ra(e){return e===M.Slash||e===M.Gt||Ge(e)}function Od(e){return e>=M.LowerA&&e<=M.LowerZ||e>=M.UpperA&&e<=M.UpperZ}var Fe;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(Fe||(Fe={}));const Ee={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class Dd{constructor({xmlMode:t=!1,decodeEntities:a=!0},n){this.cbs=n,this.state=S.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=S.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=a,this.entityDecoder=new Xa(t?Kn:qa,(i,r)=>this.emitCodePoint(i,r))}reset(){this.state=S.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=S.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===M.Lt||!this.decodeEntities&&this.fastForwardTo(M.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=S.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateSpecialStartSequence(t){const a=this.sequenceIndex===this.currentSequence.length;if(!(a?Ra(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!a){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=S.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===M.Gt||Ge(t)){const a=this.index-this.currentSequence.length;if(this.sectionStart<a){const n=this.index;this.index=a,this.cbs.ontext(this.sectionStart,a),this.index=n}this.isSpecial=!1,this.sectionStart=a+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Ee.TitleEnd?this.decodeEntities&&t===M.Amp&&this.startEntity():this.fastForwardTo(M.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===M.Lt)}stateCDATASequence(t){t===Ee.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ee.Cdata.length&&(this.state=S.InCommentLike,this.currentSequence=Ee.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=S.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ee.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=S.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!Ra(t):Od(t)}startSpecial(t,a){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=a,this.state=S.SpecialStartSequence}stateBeforeTagName(t){if(t===M.ExclamationMark)this.state=S.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===M.Questionmark)this.state=S.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const a=t|32;this.sectionStart=this.index,this.xmlMode?this.state=S.InTagName:a===Ee.ScriptEnd[2]?this.state=S.BeforeSpecialS:a===Ee.TitleEnd[2]?this.state=S.BeforeSpecialT:this.state=S.InTagName}else t===M.Slash?this.state=S.BeforeClosingTagName:(this.state=S.Text,this.stateText(t))}stateInTagName(t){Ra(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){Ge(t)||(t===M.Gt?this.state=S.Text:(this.state=this.isTagStartChar(t)?S.InClosingTagName:S.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===M.Gt||Ge(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=S.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===M.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=S.InSpecialTag,this.sequenceIndex=0):this.state=S.Text,this.sectionStart=this.index+1):t===M.Slash?this.state=S.InSelfClosingTag:Ge(t)||(this.state=S.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===M.Gt?(this.cbs.onselfclosingtag(this.index),this.state=S.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ge(t)||(this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===M.Eq||Ra(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=S.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===M.Eq?this.state=S.BeforeAttributeValue:t===M.Slash||t===M.Gt?(this.cbs.onattribend(Fe.NoValue,this.sectionStart),this.sectionStart=-1,this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t)):Ge(t)||(this.cbs.onattribend(Fe.NoValue,this.sectionStart),this.state=S.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===M.DoubleQuote?(this.state=S.InAttributeValueDq,this.sectionStart=this.index+1):t===M.SingleQuote?(this.state=S.InAttributeValueSq,this.sectionStart=this.index+1):Ge(t)||(this.sectionStart=this.index,this.state=S.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,a){t===a||!this.decodeEntities&&this.fastForwardTo(a)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(a===M.DoubleQuote?Fe.Double:Fe.Single,this.index+1),this.state=S.BeforeAttributeName):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,M.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,M.SingleQuote)}stateInAttributeValueNoQuotes(t){Ge(t)||t===M.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Fe.Unquoted,this.index),this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===M.OpeningSquareBracket?(this.state=S.CDATASequence,this.sequenceIndex=0):this.state=t===M.Dash?S.BeforeComment:S.InDeclaration}stateInDeclaration(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=S.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===M.Dash?(this.state=S.InCommentLike,this.currentSequence=Ee.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=S.InDeclaration}stateInSpecialComment(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const a=t|32;a===Ee.ScriptEnd[3]?this.startSpecial(Ee.ScriptEnd,4):a===Ee.StyleEnd[3]?this.startSpecial(Ee.StyleEnd,4):(this.state=S.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){const a=t|32;a===Ee.TitleEnd[3]?this.startSpecial(Ee.TitleEnd,4):a===Ee.TextareaEnd[3]?this.startSpecial(Ee.TextareaEnd,4):(this.state=S.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=S.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?xe.Strict:this.baseState===S.Text||this.baseState===S.InSpecialTag?xe.Legacy:xe.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,t===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===S.Text||this.state===S.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===S.InAttributeValueDq||this.state===S.InAttributeValueSq||this.state===S.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case S.Text:{this.stateText(t);break}case S.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case S.InSpecialTag:{this.stateInSpecialTag(t);break}case S.CDATASequence:{this.stateCDATASequence(t);break}case S.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case S.InAttributeName:{this.stateInAttributeName(t);break}case S.InCommentLike:{this.stateInCommentLike(t);break}case S.InSpecialComment:{this.stateInSpecialComment(t);break}case S.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case S.InTagName:{this.stateInTagName(t);break}case S.InClosingTagName:{this.stateInClosingTagName(t);break}case S.BeforeTagName:{this.stateBeforeTagName(t);break}case S.AfterAttributeName:{this.stateAfterAttributeName(t);break}case S.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case S.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case S.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case S.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case S.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case S.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case S.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case S.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case S.InDeclaration:{this.stateInDeclaration(t);break}case S.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case S.BeforeComment:{this.stateBeforeComment(t);break}case S.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case S.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===S.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===S.InCommentLike?this.currentSequence===Ee.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===S.InTagName||this.state===S.BeforeAttributeName||this.state===S.BeforeAttributeValue||this.state===S.AfterAttributeName||this.state===S.InAttributeName||this.state===S.InAttributeValueSq||this.state===S.InAttributeValueDq||this.state===S.InAttributeValueNq||this.state===S.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,a){this.baseState!==S.Text&&this.baseState!==S.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+a,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+a,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const At=new Set(["input","option","optgroup","select","button","datalist","textarea"]),j=new Set(["p"]),ws=new Set(["thead","tbody"]),Us=new Set(["dd","dt"]),Fs=new Set(["rt","rp"]),Ld=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",j],["h1",j],["h2",j],["h3",j],["h4",j],["h5",j],["h6",j],["select",At],["input",At],["output",At],["button",At],["datalist",At],["textarea",At],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Us],["dt",Us],["address",j],["article",j],["aside",j],["blockquote",j],["details",j],["div",j],["dl",j],["fieldset",j],["figcaption",j],["figure",j],["footer",j],["form",j],["header",j],["hr",j],["main",j],["nav",j],["ol",j],["pre",j],["section",j],["table",j],["ul",j],["rt",Fs],["rp",Fs],["tbody",ws],["tfoot",ws]]),yd=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Hs=new Set(["math","svg"]),Vs=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Rd=/\s|\//;class kd{constructor(t,a={}){var n,i,r,u,o,l;this.options=a,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(n=a.lowerCaseTags)!==null&&n!==void 0?n:this.htmlMode,this.lowerCaseAttributeNames=(i=a.lowerCaseAttributeNames)!==null&&i!==void 0?i:this.htmlMode,this.recognizeSelfClosing=(r=a.recognizeSelfClosing)!==null&&r!==void 0?r:!this.htmlMode,this.tokenizer=new((u=a.Tokenizer)!==null&&u!==void 0?u:Dd)(this.options,this),this.foreignContext=[!this.htmlMode],(l=(o=this.cbs).onparserinit)===null||l===void 0||l.call(o,this)}ontext(t,a){var n,i;const r=this.getSlice(t,a);this.endIndex=a-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,r),this.startIndex=a}ontextentity(t,a){var n,i;this.endIndex=a-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,Wa(t)),this.startIndex=a}isVoidElement(t){return this.htmlMode&&yd.has(t)}onopentagname(t,a){this.endIndex=a;let n=this.getSlice(t,a);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(t){var a,n,i,r;this.openTagStart=this.startIndex,this.tagname=t;const u=this.htmlMode&&Ld.get(t);if(u)for(;this.stack.length>0&&u.has(this.stack[0]);){const o=this.stack.shift();(n=(a=this.cbs).onclosetag)===null||n===void 0||n.call(a,o,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Hs.has(t)?this.foreignContext.unshift(!0):Vs.has(t)&&this.foreignContext.unshift(!1))),(r=(i=this.cbs).onopentagname)===null||r===void 0||r.call(i,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var a,n;this.startIndex=this.openTagStart,this.attribs&&((n=(a=this.cbs).onopentag)===null||n===void 0||n.call(a,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,a){var n,i,r,u,o,l,h,m;this.endIndex=a;let p=this.getSlice(t,a);if(this.lowerCaseTagNames&&(p=p.toLowerCase()),this.htmlMode&&(Hs.has(p)||Vs.has(p))&&this.foreignContext.shift(),this.isVoidElement(p))this.htmlMode&&p==="br"&&((u=(r=this.cbs).onopentagname)===null||u===void 0||u.call(r,"br"),(l=(o=this.cbs).onopentag)===null||l===void 0||l.call(o,"br",{},!0),(m=(h=this.cbs).onclosetag)===null||m===void 0||m.call(h,"br",!1));else{const T=this.stack.indexOf(p);if(T!==-1)for(let N=0;N<=T;N++){const I=this.stack.shift();(i=(n=this.cbs).onclosetag)===null||i===void 0||i.call(n,I,N!==T)}else this.htmlMode&&p==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=a+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var a,n;const i=this.tagname;this.endOpenTag(t),this.stack[0]===i&&((n=(a=this.cbs).onclosetag)===null||n===void 0||n.call(a,i,!t),this.stack.shift())}onattribname(t,a){this.startIndex=t;const n=this.getSlice(t,a);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(t,a){this.attribvalue+=this.getSlice(t,a)}onattribentity(t){this.attribvalue+=Wa(t)}onattribend(t,a){var n,i;this.endIndex=a,(i=(n=this.cbs).onattribute)===null||i===void 0||i.call(n,this.attribname,this.attribvalue,t===Fe.Double?'"':t===Fe.Single?"'":t===Fe.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const a=t.search(Rd);let n=a<0?t:t.substr(0,a);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(t,a){this.endIndex=a;const n=this.getSlice(t,a);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${i}`,`!${n}`)}this.startIndex=a+1}onprocessinginstruction(t,a){this.endIndex=a;const n=this.getSlice(t,a);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${i}`,`?${n}`)}this.startIndex=a+1}oncomment(t,a,n){var i,r,u,o;this.endIndex=a,(r=(i=this.cbs).oncomment)===null||r===void 0||r.call(i,this.getSlice(t,a-n)),(o=(u=this.cbs).oncommentend)===null||o===void 0||o.call(u),this.startIndex=a+1}oncdata(t,a,n){var i,r,u,o,l,h,m,p,T,N;this.endIndex=a;const I=this.getSlice(t,a-n);!this.htmlMode||this.options.recognizeCDATA?((r=(i=this.cbs).oncdatastart)===null||r===void 0||r.call(i),(o=(u=this.cbs).ontext)===null||o===void 0||o.call(u,I),(h=(l=this.cbs).oncdataend)===null||h===void 0||h.call(l)):((p=(m=this.cbs).oncomment)===null||p===void 0||p.call(m,`[CDATA[${I}]]`),(N=(T=this.cbs).oncommentend)===null||N===void 0||N.call(T)),this.startIndex=a+1}onend(){var t,a;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=0;n<this.stack.length;n++)this.cbs.onclosetag(this.stack[n],!0)}(a=(t=this.cbs).onend)===null||a===void 0||a.call(t)}reset(){var t,a,n,i;(a=(t=this.cbs).onreset)===null||a===void 0||a.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(i=(n=this.cbs).onparserinit)===null||i===void 0||i.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,a){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(t-this.bufferOffset,a-this.bufferOffset);for(;a-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,a-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var a,n;if(this.ended){(n=(a=this.cbs).onerror)===null||n===void 0||n.call(a,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var a,n;if(this.ended){(n=(a=this.cbs).onerror)===null||n===void 0||n.call(a,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}function Md(e,t){const a=new Pr(void 0,t);return new kd(a,t).end(e),a.root}const Pd=cc((e,t,a,n)=>t._useHtmlParser2?Md(e,t):Id(e,t,a,n)),Ys=Yc(Pd,(e,t)=>t._useHtmlParser2?sa(e,t):xd(e));var X=(e=>(e[e.None=0]="None",e[e.Text=1]="Text",e[e.Image=2]="Image",e[e.Video=3]="Video",e[e.Icon=4]="Icon",e[e.Link=5]="Link",e[e.Button=6]="Button",e[e.Block=10]="Block",e))(X||{});const vd=c.defineComponent({name:"GpImageUpload",props:{accept:{type:String,default:"image/*"},multiple:{type:Boolean,default:!1},maxCount:{type:Number,default:1/0},beforeUpload:Function,onChange:Function,showList:{type:Boolean,default:!1}},setup(e,{emit:t}){const a=c.ref(null),n=c.ref([]);return{inputRef:a,fileList:n,triggerInput:()=>{var o;(o=a.value)==null||o.click()},handleChange:async o=>{var p;const h=o.target.files;if(!h)return;const m=[];for(let T=0;T<h.length;T++){const N=h[T];if(e.beforeUpload&&await e.beforeUpload(N)===!1)continue;const I=`${Date.now()}-${N.name}`,y=URL.createObjectURL(N),D=document.createElement("img");D.src=y,document.body.appendChild(D),await new Promise(V=>{D.onload=V});const P=D.width,$=D.height;m.push({uid:I,name:N.name,status:"uploading",thumbUrl:y,file:N,width:P,height:$})}e.maxCount&&n.value.length+m.length>e.maxCount&&m.splice(e.maxCount-n.value.length),e.multiple?n.value=[...n.value,...m]:n.value=m.slice(0,1),(p=e.onChange)==null||p.call(e,n.value),t("update:fileList",n.value),a.value&&(a.value.value="")},removeFile:o=>{var l;n.value=n.value.filter(h=>h.uid!==o),(l=e.onChange)==null||l.call(e,n.value)}}}}),et=(e,t)=>{const a=e.__vccOpts||e;for(const[n,i]of t)a[n]=i;return a},Bd={class:"upload-wrapper"},wd=["accept","multiple"],Ud={key:0,class:"file-list mt-4"},Fd={class:"flex items-center space-x-4"},Hd=["src"],Vd=["onClick"];function Yd(e,t,a,n,i,r){return c.openBlock(),c.createElementBlock("div",Bd,[c.createElementVNode("div",{class:"",onClick:t[0]||(t[0]=(...u)=>e.triggerInput&&e.triggerInput(...u))},[c.renderSlot(e.$slots,"upload-icon",{},()=>[t[2]||(t[2]=c.createElementVNode("div",{class:"upload-area border-dashed border-2 p-6 rounded cursor-pointer hover:border-blue-500"},[c.createElementVNode("div",{class:"text-gray-400 text-lg text-center"}," 点击或拖拽上传图片 ")],-1))],!0)]),c.createElementVNode("input",{type:"file",ref:"inputRef",class:"hidden",accept:e.accept,multiple:e.multiple,onChange:t[1]||(t[1]=(...u)=>e.handleChange&&e.handleChange(...u))},null,40,wd),e.showList?(c.openBlock(),c.createElementBlock("div",Ud,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.fileList,u=>(c.openBlock(),c.createElementBlock("div",{key:u.uid,class:"file-item flex items-center justify-between p-2 border rounded mb-2"},[c.createElementVNode("div",Fd,[u.thumbUrl?(c.openBlock(),c.createElementBlock("img",{key:0,src:u.thumbUrl,alt:"preview",class:"w-12 h-12 object-cover rounded"},null,8,Hd)):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(u.name),1)]),c.createElementVNode("div",null,[c.createElementVNode("button",{onClick:o=>e.removeFile(u.uid),class:"text-red-500 hover:underline"}," 删除 ",8,Vd)])]))),128))])):c.createCommentVNode("",!0)])}const qd=et(vd,[["render",Yd],["__scopeId","data-v-fa0e69af"]]),$d=c.defineComponent({name:"GpMessage",props:{message:{type:String,required:!0},type:{type:String,default:"info"},position:{type:String,default:"top-right"},duration:{type:Number,default:3e3},onClose:{type:Function,required:!0},icon:{type:Boolean,default:!0}},setup(e){const t=c.ref(!1),a=c.computed(()=>({success:"bg-green-100 text-green-800",error:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",warning:"bg-yellow-100 text-yellow-800"})[e.type]),n=()=>{t.value=!1,e.onClose()};return setTimeout(()=>{n()},e.duration),t.value=!0,{visible:t,typeClass:a,closeMessage:n}}}),Wd={key:0,class:"gp-message"},Gd={key:0,class:"mr-2"},Xd={key:0,class:"text-green-500"},Qd={key:1,class:"text-red-500"},jd={key:2,class:"text-blue-500"},zd={key:3,class:"text-yellow-500"};function Kd(e,t,a,n,i,r){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[e.visible?(c.openBlock(),c.createElementBlock("div",Wd,[c.createElementVNode("div",{class:c.normalizeClass([e.typeClass,"message-content"])},[e.icon?(c.openBlock(),c.createElementBlock("span",Gd,[c.renderSlot(e.$slots,"icon",{},()=>[e.type==="success"?(c.openBlock(),c.createElementBlock("span",Xd,"✔")):c.createCommentVNode("",!0),e.type==="error"?(c.openBlock(),c.createElementBlock("span",Qd,"✖")):c.createCommentVNode("",!0),e.type==="info"?(c.openBlock(),c.createElementBlock("span",jd,"ℹ")):c.createCommentVNode("",!0),e.type==="warning"?(c.openBlock(),c.createElementBlock("span",zd,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(e.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:t[0]||(t[0]=(...u)=>e.closeMessage&&e.closeMessage(...u))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const Zd=et($d,[["render",Kd],["__scopeId","data-v-56476f4c"]]),Nt=c.reactive([]);let Ln=null;const Jd=()=>{const e=document.createElement("div");return e.id="global-message-container",document.body.appendChild(e),e},eh=()=>{if(Ln)return;const e=Jd();Ln=c.createApp({setup(){return{messageQueue:Nt}},render(){const t=c.computed(()=>{var n;return{"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4","top-center":"top-4 left-1/2 transform -translate-x-1/2","bottom-center":"bottom-4 left-1/2 transform -translate-x-1/2"}[((n=Nt[0])==null?void 0:n.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${t.value}`},Nt.map(a=>c.h(Zd,{key:a.id,...a.options,onClose:()=>qs(a.id)})))}}),Ln.mount(e)},qs=e=>{const t=Nt.findIndex(a=>a.id===e);t!==-1&&Nt.splice(t,1)};let th=0;const Q=e=>{eh();const t=th++;Nt.push({id:t,options:e}),setTimeout(()=>{qs(t)},e.duration||3e3)};Q.success=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"success",duration:t,icon:a}:{...e,type:"success"})},Q.error=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"error",duration:t,icon:a}:{...e,type:"error"})},Q.info=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"info",duration:t,icon:a}:{...e,type:"info"})},Q.warning=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"warning",duration:t,icon:a}:{...e,type:"warning"})};const ah={key:0,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},nh=et(c.defineComponent({__name:"ElementRenderer",props:{element:{type:Object,required:!0},selectedElement:Object,hoveredElement:Object,uploadByFile:{type:Function,required:!1},icons:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},cropper:{type:Object,required:!1},icon:{type:Object,required:!1},r:{type:String,required:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","upload"],setup(e,{emit:t}){const a=e,n=t,i=c.computed(()=>a.selectedElement===a.element),r=c.computed(()=>a.hoveredElement===a.element),u=c.ref(!1),o=c.ref(!1),l=c.ref(""),h=c.computed(()=>a.element.rule.minText||0),m=c.computed(()=>a.element.rule.maxText||1/0);c.watch(()=>a.r,()=>{n("contentUpdated",P())},{immediate:!0});function p(R){R.xpath!="/div[1]"&&a.mode!=="preview"&&(a.mode==="edit"?R.type===X.Text&&n("selectElement",R):n("selectElement",R),!R.rule.isReadOnly&&R.type===X.Text&&(u.value=!0))}function T(R){n("selectElement",R)}function N(R,O){n("hoverElement",R,O)}function I(R){n("hoverElement",R)}function y(R){R.currentTarget.contains(R.relatedTarget)?n("hoverElement",null):a.hoveredElement?n("hoverElement",null,a.hoveredElement.parentxpath):n("hoverElement",null)}function D(){u.value=!1,n("contentUpdated",P())}function P(){function R(O){const z=Object.entries(O.attrs||{}).map(([A,L])=>`${A}="${L}"`).join(" "),me=`<${O.tag}${z?" "+z:""}>`,ye=`</${O.tag}>`,mt=(O.children||[]).map(A=>R(A)).join("");return`${me}${O.editText||O.text||""}${mt}${ye}`}return R(a.element)}function $(R){var ye;R.stopPropagation();const O=R.target,z=((ye=O.firstChild)==null?void 0:ye.nodeType)===Node.TEXT_NODE&&O.firstChild.nodeValue||"";if(z.length<h.value){o.value=!0,l.value=`最少输入 ${h.value} 个字符`;return}else if(z.length>m.value){o.value=!0,l.value=`最多输入 ${m.value} 个字符`;return}else o.value=!1,l.value="";n("updateText",{element:a.element,newText:z}),n("contentUpdated",P());const me=c.toRaw(a.element);me.editText=z}function V(R){n("updateText",R),n("contentUpdated",P())}function te(){const R={...a.element};n("blockAction",{action:"add",element:a.element,newBlock:R})}function U(){_(a.element),n("blockAction",{action:"moveUp",element:a.element})}function _(R){R.children&&R.children.length>0&&R.children.forEach(O=>{O.type==X.Text&&(O.text!==O.editText&&(O.text=O.editText),_(O))})}function B(){_(a.element),n("blockAction",{action:"moveDown",element:a.element})}function q(){n("blockAction",{action:"delete",element:a.element})}function ne(R){n("blockAction",R),n("contentUpdated",P())}function Te(R){Le.value.openModal(R)}function Pe(R,O){n("addIcon",R,O),n("contentUpdated",P())}const ve=c.ref(a.cropper),Le=c.ref(a.icon),ie=c.ref({});function se(R,O){if(!R||R.length===0)return;console.log("files",R,O);const z=R[0];if(O.rule&&(O.rule.minImageWidth||O.rule.maxImageHeight)){if(O.rule.minImageWidth&&z.width<O.rule.minImageWidth){Q.error(`图片宽度不能小于 ${O.rule.minImageWidth}px`);return}if(O.rule.maxImageHeight&&z.height<O.rule.maxImageHeight){Q.error(`图片高度不能小于 ${O.rule.maxImageHeight}px`);return}}if(O.rule.minImageWidth&&O.rule.maxImageHeight?(ie.value.width=O.rule.minImageWidth,ie.value.height=O.rule.maxImageHeight,ie.value.aspectRatio=O.rule.minImageWidth/O.rule.maxImageHeight):ie.value={},z)if(O.rule.crop){const me=z.thumbUrl;ve.value.handleOpenCropper(ie.value,me,z.name,O)}else a.uploadByFile?a.uploadByFile(z.file).then(me=>{me.success&&(O.attrs.src=me.file.url,n("contentUpdated",P()))}):(O.attrs.src=z.thumbUrl,n("contentUpdated",P()))}const Se=R=>R.type.startsWith("image/")?!0:(Q.error("只能上传图片文件"),!1);return(R,O)=>{const z=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(a.element.tag),c.mergeProps({class:["relative",e.mode==="design"?"m-2 p-1 border-dashed border-2":"",r.value?"border-dashed border-blue-500":"",i.value?"border-dashed border-green-500 z-10 border-2":"",o.value?"border-dashed border-red-500":"",(!r.value&&!i.value&&!o.value,""),a.element.rule&&a.element.rule.isReadOnly?"cursor-not-allowed":""]},a.element.attrs,{contenteditable:u.value,onClick:O[2]||(O[2]=c.withModifiers(()=>p(a.element),["stop"])),onMouseenter:O[3]||(O[3]=()=>I(a.element)),onMouseleave:y,onBlur:D,onInput:$}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(a.element.text),1),a.element.children&&a.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.element.children,(me,ye)=>(c.openBlock(),c.createBlock(z,{key:ye,r:e.r,mode:e.mode,icons:e.icons,element:me,selectedElement:a.selectedElement,hoveredElement:a.hoveredElement,cropper:e.cropper,icon:e.icon,"upload-by-file":e.uploadByFile,onSelectElement:T,onHoverElement:N,onUpdateText:V,onBlockAction:ne,onAddIcon:Pe},null,8,["r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload-by-file"]))),128)),a.element.type===c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:O[0]||(O[0]=c.withModifiers(()=>{},["stop"])),class:"z-10 flex space-x-1 flex-none flex-nowrap overflow-visible absolute top-2"},[c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-blue-500 text-white rounded",onClick:c.withModifiers(te,["stop"])}," + "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-gray-300 text-white rounded",onClick:c.withModifiers(U,["stop"])}," ⬅️ "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-gray-300 text-white rounded",onClick:c.withModifiers(B,["stop"])}," ➡️ "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-red-500 text-white rounded",onClick:c.withModifiers(q,["stop"])}," ✖ ")])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),a.element.type===c.unref(X).Icon?(c.openBlock(),c.createElementBlock("div",{key:1,class:"cursor-pointer rounded-sm w-5 h-5 flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80",contenteditable:"false",onClick:O[1]||(O[1]=c.withModifiers(()=>Te(a.element),["stop"]))}," ↑ ")):c.createCommentVNode("",!0)]),_:1},16,["class","contenteditable"])),a.element.type==c.unref(X).Text&&o.value?(c.openBlock(),c.createElementBlock("div",ah,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),a.element.type===c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",{key:1,class:"cursor-pointer rounded-sm flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80",onClick:O[5]||(O[5]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createVNode(qd,{multiple:!1,beforeUpload:Se,onChange:O[4]||(O[4]=me=>se(me,a.element))},{"upload-icon":c.withCtx(()=>O[6]||(O[6]=[c.createElementVNode("div",{class:"p-2"},"上传",-1)])),_:1})])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-f92bee30"]]),ih=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){return{updateValue:n=>{t("update:modelValue",n.target.checked)}}}}),sh={class:"form-group"},rh={class:"flex items-center space-x-2 cursor-pointer"},uh=["checked","aria-checked"],oh={class:"checkbox-label text-sm text-gray-700"};function ch(e,t,a,n,i,r){return c.openBlock(),c.createElementBlock("div",sh,[c.createElementVNode("label",rh,[c.createElementVNode("input",{type:"checkbox",checked:e.modelValue,onChange:t[0]||(t[0]=(...u)=>e.updateValue&&e.updateValue(...u)),class:"custom-checkbox","aria-checked":e.modelValue},null,40,uh),c.createElementVNode("span",oh,c.toDisplayString(e.label),1)])])}const Qt=et(ih,[["render",ch],["__scopeId","data-v-68b8f276"]]),lh={key:0},dh={key:0},hh={class:"text-gray-500 my-2"},fh={class:"text-gray-500 my-2"},mh={key:1},Eh={key:2},ph={key:3},Th={key:4},bh={key:5},gh={key:6},_h={key:7},Ah={key:8},Nh={key:9},Ch={key:10},Ih=et(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(e,{emit:t}){const a=e,n=t,i=c.ref({rule:{},...a.element});c.watch(()=>a.element,u=>{i.value={rule:{},...u}},{immediate:!0});function r(){if(i.value.type===X.Icon&&!i.value.attrs.class.includes("iconfont")){Q.error("图标仅支持 iconfont 图标");return}if(i.value.type===X.Image&&i.value.tag!=="img"){Q.error("节点类型错误");return}if(i.value.type===X.Video&&i.value.tag!=="video"){Q.error("节点类型错误");return}if(i.value.type===X.Link&&i.value.tag!=="a"){Q.error("节点类型错误");return}if(i.value.type===X.Text){if(i.value.rule.minText>i.value.rule.maxText){Q.error("最小文本长度不能大于最大文本长度");return}if(i.value.tag!=="p"&&i.value.tag!=="div"&&i.value.tag!=="span"&&i.value.tag!=="h1"&&i.value.tag!=="h2"&&i.value.tag!=="h3"&&i.value.tag!=="h4"&&i.value.tag!=="h5"&&i.value.tag!=="h6"){Q.error("节点类型错误");return}}if(i.value.type===X.Block){if(i.value.rule.minBlock>i.value.rule.maxBlock){Q.error("最小块数量不能大于最大块数量");return}if(i.value.tag!=="div"&&i.value.tag!=="section"&&i.value.tag!=="article"&&i.value.tag!=="nav"&&i.value.tag!=="header"&&i.value.tag!=="footer"&&i.value.tag!=="span"&&i.value.tag!=="p"&&i.value.tag!=="img"){Q.error("节点类型错误");return}if(!i.value.children||i.value.children.length<1){Q.error("节点错误,必须包含子元素");return}}n("updateElement",i.value)}return(u,o)=>(c.openBlock(),c.createElementBlock("div",null,[i.value?(c.openBlock(),c.createElementBlock("div",lh,[i.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",dh,[o[13]||(o[13]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",hh,c.toDisplayString(i.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[o[14]||(o[14]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",fh,c.toDisplayString(i.value.xpath),1)]),c.createElementVNode("div",null,[o[16]||(o[16]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":o[0]||(o[0]=l=>i.value.type=l),class:"border rounded p-1 w-full"},o[15]||(o[15]=[c.createElementVNode("option",{value:0},"无",-1),c.createElementVNode("option",{value:1},"文本",-1),c.createElementVNode("option",{value:2},"图片",-1),c.createElementVNode("option",{value:3},"视频",-1),c.createElementVNode("option",{value:4},"图标",-1),c.createElementVNode("option",{value:5},"链接",-1),c.createElementVNode("option",{value:6},"按钮",-1),c.createElementVNode("option",{value:10},"块",-1)]),512),[[c.vModelSelect,i.value.type]])]),i.value.type==c.unref(X).Text?(c.openBlock(),c.createElementBlock("div",mh,[o[17]||(o[17]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[1]||(o[1]=l=>i.value.rule.minText=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minText]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Text?(c.openBlock(),c.createElementBlock("div",Eh,[o[18]||(o[18]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[2]||(o[2]=l=>i.value.rule.maxText=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxText]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",ph,[o[19]||(o[19]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.crop,"onUpdate:modelValue":o[3]||(o[3]=l=>i.value.rule.crop=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",Th,[o[20]||(o[20]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[4]||(o[4]=l=>i.value.rule.minImageWidth=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",bh,[o[21]||(o[21]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[5]||(o[5]=l=>i.value.rule.maxImageHeight=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",gh,[o[22]||(o[22]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[6]||(o[6]=l=>i.value.rule.minBlock=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minBlock]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",_h,[o[23]||(o[23]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[7]||(o[7]=l=>i.value.rule.maxBlock=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxBlock]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Text||i.value.type==c.unref(X).Icon||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Ah,[o[24]||(o[24]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isThemeColor,"onUpdate:modelValue":o[8]||(o[8]=l=>i.value.rule.isThemeColor=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[o[25]||(o[25]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isRequired,"onUpdate:modelValue":o[9]||(o[9]=l=>i.value.rule.isRequired=l),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[o[26]||(o[26]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isReadOnly,"onUpdate:modelValue":o[10]||(o[10]=l=>i.value.rule.isReadOnly=l),label:"是"},null,8,["modelValue"])]),i.value.type==c.unref(X).Link||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Nh,[o[27]||(o[27]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.openMeiqia,"onUpdate:modelValue":o[11]||(o[11]=l=>i.value.rule.openMeiqia=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Link||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Ch,[o[28]||(o[28]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[12]||(o[12]=l=>i.value.rule.linkUrl=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.linkUrl]])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:r,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-0d892d0b"]]);/*!
8
+ `)}}).toArray()}const Uc=Object.freeze(Object.defineProperty({__proto__:null,serialize:Bc,serializeArray:wc},Symbol.toStringTag,{value:"Module"}));function Fc(e){var t;return typeof e=="string"?{selector:e,value:"textContent"}:{selector:e.selector,value:(t=e.value)!==null&&t!==void 0?t:"textContent"}}function Hc(e){const t={};for(const a in e){const n=e[a],i=Array.isArray(n),{selector:r,value:u}=Fc(i?n[0]:n),o=typeof u=="function"?u:typeof u=="string"?l=>this._make(l).prop(u):l=>this._make(l).extract(u);if(i)t[a]=this._findBySelector(r,Number.POSITIVE_INFINITY).map((l,h)=>o(h,a,t)).get();else{const l=this._findBySelector(r,1);t[a]=l.length>0?o(l[0],a,t):void 0}}return t}const Vc=Object.freeze(Object.defineProperty({__proto__:null,extract:Hc},Symbol.toStringTag,{value:"Module"}));class wt{constructor(t,a,n){if(this.length=0,this.options=n,this._root=a,t){for(let i=0;i<t.length;i++)this[i]=t[i];this.length=t.length}}}wt.prototype.cheerio="[cheerio object]",wt.prototype.splice=Array.prototype.splice,wt.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(wt.prototype,Gu,oc,yc,Pc,Uc,Vc);function Yc(e,t){return function a(n,i,r=!0){if(n==null)throw new Error("cheerio.load() expects a string");const u=Za(i),o=e(n,u,r,null);class l extends wt{_make(p,T){const N=h(p,T);return N.prevObject=this,N}_parse(p,T,N,I){return e(p,T,N,I)}_render(p){return t(p,this.options)}}function h(m,p,T=o,N){if(m&&$e(m))return m;const I=Za(N,u),y=typeof T=="string"?[e(T,I,!1,null)]:"length"in T?T:[T],D=$e(y)?y:new l(y,null,I);if(D._root=D,!m)return new l(void 0,D,I);const P=typeof m=="string"&&Ja(m)?e(m,I,!1,null).children:qc(m)?[m]:Array.isArray(m)?m:void 0,$=new l(P,D,I);if(P)return $;if(typeof m!="string")throw new TypeError("Unexpected type of selector");let V=m;const te=p?typeof p=="string"?Ja(p)?new l([e(p,I,!1,null)],D,I):(V=`${p} ${V}`,D):$e(p)?p:new l(Array.isArray(p)?p:[p],D,I):D;return te?te.find(V):$}return Object.assign(h,Pu,{load:a,_root:o,_options:u,fn:l.prototype,prototype:l.prototype}),h}}function qc(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}const $c=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]),K="�";var d;(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"})(d||(d={}));const _e={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function zi(e){return e>=55296&&e<=57343}function Wc(e){return e>=56320&&e<=57343}function Gc(e,t){return(e-55296)*1024+9216+t}function Ki(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Zi(e){return e>=64976&&e<=65007||$c.has(e)}var g;(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"})(g||(g={}));const Xc=65536;class Qc{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=Xc,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,a){const{line:n,col:i,offset:r}=this,u=i+a,o=r+a;return{code:t,startLine:n,endLine:n,startCol:u,endCol:u,startOffset:o,endOffset:o}}_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 a=this.html.charCodeAt(this.pos+1);if(Wc(a))return this.pos++,this._addGap(),Gc(t,a)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,d.EOF;return this._err(g.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,a){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=a}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,a){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(a)return this.html.startsWith(t,this.pos);for(let n=0;n<t.length;n++)if((this.html.charCodeAt(this.pos+n)|32)!==t.charCodeAt(n))return!1;return!0}peek(t){const a=this.pos+t;if(a>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,d.EOF;const n=this.html.charCodeAt(a);return n===d.CARRIAGE_RETURN?d.LINE_FEED:n}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,d.EOF;let t=this.html.charCodeAt(this.pos);return t===d.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,d.LINE_FEED):t===d.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,zi(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===d.LINE_FEED||t===d.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Ki(t)?this._err(g.controlCharacterInInputStream):Zi(t)&&this._err(g.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var W;(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"})(W||(W={}));function Ji(e,t){for(let a=e.attrs.length-1;a>=0;a--)if(e.attrs[a].name===t)return e.attrs[a].value;return null}var C;(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/"})(C||(C={}));var ct;(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"})(ct||(ct={}));var Ie;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Ie||(Ie={}));var b;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(b||(b={}));var s;(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"})(s||(s={}));const jc=new Map([[b.A,s.A],[b.ADDRESS,s.ADDRESS],[b.ANNOTATION_XML,s.ANNOTATION_XML],[b.APPLET,s.APPLET],[b.AREA,s.AREA],[b.ARTICLE,s.ARTICLE],[b.ASIDE,s.ASIDE],[b.B,s.B],[b.BASE,s.BASE],[b.BASEFONT,s.BASEFONT],[b.BGSOUND,s.BGSOUND],[b.BIG,s.BIG],[b.BLOCKQUOTE,s.BLOCKQUOTE],[b.BODY,s.BODY],[b.BR,s.BR],[b.BUTTON,s.BUTTON],[b.CAPTION,s.CAPTION],[b.CENTER,s.CENTER],[b.CODE,s.CODE],[b.COL,s.COL],[b.COLGROUP,s.COLGROUP],[b.DD,s.DD],[b.DESC,s.DESC],[b.DETAILS,s.DETAILS],[b.DIALOG,s.DIALOG],[b.DIR,s.DIR],[b.DIV,s.DIV],[b.DL,s.DL],[b.DT,s.DT],[b.EM,s.EM],[b.EMBED,s.EMBED],[b.FIELDSET,s.FIELDSET],[b.FIGCAPTION,s.FIGCAPTION],[b.FIGURE,s.FIGURE],[b.FONT,s.FONT],[b.FOOTER,s.FOOTER],[b.FOREIGN_OBJECT,s.FOREIGN_OBJECT],[b.FORM,s.FORM],[b.FRAME,s.FRAME],[b.FRAMESET,s.FRAMESET],[b.H1,s.H1],[b.H2,s.H2],[b.H3,s.H3],[b.H4,s.H4],[b.H5,s.H5],[b.H6,s.H6],[b.HEAD,s.HEAD],[b.HEADER,s.HEADER],[b.HGROUP,s.HGROUP],[b.HR,s.HR],[b.HTML,s.HTML],[b.I,s.I],[b.IMG,s.IMG],[b.IMAGE,s.IMAGE],[b.INPUT,s.INPUT],[b.IFRAME,s.IFRAME],[b.KEYGEN,s.KEYGEN],[b.LABEL,s.LABEL],[b.LI,s.LI],[b.LINK,s.LINK],[b.LISTING,s.LISTING],[b.MAIN,s.MAIN],[b.MALIGNMARK,s.MALIGNMARK],[b.MARQUEE,s.MARQUEE],[b.MATH,s.MATH],[b.MENU,s.MENU],[b.META,s.META],[b.MGLYPH,s.MGLYPH],[b.MI,s.MI],[b.MO,s.MO],[b.MN,s.MN],[b.MS,s.MS],[b.MTEXT,s.MTEXT],[b.NAV,s.NAV],[b.NOBR,s.NOBR],[b.NOFRAMES,s.NOFRAMES],[b.NOEMBED,s.NOEMBED],[b.NOSCRIPT,s.NOSCRIPT],[b.OBJECT,s.OBJECT],[b.OL,s.OL],[b.OPTGROUP,s.OPTGROUP],[b.OPTION,s.OPTION],[b.P,s.P],[b.PARAM,s.PARAM],[b.PLAINTEXT,s.PLAINTEXT],[b.PRE,s.PRE],[b.RB,s.RB],[b.RP,s.RP],[b.RT,s.RT],[b.RTC,s.RTC],[b.RUBY,s.RUBY],[b.S,s.S],[b.SCRIPT,s.SCRIPT],[b.SEARCH,s.SEARCH],[b.SECTION,s.SECTION],[b.SELECT,s.SELECT],[b.SOURCE,s.SOURCE],[b.SMALL,s.SMALL],[b.SPAN,s.SPAN],[b.STRIKE,s.STRIKE],[b.STRONG,s.STRONG],[b.STYLE,s.STYLE],[b.SUB,s.SUB],[b.SUMMARY,s.SUMMARY],[b.SUP,s.SUP],[b.TABLE,s.TABLE],[b.TBODY,s.TBODY],[b.TEMPLATE,s.TEMPLATE],[b.TEXTAREA,s.TEXTAREA],[b.TFOOT,s.TFOOT],[b.TD,s.TD],[b.TH,s.TH],[b.THEAD,s.THEAD],[b.TITLE,s.TITLE],[b.TR,s.TR],[b.TRACK,s.TRACK],[b.TT,s.TT],[b.U,s.U],[b.UL,s.UL],[b.SVG,s.SVG],[b.VAR,s.VAR],[b.WBR,s.WBR],[b.XMP,s.XMP]]);function Aa(e){var t;return(t=jc.get(e))!==null&&t!==void 0?t:s.UNKNOWN}const x=s,zc={[C.HTML]:new Set([x.ADDRESS,x.APPLET,x.AREA,x.ARTICLE,x.ASIDE,x.BASE,x.BASEFONT,x.BGSOUND,x.BLOCKQUOTE,x.BODY,x.BR,x.BUTTON,x.CAPTION,x.CENTER,x.COL,x.COLGROUP,x.DD,x.DETAILS,x.DIR,x.DIV,x.DL,x.DT,x.EMBED,x.FIELDSET,x.FIGCAPTION,x.FIGURE,x.FOOTER,x.FORM,x.FRAME,x.FRAMESET,x.H1,x.H2,x.H3,x.H4,x.H5,x.H6,x.HEAD,x.HEADER,x.HGROUP,x.HR,x.HTML,x.IFRAME,x.IMG,x.INPUT,x.LI,x.LINK,x.LISTING,x.MAIN,x.MARQUEE,x.MENU,x.META,x.NAV,x.NOEMBED,x.NOFRAMES,x.NOSCRIPT,x.OBJECT,x.OL,x.P,x.PARAM,x.PLAINTEXT,x.PRE,x.SCRIPT,x.SECTION,x.SELECT,x.SOURCE,x.STYLE,x.SUMMARY,x.TABLE,x.TBODY,x.TD,x.TEMPLATE,x.TEXTAREA,x.TFOOT,x.TH,x.THEAD,x.TITLE,x.TR,x.TRACK,x.UL,x.WBR,x.XMP]),[C.MATHML]:new Set([x.MI,x.MO,x.MN,x.MS,x.MTEXT,x.ANNOTATION_XML]),[C.SVG]:new Set([x.TITLE,x.FOREIGN_OBJECT,x.DESC]),[C.XLINK]:new Set,[C.XML]:new Set,[C.XMLNS]:new Set},_n=new Set([x.H1,x.H2,x.H3,x.H4,x.H5,x.H6]),Kc=new Set([b.STYLE,b.SCRIPT,b.XMP,b.IFRAME,b.NOEMBED,b.NOFRAMES,b.PLAINTEXT]);function Zc(e,t){return Kc.has(e)||t&&e===b.NOSCRIPT}var f;(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"})(f||(f={}));const Ae={DATA:f.DATA,RCDATA:f.RCDATA,RAWTEXT:f.RAWTEXT,SCRIPT_DATA:f.SCRIPT_DATA,PLAINTEXT:f.PLAINTEXT,CDATA_SECTION:f.CDATA_SECTION};function Jc(e){return e>=d.DIGIT_0&&e<=d.DIGIT_9}function Ut(e){return e>=d.LATIN_CAPITAL_A&&e<=d.LATIN_CAPITAL_Z}function el(e){return e>=d.LATIN_SMALL_A&&e<=d.LATIN_SMALL_Z}function Ze(e){return el(e)||Ut(e)}function es(e){return Ze(e)||Jc(e)}function Na(e){return e+32}function ts(e){return e===d.SPACE||e===d.LINE_FEED||e===d.TABULATION||e===d.FORM_FEED}function as(e){return ts(e)||e===d.SOLIDUS||e===d.GREATER_THAN_SIGN}function tl(e){return e===d.NULL?g.nullCharacterReference:e>1114111?g.characterReferenceOutsideUnicodeRange:zi(e)?g.surrogateCharacterReference:Zi(e)?g.noncharacterCharacterReference:Ki(e)||e===d.CARRIAGE_RETURN?g.controlCharacterReference:null}let al=class{constructor(t,a){this.options=t,this.handler=a,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=f.DATA,this.returnState=f.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Qc(a),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Xa(qa,(n,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(n)},a.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(g.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:n=>{this._err(g.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+n)},validateNumericCharacterReference:n=>{const i=tl(n);i&&this._err(i,1)}}:void 0)}_err(t,a=0){var n,i;(i=(n=this.handler).onParseError)===null||i===void 0||i.call(n,this.preprocessor.getError(t,a))}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,a,n){this.active=!0,this.preprocessor.write(t,a),this._runParsingLoop(),this.paused||n==null||n()}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 a=0;a<t;a++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,a){return this.preprocessor.startsWith(t,a)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:W.START_TAG,tagName:"",tagID:s.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:W.END_TAG,tagName:"",tagID:s.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:W.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:W.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,a){this.currentCharacterToken={type:t,chars:a,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,a;const n=this.currentToken;if(Ji(n,this.currentAttr.name)===null){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){const i=(t=(a=n.location).attrs)!==null&&t!==void 0?t:a.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(g.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=Aa(t.tagName),t.type===W.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(g.endTagWithAttributes),t.selfClosing&&this._err(g.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 W.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case W.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case W.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:W.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,a){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=a;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,a)}_emitCodePoint(t){const a=ts(t)?W.WHITESPACE_CHARACTER:t===d.NULL?W.NULL_CHARACTER:W.CHARACTER;this._appendCharToCurrentCharacterToken(a,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(W.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=f.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?xe.Attribute:xe.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===f.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===f.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===f.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case f.DATA:{this._stateData(t);break}case f.RCDATA:{this._stateRcdata(t);break}case f.RAWTEXT:{this._stateRawtext(t);break}case f.SCRIPT_DATA:{this._stateScriptData(t);break}case f.PLAINTEXT:{this._statePlaintext(t);break}case f.TAG_OPEN:{this._stateTagOpen(t);break}case f.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case f.TAG_NAME:{this._stateTagName(t);break}case f.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case f.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case f.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case f.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case f.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case f.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case f.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case f.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case f.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case f.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case f.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case f.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case f.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case f.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case f.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case f.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case f.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case f.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case f.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case f.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case f.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case f.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case f.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case f.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case f.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case f.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case f.BOGUS_COMMENT:{this._stateBogusComment(t);break}case f.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case f.COMMENT_START:{this._stateCommentStart(t);break}case f.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case f.COMMENT:{this._stateComment(t);break}case f.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case f.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case f.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case f.COMMENT_END:{this._stateCommentEnd(t);break}case f.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case f.DOCTYPE:{this._stateDoctype(t);break}case f.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case f.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case f.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case f.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case f.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case f.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case f.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case f.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case f.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case f.CDATA_SECTION:{this._stateCdataSection(t);break}case f.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case f.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case f.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case f.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.TAG_OPEN;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitCodePoint(t);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case d.AMPERSAND:{this._startCharacterReference();break}case d.LESS_THAN_SIGN:{this.state=f.RCDATA_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.RAWTEXT_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ze(t))this._createStartTagToken(),this.state=f.TAG_NAME,this._stateTagName(t);else switch(t){case d.EXCLAMATION_MARK:{this.state=f.MARKUP_DECLARATION_OPEN;break}case d.SOLIDUS:{this.state=f.END_TAG_OPEN;break}case d.QUESTION_MARK:{this._err(g.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t);break}case d.EOF:{this._err(g.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(g.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=f.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ze(t))this._createEndTagToken(),this.state=f.TAG_NAME,this._stateTagName(t);else switch(t){case d.GREATER_THAN_SIGN:{this._err(g.missingEndTagName),this.state=f.DATA;break}case d.EOF:{this._err(g.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(g.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.SOLIDUS:{this.state=f.SELF_CLOSING_START_TAG;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentTagToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.tagName+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:a.tagName+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateRcdataLessThanSign(t){t===d.SOLIDUS?this.state=f.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=f.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Ze(t)?(this.state=f.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=f.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const a=this.currentToken;switch(a.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=f.BEFORE_ATTRIBUTE_NAME,!1;case d.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=f.SELF_CLOSING_START_TAG,!1;case d.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=f.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===d.SOLIDUS?this.state=f.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Ze(t)?(this.state=f.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case d.SOLIDUS:{this.state=f.SCRIPT_DATA_END_TAG_OPEN;break}case d.EXCLAMATION_MARK:{this.state=f.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=f.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Ze(t)?(this.state=f.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===d.HYPHEN_MINUS?(this.state=f.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===d.HYPHEN_MINUS?(this.state=f.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=f.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case d.HYPHEN_MINUS:{this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case d.GREATER_THAN_SIGN:{this.state=f.SCRIPT_DATA,this._emitChars(">");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===d.SOLIDUS?this.state=f.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ze(t)?(this._emitChars("<"),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ze(t)?(this.state=f.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(_e.SCRIPT,!1)&&as(this.preprocessor.peek(_e.SCRIPT.length))){this._emitCodePoint(t);for(let a=0;a<_e.SCRIPT.length;a++)this._emitCodePoint(this._consume());this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=f.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case d.HYPHEN_MINUS:{this._emitChars("-");break}case d.LESS_THAN_SIGN:{this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case d.GREATER_THAN_SIGN:{this.state=f.SCRIPT_DATA,this._emitChars(">");break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(K);break}case d.EOF:{this._err(g.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===d.SOLIDUS?(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(_e.SCRIPT,!1)&&as(this.preprocessor.peek(_e.SCRIPT.length))){this._emitCodePoint(t);for(let a=0;a<_e.SCRIPT.length;a++)this._emitCodePoint(this._consume());this.state=f.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=f.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.SOLIDUS:case d.GREATER_THAN_SIGN:case d.EOF:{this.state=f.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case d.EQUALS_SIGN:{this._err(g.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=f.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=f.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:case d.SOLIDUS:case d.GREATER_THAN_SIGN:case d.EOF:{this._leaveAttrName(),this.state=f.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case d.EQUALS_SIGN:{this._leaveAttrName(),this.state=f.BEFORE_ATTRIBUTE_VALUE;break}case d.QUOTATION_MARK:case d.APOSTROPHE:case d.LESS_THAN_SIGN:{this._err(g.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.name+=K;break}default:this.currentAttr.name+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateAfterAttributeName(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.SOLIDUS:{this.state=f.SELF_CLOSING_START_TAG;break}case d.EQUALS_SIGN:{this.state=f.BEFORE_ATTRIBUTE_VALUE;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=f.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{this.state=f.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this.state=f.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingAttributeValue),this.state=f.DATA,this.emitCurrentTagToken();break}default:this.state=f.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case d.APOSTROPHE:{this.state=f.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this._leaveAttrValue(),this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.AMPERSAND:{this._startCharacterReference();break}case d.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=f.DATA,this.emitCurrentTagToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),this.currentAttr.value+=K;break}case d.QUOTATION_MARK:case d.APOSTROPHE:case d.LESS_THAN_SIGN:case d.EQUALS_SIGN:case d.GRAVE_ACCENT:{this._err(g.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this._leaveAttrValue(),this.state=f.BEFORE_ATTRIBUTE_NAME;break}case d.SOLIDUS:{this._leaveAttrValue(),this.state=f.SELF_CLOSING_START_TAG;break}case d.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._err(g.missingWhitespaceBetweenAttributes),this.state=f.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case d.GREATER_THAN_SIGN:{const a=this.currentToken;a.selfClosing=!0,this.state=f.DATA,this.emitCurrentTagToken();break}case d.EOF:{this._err(g.eofInTag),this._emitEOFToken();break}default:this._err(g.unexpectedSolidusInTag),this.state=f.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this.emitCurrentComment(a),this._emitEOFToken();break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.data+=K;break}default:a.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(_e.DASH_DASH,!0)?(this._createCommentToken(_e.DASH_DASH.length+1),this.state=f.COMMENT_START):this._consumeSequenceIfMatch(_e.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(_e.DOCTYPE.length+1),this.state=f.DOCTYPE):this._consumeSequenceIfMatch(_e.CDATA_START,!0)?this.inForeignNode?this.state=f.CDATA_SECTION:(this._err(g.cdataInHtmlContent),this._createCommentToken(_e.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=f.BOGUS_COMMENT):this._ensureHibernation()||(this._err(g.incorrectlyOpenedComment),this._createCommentToken(2),this.state=f.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_START_DASH;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptClosingOfEmptyComment),this.state=f.DATA;const a=this.currentToken;this.emitCurrentComment(a);break}default:this.state=f.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptClosingOfEmptyComment),this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="-",this.state=f.COMMENT,this._stateComment(t)}}_stateComment(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END_DASH;break}case d.LESS_THAN_SIGN:{a.data+="<",this.state=f.COMMENT_LESS_THAN_SIGN;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.data+=K;break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const a=this.currentToken;switch(t){case d.EXCLAMATION_MARK:{a.data+="!",this.state=f.COMMENT_LESS_THAN_SIGN_BANG;break}case d.LESS_THAN_SIGN:{a.data+="<";break}default:this.state=f.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===d.HYPHEN_MINUS?this.state=f.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=f.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===d.HYPHEN_MINUS?this.state=f.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=f.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==d.GREATER_THAN_SIGN&&t!==d.EOF&&this._err(g.nestedComment),this.state=f.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{this.state=f.COMMENT_END;break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="-",this.state=f.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentComment(a);break}case d.EXCLAMATION_MARK:{this.state=f.COMMENT_END_BANG;break}case d.HYPHEN_MINUS:{a.data+="-";break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="--",this.state=f.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const a=this.currentToken;switch(t){case d.HYPHEN_MINUS:{a.data+="--!",this.state=f.COMMENT_END_DASH;break}case d.GREATER_THAN_SIGN:{this._err(g.incorrectlyClosedComment),this.state=f.DATA,this.emitCurrentComment(a);break}case d.EOF:{this._err(g.eofInComment),this.emitCurrentComment(a),this._emitEOFToken();break}default:a.data+="--!",this.state=f.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this.state=f.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case d.EOF:{this._err(g.eofInDoctype),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingWhitespaceBeforeDoctypeName),this.state=f.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Ut(t))this._createDoctypeToken(String.fromCharCode(Na(t))),this.state=f.DOCTYPE_NAME;else switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.NULL:{this._err(g.unexpectedNullCharacter),this._createDoctypeToken(K),this.state=f.DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeName),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),this._createDoctypeToken(null);const a=this.currentToken;a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=f.DOCTYPE_NAME}}_stateDoctypeName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.AFTER_DOCTYPE_NAME;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.name+=K;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.name+=String.fromCodePoint(Ut(t)?Na(t):t)}}_stateAfterDoctypeName(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(_e.PUBLIC,!1)?this.state=f.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(_e.SYSTEM,!1)?this.state=f.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(g.invalidCharacterSequenceAfterDoctypeName),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceAfterDoctypePublicKeyword),a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceAfterDoctypePublicKeyword),a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.publicId="",this.state=f.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypePublicIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const a=this.currentToken;switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.publicId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypePublicIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const a=this.currentToken;switch(t){case d.APOSTROPHE:{this.state=f.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.publicId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypePublicIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case d.GREATER_THAN_SIGN:{this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.QUOTATION_MARK:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:{this.state=f.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.QUOTATION_MARK:{this._err(g.missingWhitespaceAfterDoctypeSystemKeyword),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{this._err(g.missingWhitespaceAfterDoctypeSystemKeyword),a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.QUOTATION_MARK:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case d.APOSTROPHE:{a.systemId="",this.state=f.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case d.GREATER_THAN_SIGN:{this._err(g.missingDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.DATA,this.emitCurrentDoctype(a);break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.missingQuoteBeforeDoctypeSystemIdentifier),a.forceQuirks=!0,this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const a=this.currentToken;switch(t){case d.QUOTATION_MARK:{this.state=f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.systemId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypeSystemIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const a=this.currentToken;switch(t){case d.APOSTROPHE:{this.state=f.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case d.NULL:{this._err(g.unexpectedNullCharacter),a.systemId+=K;break}case d.GREATER_THAN_SIGN:{this._err(g.abruptDoctypeSystemIdentifier),a.forceQuirks=!0,this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:a.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const a=this.currentToken;switch(t){case d.SPACE:case d.LINE_FEED:case d.TABULATION:case d.FORM_FEED:break;case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.EOF:{this._err(g.eofInDoctype),a.forceQuirks=!0,this.emitCurrentDoctype(a),this._emitEOFToken();break}default:this._err(g.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=f.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const a=this.currentToken;switch(t){case d.GREATER_THAN_SIGN:{this.emitCurrentDoctype(a),this.state=f.DATA;break}case d.NULL:{this._err(g.unexpectedNullCharacter);break}case d.EOF:{this.emitCurrentDoctype(a),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case d.RIGHT_SQUARE_BRACKET:{this.state=f.CDATA_SECTION_BRACKET;break}case d.EOF:{this._err(g.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===d.RIGHT_SQUARE_BRACKET?this.state=f.CDATA_SECTION_END:(this._emitChars("]"),this.state=f.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case d.GREATER_THAN_SIGN:{this.state=f.DATA;break}case d.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=f.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(d.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&es(this.preprocessor.peek(1))?f.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){es(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===d.SEMICOLON&&this._err(g.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}};const ns=new Set([s.DD,s.DT,s.LI,s.OPTGROUP,s.OPTION,s.P,s.RB,s.RP,s.RT,s.RTC]),is=new Set([...ns,s.CAPTION,s.COLGROUP,s.TBODY,s.TD,s.TFOOT,s.TH,s.THEAD,s.TR]),Ca=new Set([s.APPLET,s.CAPTION,s.HTML,s.MARQUEE,s.OBJECT,s.TABLE,s.TD,s.TEMPLATE,s.TH]),nl=new Set([...Ca,s.OL,s.UL]),il=new Set([...Ca,s.BUTTON]),ss=new Set([s.ANNOTATION_XML,s.MI,s.MN,s.MO,s.MS,s.MTEXT]),rs=new Set([s.DESC,s.FOREIGN_OBJECT,s.TITLE]),sl=new Set([s.TR,s.TEMPLATE,s.HTML]),rl=new Set([s.TBODY,s.TFOOT,s.THEAD,s.TEMPLATE,s.HTML]),ul=new Set([s.TABLE,s.TEMPLATE,s.HTML]),ol=new Set([s.TD,s.TH]);class cl{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,a,n){this.treeAdapter=a,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=s.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===s.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===C.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,a){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=a,this.currentTagId=a,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,a,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,a){const n=this._indexOf(t);this.items[n]=a,n===this.stackTop&&(this.current=a)}insertAfter(t,a,n){const i=this._indexOf(t)+1;this.items.splice(i,0,a),this.tagIDs.splice(i,0,n),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let a=this.stackTop+1;do a=this.tagIDs.lastIndexOf(t,a-1);while(a>0&&this.treeAdapter.getNamespaceURI(this.items[a])!==C.HTML);this.shortenToLength(a<0?0:a)}shortenToLength(t){for(;this.stackTop>=t;){const a=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(a,this.stackTop<t)}}popUntilElementPopped(t){const a=this._indexOf(t);this.shortenToLength(a<0?0:a)}popUntilPopped(t,a){const n=this._indexOfTagNames(t,a);this.shortenToLength(n<0?0:n)}popUntilNumberedHeaderPopped(){this.popUntilPopped(_n,C.HTML)}popUntilTableCellPopped(){this.popUntilPopped(ol,C.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,a){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===a)return n;return-1}clearBackTo(t,a){const n=this._indexOfTagNames(t,a);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(ul,C.HTML)}clearBackToTableBodyContext(){this.clearBackTo(rl,C.HTML)}clearBackToTableRowContext(){this.clearBackTo(sl,C.HTML)}remove(t){const a=this._indexOf(t);a>=0&&(a===this.stackTop?this.pop():(this.items.splice(a,1),this.tagIDs.splice(a,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===s.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const a=this._indexOf(t)-1;return a>=0?this.items[a]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===s.HTML}hasInDynamicScope(t,a){for(let n=this.stackTop;n>=0;n--){const i=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case C.HTML:{if(i===t)return!0;if(a.has(i))return!1;break}case C.SVG:{if(rs.has(i))return!1;break}case C.MATHML:{if(ss.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Ca)}hasInListItemScope(t){return this.hasInDynamicScope(t,nl)}hasInButtonScope(t){return this.hasInDynamicScope(t,il)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const a=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case C.HTML:{if(_n.has(a))return!0;if(Ca.has(a))return!1;break}case C.SVG:{if(rs.has(a))return!1;break}case C.MATHML:{if(ss.has(a))return!1;break}}}return!0}hasInTableScope(t){for(let a=this.stackTop;a>=0;a--)if(this.treeAdapter.getNamespaceURI(this.items[a])===C.HTML)switch(this.tagIDs[a]){case t:return!0;case s.TABLE:case s.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===C.HTML)switch(this.tagIDs[t]){case s.TBODY:case s.THEAD:case s.TFOOT:return!0;case s.TABLE:case s.HTML:return!1}return!0}hasInSelectScope(t){for(let a=this.stackTop;a>=0;a--)if(this.treeAdapter.getNamespaceURI(this.items[a])===C.HTML)switch(this.tagIDs[a]){case t:return!0;case s.OPTION:case s.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;ns.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;is.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==t&&is.has(this.currentTagId);)this.pop()}}const An=3;var Ue;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ue||(Ue={}));const us={type:Ue.Marker};class ll{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,a){const n=[],i=a.length,r=this.treeAdapter.getTagName(t),u=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===Ue.Marker)break;const{element:h}=l;if(this.treeAdapter.getTagName(h)===r&&this.treeAdapter.getNamespaceURI(h)===u){const m=this.treeAdapter.getAttrList(h);m.length===i&&n.push({idx:o,attrs:m})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<An)return;const a=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,a);if(n.length<An)return;const i=new Map(a.map(u=>[u.name,u.value]));let r=0;for(let u=0;u<n.length;u++){const o=n[u];o.attrs.every(l=>i.get(l.name)===l.value)&&(r+=1,r>=An&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(us)}pushElement(t,a){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ue.Element,element:t,token:a})}insertElementAfterBookmark(t,a){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Ue.Element,element:t,token:a})}removeEntry(t){const a=this.entries.indexOf(t);a>=0&&this.entries.splice(a,1)}clearToLastMarker(){const t=this.entries.indexOf(us);t>=0?this.entries.splice(0,t+1):this.entries.length=0}getElementEntryInScopeWithTagName(t){const a=this.entries.find(n=>n.type===Ue.Marker||this.treeAdapter.getTagName(n.element)===t);return a&&a.type===Ue.Element?a:null}getElementEntry(t){return this.entries.find(a=>a.type===Ue.Element&&a.element===t)}}const We={createDocument(){return{nodeName:"#document",mode:Ie.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,a){return{nodeName:e,tagName:e,attrs:a,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,a){const n=e.childNodes.indexOf(a);e.childNodes.splice(n,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,a,n){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=a,i.systemId=n;else{const r={nodeName:"#documentType",name:t,publicId:a,systemId:n,parentNode:null};We.appendChild(e,r)}},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 a=e.childNodes[e.childNodes.length-1];if(We.isTextNode(a)){a.value+=t;return}}We.appendChild(e,We.createTextNode(t))},insertTextBefore(e,t,a){const n=e.childNodes[e.childNodes.indexOf(a)-1];n&&We.isTextNode(n)?n.value+=t:We.insertBefore(e,We.createTextNode(t),a)},adoptAttributes(e,t){const a=new Set(e.attrs.map(n=>n.name));for(let n=0;n<t.length;n++)a.has(t[n].name)||e.attrs.push(t[n])},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}}},os="html",dl="about:legacy-compat",hl="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",cs=["+//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//"],fl=[...cs,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],ml=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ls=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],El=[...ls,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function ds(e,t){return t.some(a=>e.startsWith(a))}function pl(e){return e.name===os&&e.publicId===null&&(e.systemId===null||e.systemId===dl)}function Tl(e){if(e.name!==os)return Ie.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===hl)return Ie.QUIRKS;let{publicId:a}=e;if(a!==null){if(a=a.toLowerCase(),ml.has(a))return Ie.QUIRKS;let n=t===null?fl:cs;if(ds(a,n))return Ie.QUIRKS;if(n=t===null?ls:El,ds(a,n))return Ie.LIMITED_QUIRKS}return Ie.NO_QUIRKS}const hs={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},bl="definitionurl",gl="definitionURL",_l=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])),Al=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:C.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:C.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:C.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:C.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:C.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:C.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:C.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:C.XML}],["xml:space",{prefix:"xml",name:"space",namespace:C.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:C.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:C.XMLNS}]]),Nl=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])),Cl=new Set([s.B,s.BIG,s.BLOCKQUOTE,s.BODY,s.BR,s.CENTER,s.CODE,s.DD,s.DIV,s.DL,s.DT,s.EM,s.EMBED,s.H1,s.H2,s.H3,s.H4,s.H5,s.H6,s.HEAD,s.HR,s.I,s.IMG,s.LI,s.LISTING,s.MENU,s.META,s.NOBR,s.OL,s.P,s.PRE,s.RUBY,s.S,s.SMALL,s.SPAN,s.STRONG,s.STRIKE,s.SUB,s.SUP,s.TABLE,s.TT,s.U,s.UL,s.VAR]);function Il(e){const t=e.tagID;return t===s.FONT&&e.attrs.some(({name:n})=>n===ct.COLOR||n===ct.SIZE||n===ct.FACE)||Cl.has(t)}function fs(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===bl){e.attrs[t].name=gl;break}}function ms(e){for(let t=0;t<e.attrs.length;t++){const a=_l.get(e.attrs[t].name);a!=null&&(e.attrs[t].name=a)}}function Nn(e){for(let t=0;t<e.attrs.length;t++){const a=Al.get(e.attrs[t].name);a&&(e.attrs[t].prefix=a.prefix,e.attrs[t].name=a.name,e.attrs[t].namespace=a.namespace)}}function Sl(e){const t=Nl.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Aa(e.tagName))}function xl(e,t){return t===C.MATHML&&(e===s.MI||e===s.MO||e===s.MN||e===s.MS||e===s.MTEXT)}function Ol(e,t,a){if(t===C.MATHML&&e===s.ANNOTATION_XML){for(let n=0;n<a.length;n++)if(a[n].name===ct.ENCODING){const i=a[n].value.toLowerCase();return i===hs.TEXT_HTML||i===hs.APPLICATION_XML}}return t===C.SVG&&(e===s.FOREIGN_OBJECT||e===s.DESC||e===s.TITLE)}function Dl(e,t,a,n){return(!n||n===C.HTML)&&Ol(e,t,a)||(!n||n===C.MATHML)&&xl(e,t)}const Ll="hidden",yl=8,Rl=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 kl={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Es=new Set([s.TABLE,s.TBODY,s.TFOOT,s.THEAD,s.TR]),ps={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:We,onParseError:null};let Ts=class{constructor(t,a,n=null,i=null){this.fragmentContext=n,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={...ps,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=a??this.treeAdapter.createDocument(),this.tokenizer=new al(this.options,this),this.activeFormattingElements=new ll(this.treeAdapter),this.fragmentContextID=n?Aa(this.treeAdapter.getTagName(n)):s.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new cl(this.document,this.treeAdapter,this)}static parse(t,a){const n=new this(a);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,a){const n={...ps,...a};t??(t=n.treeAdapter.createElement(b.TEMPLATE,C.HTML,[]));const i=n.treeAdapter.createElement("documentmock",C.HTML,[]),r=new this(n,i,t);return r.fragmentContextID===s.TEMPLATE&&r.tmplInsertionModeStack.unshift(E.IN_TEMPLATE),r._initTokenizerForFragmentParsing(),r._insertFakeRootElement(),r._resetInsertionMode(),r._findFormInFragmentContext(),r}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),a=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,a),a}_err(t,a,n){var i;if(!this.onParseError)return;const r=(i=t.location)!==null&&i!==void 0?i:kl,u={code:a,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(u)}onItemPush(t,a,n){var i,r;(r=(i=this.treeAdapter).onItemPush)===null||r===void 0||r.call(i,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,a)}onItemPop(t,a){var n,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(n=this.treeAdapter).onItemPop)===null||i===void 0||i.call(n,t,this.openElements.current),a){let r,u;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,u=this.fragmentContextID):{current:r,currentTagId:u}=this.openElements,this._setContextModes(r,u)}}_setContextModes(t,a){const n=t===this.document||this.treeAdapter.getNamespaceURI(t)===C.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&!this._isIntegrationPoint(a,t)}_switchToTextParsing(t,a){this._insertElement(t,C.HTML),this.tokenizer.state=a,this.originalInsertionMode=this.insertionMode,this.insertionMode=E.TEXT}switchToPlaintextParsing(){this.insertionMode=E.TEXT,this.originalInsertionMode=E.IN_BODY,this.tokenizer.state=Ae.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===b.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==C.HTML))switch(this.fragmentContextID){case s.TITLE:case s.TEXTAREA:{this.tokenizer.state=Ae.RCDATA;break}case s.STYLE:case s.XMP:case s.IFRAME:case s.NOEMBED:case s.NOFRAMES:case s.NOSCRIPT:{this.tokenizer.state=Ae.RAWTEXT;break}case s.SCRIPT:{this.tokenizer.state=Ae.SCRIPT_DATA;break}case s.PLAINTEXT:{this.tokenizer.state=Ae.PLAINTEXT;break}}}_setDocumentType(t){const a=t.name||"",n=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,a,n,i),t.location){const u=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));u&&this.treeAdapter.setNodeSourceCodeLocation(u,t.location)}}_attachElementToTree(t,a){if(this.options.sourceCodeLocationInfo){const n=a&&{...a,startTag:a};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const n=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(n,t)}}_appendElement(t,a){const n=this.treeAdapter.createElement(t.tagName,a,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,a){const n=this.treeAdapter.createElement(t.tagName,a,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,a){const n=this.treeAdapter.createElement(t,C.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,a)}_insertTemplate(t){const a=this.treeAdapter.createElement(t.tagName,C.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(a,n),this._attachElementToTree(a,t.location),this.openElements.push(a,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(b.HTML,C.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,s.HTML)}_appendCommentNode(t,a){const n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(a,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let a,n;if(this._shouldFosterParentOnInsertion()?({parent:a,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(a,t.chars,n):this.treeAdapter.insertText(a,t.chars)):(a=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(a,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(a),r=n?i.lastIndexOf(n):i.length,u=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(u)){const{endLine:l,endCol:h,endOffset:m}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(u,{endLine:l,endCol:h,endOffset:m})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(u,t.location)}_adoptNodes(t,a){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(a,n)}_setEndLocation(t,a){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&a.location){const n=a.location,i=this.treeAdapter.getTagName(t),r=a.type===W.END_TAG&&i===a.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let a,n;return this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,n=this.fragmentContextID):{current:a,currentTagId:n}=this.openElements,t.tagID===s.SVG&&this.treeAdapter.getTagName(a)===b.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(a)===C.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===s.MGLYPH||t.tagID===s.MALIGNMARK)&&!this._isIntegrationPoint(n,a,C.HTML)}_processToken(t){switch(t.type){case W.CHARACTER:{this.onCharacter(t);break}case W.NULL_CHARACTER:{this.onNullCharacter(t);break}case W.COMMENT:{this.onComment(t);break}case W.DOCTYPE:{this.onDoctype(t);break}case W.START_TAG:{this._processStartTag(t);break}case W.END_TAG:{this.onEndTag(t);break}case W.EOF:{this.onEof(t);break}case W.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,a,n){const i=this.treeAdapter.getNamespaceURI(a),r=this.treeAdapter.getAttrList(a);return Dl(t,i,r,n)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const a=this.activeFormattingElements.entries.findIndex(i=>i.type===Ue.Marker||this.openElements.contains(i.element)),n=a<0?t-1:a-1;for(let i=n;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=E.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(s.P),this.openElements.popUntilTagNamePopped(s.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case s.TR:{this.insertionMode=E.IN_ROW;return}case s.TBODY:case s.THEAD:case s.TFOOT:{this.insertionMode=E.IN_TABLE_BODY;return}case s.CAPTION:{this.insertionMode=E.IN_CAPTION;return}case s.COLGROUP:{this.insertionMode=E.IN_COLUMN_GROUP;return}case s.TABLE:{this.insertionMode=E.IN_TABLE;return}case s.BODY:{this.insertionMode=E.IN_BODY;return}case s.FRAMESET:{this.insertionMode=E.IN_FRAMESET;return}case s.SELECT:{this._resetInsertionModeForSelect(t);return}case s.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case s.HTML:{this.insertionMode=this.headElement?E.AFTER_HEAD:E.BEFORE_HEAD;return}case s.TD:case s.TH:{if(t>0){this.insertionMode=E.IN_CELL;return}break}case s.HEAD:{if(t>0){this.insertionMode=E.IN_HEAD;return}break}}this.insertionMode=E.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let a=t-1;a>0;a--){const n=this.openElements.tagIDs[a];if(n===s.TEMPLATE)break;if(n===s.TABLE){this.insertionMode=E.IN_SELECT_IN_TABLE;return}}this.insertionMode=E.IN_SELECT}_isElementCausesFosterParenting(t){return Es.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const a=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case s.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(a)===C.HTML)return{parent:this.treeAdapter.getTemplateContent(a),beforeElement:null};break}case s.TABLE:{const n=this.treeAdapter.getParentNode(a);return n?{parent:n,beforeElement:a}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const a=this._findFosterParentingLocation();a.beforeElement?this.treeAdapter.insertBefore(a.parent,t,a.beforeElement):this.treeAdapter.appendChild(a.parent,t)}_isSpecialElement(t,a){const n=this.treeAdapter.getNamespaceURI(t);return zc[n].has(a)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){od(this,t);return}switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(this,t);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:{gs(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:{xn(this,t);break}case E.IN_TABLE_TEXT:{Os(this,t);break}case E.IN_COLUMN_GROUP:{xa(this,t);break}case E.AFTER_BODY:{La(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){ud(this,t);return}switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(this,t);break}case E.TEXT:{this._insertCharacters(t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{xn(this,t);break}case E.IN_COLUMN_GROUP:{xa(this,t);break}case E.AFTER_BODY:{La(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){In(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:{In(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.AFTER_BODY:{Fl(this,t);break}case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{Hl(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case E.INITIAL:{Vl(this,t);break}case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:{this._err(t,g.misplacedDoctype);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,g.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?cd(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Yl(this,t);break}case E.BEFORE_HEAD:{$l(this,t);break}case E.IN_HEAD:{ke(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Xl(this,t);break}case E.AFTER_HEAD:{jl(this,t);break}case E.IN_BODY:{pe(this,t);break}case E.IN_TABLE:{_t(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_CAPTION:{W0(this,t);break}case E.IN_COLUMN_GROUP:{On(this,t);break}case E.IN_TABLE_BODY:{Oa(this,t);break}case E.IN_ROW:{Da(this,t);break}case E.IN_CELL:{Q0(this,t);break}case E.IN_SELECT:{ys(this,t);break}case E.IN_SELECT_IN_TABLE:{z0(this,t);break}case E.IN_TEMPLATE:{Z0(this,t);break}case E.AFTER_BODY:{ed(this,t);break}case E.IN_FRAMESET:{td(this,t);break}case E.AFTER_FRAMESET:{nd(this,t);break}case E.AFTER_AFTER_BODY:{sd(this,t);break}case E.AFTER_AFTER_FRAMESET:{rd(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?ld(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{ql(this,t);break}case E.BEFORE_HEAD:{Wl(this,t);break}case E.IN_HEAD:{Gl(this,t);break}case E.IN_HEAD_NO_SCRIPT:{Ql(this,t);break}case E.AFTER_HEAD:{zl(this,t);break}case E.IN_BODY:{Sa(this,t);break}case E.TEXT:{v0(this,t);break}case E.IN_TABLE:{Wt(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_CAPTION:{G0(this,t);break}case E.IN_COLUMN_GROUP:{X0(this,t);break}case E.IN_TABLE_BODY:{Dn(this,t);break}case E.IN_ROW:{Ls(this,t);break}case E.IN_CELL:{j0(this,t);break}case E.IN_SELECT:{Rs(this,t);break}case E.IN_SELECT_IN_TABLE:{K0(this,t);break}case E.IN_TEMPLATE:{J0(this,t);break}case E.AFTER_BODY:{Ms(this,t);break}case E.IN_FRAMESET:{ad(this,t);break}case E.AFTER_FRAMESET:{id(this,t);break}case E.AFTER_AFTER_BODY:{ya(this,t);break}}}onEof(t){switch(this.insertionMode){case E.INITIAL:{Ft(this,t);break}case E.BEFORE_HTML:{Ht(this,t);break}case E.BEFORE_HEAD:{Vt(this,t);break}case E.IN_HEAD:{Yt(this,t);break}case E.IN_HEAD_NO_SCRIPT:{qt(this,t);break}case E.AFTER_HEAD:{$t(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:{Ss(this,t);break}case E.TEXT:{B0(this,t);break}case E.IN_TABLE_TEXT:{Xt(this,t);break}case E.IN_TEMPLATE:{ks(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:{Sn(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===d.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:{bs(this,t);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{xn(this,t);break}case E.IN_TABLE_TEXT:{xs(this,t);break}}}};function Ml(e,t){let a=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return a?e.openElements.contains(a.element)?e.openElements.hasInScope(t.tagID)||(a=null):(e.activeFormattingElements.removeEntry(a),a=null):Is(e,t),a}function Pl(e,t){let a=null,n=e.openElements.stackTop;for(;n>=0;n--){const i=e.openElements.items[n];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[n])&&(a=i)}return a||(e.openElements.shortenToLength(n<0?0:n),e.activeFormattingElements.removeEntry(t)),a}function vl(e,t,a){let n=t,i=e.openElements.getCommonAncestor(t);for(let r=0,u=i;u!==a;r++,u=i){i=e.openElements.getCommonAncestor(u);const o=e.activeFormattingElements.getElementEntry(u),l=o&&r>=Rl;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(u)):(u=Bl(e,o),n===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(n),e.treeAdapter.appendChild(u,n),n=u)}return n}function Bl(e,t){const a=e.treeAdapter.getNamespaceURI(t.element),n=e.treeAdapter.createElement(t.token.tagName,a,t.token.attrs);return e.openElements.replace(t.element,n),t.element=n,n}function wl(e,t,a){const n=e.treeAdapter.getTagName(t),i=Aa(n);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(a);else{const r=e.treeAdapter.getNamespaceURI(t);i===s.TEMPLATE&&r===C.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,a)}}function Ul(e,t,a){const n=e.treeAdapter.getNamespaceURI(a.element),{token:i}=a,r=e.treeAdapter.createElement(i.tagName,n,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(a),e.openElements.remove(a.element),e.openElements.insertAfter(t,r,i.tagID)}function Cn(e,t){for(let a=0;a<yl;a++){const n=Ml(e,t);if(!n)break;const i=Pl(e,n);if(!i)break;e.activeFormattingElements.bookmark=n;const r=vl(e,i,n.element),u=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(r),u&&wl(e,u,r),Ul(e,i,n)}}function In(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Fl(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Hl(e,t){e._appendCommentNode(t,e.document)}function Sn(e,t){if(e.stopped=!0,t.location){const a=e.fragmentContext?0:2;for(let n=e.openElements.stackTop;n>=a;n--)e._setEndLocation(e.openElements.items[n],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const n=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(n);if(i&&!i.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],u=e.treeAdapter.getNodeSourceCodeLocation(r);u&&!u.endTag&&e._setEndLocation(r,t)}}}}function Vl(e,t){e._setDocumentType(t);const a=t.forceQuirks?Ie.QUIRKS:Tl(t);pl(t)||e._err(t,g.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,a),e.insertionMode=E.BEFORE_HTML}function Ft(e,t){e._err(t,g.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ie.QUIRKS),e.insertionMode=E.BEFORE_HTML,e._processToken(t)}function Yl(e,t){t.tagID===s.HTML?(e._insertElement(t,C.HTML),e.insertionMode=E.BEFORE_HEAD):Ht(e,t)}function ql(e,t){const a=t.tagID;(a===s.HTML||a===s.HEAD||a===s.BODY||a===s.BR)&&Ht(e,t)}function Ht(e,t){e._insertFakeRootElement(),e.insertionMode=E.BEFORE_HEAD,e._processToken(t)}function $l(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.HEAD:{e._insertElement(t,C.HTML),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD;break}default:Vt(e,t)}}function Wl(e,t){const a=t.tagID;a===s.HEAD||a===s.BODY||a===s.HTML||a===s.BR?Vt(e,t):e._err(t,g.endTagWithoutMatchingOpenElement)}function Vt(e,t){e._insertFakeElement(b.HEAD,s.HEAD),e.headElement=e.openElements.current,e.insertionMode=E.IN_HEAD,e._processToken(t)}function ke(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.TITLE:{e._switchToTextParsing(t,Ae.RCDATA);break}case s.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Ae.RAWTEXT):(e._insertElement(t,C.HTML),e.insertionMode=E.IN_HEAD_NO_SCRIPT);break}case s.NOFRAMES:case s.STYLE:{e._switchToTextParsing(t,Ae.RAWTEXT);break}case s.SCRIPT:{e._switchToTextParsing(t,Ae.SCRIPT_DATA);break}case s.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=E.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(E.IN_TEMPLATE);break}case s.HEAD:{e._err(t,g.misplacedStartTagForHeadElement);break}default:Yt(e,t)}}function Gl(e,t){switch(t.tagID){case s.HEAD:{e.openElements.pop(),e.insertionMode=E.AFTER_HEAD;break}case s.BODY:case s.BR:case s.HTML:{Yt(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function lt(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==s.TEMPLATE&&e._err(t,g.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(s.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,g.endTagWithoutMatchingOpenElement)}function Yt(e,t){e.openElements.pop(),e.insertionMode=E.AFTER_HEAD,e._processToken(t)}function Xl(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BASEFONT:case s.BGSOUND:case s.HEAD:case s.LINK:case s.META:case s.NOFRAMES:case s.STYLE:{ke(e,t);break}case s.NOSCRIPT:{e._err(t,g.nestedNoscriptInHead);break}default:qt(e,t)}}function Ql(e,t){switch(t.tagID){case s.NOSCRIPT:{e.openElements.pop(),e.insertionMode=E.IN_HEAD;break}case s.BR:{qt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function qt(e,t){const a=t.type===W.EOF?g.openElementsLeftAfterEof:g.disallowedContentInNoscriptInHead;e._err(t,a),e.openElements.pop(),e.insertionMode=E.IN_HEAD,e._processToken(t)}function jl(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.BODY:{e._insertElement(t,C.HTML),e.framesetOk=!1,e.insertionMode=E.IN_BODY;break}case s.FRAMESET:{e._insertElement(t,C.HTML),e.insertionMode=E.IN_FRAMESET;break}case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:case s.NOFRAMES:case s.SCRIPT:case s.STYLE:case s.TEMPLATE:case s.TITLE:{e._err(t,g.abandonedHeadElementChild),e.openElements.push(e.headElement,s.HEAD),ke(e,t),e.openElements.remove(e.headElement);break}case s.HEAD:{e._err(t,g.misplacedStartTagForHeadElement);break}default:$t(e,t)}}function zl(e,t){switch(t.tagID){case s.BODY:case s.HTML:case s.BR:{$t(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:e._err(t,g.endTagWithoutMatchingOpenElement)}}function $t(e,t){e._insertFakeElement(b.BODY,s.BODY),e.insertionMode=E.IN_BODY,Ia(e,t)}function Ia(e,t){switch(t.type){case W.CHARACTER:{gs(e,t);break}case W.WHITESPACE_CHARACTER:{bs(e,t);break}case W.COMMENT:{In(e,t);break}case W.START_TAG:{pe(e,t);break}case W.END_TAG:{Sa(e,t);break}case W.EOF:{Ss(e,t);break}}}function bs(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function gs(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Kl(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Zl(e,t){const a=e.openElements.tryPeekProperlyNestedBodyElement();a&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(a,t.attrs))}function Jl(e,t){const a=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&a&&(e.treeAdapter.detachNode(a),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_FRAMESET)}function e0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML)}function t0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),_n.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,C.HTML)}function a0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function n0(e,t){const a=e.openElements.tmplCount>0;(!e.formElement||a)&&(e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),a||(e.formElement=e.openElements.current))}function i0(e,t){e.framesetOk=!1;const a=t.tagID;for(let n=e.openElements.stackTop;n>=0;n--){const i=e.openElements.tagIDs[n];if(a===s.LI&&i===s.LI||(a===s.DD||a===s.DT)&&(i===s.DD||i===s.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==s.ADDRESS&&i!==s.DIV&&i!==s.P&&e._isSpecialElement(e.openElements.items[n],i))break}e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML)}function s0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.tokenizer.state=Ae.PLAINTEXT}function r0(e,t){e.openElements.hasInScope(s.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.framesetOk=!1}function u0(e,t){const a=e.activeFormattingElements.getElementEntryInScopeWithTagName(b.A);a&&(Cn(e,t),e.openElements.remove(a.element),e.activeFormattingElements.removeEntry(a)),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function o0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function c0(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(s.NOBR)&&(Cn(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,C.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function l0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function d0(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ie.QUIRKS&&e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._insertElement(t,C.HTML),e.framesetOk=!1,e.insertionMode=E.IN_TABLE}function _s(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,C.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function As(e){const t=Ji(e,ct.TYPE);return t!=null&&t.toLowerCase()===Ll}function h0(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,C.HTML),As(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function f0(e,t){e._appendElement(t,C.HTML),t.ackSelfClosing=!0}function m0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._appendElement(t,C.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function E0(e,t){t.tagName=b.IMG,t.tagID=s.IMG,_s(e,t)}function p0(e,t){e._insertElement(t,C.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Ae.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=E.TEXT}function T0(e,t){e.openElements.hasInButtonScope(s.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Ae.RAWTEXT)}function b0(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Ae.RAWTEXT)}function Ns(e,t){e._switchToTextParsing(t,Ae.RAWTEXT)}function g0(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.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 _0(e,t){e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML)}function A0(e,t){e.openElements.hasInScope(s.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,C.HTML)}function N0(e,t){e.openElements.hasInScope(s.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(s.RTC),e._insertElement(t,C.HTML)}function C0(e,t){e._reconstructActiveFormattingElements(),fs(t),Nn(t),t.selfClosing?e._appendElement(t,C.MATHML):e._insertElement(t,C.MATHML),t.ackSelfClosing=!0}function I0(e,t){e._reconstructActiveFormattingElements(),ms(t),Nn(t),t.selfClosing?e._appendElement(t,C.SVG):e._insertElement(t,C.SVG),t.ackSelfClosing=!0}function Cs(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,C.HTML)}function pe(e,t){switch(t.tagID){case s.I:case s.S:case s.B:case s.U:case s.EM:case s.TT:case s.BIG:case s.CODE:case s.FONT:case s.SMALL:case s.STRIKE:case s.STRONG:{o0(e,t);break}case s.A:{u0(e,t);break}case s.H1:case s.H2:case s.H3:case s.H4:case s.H5:case s.H6:{t0(e,t);break}case s.P:case s.DL:case s.OL:case s.UL:case s.DIV:case s.DIR:case s.NAV:case s.MAIN:case s.MENU:case s.ASIDE:case s.CENTER:case s.FIGURE:case s.FOOTER:case s.HEADER:case s.HGROUP:case s.DIALOG:case s.DETAILS:case s.ADDRESS:case s.ARTICLE:case s.SEARCH:case s.SECTION:case s.SUMMARY:case s.FIELDSET:case s.BLOCKQUOTE:case s.FIGCAPTION:{e0(e,t);break}case s.LI:case s.DD:case s.DT:{i0(e,t);break}case s.BR:case s.IMG:case s.WBR:case s.AREA:case s.EMBED:case s.KEYGEN:{_s(e,t);break}case s.HR:{m0(e,t);break}case s.RB:case s.RTC:{A0(e,t);break}case s.RT:case s.RP:{N0(e,t);break}case s.PRE:case s.LISTING:{a0(e,t);break}case s.XMP:{T0(e,t);break}case s.SVG:{I0(e,t);break}case s.HTML:{Kl(e,t);break}case s.BASE:case s.LINK:case s.META:case s.STYLE:case s.TITLE:case s.SCRIPT:case s.BGSOUND:case s.BASEFONT:case s.TEMPLATE:{ke(e,t);break}case s.BODY:{Zl(e,t);break}case s.FORM:{n0(e,t);break}case s.NOBR:{c0(e,t);break}case s.MATH:{C0(e,t);break}case s.TABLE:{d0(e,t);break}case s.INPUT:{h0(e,t);break}case s.PARAM:case s.TRACK:case s.SOURCE:{f0(e,t);break}case s.IMAGE:{E0(e,t);break}case s.BUTTON:{r0(e,t);break}case s.APPLET:case s.OBJECT:case s.MARQUEE:{l0(e,t);break}case s.IFRAME:{b0(e,t);break}case s.SELECT:{g0(e,t);break}case s.OPTION:case s.OPTGROUP:{_0(e,t);break}case s.NOEMBED:case s.NOFRAMES:{Ns(e,t);break}case s.FRAMESET:{Jl(e,t);break}case s.TEXTAREA:{p0(e,t);break}case s.NOSCRIPT:{e.options.scriptingEnabled?Ns(e,t):Cs(e,t);break}case s.PLAINTEXT:{s0(e,t);break}case s.COL:case s.TH:case s.TD:case s.TR:case s.HEAD:case s.FRAME:case s.TBODY:case s.TFOOT:case s.THEAD:case s.CAPTION:case s.COLGROUP:break;default:Cs(e,t)}}function S0(e,t){if(e.openElements.hasInScope(s.BODY)&&(e.insertionMode=E.AFTER_BODY,e.options.sourceCodeLocationInfo)){const a=e.openElements.tryPeekProperlyNestedBodyElement();a&&e._setEndLocation(a,t)}}function x0(e,t){e.openElements.hasInScope(s.BODY)&&(e.insertionMode=E.AFTER_BODY,Ms(e,t))}function O0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a))}function D0(e){const t=e.openElements.tmplCount>0,{formElement:a}=e;t||(e.formElement=null),(a||t)&&e.openElements.hasInScope(s.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(s.FORM):a&&e.openElements.remove(a))}function L0(e){e.openElements.hasInButtonScope(s.P)||e._insertFakeElement(b.P,s.P),e._closePElement()}function y0(e){e.openElements.hasInListItemScope(s.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(s.LI),e.openElements.popUntilTagNamePopped(s.LI))}function R0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a))}function k0(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function M0(e,t){const a=t.tagID;e.openElements.hasInScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a),e.activeFormattingElements.clearToLastMarker())}function P0(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(b.BR,s.BR),e.openElements.pop(),e.framesetOk=!1}function Is(e,t){const a=t.tagName,n=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],u=e.openElements.tagIDs[i];if(n===u&&(n!==s.UNKNOWN||e.treeAdapter.getTagName(r)===a)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,u))break}}function Sa(e,t){switch(t.tagID){case s.A:case s.B:case s.I:case s.S:case s.U:case s.EM:case s.TT:case s.BIG:case s.CODE:case s.FONT:case s.NOBR:case s.SMALL:case s.STRIKE:case s.STRONG:{Cn(e,t);break}case s.P:{L0(e);break}case s.DL:case s.UL:case s.OL:case s.DIR:case s.DIV:case s.NAV:case s.PRE:case s.MAIN:case s.MENU:case s.ASIDE:case s.BUTTON:case s.CENTER:case s.FIGURE:case s.FOOTER:case s.HEADER:case s.HGROUP:case s.DIALOG:case s.ADDRESS:case s.ARTICLE:case s.DETAILS:case s.SEARCH:case s.SECTION:case s.SUMMARY:case s.LISTING:case s.FIELDSET:case s.BLOCKQUOTE:case s.FIGCAPTION:{O0(e,t);break}case s.LI:{y0(e);break}case s.DD:case s.DT:{R0(e,t);break}case s.H1:case s.H2:case s.H3:case s.H4:case s.H5:case s.H6:{k0(e);break}case s.BR:{P0(e);break}case s.BODY:{S0(e,t);break}case s.HTML:{x0(e,t);break}case s.FORM:{D0(e);break}case s.APPLET:case s.OBJECT:case s.MARQUEE:{M0(e,t);break}case s.TEMPLATE:{lt(e,t);break}default:Is(e,t)}}function Ss(e,t){e.tmplInsertionModeStack.length>0?ks(e,t):Sn(e,t)}function v0(e,t){var a;t.tagID===s.SCRIPT&&((a=e.scriptHandler)===null||a===void 0||a.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function B0(e,t){e._err(t,g.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function xn(e,t){if(Es.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 W.CHARACTER:{Os(e,t);break}case W.WHITESPACE_CHARACTER:{xs(e,t);break}}else Gt(e,t)}function w0(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_CAPTION}function U0(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_COLUMN_GROUP}function F0(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(b.COLGROUP,s.COLGROUP),e.insertionMode=E.IN_COLUMN_GROUP,On(e,t)}function H0(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_TABLE_BODY}function V0(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(b.TBODY,s.TBODY),e.insertionMode=E.IN_TABLE_BODY,Oa(e,t)}function Y0(e,t){e.openElements.hasInTableScope(s.TABLE)&&(e.openElements.popUntilTagNamePopped(s.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function q0(e,t){As(t)?e._appendElement(t,C.HTML):Gt(e,t),t.ackSelfClosing=!0}function $0(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,C.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function _t(e,t){switch(t.tagID){case s.TD:case s.TH:case s.TR:{V0(e,t);break}case s.STYLE:case s.SCRIPT:case s.TEMPLATE:{ke(e,t);break}case s.COL:{F0(e,t);break}case s.FORM:{$0(e,t);break}case s.TABLE:{Y0(e,t);break}case s.TBODY:case s.TFOOT:case s.THEAD:{H0(e,t);break}case s.INPUT:{q0(e,t);break}case s.CAPTION:{w0(e,t);break}case s.COLGROUP:{U0(e,t);break}default:Gt(e,t)}}function Wt(e,t){switch(t.tagID){case s.TABLE:{e.openElements.hasInTableScope(s.TABLE)&&(e.openElements.popUntilTagNamePopped(s.TABLE),e._resetInsertionMode());break}case s.TEMPLATE:{lt(e,t);break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TBODY:case s.TD:case s.TFOOT:case s.TH:case s.THEAD:case s.TR:break;default:Gt(e,t)}}function Gt(e,t){const a=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Ia(e,t),e.fosterParentingEnabled=a}function xs(e,t){e.pendingCharacterTokens.push(t)}function Os(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Xt(e,t){let a=0;if(e.hasNonWhitespacePendingCharacterToken)for(;a<e.pendingCharacterTokens.length;a++)Gt(e,e.pendingCharacterTokens[a]);else for(;a<e.pendingCharacterTokens.length;a++)e._insertCharacters(e.pendingCharacterTokens[a]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Ds=new Set([s.CAPTION,s.COL,s.COLGROUP,s.TBODY,s.TD,s.TFOOT,s.TH,s.THEAD,s.TR]);function W0(e,t){const a=t.tagID;Ds.has(a)?e.openElements.hasInTableScope(s.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,_t(e,t)):pe(e,t)}function G0(e,t){const a=t.tagID;switch(a){case s.CAPTION:case s.TABLE:{e.openElements.hasInTableScope(s.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_TABLE,a===s.TABLE&&Wt(e,t));break}case s.BODY:case s.COL:case s.COLGROUP:case s.HTML:case s.TBODY:case s.TD:case s.TFOOT:case s.TH:case s.THEAD:case s.TR:break;default:Sa(e,t)}}function On(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.COL:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.TEMPLATE:{ke(e,t);break}default:xa(e,t)}}function X0(e,t){switch(t.tagID){case s.COLGROUP:{e.openElements.currentTagId===s.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case s.TEMPLATE:{lt(e,t);break}case s.COL:break;default:xa(e,t)}}function xa(e,t){e.openElements.currentTagId===s.COLGROUP&&(e.openElements.pop(),e.insertionMode=E.IN_TABLE,e._processToken(t))}function Oa(e,t){switch(t.tagID){case s.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_ROW;break}case s.TH:case s.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(b.TR,s.TR),e.insertionMode=E.IN_ROW,Da(e,t);break}case s.CAPTION:case s.COL:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,_t(e,t));break}default:_t(e,t)}}function Dn(e,t){const a=t.tagID;switch(t.tagID){case s.TBODY:case s.TFOOT:case s.THEAD:{e.openElements.hasInTableScope(a)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE);break}case s.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE,Wt(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TD:case s.TH:case s.TR:break;default:Wt(e,t)}}function Da(e,t){switch(t.tagID){case s.TH:case s.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,C.HTML),e.insertionMode=E.IN_CELL,e.activeFormattingElements.insertMarker();break}case s.CAPTION:case s.COL:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:case s.TR:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Oa(e,t));break}default:_t(e,t)}}function Ls(e,t){switch(t.tagID){case s.TR:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY);break}case s.TABLE:{e.openElements.hasInTableScope(s.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Dn(e,t));break}case s.TBODY:case s.TFOOT:case s.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(s.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=E.IN_TABLE_BODY,Dn(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:case s.TD:case s.TH:break;default:Wt(e,t)}}function Q0(e,t){const a=t.tagID;Ds.has(a)?(e.openElements.hasInTableScope(s.TD)||e.openElements.hasInTableScope(s.TH))&&(e._closeTableCell(),Da(e,t)):pe(e,t)}function j0(e,t){const a=t.tagID;switch(a){case s.TD:case s.TH:{e.openElements.hasInTableScope(a)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(a),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=E.IN_ROW);break}case s.TABLE:case s.TBODY:case s.TFOOT:case s.THEAD:case s.TR:{e.openElements.hasInTableScope(a)&&(e._closeTableCell(),Ls(e,t));break}case s.BODY:case s.CAPTION:case s.COL:case s.COLGROUP:case s.HTML:break;default:Sa(e,t)}}function ys(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.OPTION:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e._insertElement(t,C.HTML);break}case s.OPTGROUP:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop(),e._insertElement(t,C.HTML);break}case s.HR:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop(),e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.INPUT:case s.KEYGEN:case s.TEXTAREA:case s.SELECT:{e.openElements.hasInSelectScope(s.SELECT)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),t.tagID!==s.SELECT&&e._processStartTag(t));break}case s.SCRIPT:case s.TEMPLATE:{ke(e,t);break}}}function Rs(e,t){switch(t.tagID){case s.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===s.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===s.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===s.OPTGROUP&&e.openElements.pop();break}case s.OPTION:{e.openElements.currentTagId===s.OPTION&&e.openElements.pop();break}case s.SELECT:{e.openElements.hasInSelectScope(s.SELECT)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode());break}case s.TEMPLATE:{lt(e,t);break}}}function z0(e,t){const a=t.tagID;a===s.CAPTION||a===s.TABLE||a===s.TBODY||a===s.TFOOT||a===s.THEAD||a===s.TR||a===s.TD||a===s.TH?(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ys(e,t)}function K0(e,t){const a=t.tagID;a===s.CAPTION||a===s.TABLE||a===s.TBODY||a===s.TFOOT||a===s.THEAD||a===s.TR||a===s.TD||a===s.TH?e.openElements.hasInTableScope(a)&&(e.openElements.popUntilTagNamePopped(s.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Rs(e,t)}function Z0(e,t){switch(t.tagID){case s.BASE:case s.BASEFONT:case s.BGSOUND:case s.LINK:case s.META:case s.NOFRAMES:case s.SCRIPT:case s.STYLE:case s.TEMPLATE:case s.TITLE:{ke(e,t);break}case s.CAPTION:case s.COLGROUP:case s.TBODY:case s.TFOOT:case s.THEAD:{e.tmplInsertionModeStack[0]=E.IN_TABLE,e.insertionMode=E.IN_TABLE,_t(e,t);break}case s.COL:{e.tmplInsertionModeStack[0]=E.IN_COLUMN_GROUP,e.insertionMode=E.IN_COLUMN_GROUP,On(e,t);break}case s.TR:{e.tmplInsertionModeStack[0]=E.IN_TABLE_BODY,e.insertionMode=E.IN_TABLE_BODY,Oa(e,t);break}case s.TD:case s.TH:{e.tmplInsertionModeStack[0]=E.IN_ROW,e.insertionMode=E.IN_ROW,Da(e,t);break}default:e.tmplInsertionModeStack[0]=E.IN_BODY,e.insertionMode=E.IN_BODY,pe(e,t)}}function J0(e,t){t.tagID===s.TEMPLATE&&lt(e,t)}function ks(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(s.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Sn(e,t)}function ed(e,t){t.tagID===s.HTML?pe(e,t):La(e,t)}function Ms(e,t){var a;if(t.tagID===s.HTML){if(e.fragmentContext||(e.insertionMode=E.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===s.HTML){e._setEndLocation(e.openElements.items[0],t);const n=e.openElements.items[1];n&&!(!((a=e.treeAdapter.getNodeSourceCodeLocation(n))===null||a===void 0)&&a.endTag)&&e._setEndLocation(n,t)}}else La(e,t)}function La(e,t){e.insertionMode=E.IN_BODY,Ia(e,t)}function td(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.FRAMESET:{e._insertElement(t,C.HTML);break}case s.FRAME:{e._appendElement(t,C.HTML),t.ackSelfClosing=!0;break}case s.NOFRAMES:{ke(e,t);break}}}function ad(e,t){t.tagID===s.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==s.FRAMESET&&(e.insertionMode=E.AFTER_FRAMESET))}function nd(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.NOFRAMES:{ke(e,t);break}}}function id(e,t){t.tagID===s.HTML&&(e.insertionMode=E.AFTER_AFTER_FRAMESET)}function sd(e,t){t.tagID===s.HTML?pe(e,t):ya(e,t)}function ya(e,t){e.insertionMode=E.IN_BODY,Ia(e,t)}function rd(e,t){switch(t.tagID){case s.HTML:{pe(e,t);break}case s.NOFRAMES:{ke(e,t);break}}}function ud(e,t){t.chars=K,e._insertCharacters(t)}function od(e,t){e._insertCharacters(t),e.framesetOk=!1}function Ps(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==C.HTML&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function cd(e,t){if(Il(t))Ps(e),e._startTagOutsideForeignContent(t);else{const a=e._getAdjustedCurrentElement(),n=e.treeAdapter.getNamespaceURI(a);n===C.MATHML?fs(t):n===C.SVG&&(Sl(t),ms(t)),Nn(t),t.selfClosing?e._appendElement(t,n):e._insertElement(t,n),t.ackSelfClosing=!0}}function ld(e,t){if(t.tagID===s.P||t.tagID===s.BR){Ps(e),e._endTagOutsideForeignContent(t);return}for(let a=e.openElements.stackTop;a>0;a--){const n=e.openElements.items[a];if(e.treeAdapter.getNamespaceURI(n)===C.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(n);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(a);break}}}const dd=new Set([b.AREA,b.BASE,b.BASEFONT,b.BGSOUND,b.BR,b.COL,b.EMBED,b.FRAME,b.HR,b.IMG,b.INPUT,b.KEYGEN,b.LINK,b.META,b.PARAM,b.SOURCE,b.TRACK,b.WBR]);function hd(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===C.HTML&&dd.has(t.treeAdapter.getTagName(e))}const fd={treeAdapter:We,scriptingEnabled:!0};function md(e,t){const a={...fd,...t};return vs(e,a)}function Ed(e,t){let a="";const n=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===b.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===C.HTML?t.treeAdapter.getTemplateContent(e):e,i=t.treeAdapter.getChildNodes(n);if(i)for(const r of i)a+=vs(r,t);return a}function vs(e,t){return t.treeAdapter.isElementNode(e)?pd(e,t):t.treeAdapter.isTextNode(e)?bd(e,t):t.treeAdapter.isCommentNode(e)?gd(e,t):t.treeAdapter.isDocumentTypeNode(e)?_d(e,t):""}function pd(e,t){const a=t.treeAdapter.getTagName(e);return`<${a}${Td(e,t)}>${hd(e,t)?"":`${Ed(e,t)}</${a}>`}`}function Td(e,{treeAdapter:t}){let a="";for(const n of t.getAttrList(e)){if(a+=" ",n.namespace)switch(n.namespace){case C.XML:{a+=`xml:${n.name}`;break}case C.XMLNS:{n.name!=="xmlns"&&(a+="xmlns:"),a+=n.name;break}case C.XLINK:{a+=`xlink:${n.name}`;break}default:a+=`${n.prefix}:${n.name}`}else a+=n.name;a+=`="${ai(n.value)}"`}return a}function bd(e,t){const{treeAdapter:a}=t,n=a.getTextNodeContent(e),i=a.getParentNode(e),r=i&&a.isElementNode(i)&&a.getTagName(i);return r&&a.getNamespaceURI(i)===C.HTML&&Zc(r,t.scriptingEnabled)?n:ni(n)}function gd(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function _d(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function Ad(e,t){return Ts.parse(e,t)}function Nd(e,t,a){typeof e=="string"&&(a=t,t=e,e=null);const n=Ts.getFragmentParser(e,a);return n.tokenizer.write(t,!0),n.getFragment()}function Bs(e){const t=e.includes('"')?"'":'"';return t+e+t}function Cd(e,t,a){let n="!DOCTYPE ";return e&&(n+=e),t?n+=` PUBLIC ${Bs(t)}`:a&&(n+=" SYSTEM"),a&&(n+=` ${Bs(a)}`),n}const Je={isCommentNode:ia,isElementNode:v,isTextNode:we,createDocument(){const e=new it([]);return e["x-mode"]=Ie.NO_QUIRKS,e},createDocumentFragment(){return new it([])},createElement(e,t,a){const n=Object.create(null),i=Object.create(null),r=Object.create(null);for(let o=0;o<a.length;o++){const l=a[o].name;n[l]=a[o].value,i[l]=a[o].namespace,r[l]=a[o].prefix}const u=new Ha(e,n,[]);return u.namespace=t,u["x-attribsNamespace"]=i,u["x-attribsPrefix"]=r,u},createCommentNode(e){return new wa(e)},createTextNode(e){return new Dt(e)},appendChild(e,t){const a=e.children[e.children.length-1];a&&(a.next=t,t.prev=a),e.children.push(t),t.parent=e},insertBefore(e,t,a){const n=e.children.indexOf(a),{prev:i}=a;i&&(i.next=t,t.prev=i),a.prev=t,t.next=a,e.children.splice(n,0,t),t.parent=e},setTemplateContent(e,t){Je.appendChild(e,t)},getTemplateContent(e){return e.children[0]},setDocumentType(e,t,a,n){const i=Cd(t,a,n);let r=e.children.find(u=>Va(u)&&u.name==="!doctype");r?r.data=i??null:(r=new Ua("!doctype",i),Je.appendChild(e,r)),r["x-name"]=t,r["x-publicId"]=a,r["x-systemId"]=n},setDocumentMode(e,t){e["x-mode"]=t},getDocumentMode(e){return e["x-mode"]},detachNode(e){if(e.parent){const t=e.parent.children.indexOf(e),{prev:a,next:n}=e;e.prev=null,e.next=null,a&&(a.next=n),n&&(n.prev=a),e.parent.children.splice(t,1),e.parent=null}},insertText(e,t){const a=e.children[e.children.length-1];a&&we(a)?a.data+=t:Je.appendChild(e,Je.createTextNode(t))},insertTextBefore(e,t,a){const n=e.children[e.children.indexOf(a)-1];n&&we(n)?n.data+=t:Je.insertBefore(e,Je.createTextNode(t),a)},adoptAttributes(e,t){for(let a=0;a<t.length;a++){const n=t[a].name;e.attribs[n]===void 0&&(e.attribs[n]=t[a].value,e["x-attribsNamespace"][n]=t[a].namespace,e["x-attribsPrefix"][n]=t[a].prefix)}},getFirstChild(e){return e.children[0]},getChildNodes(e){return e.children},getParentNode(e){return e.parent},getAttrList(e){return e.attributes},getTagName(e){return e.name},getNamespaceURI(e){return e.namespace},getTextNodeContent(e){return e.data},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){var t;return(t=e["x-name"])!==null&&t!==void 0?t:""},getDocumentTypeNodePublicId(e){var t;return(t=e["x-publicId"])!==null&&t!==void 0?t:""},getDocumentTypeNodeSystemId(e){var t;return(t=e["x-systemId"])!==null&&t!==void 0?t:""},isDocumentTypeNode(e){return Va(e)&&e.name==="!doctype"},setNodeSourceCodeLocation(e,t){t&&(e.startIndex=t.startOffset,e.endIndex=t.endOffset),e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){t.endOffset!=null&&(e.endIndex=t.endOffset),e.sourceCodeLocation={...e.sourceCodeLocation,...t}}};function Id(e,t,a,n){var i;return(i=t.treeAdapter)!==null&&i!==void 0||(t.treeAdapter=Je),t.scriptingEnabled!==!1&&(t.scriptingEnabled=!0),a?Ad(e,t):Nd(n,e,t)}const Sd={treeAdapter:Je};function xd(e){const t="length"in e?e:[e];for(let n=0;n<t.length;n+=1){const i=t[n];Qe(i)&&Array.prototype.splice.call(t,n,1,...i.children)}let a="";for(let n=0;n<t.length;n+=1){const i=t[n];a+=md(i,Sd)}return a}var M;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(M||(M={}));var S;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(S||(S={}));function Ge(e){return e===M.Space||e===M.NewLine||e===M.Tab||e===M.FormFeed||e===M.CarriageReturn}function Ra(e){return e===M.Slash||e===M.Gt||Ge(e)}function Od(e){return e>=M.LowerA&&e<=M.LowerZ||e>=M.UpperA&&e<=M.UpperZ}var Fe;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(Fe||(Fe={}));const Ee={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class Dd{constructor({xmlMode:t=!1,decodeEntities:a=!0},n){this.cbs=n,this.state=S.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=S.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=a,this.entityDecoder=new Xa(t?Kn:qa,(i,r)=>this.emitCodePoint(i,r))}reset(){this.state=S.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=S.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===M.Lt||!this.decodeEntities&&this.fastForwardTo(M.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=S.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateSpecialStartSequence(t){const a=this.sequenceIndex===this.currentSequence.length;if(!(a?Ra(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!a){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=S.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===M.Gt||Ge(t)){const a=this.index-this.currentSequence.length;if(this.sectionStart<a){const n=this.index;this.index=a,this.cbs.ontext(this.sectionStart,a),this.index=n}this.isSpecial=!1,this.sectionStart=a+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Ee.TitleEnd?this.decodeEntities&&t===M.Amp&&this.startEntity():this.fastForwardTo(M.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===M.Lt)}stateCDATASequence(t){t===Ee.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ee.Cdata.length&&(this.state=S.InCommentLike,this.currentSequence=Ee.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=S.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ee.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=S.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!Ra(t):Od(t)}startSpecial(t,a){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=a,this.state=S.SpecialStartSequence}stateBeforeTagName(t){if(t===M.ExclamationMark)this.state=S.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===M.Questionmark)this.state=S.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const a=t|32;this.sectionStart=this.index,this.xmlMode?this.state=S.InTagName:a===Ee.ScriptEnd[2]?this.state=S.BeforeSpecialS:a===Ee.TitleEnd[2]?this.state=S.BeforeSpecialT:this.state=S.InTagName}else t===M.Slash?this.state=S.BeforeClosingTagName:(this.state=S.Text,this.stateText(t))}stateInTagName(t){Ra(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){Ge(t)||(t===M.Gt?this.state=S.Text:(this.state=this.isTagStartChar(t)?S.InClosingTagName:S.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===M.Gt||Ge(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=S.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===M.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=S.InSpecialTag,this.sequenceIndex=0):this.state=S.Text,this.sectionStart=this.index+1):t===M.Slash?this.state=S.InSelfClosingTag:Ge(t)||(this.state=S.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===M.Gt?(this.cbs.onselfclosingtag(this.index),this.state=S.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ge(t)||(this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===M.Eq||Ra(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=S.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===M.Eq?this.state=S.BeforeAttributeValue:t===M.Slash||t===M.Gt?(this.cbs.onattribend(Fe.NoValue,this.sectionStart),this.sectionStart=-1,this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t)):Ge(t)||(this.cbs.onattribend(Fe.NoValue,this.sectionStart),this.state=S.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===M.DoubleQuote?(this.state=S.InAttributeValueDq,this.sectionStart=this.index+1):t===M.SingleQuote?(this.state=S.InAttributeValueSq,this.sectionStart=this.index+1):Ge(t)||(this.sectionStart=this.index,this.state=S.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,a){t===a||!this.decodeEntities&&this.fastForwardTo(a)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(a===M.DoubleQuote?Fe.Double:Fe.Single,this.index+1),this.state=S.BeforeAttributeName):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,M.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,M.SingleQuote)}stateInAttributeValueNoQuotes(t){Ge(t)||t===M.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Fe.Unquoted,this.index),this.state=S.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===M.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===M.OpeningSquareBracket?(this.state=S.CDATASequence,this.sequenceIndex=0):this.state=t===M.Dash?S.BeforeComment:S.InDeclaration}stateInDeclaration(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=S.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===M.Dash?(this.state=S.InCommentLike,this.currentSequence=Ee.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=S.InDeclaration}stateInSpecialComment(t){(t===M.Gt||this.fastForwardTo(M.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=S.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const a=t|32;a===Ee.ScriptEnd[3]?this.startSpecial(Ee.ScriptEnd,4):a===Ee.StyleEnd[3]?this.startSpecial(Ee.StyleEnd,4):(this.state=S.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){const a=t|32;a===Ee.TitleEnd[3]?this.startSpecial(Ee.TitleEnd,4):a===Ee.TextareaEnd[3]?this.startSpecial(Ee.TextareaEnd,4):(this.state=S.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=S.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?xe.Strict:this.baseState===S.Text||this.baseState===S.InSpecialTag?xe.Legacy:xe.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,t===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===S.Text||this.state===S.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===S.InAttributeValueDq||this.state===S.InAttributeValueSq||this.state===S.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case S.Text:{this.stateText(t);break}case S.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case S.InSpecialTag:{this.stateInSpecialTag(t);break}case S.CDATASequence:{this.stateCDATASequence(t);break}case S.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case S.InAttributeName:{this.stateInAttributeName(t);break}case S.InCommentLike:{this.stateInCommentLike(t);break}case S.InSpecialComment:{this.stateInSpecialComment(t);break}case S.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case S.InTagName:{this.stateInTagName(t);break}case S.InClosingTagName:{this.stateInClosingTagName(t);break}case S.BeforeTagName:{this.stateBeforeTagName(t);break}case S.AfterAttributeName:{this.stateAfterAttributeName(t);break}case S.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case S.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case S.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case S.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case S.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case S.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case S.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case S.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case S.InDeclaration:{this.stateInDeclaration(t);break}case S.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case S.BeforeComment:{this.stateBeforeComment(t);break}case S.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case S.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===S.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===S.InCommentLike?this.currentSequence===Ee.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===S.InTagName||this.state===S.BeforeAttributeName||this.state===S.BeforeAttributeValue||this.state===S.AfterAttributeName||this.state===S.InAttributeName||this.state===S.InAttributeValueSq||this.state===S.InAttributeValueDq||this.state===S.InAttributeValueNq||this.state===S.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,a){this.baseState!==S.Text&&this.baseState!==S.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+a,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+a,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const At=new Set(["input","option","optgroup","select","button","datalist","textarea"]),j=new Set(["p"]),ws=new Set(["thead","tbody"]),Us=new Set(["dd","dt"]),Fs=new Set(["rt","rp"]),Ld=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",j],["h1",j],["h2",j],["h3",j],["h4",j],["h5",j],["h6",j],["select",At],["input",At],["output",At],["button",At],["datalist",At],["textarea",At],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Us],["dt",Us],["address",j],["article",j],["aside",j],["blockquote",j],["details",j],["div",j],["dl",j],["fieldset",j],["figcaption",j],["figure",j],["footer",j],["form",j],["header",j],["hr",j],["main",j],["nav",j],["ol",j],["pre",j],["section",j],["table",j],["ul",j],["rt",Fs],["rp",Fs],["tbody",ws],["tfoot",ws]]),yd=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Hs=new Set(["math","svg"]),Vs=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Rd=/\s|\//;class kd{constructor(t,a={}){var n,i,r,u,o,l;this.options=a,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(n=a.lowerCaseTags)!==null&&n!==void 0?n:this.htmlMode,this.lowerCaseAttributeNames=(i=a.lowerCaseAttributeNames)!==null&&i!==void 0?i:this.htmlMode,this.recognizeSelfClosing=(r=a.recognizeSelfClosing)!==null&&r!==void 0?r:!this.htmlMode,this.tokenizer=new((u=a.Tokenizer)!==null&&u!==void 0?u:Dd)(this.options,this),this.foreignContext=[!this.htmlMode],(l=(o=this.cbs).onparserinit)===null||l===void 0||l.call(o,this)}ontext(t,a){var n,i;const r=this.getSlice(t,a);this.endIndex=a-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,r),this.startIndex=a}ontextentity(t,a){var n,i;this.endIndex=a-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,Wa(t)),this.startIndex=a}isVoidElement(t){return this.htmlMode&&yd.has(t)}onopentagname(t,a){this.endIndex=a;let n=this.getSlice(t,a);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(t){var a,n,i,r;this.openTagStart=this.startIndex,this.tagname=t;const u=this.htmlMode&&Ld.get(t);if(u)for(;this.stack.length>0&&u.has(this.stack[0]);){const o=this.stack.shift();(n=(a=this.cbs).onclosetag)===null||n===void 0||n.call(a,o,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Hs.has(t)?this.foreignContext.unshift(!0):Vs.has(t)&&this.foreignContext.unshift(!1))),(r=(i=this.cbs).onopentagname)===null||r===void 0||r.call(i,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var a,n;this.startIndex=this.openTagStart,this.attribs&&((n=(a=this.cbs).onopentag)===null||n===void 0||n.call(a,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,a){var n,i,r,u,o,l,h,m;this.endIndex=a;let p=this.getSlice(t,a);if(this.lowerCaseTagNames&&(p=p.toLowerCase()),this.htmlMode&&(Hs.has(p)||Vs.has(p))&&this.foreignContext.shift(),this.isVoidElement(p))this.htmlMode&&p==="br"&&((u=(r=this.cbs).onopentagname)===null||u===void 0||u.call(r,"br"),(l=(o=this.cbs).onopentag)===null||l===void 0||l.call(o,"br",{},!0),(m=(h=this.cbs).onclosetag)===null||m===void 0||m.call(h,"br",!1));else{const T=this.stack.indexOf(p);if(T!==-1)for(let N=0;N<=T;N++){const I=this.stack.shift();(i=(n=this.cbs).onclosetag)===null||i===void 0||i.call(n,I,N!==T)}else this.htmlMode&&p==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=a+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var a,n;const i=this.tagname;this.endOpenTag(t),this.stack[0]===i&&((n=(a=this.cbs).onclosetag)===null||n===void 0||n.call(a,i,!t),this.stack.shift())}onattribname(t,a){this.startIndex=t;const n=this.getSlice(t,a);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(t,a){this.attribvalue+=this.getSlice(t,a)}onattribentity(t){this.attribvalue+=Wa(t)}onattribend(t,a){var n,i;this.endIndex=a,(i=(n=this.cbs).onattribute)===null||i===void 0||i.call(n,this.attribname,this.attribvalue,t===Fe.Double?'"':t===Fe.Single?"'":t===Fe.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const a=t.search(Rd);let n=a<0?t:t.substr(0,a);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(t,a){this.endIndex=a;const n=this.getSlice(t,a);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${i}`,`!${n}`)}this.startIndex=a+1}onprocessinginstruction(t,a){this.endIndex=a;const n=this.getSlice(t,a);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${i}`,`?${n}`)}this.startIndex=a+1}oncomment(t,a,n){var i,r,u,o;this.endIndex=a,(r=(i=this.cbs).oncomment)===null||r===void 0||r.call(i,this.getSlice(t,a-n)),(o=(u=this.cbs).oncommentend)===null||o===void 0||o.call(u),this.startIndex=a+1}oncdata(t,a,n){var i,r,u,o,l,h,m,p,T,N;this.endIndex=a;const I=this.getSlice(t,a-n);!this.htmlMode||this.options.recognizeCDATA?((r=(i=this.cbs).oncdatastart)===null||r===void 0||r.call(i),(o=(u=this.cbs).ontext)===null||o===void 0||o.call(u,I),(h=(l=this.cbs).oncdataend)===null||h===void 0||h.call(l)):((p=(m=this.cbs).oncomment)===null||p===void 0||p.call(m,`[CDATA[${I}]]`),(N=(T=this.cbs).oncommentend)===null||N===void 0||N.call(T)),this.startIndex=a+1}onend(){var t,a;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=0;n<this.stack.length;n++)this.cbs.onclosetag(this.stack[n],!0)}(a=(t=this.cbs).onend)===null||a===void 0||a.call(t)}reset(){var t,a,n,i;(a=(t=this.cbs).onreset)===null||a===void 0||a.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(i=(n=this.cbs).onparserinit)===null||i===void 0||i.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,a){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(t-this.bufferOffset,a-this.bufferOffset);for(;a-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,a-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var a,n;if(this.ended){(n=(a=this.cbs).onerror)===null||n===void 0||n.call(a,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var a,n;if(this.ended){(n=(a=this.cbs).onerror)===null||n===void 0||n.call(a,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}function Md(e,t){const a=new Pr(void 0,t);return new kd(a,t).end(e),a.root}const Pd=cc((e,t,a,n)=>t._useHtmlParser2?Md(e,t):Id(e,t,a,n)),Ys=Yc(Pd,(e,t)=>t._useHtmlParser2?sa(e,t):xd(e));var X=(e=>(e[e.None=0]="None",e[e.Text=1]="Text",e[e.Image=2]="Image",e[e.Video=3]="Video",e[e.Icon=4]="Icon",e[e.Link=5]="Link",e[e.Button=6]="Button",e[e.Block=10]="Block",e))(X||{});const vd=c.defineComponent({name:"GpImageUpload",props:{accept:{type:String,default:"image/*"},multiple:{type:Boolean,default:!1},maxCount:{type:Number,default:1/0},beforeUpload:Function,onChange:Function,showList:{type:Boolean,default:!1}},setup(e,{emit:t}){const a=c.ref(null),n=c.ref([]);return{inputRef:a,fileList:n,triggerInput:()=>{var o;(o=a.value)==null||o.click()},handleChange:async o=>{var p;const h=o.target.files;if(!h)return;const m=[];for(let T=0;T<h.length;T++){const N=h[T];if(e.beforeUpload&&await e.beforeUpload(N)===!1)continue;const I=`${Date.now()}-${N.name}`,y=URL.createObjectURL(N),D=document.createElement("img");D.src=y,document.body.appendChild(D),await new Promise(V=>{D.onload=V});const P=D.width,$=D.height;m.push({uid:I,name:N.name,status:"uploading",thumbUrl:y,file:N,width:P,height:$})}e.maxCount&&n.value.length+m.length>e.maxCount&&m.splice(e.maxCount-n.value.length),e.multiple?n.value=[...n.value,...m]:n.value=m.slice(0,1),(p=e.onChange)==null||p.call(e,n.value),t("update:fileList",n.value),a.value&&(a.value.value="")},removeFile:o=>{var l;n.value=n.value.filter(h=>h.uid!==o),(l=e.onChange)==null||l.call(e,n.value)}}}}),et=(e,t)=>{const a=e.__vccOpts||e;for(const[n,i]of t)a[n]=i;return a},Bd={class:"upload-wrapper"},wd=["accept","multiple"],Ud={key:0,class:"file-list mt-4"},Fd={class:"flex items-center space-x-4"},Hd=["src"],Vd=["onClick"];function Yd(e,t,a,n,i,r){return c.openBlock(),c.createElementBlock("div",Bd,[c.createElementVNode("div",{class:"",onClick:t[0]||(t[0]=(...u)=>e.triggerInput&&e.triggerInput(...u))},[c.renderSlot(e.$slots,"upload-icon",{},()=>[t[2]||(t[2]=c.createElementVNode("div",{class:"upload-area border-dashed border-2 p-6 rounded cursor-pointer hover:border-blue-500"},[c.createElementVNode("div",{class:"text-gray-400 text-lg text-center"}," 点击或拖拽上传图片 ")],-1))],!0)]),c.createElementVNode("input",{type:"file",ref:"inputRef",class:"hidden",accept:e.accept,multiple:e.multiple,onChange:t[1]||(t[1]=(...u)=>e.handleChange&&e.handleChange(...u))},null,40,wd),e.showList?(c.openBlock(),c.createElementBlock("div",Ud,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.fileList,u=>(c.openBlock(),c.createElementBlock("div",{key:u.uid,class:"file-item flex items-center justify-between p-2 border rounded mb-2"},[c.createElementVNode("div",Fd,[u.thumbUrl?(c.openBlock(),c.createElementBlock("img",{key:0,src:u.thumbUrl,alt:"preview",class:"w-12 h-12 object-cover rounded"},null,8,Hd)):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(u.name),1)]),c.createElementVNode("div",null,[c.createElementVNode("button",{onClick:o=>e.removeFile(u.uid),class:"text-red-500 hover:underline"}," 删除 ",8,Vd)])]))),128))])):c.createCommentVNode("",!0)])}const qd=et(vd,[["render",Yd],["__scopeId","data-v-fa0e69af"]]),$d=c.defineComponent({name:"GpMessage",props:{message:{type:String,required:!0},type:{type:String,default:"info"},position:{type:String,default:"top-right"},duration:{type:Number,default:3e3},onClose:{type:Function,required:!0},icon:{type:Boolean,default:!0}},setup(e){const t=c.ref(!1),a=c.computed(()=>({success:"bg-green-100 text-green-800",error:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",warning:"bg-yellow-100 text-yellow-800"})[e.type]),n=()=>{t.value=!1,e.onClose()};return setTimeout(()=>{n()},e.duration),t.value=!0,{visible:t,typeClass:a,closeMessage:n}}}),Wd={key:0,class:"gp-message"},Gd={key:0,class:"mr-2"},Xd={key:0,class:"text-green-500"},Qd={key:1,class:"text-red-500"},jd={key:2,class:"text-blue-500"},zd={key:3,class:"text-yellow-500"};function Kd(e,t,a,n,i,r){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[e.visible?(c.openBlock(),c.createElementBlock("div",Wd,[c.createElementVNode("div",{class:c.normalizeClass([e.typeClass,"message-content"])},[e.icon?(c.openBlock(),c.createElementBlock("span",Gd,[c.renderSlot(e.$slots,"icon",{},()=>[e.type==="success"?(c.openBlock(),c.createElementBlock("span",Xd,"✔")):c.createCommentVNode("",!0),e.type==="error"?(c.openBlock(),c.createElementBlock("span",Qd,"✖")):c.createCommentVNode("",!0),e.type==="info"?(c.openBlock(),c.createElementBlock("span",jd,"ℹ")):c.createCommentVNode("",!0),e.type==="warning"?(c.openBlock(),c.createElementBlock("span",zd,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(e.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:t[0]||(t[0]=(...u)=>e.closeMessage&&e.closeMessage(...u))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const Zd=et($d,[["render",Kd],["__scopeId","data-v-56476f4c"]]),Nt=c.reactive([]);let Ln=null;const Jd=()=>{const e=document.createElement("div");return e.id="global-message-container",document.body.appendChild(e),e},eh=()=>{if(Ln)return;const e=Jd();Ln=c.createApp({setup(){return{messageQueue:Nt}},render(){const t=c.computed(()=>{var n;return{"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4","top-center":"top-4 left-1/2 transform -translate-x-1/2","bottom-center":"bottom-4 left-1/2 transform -translate-x-1/2"}[((n=Nt[0])==null?void 0:n.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${t.value}`},Nt.map(a=>c.h(Zd,{key:a.id,...a.options,onClose:()=>qs(a.id)})))}}),Ln.mount(e)},qs=e=>{const t=Nt.findIndex(a=>a.id===e);t!==-1&&Nt.splice(t,1)};let th=0;const Q=e=>{eh();const t=th++;Nt.push({id:t,options:e}),setTimeout(()=>{qs(t)},e.duration||3e3)};Q.success=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"success",duration:t,icon:a}:{...e,type:"success"})},Q.error=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"error",duration:t,icon:a}:{...e,type:"error"})},Q.info=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"info",duration:t,icon:a}:{...e,type:"info"})},Q.warning=(e,t=3e3,a=!0)=>{Q(typeof e=="string"?{message:e,type:"warning",duration:t,icon:a}:{...e,type:"warning"})};const ah={key:0,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},nh=et(c.defineComponent({__name:"ElementRenderer",props:{element:{type:Object,required:!0},selectedElement:Object,hoveredElement:Object,uploadByFile:{type:Function,required:!1},icons:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},cropper:{type:Object,required:!1},icon:{type:Object,required:!1},r:{type:String,required:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","upload"],setup(e,{emit:t}){const a=e,n=t,i=c.computed(()=>a.selectedElement===a.element),r=c.computed(()=>a.hoveredElement===a.element),u=c.ref(!1),o=c.ref(!1),l=c.ref(""),h=c.computed(()=>a.element.rule.minText||0),m=c.computed(()=>a.element.rule.maxText||1/0);c.watch(()=>a.r,()=>{n("contentUpdated",P())},{immediate:!0});function p(R){R.xpath!="/div[1]"&&a.mode!=="preview"&&(a.mode==="edit"?R.type===X.Text&&n("selectElement",R):n("selectElement",R),!R.rule.isReadOnly&&R.type===X.Text&&(u.value=!0))}function T(R){n("selectElement",R)}function N(R,O){n("hoverElement",R,O)}function I(R){n("hoverElement",R)}function y(R){R.currentTarget.contains(R.relatedTarget)?n("hoverElement",null):a.hoveredElement?n("hoverElement",null,a.hoveredElement.parentxpath):n("hoverElement",null)}function D(){u.value=!1,n("contentUpdated",P())}function P(){function R(O){const z=Object.entries(O.attrs||{}).map(([A,L])=>`${A}="${L}"`).join(" "),me=`<${O.tag}${z?" "+z:""}>`,ye=`</${O.tag}>`,mt=(O.children||[]).map(A=>R(A)).join("");return`${me}${O.editText||O.text||""}${mt}${ye}`}return R(a.element)}function $(R){var ye;R.stopPropagation();const O=R.target,z=((ye=O.firstChild)==null?void 0:ye.nodeType)===Node.TEXT_NODE&&O.firstChild.nodeValue||"";if(z.length<h.value){o.value=!0,l.value=`最少输入 ${h.value} 个字符`;return}else if(z.length>m.value){o.value=!0,l.value=`最多输入 ${m.value} 个字符`;return}else o.value=!1,l.value="";n("updateText",{element:a.element,newText:z}),n("contentUpdated",P());const me=c.toRaw(a.element);me.editText=z}function V(R){n("updateText",R),n("contentUpdated",P())}function te(){const R={...a.element};n("blockAction",{action:"add",element:a.element,newBlock:R})}function U(){_(a.element),n("blockAction",{action:"moveUp",element:a.element})}function _(R){R.children&&R.children.length>0&&R.children.forEach(O=>{O.type==X.Text&&(O.text!==O.editText&&(O.text=O.editText),_(O))})}function B(){_(a.element),n("blockAction",{action:"moveDown",element:a.element})}function q(){n("blockAction",{action:"delete",element:a.element})}function ne(R){n("blockAction",R),n("contentUpdated",P())}function Te(R){Le.value.openModal(R)}function Pe(R,O){n("addIcon",R,O),n("contentUpdated",P())}const ve=c.ref(a.cropper),Le=c.ref(a.icon),ie=c.ref({});function se(R,O){if(!R||R.length===0)return;console.log("files",R,O);const z=R[0];if(O.rule&&(O.rule.minImageWidth||O.rule.maxImageHeight)){if(O.rule.minImageWidth&&z.width<O.rule.minImageWidth){Q.error(`图片宽度不能小于 ${O.rule.minImageWidth}px`);return}if(O.rule.maxImageHeight&&z.height<O.rule.maxImageHeight){Q.error(`图片高度不能小于 ${O.rule.maxImageHeight}px`);return}}if(O.rule.minImageWidth&&O.rule.maxImageHeight?(ie.value.width=O.rule.minImageWidth,ie.value.height=O.rule.maxImageHeight,ie.value.aspectRatio=O.rule.minImageWidth/O.rule.maxImageHeight):ie.value={},z)if(O.rule.crop){const me=z.thumbUrl;ve.value.handleOpenCropper(ie.value,me,z.name,O)}else a.uploadByFile?a.uploadByFile(z.file).then(me=>{me.success&&(O.attrs.src=me.file.url,n("contentUpdated",P()))}):(O.attrs.src=z.thumbUrl,n("contentUpdated",P()))}const Se=R=>R.type.startsWith("image/")?!0:(Q.error("只能上传图片文件"),!1);return(R,O)=>{const z=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(a.element.tag),c.mergeProps({class:["relative",e.mode==="design"?"m-2 p-1 border-dashed border-2":"",r.value?"border-dashed border-blue-500":"",i.value?"border-dashed border-green-500 z-10 border-2":"",o.value?"border-dashed border-red-500":"",(!r.value&&!i.value&&!o.value,""),a.element.rule&&a.element.rule.isReadOnly?"cursor-not-allowed":""]},a.element.attrs,{contenteditable:u.value,onClick:O[2]||(O[2]=c.withModifiers(()=>p(a.element),["stop"])),onMouseenter:O[3]||(O[3]=()=>I(a.element)),onMouseleave:y,onBlur:D,onInput:$}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(a.element.text),1),a.element.children&&a.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.element.children,(me,ye)=>(c.openBlock(),c.createBlock(z,{key:ye,r:e.r,mode:e.mode,icons:e.icons,element:me,selectedElement:a.selectedElement,hoveredElement:a.hoveredElement,cropper:e.cropper,icon:e.icon,"upload-by-file":e.uploadByFile,onSelectElement:T,onHoverElement:N,onUpdateText:V,onBlockAction:ne,onAddIcon:Pe},null,8,["r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload-by-file"]))),128)),a.element.type===c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:O[0]||(O[0]=c.withModifiers(()=>{},["stop"])),class:"z-10 flex space-x-1 flex-none flex-nowrap overflow-visible absolute top-2"},[c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-blue-500 text-white rounded",onClick:c.withModifiers(te,["stop"])}," + "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-gray-300 text-white rounded",onClick:c.withModifiers(U,["stop"])}," ⬅️ "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-gray-300 text-white rounded",onClick:c.withModifiers(B,["stop"])}," ➡️ "),c.createElementVNode("button",{class:"flex-none px-2 py-1 bg-red-500 text-white rounded",onClick:c.withModifiers(q,["stop"])}," ✖ ")])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),a.element.type===c.unref(X).Icon?(c.openBlock(),c.createElementBlock("div",{key:1,class:"cursor-pointer rounded-sm w-5 h-5 flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80",contenteditable:"false",onClick:O[1]||(O[1]=c.withModifiers(()=>Te(a.element),["stop"]))}," ↑ ")):c.createCommentVNode("",!0)]),_:1},16,["class","contenteditable"])),a.element.type==c.unref(X).Text&&o.value?(c.openBlock(),c.createElementBlock("div",ah,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),a.element.type===c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",{key:1,class:"cursor-pointer rounded-sm flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80",onClick:O[5]||(O[5]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createVNode(qd,{multiple:!1,beforeUpload:Se,onChange:O[4]||(O[4]=me=>se(me,a.element))},{"upload-icon":c.withCtx(()=>O[6]||(O[6]=[c.createElementVNode("div",{class:"p-2"},"上传",-1)])),_:1})])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-f92bee30"]]),ih=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){return{updateValue:n=>{t("update:modelValue",n.target.checked)}}}}),sh={class:"form-group"},rh={class:"flex items-center space-x-2 cursor-pointer"},uh=["checked","aria-checked"],oh={class:"checkbox-label text-sm text-gray-700"};function ch(e,t,a,n,i,r){return c.openBlock(),c.createElementBlock("div",sh,[c.createElementVNode("label",rh,[c.createElementVNode("input",{type:"checkbox",checked:e.modelValue,onChange:t[0]||(t[0]=(...u)=>e.updateValue&&e.updateValue(...u)),class:"custom-checkbox","aria-checked":e.modelValue},null,40,uh),c.createElementVNode("span",oh,c.toDisplayString(e.label),1)])])}const Qt=et(ih,[["render",ch],["__scopeId","data-v-68b8f276"]]),lh={key:0},dh={key:0},hh={class:"text-gray-500 my-2"},fh={class:"text-gray-500 my-2"},mh={key:1},Eh={key:2},ph={key:3},Th={key:4},bh={key:5},gh={key:6},_h={key:7},Ah={key:8},Nh={key:9},Ch={key:10},Ih=et(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(e,{emit:t}){const a=e,n=t,i=c.ref({rule:{},...a.element});c.watch(()=>a.element,u=>{i.value={rule:{},...u}},{immediate:!0});function r(){if(i.value.type===X.Icon&&!i.value.attrs.class.includes("iconfont")){Q.error("图标仅支持 iconfont 图标");return}if(i.value.type===X.Image&&i.value.tag!=="img"){Q.error("节点类型错误");return}if(i.value.type===X.Video&&i.value.tag!=="video"){Q.error("节点类型错误");return}if(i.value.type===X.Link&&i.value.tag!=="a"){Q.error("节点类型错误");return}if(i.value.type===X.Text){if(Number(i.value.rule.minText)>Number(i.value.rule.maxText)){Q.error("最小文本长度不能大于最大文本长度");return}if(i.value.tag!=="p"&&i.value.tag!=="div"&&i.value.tag!=="span"&&i.value.tag!=="h1"&&i.value.tag!=="h2"&&i.value.tag!=="h3"&&i.value.tag!=="h4"&&i.value.tag!=="h5"&&i.value.tag!=="h6"){Q.error("节点类型错误");return}}if(i.value.type===X.Block){if(Number(i.value.rule.minBlock)>Number(i.value.rule.maxBlock)){Q.error("最小块数量不能大于最大块数量");return}if(i.value.tag!=="div"&&i.value.tag!=="section"&&i.value.tag!=="article"&&i.value.tag!=="nav"&&i.value.tag!=="header"&&i.value.tag!=="footer"&&i.value.tag!=="span"&&i.value.tag!=="p"&&i.value.tag!=="img"){Q.error("节点类型错误");return}if(!i.value.children||i.value.children.length<1){Q.error("节点错误,必须包含子元素");return}}n("updateElement",i.value)}return(u,o)=>(c.openBlock(),c.createElementBlock("div",null,[i.value?(c.openBlock(),c.createElementBlock("div",lh,[i.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",dh,[o[13]||(o[13]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",hh,c.toDisplayString(i.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[o[14]||(o[14]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",fh,c.toDisplayString(i.value.xpath),1)]),c.createElementVNode("div",null,[o[16]||(o[16]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":o[0]||(o[0]=l=>i.value.type=l),class:"border rounded p-1 w-full"},o[15]||(o[15]=[c.createElementVNode("option",{value:0},"无",-1),c.createElementVNode("option",{value:1},"文本",-1),c.createElementVNode("option",{value:2},"图片",-1),c.createElementVNode("option",{value:3},"视频",-1),c.createElementVNode("option",{value:4},"图标",-1),c.createElementVNode("option",{value:5},"链接",-1),c.createElementVNode("option",{value:6},"按钮",-1),c.createElementVNode("option",{value:10},"块",-1)]),512),[[c.vModelSelect,i.value.type]])]),i.value.type==c.unref(X).Text?(c.openBlock(),c.createElementBlock("div",mh,[o[17]||(o[17]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[1]||(o[1]=l=>i.value.rule.minText=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minText]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Text?(c.openBlock(),c.createElementBlock("div",Eh,[o[18]||(o[18]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[2]||(o[2]=l=>i.value.rule.maxText=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxText]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",ph,[o[19]||(o[19]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.crop,"onUpdate:modelValue":o[3]||(o[3]=l=>i.value.rule.crop=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",Th,[o[20]||(o[20]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[4]||(o[4]=l=>i.value.rule.minImageWidth=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Image?(c.openBlock(),c.createElementBlock("div",bh,[o[21]||(o[21]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[5]||(o[5]=l=>i.value.rule.maxImageHeight=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",gh,[o[22]||(o[22]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[6]||(o[6]=l=>i.value.rule.minBlock=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.minBlock]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Block?(c.openBlock(),c.createElementBlock("div",_h,[o[23]||(o[23]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[7]||(o[7]=l=>i.value.rule.maxBlock=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.maxBlock]])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Text||i.value.type==c.unref(X).Icon||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Ah,[o[24]||(o[24]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isThemeColor,"onUpdate:modelValue":o[8]||(o[8]=l=>i.value.rule.isThemeColor=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[o[25]||(o[25]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isRequired,"onUpdate:modelValue":o[9]||(o[9]=l=>i.value.rule.isRequired=l),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[o[26]||(o[26]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.isReadOnly,"onUpdate:modelValue":o[10]||(o[10]=l=>i.value.rule.isReadOnly=l),label:"是"},null,8,["modelValue"])]),i.value.type==c.unref(X).Link||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Nh,[o[27]||(o[27]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(Qt,{class:"py-2",modelValue:i.value.rule.openMeiqia,"onUpdate:modelValue":o[11]||(o[11]=l=>i.value.rule.openMeiqia=l),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),i.value.type==c.unref(X).Link||i.value.type==c.unref(X).Button?(c.openBlock(),c.createElementBlock("div",Ch,[o[28]||(o[28]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":o[12]||(o[12]=l=>i.value.rule.linkUrl=l),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,i.value.rule.linkUrl]])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:r,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-7395db8a"]]);/*!
9
9
  * Cropper.js v1.6.2
10
10
  * https://fengyuanchen.github.io/cropperjs
11
11
  *
package/dist/style.css CHANGED
@@ -1,4 +1,4 @@
1
- .upload-wrapper[data-v-fa0e69af]{max-width:500px}.file-list[data-v-fa0e69af]{max-height:300px;overflow-y:auto}.gp-message[data-v-56476f4c]{z-index:1000;transition:all .3s ease;max-width:300px}.message-content[data-v-56476f4c]{display:flex;align-items:center;justify-content:space-between;padding:10px 20px;border-radius:4px;box-shadow:0 2px 8px #00000026;font-size:14px}.close-btn[data-v-56476f4c]{background:none;border:none;color:#4b5563;cursor:pointer;margin-left:10px;line-height:1;padding:0}.fade-enter-active[data-v-56476f4c],.fade-leave-active[data-v-56476f4c]{transition:opacity .3s}.fade-enter-from[data-v-56476f4c],.fade-leave-to[data-v-56476f4c]{opacity:0}[contenteditable=true][data-v-f92bee30]:focus{outline:none}[contenteditable=true][data-v-f92bee30]{outline:none}.custom-checkbox[data-v-68b8f276]{width:16px;height:16px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-68b8f276]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-68b8f276]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.checkbox-label[data-v-68b8f276]{line-height:1.2;font-size:14px;color:#4b5563}.border[data-v-0d892d0b]{border:1px solid #ccc}.custom-checkbox[data-v-0d892d0b]{width:18px;height:18px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-0d892d0b]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-0d892d0b]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}/*!
1
+ .upload-wrapper[data-v-fa0e69af]{max-width:500px}.file-list[data-v-fa0e69af]{max-height:300px;overflow-y:auto}.gp-message[data-v-56476f4c]{z-index:1000;transition:all .3s ease;max-width:300px}.message-content[data-v-56476f4c]{display:flex;align-items:center;justify-content:space-between;padding:10px 20px;border-radius:4px;box-shadow:0 2px 8px #00000026;font-size:14px}.close-btn[data-v-56476f4c]{background:none;border:none;color:#4b5563;cursor:pointer;margin-left:10px;line-height:1;padding:0}.fade-enter-active[data-v-56476f4c],.fade-leave-active[data-v-56476f4c]{transition:opacity .3s}.fade-enter-from[data-v-56476f4c],.fade-leave-to[data-v-56476f4c]{opacity:0}[contenteditable=true][data-v-f92bee30]:focus{outline:none}[contenteditable=true][data-v-f92bee30]{outline:none}.custom-checkbox[data-v-68b8f276]{width:16px;height:16px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-68b8f276]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-68b8f276]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.checkbox-label[data-v-68b8f276]{line-height:1.2;font-size:14px;color:#4b5563}.border[data-v-7395db8a]{border:1px solid #ccc}.custom-checkbox[data-v-7395db8a]{width:18px;height:18px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-7395db8a]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-7395db8a]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}/*!
2
2
  * Cropper.js v1.6.2
3
3
  * https://fengyuanchen.github.io/cropperjs
4
4
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gp-designer",
3
3
  "private": false,
4
- "version": "1.0.28",
4
+ "version": "1.0.29",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "gp",