gp-designer 1.0.65 → 1.0.67
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.
- package/README.md +4 -0
- package/dist/gp-designer.es.js +983 -975
- package/dist/gp-designer.umd.js +4 -4
- package/dist/spa/topic/css/style.css +2 -2
- package/dist/spa/topic/html/demo-xiaoyuan.html +29 -3
- package/dist/spa/topic/js/index.js +17 -2
- package/dist/spa/topic/js/kefu.js +24 -0
- package/dist/style.css +2 -2
- package/package.json +1 -1
package/dist/gp-designer.umd.js
CHANGED
@@ -5,8 +5,8 @@
|
|
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])"},Au={};function Hf(A,e){return A===Z.falseFunc?Z.falseFunc:t=>e.isTag(t)&&A(t)}function eu(A,e){const t=e.getSiblings(A);if(t.length<=1)return[];const r=t.indexOf(A);return r<0||r===t.length-1?[]:t.slice(r+1).filter(e.isTag)}function xa(A){return{xmlMode:!!A.xmlMode,lowerCaseAttributeNames:!!A.lowerCaseAttributeNames,lowerCaseTags:!!A.lowerCaseTags,quirksMode:!!A.quirksMode,cacheResults:!!A.cacheResults,pseudos:A.pseudos,adapter:A.adapter,equals:A.equals}}const Ha=(A,e,t,r,n)=>{const a=n(e,xa(t),r);return a===Z.trueFunc?A:a===Z.falseFunc?Z.falseFunc:s=>a(s)&&A(s)},Da={is:Ha,matches:Ha,where:Ha,not(A,e,t,r,n){const a=n(e,xa(t),r);return a===Z.falseFunc?A:a===Z.trueFunc?Z.falseFunc:s=>!a(s)&&A(s)},has(A,e,t,r,n){const{adapter:a}=t,s=xa(t);s.relativeSelector=!0;const u=e.some(f=>f.some(Sa))?[Au]:void 0,o=n(e,s,u);if(o===Z.falseFunc)return Z.falseFunc;const l=Hf(o,a);if(u&&o!==Z.trueFunc){const{shouldTestNextSiblings:f=!1}=o;return h=>{if(!A(h))return!1;u[0]=h;const d=a.getChildren(h),C=f?[...d,...eu(h,a)]:d;return a.existsOne(l,C)}}return f=>A(f)&&a.existsOne(l,a.getChildren(f))}};function Df(A,e,t,r,n){var a;const{name:s,data:u}=e;if(Array.isArray(u)){if(!(s in Da))throw new Error(`Unknown pseudo-class :${s}(${u})`);return Da[s](A,u,t,r,n)}const o=(a=t.pseudos)===null||a===void 0?void 0:a[s],l=typeof o=="string"?o:xf[s];if(typeof l=="string"){if(u!=null)throw new Error(`Pseudo ${s} doesn't have any arguments`);const f=Wr(l);return Da.is(A,f,t,r,n)}if(typeof o=="function")return zi(o,s,u,1),f=>o(f,u)&&A(f);if(s in va)return va[s](A,u,t,r);if(s in Zi){const f=Zi[s];return zi(f,s,u,2),h=>f(h,t,u)&&A(h)}throw new Error(`Unknown pseudo-class :${s}`)}function Oa(A,e){const t=e.getParent(A);return t&&e.isTag(t)?t:null}function Of(A,e,t,r,n){const{adapter:a,equals:s}=t;switch(e.type){case G.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case G.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case G.Attribute:{if(e.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!t.xmlMode||t.lowerCaseAttributeNames)&&(e.name=e.name.toLowerCase()),yf[e.action](A,e,t)}case G.Pseudo:return Df(A,e,t,r,n);case G.Tag:{if(e.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:u}=e;return(!t.xmlMode||t.lowerCaseTags)&&(u=u.toLowerCase()),function(l){return a.getName(l)===u&&A(l)}}case G.Descendant:{if(t.cacheResults===!1||typeof WeakSet>"u")return function(l){let f=l;for(;f=Oa(f,a);)if(A(f))return!0;return!1};const u=new WeakSet;return function(l){let f=l;for(;f=Oa(f,a);)if(!u.has(f)){if(a.isTag(f)&&A(f))return!0;u.add(f)}return!1}}case"_flexibleDescendant":return function(o){let l=o;do if(A(l))return!0;while(l=Oa(l,a));return!1};case G.Parent:return function(o){return a.getChildren(o).some(l=>a.isTag(l)&&A(l))};case G.Child:return function(o){const l=a.getParent(o);return l!=null&&a.isTag(l)&&A(l)};case G.Sibling:return function(o){const l=a.getSiblings(o);for(let f=0;f<l.length;f++){const h=l[f];if(s(o,h))break;if(a.isTag(h)&&A(h))return!0}return!1};case G.Adjacent:return a.prevElementSibling?function(o){const l=a.prevElementSibling(o);return l!=null&&A(l)}:function(o){const l=a.getSiblings(o);let f;for(let h=0;h<l.length;h++){const d=l[h];if(s(o,d))break;a.isTag(d)&&(f=d)}return!!f&&A(f)};case G.Universal:{if(e.namespace!=null&&e.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return A}}}function tu(A){return A.type===G.Pseudo&&(A.name==="scope"||Array.isArray(A.data)&&A.data.some(e=>e.some(tu)))}const Rf={type:G.Descendant},Mf={type:"_flexibleDescendant"},kf={type:G.Pseudo,name:"scope",data:null};function Pf(A,{adapter:e},t){const r=!!(t!=null&&t.every(n=>{const a=e.isTag(n)&&e.getParent(n);return n===Au||a&&e.isTag(a)}));for(const n of A){if(!(n.length>0&&Sa(n[0])&&n[0].type!==G.Descendant))if(r&&!n.some(tu))n.unshift(Rf);else continue;n.unshift(kf)}}function ru(A,e,t){var r;A.forEach(Ff),t=(r=e.context)!==null&&r!==void 0?r:t;const n=Array.isArray(t),a=t&&(Array.isArray(t)?t:[t]);if(e.relativeSelector!==!1)Pf(A,e,a);else if(A.some(o=>o.length>0&&Sa(o[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let s=!1;const u=A.map(o=>{if(o.length>=2){const[l,f]=o;l.type!==G.Pseudo||l.name!=="scope"||(n&&f.type===G.Descendant?o[1]=Mf:(f.type===G.Adjacent||f.type===G.Sibling)&&(s=!0))}return Kf(o,e,a)}).reduce(Vf,Z.falseFunc);return u.shouldTestNextSiblings=s,u}function Kf(A,e,t){var r;return A.reduce((n,a)=>n===Z.falseFunc?Z.falseFunc:Of(n,a,e,t,ru),(r=e.rootFunc)!==null&&r!==void 0?r:Z.trueFunc)}function Vf(A,e){return e===Z.falseFunc||A===Z.trueFunc?A:A===Z.falseFunc||e===Z.trueFunc?e:function(r){return A(r)||e(r)}}const nu=(A,e)=>A===e,Gf={adapter:Gr,equals:nu};function Yf(A){var e,t,r,n;const a=A??Gf;return(e=a.adapter)!==null&&e!==void 0||(a.adapter=Gr),(t=a.equals)!==null&&t!==void 0||(a.equals=(n=(r=a.adapter)===null||r===void 0?void 0:r.equals)!==null&&n!==void 0?n:nu),a}function Xf(A){return function(t,r,n){const a=Yf(r);return A(t,a,n)}}const Ra=Xf(ru);function au(A,e,t=!1){return t&&(A=Wf(A,e)),Array.isArray(A)?e.removeSubsets(A):e.getChildren(A)}function Wf(A,e){const t=Array.isArray(A)?A.slice(0):[A],r=t.length;for(let n=0;n<r;n++){const a=eu(t[n],e);t.push(...a)}return t}const Jf=new Set(["first","last","eq","gt","nth","lt","even","odd"]);function $r(A){return A.type!=="pseudo"?!1:Jf.has(A.name)?!0:A.name==="not"&&Array.isArray(A.data)?A.data.some(e=>e.some($r)):!1}function qf(A,e,t){const r=e!=null?parseInt(e,10):NaN;switch(A){case"first":return 1;case"nth":case"eq":return isFinite(r)?r>=0?r+1:1/0:0;case"lt":return isFinite(r)?r>=0?Math.min(r,t):1/0:0;case"gt":return isFinite(r)?1/0:0;case"odd":return 2*t;case"even":return 2*t-1;case"last":case"not":return 1/0}}function jf(A){for(;A.parent;)A=A.parent;return A}function Ma(A){const e=[],t=[];for(const r of A)r.some($r)?e.push(r):t.push(r);return[t,e]}const $f={type:G.Universal,namespace:null},Zf={type:G.Pseudo,name:"scope",data:null};function su(A,e,t={}){return iu([A],e,t)}function iu(A,e,t={}){if(typeof e=="function")return A.some(e);const[r,n]=Ma(Wr(e));return r.length>0&&A.some(Ra(r,t))||n.some(a=>cu(a,A,t).length>0)}function zf(A,e,t,r){const n=typeof t=="string"?parseInt(t,10):NaN;switch(A){case"first":case"lt":return e;case"last":return e.length>0?[e[e.length-1]]:e;case"nth":case"eq":return isFinite(n)&&Math.abs(n)<e.length?[n<0?e[e.length+n]:e[n]]:[];case"gt":return isFinite(n)?e.slice(n+1):[];case"even":return e.filter((a,s)=>s%2===0);case"odd":return e.filter((a,s)=>s%2===1);case"not":{const a=new Set(ou(t,e,r));return e.filter(s=>!a.has(s))}}}function uu(A,e,t={}){return ou(Wr(A),e,t)}function ou(A,e,t){if(e.length===0)return[];const[r,n]=Ma(A);let a;if(r.length){const s=Pa(e,r,t);if(n.length===0)return s;s.length&&(a=new Set(s))}for(let s=0;s<n.length&&(a==null?void 0:a.size)!==e.length;s++){const u=n[s];if((a?e.filter(f=>X(f)&&!a.has(f)):e).length===0)break;const l=cu(u,e,t);if(l.length)if(a)l.forEach(f=>a.add(f));else{if(s===n.length-1)return l;a=new Set(l)}}return typeof a<"u"?a.size===e.length?e:e.filter(s=>a.has(s)):[]}function cu(A,e,t){var r;if(A.some(Gt)){const n=(r=t.root)!==null&&r!==void 0?r:jf(e[0]),a={...t,context:e,relativeSelector:!1};return A.push(Zf),Zr(n,A,a,!0,e.length)}return Zr(e,A,t,!1,e.length)}function Ah(A,e,t={},r=1/0){if(typeof A=="function")return lu(e,A);const[n,a]=Ma(Wr(A)),s=a.map(u=>Zr(e,u,t,!0,r));return n.length&&s.push(ka(e,n,t,r)),s.length===0?[]:s.length===1?s[0]:Bt(s.reduce((u,o)=>[...u,...o]))}function Zr(A,e,t,r,n){const a=e.findIndex($r),s=e.slice(0,a),u=e[a],o=e.length-1===a?n:1/0,l=qf(u.name,u.data,o);if(l===0)return[];const h=(s.length===0&&!Array.isArray(A)?kr(A).filter(X):s.length===0?(Array.isArray(A)?A:[A]).filter(X):r||s.some(Gt)?ka(A,[s],t,l):Pa(A,[s],t)).slice(0,l);let d=zf(u.name,h,u.data,t);if(d.length===0||e.length===a+1)return d;const C=e.slice(a+1),p=C.some(Gt);if(p){if(Gt(C[0])){const{type:T}=C[0];(T===G.Sibling||T===G.Adjacent)&&(d=au(d,Gr,!0)),C.unshift($f)}t={...t,relativeSelector:!1,rootFunc:T=>d.includes(T)}}else t.rootFunc&&t.rootFunc!==Jr.trueFunc&&(t={...t,rootFunc:Jr.trueFunc});return C.some($r)?Zr(d,C,t,!1,n):p?ka(d,[C],t,n):Pa(d,[C],t)}function ka(A,e,t,r){const n=Ra(e,t,A);return lu(A,n,r)}function lu(A,e,t=1/0){const r=au(A,Gr,e.shouldTestNextSiblings);return ba(n=>X(n)&&e(n),r,!0,t)}function Pa(A,e,t){const r=(Array.isArray(A)?A:[A]).filter(X);if(r.length===0)return r;const n=Ra(e,t);return n===Jr.trueFunc?r:r.filter(n)}const eh=/^\s*[+~]/;function th(A){if(!A)return this._make([]);if(typeof A!="string"){const e=be(A)?A.toArray():[A],t=this.toArray();return this._make(e.filter(r=>t.some(n=>Di(n,r))))}return this._findBySelector(A,Number.POSITIVE_INFINITY)}function rh(A,e){var t;const r=this.toArray(),n=eh.test(A)?r:this.children().toArray(),a={context:r,root:(t=this._root)===null||t===void 0?void 0:t[0],xmlMode:this.options.xmlMode,lowerCaseTags:this.options.lowerCaseTags,lowerCaseAttributeNames:this.options.lowerCaseAttributeNames,pseudos:this.options.pseudos,quirksMode:this.options.quirksMode};return this._make(Ah(A,n,a,e))}function Ka(A){return function(e,...t){return function(r){var n;let a=A(e,this);return r&&(a=Ya(a,r,this.options.xmlMode,(n=this._root)===null||n===void 0?void 0:n[0])),this._make(this.length>1&&a.length>1?t.reduce((s,u)=>u(s),a):a)}}}const Xt=Ka((A,e)=>{let t=[];for(let r=0;r<e.length;r++){const n=A(e[r]);n.length>0&&(t=t.concat(n))}return t}),Va=Ka((A,e)=>{const t=[];for(let r=0;r<e.length;r++){const n=A(e[r]);n!==null&&t.push(n)}return t});function Ga(A,...e){let t=null;const r=Ka((n,a)=>{const s=[];return mA(a,u=>{for(let o;(o=n(u))&&!(t!=null&&t(o,s.length));u=o)s.push(o)}),s})(A,...e);return function(n,a){t=typeof n=="string"?u=>su(u,n,this.options):n?Wt(n):null;const s=r.call(this,a);return t=null,s}}function Et(A){return A.length>1?Array.from(new Set(A)):A}const nh=Va(({parent:A})=>A&&!Se(A)?A:null,Et),ah=Xt(A=>{const e=[];for(;A.parent&&!Se(A.parent);)e.push(A.parent),A=A.parent;return e},Bt,A=>A.reverse()),sh=Ga(({parent:A})=>A&&!Se(A)?A:null,Bt,A=>A.reverse());function ih(A){var e;const t=[];if(!A)return this._make(t);const r={xmlMode:this.options.xmlMode,root:(e=this._root)===null||e===void 0?void 0:e[0]},n=typeof A=="string"?a=>su(a,A,r):Wt(A);return mA(this,a=>{for(a&&!Se(a)&&!X(a)&&(a=a.parent);a&&X(a);){if(n(a,0)){t.includes(a)||t.push(a);break}a=a.parent}}),this._make(t)}const uh=Va(A=>wa(A)),oh=Xt(A=>{const e=[];for(;A.next;)A=A.next,X(A)&&e.push(A);return e},Et),ch=Ga(A=>wa(A),Et),lh=Va(A=>Ta(A)),fh=Xt(A=>{const e=[];for(;A.prev;)A=A.prev,X(A)&&e.push(A);return e},Et),hh=Ga(A=>Ta(A),Et),dh=Xt(A=>yi(A).filter(e=>X(e)&&e!==A),Bt),Bh=Xt(A=>kr(A).filter(X),Et);function gh(){const A=this.toArray().reduce((e,t)=>yA(t)?e.concat(t.children):e,[]);return this._make(A)}function Eh(A){let e=0;const t=this.length;for(;e<t&&A.call(this[e],e,this[e])!==!1;)++e;return this}function mh(A){let e=[];for(let t=0;t<this.length;t++){const r=this[t],n=A.call(r,t,r);n!=null&&(e=e.concat(n))}return this._make(e)}function Wt(A){return typeof A=="function"?(e,t)=>A.call(e,t,e):be(A)?e=>Array.prototype.includes.call(A,e):function(e){return A===e}}function ph(A){var e;return this._make(Ya(this.toArray(),A,this.options.xmlMode,(e=this._root)===null||e===void 0?void 0:e[0]))}function Ya(A,e,t,r){return typeof e=="string"?uu(e,A,{xmlMode:t,root:r}):A.filter(Wt(e))}function Ch(A){const e=this.toArray();return typeof A=="string"?iu(e.filter(X),A,this.options):A?e.some(Wt(A)):!1}function wh(A){let e=this.toArray();if(typeof A=="string"){const t=new Set(uu(A,e,this.options));e=e.filter(r=>!t.has(r))}else{const t=Wt(A);e=e.filter((r,n)=>!t(r,n))}return this._make(e)}function Th(A){return this.filter(typeof A=="string"?`:has(${A})`:(e,t)=>this._make(t).find(A).length>0)}function bh(){return this.length>1?this._make(this[0]):this}function Uh(){return this.length>0?this._make(this[this.length-1]):this}function Qh(A){var e;return A=+A,A===0&&this.length<=1?this:(A<0&&(A=this.length+A),this._make((e=this[A])!==null&&e!==void 0?e:[]))}function Fh(A){return A==null?this.toArray():this[A<0?this.length+A:A]}function Ih(){return Array.prototype.slice.call(this)}function _h(A){let e,t;return A==null?(e=this.parent().children(),t=this[0]):typeof A=="string"?(e=this._make(A),t=this[0]):(e=this,t=be(A)?A[0]:A),Array.prototype.indexOf.call(e,t)}function yh(A,e){return this._make(Array.prototype.slice.call(this,A,e))}function Nh(){var A;return(A=this.prevObject)!==null&&A!==void 0?A:this._make([])}function Sh(A,e){const t=this._make(A,e),r=Bt([...this.get(),...t.get()]);return this._make(r)}function vh(A){return this.prevObject?this.add(A?this.prevObject.filter(A):this.prevObject):this}const Lh=Object.freeze(Object.defineProperty({__proto__:null,_findBySelector:rh,add:Sh,addBack:vh,children:Bh,closest:ih,contents:gh,each:Eh,end:Nh,eq:Qh,filter:ph,filterArray:Ya,find:th,first:bh,get:Fh,has:Th,index:_h,is:Ch,last:Uh,map:mh,next:uh,nextAll:oh,nextUntil:ch,not:wh,parent:nh,parents:ah,parentsUntil:sh,prev:lh,prevAll:fh,prevUntil:hh,siblings:dh,slice:yh,toArray:Ih},Symbol.toStringTag,{value:"Module"}));function xh(A){return function(t,r,n,a){if(typeof Buffer<"u"&&Buffer.isBuffer(t)&&(t=t.toString()),typeof t=="string")return A(t,r,n,a);const s=t;if(!Array.isArray(s)&&Se(s))return s;const u=new Ze([]);return tt(s,u),u}}function tt(A,e){const t=Array.isArray(A)?A:[A];e?e.children=t:e=null;for(let r=0;r<t.length;r++){const n=t[r];n.parent&&n.parent.children!==t&&ze(n),e?(n.prev=t[r-1]||null,n.next=t[r+1]||null):n.prev=n.next=null,n.parent=e}return e}function Hh(A,e){if(A==null)return[];if(typeof A=="string")return this._parse(A,this.options,!1,null).children.slice(0);if("length"in A){if(A.length===1)return this._makeDomArray(A[0],e);const t=[];for(let r=0;r<A.length;r++){const n=A[r];if(typeof n=="object"){if(n==null)continue;if(!("length"in n)){t.push(e?kt(n,!0):n);continue}}t.push(...this._makeDomArray(n,e))}return t}return[e?kt(A,!0):A]}function fu(A){return function(...e){const t=this.length-1;return mA(this,(r,n)=>{if(!yA(r))return;const a=typeof e[0]=="function"?e[0].call(r,n,this._render(r.children)):e,s=this._makeDomArray(a,n<t);A(s,r.children,r)})}}function xe(A,e,t,r,n){var a,s;const u=[e,t,...r],o=e===0?null:A[e-1],l=e+t>=A.length?null:A[e+t];for(let f=0;f<r.length;++f){const h=r[f],d=h.parent;if(d){const p=d.children.indexOf(h);p>-1&&(d.children.splice(p,1),n===d&&e>p&&u[0]--)}h.parent=n,h.prev&&(h.prev.next=(a=h.next)!==null&&a!==void 0?a:null),h.next&&(h.next.prev=(s=h.prev)!==null&&s!==void 0?s:null),h.prev=f===0?o:r[f-1],h.next=f===r.length-1?l:r[f+1]}return o&&(o.next=r[0]),l&&(l.prev=r[r.length-1]),A.splice(...u)}function Dh(A){return(be(A)?A:this._make(A)).append(this),this}function Oh(A){return(be(A)?A:this._make(A)).prepend(this),this}const Rh=fu((A,e,t)=>{xe(e,e.length,0,A,t)}),Mh=fu((A,e,t)=>{xe(e,0,0,A,t)});function hu(A){return function(e){const t=this.length-1,r=this.parents().last();for(let n=0;n<this.length;n++){const a=this[n],s=typeof e=="function"?e.call(a,n,a):typeof e=="string"&&!Fa(e)?r.find(e).clone():e,[u]=this._makeDomArray(s,n<t);if(!u||!yA(u))continue;let o=u,l=0;for(;l<o.children.length;){const f=o.children[l];X(f)?(o=f,l=0):l++}A(a,o,[u])}return this}}const kh=hu((A,e,t)=>{const{parent:r}=A;if(!r)return;const n=r.children,a=n.indexOf(A);tt([A],e),xe(n,a,0,t,r)}),Ph=hu((A,e,t)=>{yA(A)&&(tt(A.children,e),tt(t,A))});function Kh(A){return this.parent(A).not("body").each((e,t)=>{this._make(t).replaceWith(t.children)}),this}function Vh(A){const e=this[0];if(e){const t=this._make(typeof A=="function"?A.call(e,0,e):A).insertBefore(e);let r;for(let a=0;a<t.length;a++)t[a].type==="tag"&&(r=t[a]);let n=0;for(;r&&n<r.children.length;){const a=r.children[n];a.type==="tag"?(r=a,n=0):n++}r&&this._make(r).append(this)}return this}function Gh(...A){const e=this.length-1;return mA(this,(t,r)=>{if(!yA(t)||!t.parent)return;const n=t.parent.children,a=n.indexOf(t);if(a<0)return;const s=typeof A[0]=="function"?A[0].call(t,r,this._render(t.children)):A,u=this._makeDomArray(s,r<e);xe(n,a+1,0,u,t.parent)})}function Yh(A){typeof A=="string"&&(A=this._make(A)),this.remove();const e=[];for(const t of this._makeDomArray(A)){const r=this.clone().toArray(),{parent:n}=t;if(!n)continue;const a=n.children,s=a.indexOf(t);s<0||(xe(a,s+1,0,r,n),e.push(...r))}return this._make(e)}function Xh(...A){const e=this.length-1;return mA(this,(t,r)=>{if(!yA(t)||!t.parent)return;const n=t.parent.children,a=n.indexOf(t);if(a<0)return;const s=typeof A[0]=="function"?A[0].call(t,r,this._render(t.children)):A,u=this._makeDomArray(s,r<e);xe(n,a,0,u,t.parent)})}function Wh(A){const e=this._make(A);this.remove();const t=[];return mA(e,r=>{const n=this.clone().toArray(),{parent:a}=r;if(!a)return;const s=a.children,u=s.indexOf(r);u<0||(xe(s,u,0,n,a),t.push(...n))}),this._make(t)}function Jh(A){const e=A?this.filter(A):this;return mA(e,t=>{ze(t),t.prev=t.next=t.parent=null}),this}function qh(A){return mA(this,(e,t)=>{const{parent:r}=e;if(!r)return;const n=r.children,a=typeof A=="function"?A.call(e,t,e):A,s=this._makeDomArray(a);tt(s,null);const u=n.indexOf(e);xe(n,u,1,s,r),s.includes(e)||(e.parent=e.prev=e.next=null)})}function jh(){return mA(this,A=>{if(yA(A)){for(const e of A.children)e.next=e.prev=e.parent=null;A.children.length=0}})}function $h(A){if(A===void 0){const e=this[0];return!e||!yA(e)?null:this._render(e.children)}return mA(this,e=>{if(!yA(e))return;for(const r of e.children)r.next=r.prev=r.parent=null;const t=be(A)?A.toArray():this._parse(`${A}`,this.options,!1,e).children;tt(t,e)})}function Zh(){return this._render(this)}function zh(A){return A===void 0?Pt(this):typeof A=="function"?mA(this,(e,t)=>this._make(e).text(A.call(e,t,Pt([e])))):mA(this,e=>{if(!yA(e))return;for(const r of e.children)r.next=r.prev=r.parent=null;const t=new Mt(`${A}`);tt(t,e)})}function Ad(){const A=Array.prototype.map.call(this.get(),t=>kt(t,!0)),e=new Ze(A);for(const t of A)t.parent=e;return this._make(A)}const ed=Object.freeze(Object.defineProperty({__proto__:null,_makeDomArray:Hh,after:Gh,append:Rh,appendTo:Dh,before:Xh,clone:Ad,empty:jh,html:$h,insertAfter:Yh,insertBefore:Wh,prepend:Mh,prependTo:Oh,remove:Jh,replaceWith:qh,text:zh,toString:Zh,unwrap:Kh,wrap:kh,wrapAll:Vh,wrapInner:Ph},Symbol.toStringTag,{value:"Module"}));function td(A,e){if(A!=null&&e!=null||typeof A=="object"&&!Array.isArray(A))return mA(this,(t,r)=>{X(t)&&du(t,A,e,r)});if(this.length!==0)return Bu(this[0],A)}function du(A,e,t,r){if(typeof e=="string"){const n=Bu(A),a=typeof t=="function"?t.call(A,r,n[e]):t;a===""?delete n[e]:a!=null&&(n[e]=a),A.attribs.style=rd(n)}else if(typeof e=="object"){const n=Object.keys(e);for(let a=0;a<n.length;a++){const s=n[a];du(A,s,e[s],a)}}}function Bu(A,e){if(!A||!X(A))return;const t=nd(A.attribs.style);if(typeof e=="string")return t[e];if(Array.isArray(e)){const r={};for(const n of e)t[n]!=null&&(r[n]=t[n]);return r}return t}function rd(A){return Object.keys(A).reduce((e,t)=>`${e}${e?" ":""}${t}: ${A[t]};`,"")}function nd(A){if(A=(A||"").trim(),!A)return{};const e={};let t;for(const r of A.split(";")){const n=r.indexOf(":");if(n<1||n===r.length-1){const a=r.trimEnd();a.length>0&&t!==void 0&&(e[t]+=`;${a}`)}else t=r.slice(0,n).trim(),e[t]=r.slice(n+1).trim()}return e}const ad=Object.freeze(Object.defineProperty({__proto__:null,css:td},Symbol.toStringTag,{value:"Module"})),gu="input,select,textarea,keygen",sd=/%20/g,Eu=/\r?\n/g;function id(){return this.serializeArray().map(t=>`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`).join("&").replace(sd,"+")}function ud(){return this.map((A,e)=>{const t=this._make(e);return X(e)&&e.name==="form"?t.find(gu).toArray():t.filter(gu).toArray()}).filter('[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map((A,e)=>{var t;const r=this._make(e),n=r.attr("name"),a=(t=r.val())!==null&&t!==void 0?t:"";return Array.isArray(a)?a.map(s=>({name:n,value:s.replace(Eu,`\r
|
7
7
|
`)})):{name:n,value:a.replace(Eu,`\r
|
8
|
-
`)}}).toArray()}const od=Object.freeze(Object.defineProperty({__proto__:null,serialize:id,serializeArray:ud},Symbol.toStringTag,{value:"Module"}));function cd(A){var e;return typeof A=="string"?{selector:A,value:"textContent"}:{selector:A.selector,value:(e=A.value)!==null&&e!==void 0?e:"textContent"}}function ld(A){const e={};for(const t in A){const r=A[t],n=Array.isArray(r),{selector:a,value:s}=cd(n?r[0]:r),u=typeof s=="function"?s:typeof s=="string"?o=>this._make(o).prop(s):o=>this._make(o).extract(s);if(n)e[t]=this._findBySelector(a,Number.POSITIVE_INFINITY).map((o,l)=>u(l,t,e)).get();else{const o=this._findBySelector(a,1);e[t]=o.length>0?u(o[0],t,e):void 0}}return e}const fd=Object.freeze(Object.defineProperty({__proto__:null,extract:ld},Symbol.toStringTag,{value:"Module"}));class Jt{constructor(e,t,r){if(this.length=0,this.options=r,this._root=t,e){for(let n=0;n<e.length;n++)this[n]=e[n];this.length=e.length}}}Jt.prototype.cheerio="[cheerio object]",Jt.prototype.splice=Array.prototype.splice,Jt.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(Jt.prototype,mf,Lh,ed,ad,od,fd);function hd(A,e){return function t(r,n,a=!0){if(r==null)throw new Error("cheerio.load() expects a string");const s=Qa(n),u=A(r,s,a,null);class o extends Jt{_make(h,d){const C=l(h,d);return C.prevObject=this,C}_parse(h,d,C,p){return A(h,d,C,p)}_render(h){return e(h,this.options)}}function l(f,h,d=u,C){if(f&&be(f))return f;const p=Qa(C,s),T=typeof d=="string"?[A(d,p,!1,null)]:"length"in d?d:[d],U=be(T)?T:new o(T,null,p);if(U._root=U,!f)return new o(void 0,U,p);const _=typeof f=="string"&&Fa(f)?A(f,p,!1,null).children:dd(f)?[f]:Array.isArray(f)?f:void 0,I=new o(_,U,p);if(_)return I;if(typeof f!="string")throw new TypeError("Unexpected type of selector");let D=f;const k=h?typeof h=="string"?Fa(h)?new o([A(h,p,!1,null)],U,p):(D=`${h} ${D}`,U):be(h)?h:new o(Array.isArray(h)?h:[h],U,p):U;return k?k.find(D):I}return Object.assign(l,af,{load:t,_root:u,_options:s,fn:o.prototype,prototype:o.prototype}),l}}function dd(A){return!!A.name||A.type==="root"||A.type==="text"||A.type==="comment"}const Bd=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]),dA="�";var B;(function(A){A[A.EOF=-1]="EOF",A[A.NULL=0]="NULL",A[A.TABULATION=9]="TABULATION",A[A.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",A[A.LINE_FEED=10]="LINE_FEED",A[A.FORM_FEED=12]="FORM_FEED",A[A.SPACE=32]="SPACE",A[A.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",A[A.QUOTATION_MARK=34]="QUOTATION_MARK",A[A.AMPERSAND=38]="AMPERSAND",A[A.APOSTROPHE=39]="APOSTROPHE",A[A.HYPHEN_MINUS=45]="HYPHEN_MINUS",A[A.SOLIDUS=47]="SOLIDUS",A[A.DIGIT_0=48]="DIGIT_0",A[A.DIGIT_9=57]="DIGIT_9",A[A.SEMICOLON=59]="SEMICOLON",A[A.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",A[A.EQUALS_SIGN=61]="EQUALS_SIGN",A[A.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",A[A.QUESTION_MARK=63]="QUESTION_MARK",A[A.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",A[A.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",A[A.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",A[A.GRAVE_ACCENT=96]="GRAVE_ACCENT",A[A.LATIN_SMALL_A=97]="LATIN_SMALL_A",A[A.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(B||(B={}));const WA={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function mu(A){return A>=55296&&A<=57343}function gd(A){return A>=56320&&A<=57343}function Ed(A,e){return(A-55296)*1024+9216+e}function pu(A){return A!==32&&A!==10&&A!==13&&A!==9&&A!==12&&A>=1&&A<=31||A>=127&&A<=159}function Cu(A){return A>=64976&&A<=65007||Bd.has(A)}var b;(function(A){A.controlCharacterInInputStream="control-character-in-input-stream",A.noncharacterInInputStream="noncharacter-in-input-stream",A.surrogateInInputStream="surrogate-in-input-stream",A.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",A.endTagWithAttributes="end-tag-with-attributes",A.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",A.unexpectedSolidusInTag="unexpected-solidus-in-tag",A.unexpectedNullCharacter="unexpected-null-character",A.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",A.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",A.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",A.missingEndTagName="missing-end-tag-name",A.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",A.unknownNamedCharacterReference="unknown-named-character-reference",A.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",A.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",A.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",A.eofBeforeTagName="eof-before-tag-name",A.eofInTag="eof-in-tag",A.missingAttributeValue="missing-attribute-value",A.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",A.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",A.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",A.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",A.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",A.missingDoctypePublicIdentifier="missing-doctype-public-identifier",A.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",A.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",A.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",A.cdataInHtmlContent="cdata-in-html-content",A.incorrectlyOpenedComment="incorrectly-opened-comment",A.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",A.eofInDoctype="eof-in-doctype",A.nestedComment="nested-comment",A.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",A.eofInComment="eof-in-comment",A.incorrectlyClosedComment="incorrectly-closed-comment",A.eofInCdata="eof-in-cdata",A.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",A.nullCharacterReference="null-character-reference",A.surrogateCharacterReference="surrogate-character-reference",A.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",A.controlCharacterReference="control-character-reference",A.noncharacterCharacterReference="noncharacter-character-reference",A.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",A.missingDoctypeName="missing-doctype-name",A.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",A.duplicateAttribute="duplicate-attribute",A.nonConformingDoctype="non-conforming-doctype",A.missingDoctype="missing-doctype",A.misplacedDoctype="misplaced-doctype",A.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",A.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",A.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",A.openElementsLeftAfterEof="open-elements-left-after-eof",A.abandonedHeadElementChild="abandoned-head-element-child",A.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",A.nestedNoscriptInHead="nested-noscript-in-head",A.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(b||(b={}));const md=65536;class pd{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=md,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(e,t){const{line:r,col:n,offset:a}=this,s=n+t,u=a+t;return{code:e,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:u,endOffset:u}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(gd(t))return this.pos++,this._addGap(),Ed(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(b.surrogateInInputStream),e}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(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;const r=this.html.charCodeAt(t);return r===B.CARRIAGE_RETURN?B.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let e=this.html.charCodeAt(this.pos);return e===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):e===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,mu(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===B.LINE_FEED||e===B.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){pu(e)?this._err(b.controlCharacterInInputStream):Cu(e)&&this._err(b.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var tA;(function(A){A[A.CHARACTER=0]="CHARACTER",A[A.NULL_CHARACTER=1]="NULL_CHARACTER",A[A.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",A[A.START_TAG=3]="START_TAG",A[A.END_TAG=4]="END_TAG",A[A.COMMENT=5]="COMMENT",A[A.DOCTYPE=6]="DOCTYPE",A[A.EOF=7]="EOF",A[A.HIBERNATION=8]="HIBERNATION"})(tA||(tA={}));function wu(A,e){for(let t=A.attrs.length-1;t>=0;t--)if(A.attrs[t].name===e)return A.attrs[t].value;return null}var Q;(function(A){A.HTML="http://www.w3.org/1999/xhtml",A.MATHML="http://www.w3.org/1998/Math/MathML",A.SVG="http://www.w3.org/2000/svg",A.XLINK="http://www.w3.org/1999/xlink",A.XML="http://www.w3.org/XML/1998/namespace",A.XMLNS="http://www.w3.org/2000/xmlns/"})(Q||(Q={}));var rt;(function(A){A.TYPE="type",A.ACTION="action",A.ENCODING="encoding",A.PROMPT="prompt",A.NAME="name",A.COLOR="color",A.FACE="face",A.SIZE="size"})(rt||(rt={}));var Ae;(function(A){A.NO_QUIRKS="no-quirks",A.QUIRKS="quirks",A.LIMITED_QUIRKS="limited-quirks"})(Ae||(Ae={}));var w;(function(A){A.A="a",A.ADDRESS="address",A.ANNOTATION_XML="annotation-xml",A.APPLET="applet",A.AREA="area",A.ARTICLE="article",A.ASIDE="aside",A.B="b",A.BASE="base",A.BASEFONT="basefont",A.BGSOUND="bgsound",A.BIG="big",A.BLOCKQUOTE="blockquote",A.BODY="body",A.BR="br",A.BUTTON="button",A.CAPTION="caption",A.CENTER="center",A.CODE="code",A.COL="col",A.COLGROUP="colgroup",A.DD="dd",A.DESC="desc",A.DETAILS="details",A.DIALOG="dialog",A.DIR="dir",A.DIV="div",A.DL="dl",A.DT="dt",A.EM="em",A.EMBED="embed",A.FIELDSET="fieldset",A.FIGCAPTION="figcaption",A.FIGURE="figure",A.FONT="font",A.FOOTER="footer",A.FOREIGN_OBJECT="foreignObject",A.FORM="form",A.FRAME="frame",A.FRAMESET="frameset",A.H1="h1",A.H2="h2",A.H3="h3",A.H4="h4",A.H5="h5",A.H6="h6",A.HEAD="head",A.HEADER="header",A.HGROUP="hgroup",A.HR="hr",A.HTML="html",A.I="i",A.IMG="img",A.IMAGE="image",A.INPUT="input",A.IFRAME="iframe",A.KEYGEN="keygen",A.LABEL="label",A.LI="li",A.LINK="link",A.LISTING="listing",A.MAIN="main",A.MALIGNMARK="malignmark",A.MARQUEE="marquee",A.MATH="math",A.MENU="menu",A.META="meta",A.MGLYPH="mglyph",A.MI="mi",A.MO="mo",A.MN="mn",A.MS="ms",A.MTEXT="mtext",A.NAV="nav",A.NOBR="nobr",A.NOFRAMES="noframes",A.NOEMBED="noembed",A.NOSCRIPT="noscript",A.OBJECT="object",A.OL="ol",A.OPTGROUP="optgroup",A.OPTION="option",A.P="p",A.PARAM="param",A.PLAINTEXT="plaintext",A.PRE="pre",A.RB="rb",A.RP="rp",A.RT="rt",A.RTC="rtc",A.RUBY="ruby",A.S="s",A.SCRIPT="script",A.SEARCH="search",A.SECTION="section",A.SELECT="select",A.SOURCE="source",A.SMALL="small",A.SPAN="span",A.STRIKE="strike",A.STRONG="strong",A.STYLE="style",A.SUB="sub",A.SUMMARY="summary",A.SUP="sup",A.TABLE="table",A.TBODY="tbody",A.TEMPLATE="template",A.TEXTAREA="textarea",A.TFOOT="tfoot",A.TD="td",A.TH="th",A.THEAD="thead",A.TITLE="title",A.TR="tr",A.TRACK="track",A.TT="tt",A.U="u",A.UL="ul",A.SVG="svg",A.VAR="var",A.WBR="wbr",A.XMP="xmp"})(w||(w={}));var i;(function(A){A[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP"})(i||(i={}));const Cd=new Map([[w.A,i.A],[w.ADDRESS,i.ADDRESS],[w.ANNOTATION_XML,i.ANNOTATION_XML],[w.APPLET,i.APPLET],[w.AREA,i.AREA],[w.ARTICLE,i.ARTICLE],[w.ASIDE,i.ASIDE],[w.B,i.B],[w.BASE,i.BASE],[w.BASEFONT,i.BASEFONT],[w.BGSOUND,i.BGSOUND],[w.BIG,i.BIG],[w.BLOCKQUOTE,i.BLOCKQUOTE],[w.BODY,i.BODY],[w.BR,i.BR],[w.BUTTON,i.BUTTON],[w.CAPTION,i.CAPTION],[w.CENTER,i.CENTER],[w.CODE,i.CODE],[w.COL,i.COL],[w.COLGROUP,i.COLGROUP],[w.DD,i.DD],[w.DESC,i.DESC],[w.DETAILS,i.DETAILS],[w.DIALOG,i.DIALOG],[w.DIR,i.DIR],[w.DIV,i.DIV],[w.DL,i.DL],[w.DT,i.DT],[w.EM,i.EM],[w.EMBED,i.EMBED],[w.FIELDSET,i.FIELDSET],[w.FIGCAPTION,i.FIGCAPTION],[w.FIGURE,i.FIGURE],[w.FONT,i.FONT],[w.FOOTER,i.FOOTER],[w.FOREIGN_OBJECT,i.FOREIGN_OBJECT],[w.FORM,i.FORM],[w.FRAME,i.FRAME],[w.FRAMESET,i.FRAMESET],[w.H1,i.H1],[w.H2,i.H2],[w.H3,i.H3],[w.H4,i.H4],[w.H5,i.H5],[w.H6,i.H6],[w.HEAD,i.HEAD],[w.HEADER,i.HEADER],[w.HGROUP,i.HGROUP],[w.HR,i.HR],[w.HTML,i.HTML],[w.I,i.I],[w.IMG,i.IMG],[w.IMAGE,i.IMAGE],[w.INPUT,i.INPUT],[w.IFRAME,i.IFRAME],[w.KEYGEN,i.KEYGEN],[w.LABEL,i.LABEL],[w.LI,i.LI],[w.LINK,i.LINK],[w.LISTING,i.LISTING],[w.MAIN,i.MAIN],[w.MALIGNMARK,i.MALIGNMARK],[w.MARQUEE,i.MARQUEE],[w.MATH,i.MATH],[w.MENU,i.MENU],[w.META,i.META],[w.MGLYPH,i.MGLYPH],[w.MI,i.MI],[w.MO,i.MO],[w.MN,i.MN],[w.MS,i.MS],[w.MTEXT,i.MTEXT],[w.NAV,i.NAV],[w.NOBR,i.NOBR],[w.NOFRAMES,i.NOFRAMES],[w.NOEMBED,i.NOEMBED],[w.NOSCRIPT,i.NOSCRIPT],[w.OBJECT,i.OBJECT],[w.OL,i.OL],[w.OPTGROUP,i.OPTGROUP],[w.OPTION,i.OPTION],[w.P,i.P],[w.PARAM,i.PARAM],[w.PLAINTEXT,i.PLAINTEXT],[w.PRE,i.PRE],[w.RB,i.RB],[w.RP,i.RP],[w.RT,i.RT],[w.RTC,i.RTC],[w.RUBY,i.RUBY],[w.S,i.S],[w.SCRIPT,i.SCRIPT],[w.SEARCH,i.SEARCH],[w.SECTION,i.SECTION],[w.SELECT,i.SELECT],[w.SOURCE,i.SOURCE],[w.SMALL,i.SMALL],[w.SPAN,i.SPAN],[w.STRIKE,i.STRIKE],[w.STRONG,i.STRONG],[w.STYLE,i.STYLE],[w.SUB,i.SUB],[w.SUMMARY,i.SUMMARY],[w.SUP,i.SUP],[w.TABLE,i.TABLE],[w.TBODY,i.TBODY],[w.TEMPLATE,i.TEMPLATE],[w.TEXTAREA,i.TEXTAREA],[w.TFOOT,i.TFOOT],[w.TD,i.TD],[w.TH,i.TH],[w.THEAD,i.THEAD],[w.TITLE,i.TITLE],[w.TR,i.TR],[w.TRACK,i.TRACK],[w.TT,i.TT],[w.U,i.U],[w.UL,i.UL],[w.SVG,i.SVG],[w.VAR,i.VAR],[w.WBR,i.WBR],[w.XMP,i.XMP]]);function zr(A){var e;return(e=Cd.get(A))!==null&&e!==void 0?e:i.UNKNOWN}const N=i,wd={[Q.HTML]:new Set([N.ADDRESS,N.APPLET,N.AREA,N.ARTICLE,N.ASIDE,N.BASE,N.BASEFONT,N.BGSOUND,N.BLOCKQUOTE,N.BODY,N.BR,N.BUTTON,N.CAPTION,N.CENTER,N.COL,N.COLGROUP,N.DD,N.DETAILS,N.DIR,N.DIV,N.DL,N.DT,N.EMBED,N.FIELDSET,N.FIGCAPTION,N.FIGURE,N.FOOTER,N.FORM,N.FRAME,N.FRAMESET,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HEADER,N.HGROUP,N.HR,N.HTML,N.IFRAME,N.IMG,N.INPUT,N.LI,N.LINK,N.LISTING,N.MAIN,N.MARQUEE,N.MENU,N.META,N.NAV,N.NOEMBED,N.NOFRAMES,N.NOSCRIPT,N.OBJECT,N.OL,N.P,N.PARAM,N.PLAINTEXT,N.PRE,N.SCRIPT,N.SECTION,N.SELECT,N.SOURCE,N.STYLE,N.SUMMARY,N.TABLE,N.TBODY,N.TD,N.TEMPLATE,N.TEXTAREA,N.TFOOT,N.TH,N.THEAD,N.TITLE,N.TR,N.TRACK,N.UL,N.WBR,N.XMP]),[Q.MATHML]:new Set([N.MI,N.MO,N.MN,N.MS,N.MTEXT,N.ANNOTATION_XML]),[Q.SVG]:new Set([N.TITLE,N.FOREIGN_OBJECT,N.DESC]),[Q.XLINK]:new Set,[Q.XML]:new Set,[Q.XMLNS]:new Set},Xa=new Set([N.H1,N.H2,N.H3,N.H4,N.H5,N.H6]),Td=new Set([w.STYLE,w.SCRIPT,w.XMP,w.IFRAME,w.NOEMBED,w.NOFRAMES,w.PLAINTEXT]);function bd(A,e){return Td.has(A)||e&&A===w.NOSCRIPT}var g;(function(A){A[A.DATA=0]="DATA",A[A.RCDATA=1]="RCDATA",A[A.RAWTEXT=2]="RAWTEXT",A[A.SCRIPT_DATA=3]="SCRIPT_DATA",A[A.PLAINTEXT=4]="PLAINTEXT",A[A.TAG_OPEN=5]="TAG_OPEN",A[A.END_TAG_OPEN=6]="END_TAG_OPEN",A[A.TAG_NAME=7]="TAG_NAME",A[A.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",A[A.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",A[A.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",A[A.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",A[A.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",A[A.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",A[A.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",A[A.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",A[A.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",A[A.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",A[A.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",A[A.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",A[A.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",A[A.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",A[A.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",A[A.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",A[A.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",A[A.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",A[A.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",A[A.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",A[A.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",A[A.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",A[A.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",A[A.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",A[A.BOGUS_COMMENT=40]="BOGUS_COMMENT",A[A.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",A[A.COMMENT_START=42]="COMMENT_START",A[A.COMMENT_START_DASH=43]="COMMENT_START_DASH",A[A.COMMENT=44]="COMMENT",A[A.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",A[A.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",A[A.COMMENT_END_DASH=49]="COMMENT_END_DASH",A[A.COMMENT_END=50]="COMMENT_END",A[A.COMMENT_END_BANG=51]="COMMENT_END_BANG",A[A.DOCTYPE=52]="DOCTYPE",A[A.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",A[A.DOCTYPE_NAME=54]="DOCTYPE_NAME",A[A.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",A[A.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",A[A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",A[A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",A[A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",A[A.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",A[A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",A[A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",A[A.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",A[A.CDATA_SECTION=68]="CDATA_SECTION",A[A.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",A[A.CDATA_SECTION_END=70]="CDATA_SECTION_END",A[A.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",A[A.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(g||(g={}));const JA={DATA:g.DATA,RCDATA:g.RCDATA,RAWTEXT:g.RAWTEXT,SCRIPT_DATA:g.SCRIPT_DATA,PLAINTEXT:g.PLAINTEXT,CDATA_SECTION:g.CDATA_SECTION};function Ud(A){return A>=B.DIGIT_0&&A<=B.DIGIT_9}function qt(A){return A>=B.LATIN_CAPITAL_A&&A<=B.LATIN_CAPITAL_Z}function Qd(A){return A>=B.LATIN_SMALL_A&&A<=B.LATIN_SMALL_Z}function He(A){return Qd(A)||qt(A)}function Tu(A){return He(A)||Ud(A)}function An(A){return A+32}function bu(A){return A===B.SPACE||A===B.LINE_FEED||A===B.TABULATION||A===B.FORM_FEED}function Uu(A){return bu(A)||A===B.SOLIDUS||A===B.GREATER_THAN_SIGN}function Fd(A){return A===B.NULL?b.nullCharacterReference:A>1114111?b.characterReferenceOutsideUnicodeRange:mu(A)?b.surrogateCharacterReference:Cu(A)?b.noncharacterCharacterReference:pu(A)||A===B.CARRIAGE_RETURN?b.controlCharacterReference:null}let Id=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=g.DATA,this.returnState=g.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new pd(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ca(ga,(r,n)=>{this.preprocessor.pos=this.entityStartPos+n-1,this._flushCodePointConsumedAsCharacterReference(r)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(b.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(b.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const n=Fd(r);n&&this._err(n,1)}}:void 0)}_err(e,t=0){var r,n;(n=(r=this.handler).onParseError)===null||n===void 0||n.call(r,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e==null||e())}write(e,t,r){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),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(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:tA.START_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:tA.END_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:tA.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:tA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const r=this.currentToken;if(wu(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const n=(e=(t=r.location).attrs)!==null&&e!==void 0?e:t.attrs=Object.create(null);n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(b.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=zr(e.tagName),e.type===tA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(b.endTagWithAttributes),e.selfClosing&&this._err(b.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case tA.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case tA.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case tA.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:tA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){const t=bu(e)?tA.WHITESPACE_CHARACTER:e===B.NULL?tA.NULL_CHARACTER:tA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(tA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=g.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?re.Attribute:re.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===g.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case g.DATA:{this._stateData(e);break}case g.RCDATA:{this._stateRcdata(e);break}case g.RAWTEXT:{this._stateRawtext(e);break}case g.SCRIPT_DATA:{this._stateScriptData(e);break}case g.PLAINTEXT:{this._statePlaintext(e);break}case g.TAG_OPEN:{this._stateTagOpen(e);break}case g.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case g.TAG_NAME:{this._stateTagName(e);break}case g.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case g.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case g.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case g.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case g.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case g.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case g.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case g.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case g.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case g.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case g.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case g.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case g.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case g.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case g.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case g.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case g.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case g.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case g.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case g.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case g.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case g.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case g.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case g.BOGUS_COMMENT:{this._stateBogusComment(e);break}case g.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case g.COMMENT_START:{this._stateCommentStart(e);break}case g.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case g.COMMENT:{this._stateComment(e);break}case g.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case g.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case g.COMMENT_END:{this._stateCommentEnd(e);break}case g.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case g.DOCTYPE:{this._stateDoctype(e);break}case g.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case g.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case g.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case g.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case g.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case g.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case g.CDATA_SECTION:{this._stateCdataSection(e);break}case g.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case g.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case g.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case g.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.TAG_OPEN;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitCodePoint(e);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case B.AMPERSAND:{this._startCharacterReference();break}case B.LESS_THAN_SIGN:{this.state=g.RCDATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.RAWTEXT_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(He(e))this._createStartTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:{this.state=g.MARKUP_DECLARATION_OPEN;break}case B.SOLIDUS:{this.state=g.END_TAG_OPEN;break}case B.QUESTION_MARK:{this._err(b.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e);break}case B.EOF:{this._err(b.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(b.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=g.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(He(e))this._createEndTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:{this._err(b.missingEndTagName),this.state=g.DATA;break}case B.EOF:{this._err(b.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(b.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.tagName+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:t.tagName+=String.fromCodePoint(qt(e)?An(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=g.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){He(e)?(this.state=g.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=g.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=g.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=g.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=g.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){He(e)?(this.state=g.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:{this.state=g.SCRIPT_DATA_END_TAG_OPEN;break}case B.EXCLAMATION_MARK:{this.state=g.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=g.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){He(e)?(this.state=g.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:He(e)?(this._emitChars("<"),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){He(e)?(this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(WA.SCRIPT,!1)&&Uu(this.preprocessor.peek(WA.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<WA.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(WA.SCRIPT,!1)&&Uu(this.preprocessor.peek(WA.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<WA.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._err(b.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=g.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this._leaveAttrName(),this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._leaveAttrName(),this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:{this._err(b.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.name+=dA;break}default:this.currentAttr.name+=String.fromCodePoint(qt(e)?An(e):e)}}_stateAfterAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.EQUALS_SIGN:{this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{this.state=g.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this.state=g.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingAttributeValue),this.state=g.DATA,this.emitCurrentTagToken();break}default:this.state=g.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:{this._err(b.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this._leaveAttrValue(),this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._err(b.missingWhitespaceBetweenAttributes),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{const t=this.currentToken;t.selfClosing=!0,this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._err(b.unexpectedSolidusInTag),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this.emitCurrentComment(t),this._emitEOFToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.data+=dA;break}default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(WA.DASH_DASH,!0)?(this._createCommentToken(WA.DASH_DASH.length+1),this.state=g.COMMENT_START):this._consumeSequenceIfMatch(WA.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(WA.DOCTYPE.length+1),this.state=g.DOCTYPE):this._consumeSequenceIfMatch(WA.CDATA_START,!0)?this.inForeignNode?this.state=g.CDATA_SECTION:(this._err(b.cdataInHtmlContent),this._createCommentToken(WA.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=g.BOGUS_COMMENT):this._ensureHibernation()||(this._err(b.incorrectlyOpenedComment),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_START_DASH;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptClosingOfEmptyComment),this.state=g.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptClosingOfEmptyComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END_DASH;break}case B.LESS_THAN_SIGN:{t.data+="<",this.state=g.COMMENT_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.data+=dA;break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:{t.data+="!",this.state=g.COMMENT_LESS_THAN_SIGN_BANG;break}case B.LESS_THAN_SIGN:{t.data+="<";break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=g.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=g.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(b.nestedComment),this.state=g.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EXCLAMATION_MARK:{this.state=g.COMMENT_END_BANG;break}case B.HYPHEN_MINUS:{t.data+="-";break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{t.data+="--!",this.state=g.COMMENT_END_DASH;break}case B.GREATER_THAN_SIGN:{this._err(b.incorrectlyClosedComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--!",this.state=g.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case B.EOF:{this._err(b.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingWhitespaceBeforeDoctypeName),this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(qt(e))this._createDoctypeToken(String.fromCharCode(An(e))),this.state=g.DOCTYPE_NAME;else switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:{this._err(b.unexpectedNullCharacter),this._createDoctypeToken(dA),this.state=g.DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=g.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.AFTER_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.name+=dA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.name+=String.fromCodePoint(qt(e)?An(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(WA.PUBLIC,!1)?this.state=g.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(WA.SYSTEM,!1)?this.state=g.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(b.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.publicId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.publicId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.systemId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.systemId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.NULL:{this._err(b.unexpectedNullCharacter);break}case B.EOF:{this.emitCurrentDoctype(t),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:{this.state=g.CDATA_SECTION_BRACKET;break}case B.EOF:{this._err(b.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=g.CDATA_SECTION_END:(this._emitChars("]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA;break}case B.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Tu(this.preprocessor.peek(1))?g.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Tu(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(b.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}};const Qu=new Set([i.DD,i.DT,i.LI,i.OPTGROUP,i.OPTION,i.P,i.RB,i.RP,i.RT,i.RTC]),Fu=new Set([...Qu,i.CAPTION,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]),en=new Set([i.APPLET,i.CAPTION,i.HTML,i.MARQUEE,i.OBJECT,i.TABLE,i.TD,i.TEMPLATE,i.TH]),_d=new Set([...en,i.OL,i.UL]),yd=new Set([...en,i.BUTTON]),Iu=new Set([i.ANNOTATION_XML,i.MI,i.MN,i.MO,i.MS,i.MTEXT]),_u=new Set([i.DESC,i.FOREIGN_OBJECT,i.TITLE]),Nd=new Set([i.TR,i.TEMPLATE,i.HTML]),Sd=new Set([i.TBODY,i.TFOOT,i.THEAD,i.TEMPLATE,i.HTML]),vd=new Set([i.TABLE,i.TEMPLATE,i.HTML]),Ld=new Set([i.TD,i.TH]);class xd{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,r){this.treeAdapter=t,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=i.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===i.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const r=this._indexOf(e);this.items[r]=t,r===this.stackTop&&(this.current=t)}insertAfter(e,t,r){const n=this._indexOf(e)+1;this.items.splice(n,0,t),this.tagIDs.splice(n,0,r),this.stackTop++,n===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,n===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==Q.HTML);this.shortenToLength(t<0?0:t)}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(t<0?0:t)}popUntilPopped(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r<0?0:r)}popUntilNumberedHeaderPopped(){this.popUntilPopped(Xa,Q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Ld,Q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===t)return r;return-1}clearBackTo(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(vd,Q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Sd,Q.HTML)}clearBackToTableRowContext(){this.clearBackTo(Nd,Q.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===i.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===i.HTML}hasInDynamicScope(e,t){for(let r=this.stackTop;r>=0;r--){const n=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case Q.HTML:{if(n===e)return!0;if(t.has(n))return!1;break}case Q.SVG:{if(_u.has(n))return!1;break}case Q.MATHML:{if(Iu.has(n))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,en)}hasInListItemScope(e){return this.hasInDynamicScope(e,_d)}hasInButtonScope(e){return this.hasInDynamicScope(e,yd)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case Q.HTML:{if(Xa.has(t))return!0;if(en.has(t))return!1;break}case Q.SVG:{if(_u.has(t))return!1;break}case Q.MATHML:{if(Iu.has(t))return!1;break}}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Q.HTML)switch(this.tagIDs[t]){case e:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Q.HTML)switch(this.tagIDs[e]){case i.TBODY:case i.THEAD:case i.TFOOT:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Q.HTML)switch(this.tagIDs[t]){case e:return!0;case i.OPTION:case i.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;Qu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;Fu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==e&&Fu.has(this.currentTagId);)this.pop()}}const Wa=3;var ge;(function(A){A[A.Marker=0]="Marker",A[A.Element=1]="Element"})(ge||(ge={}));const yu={type:ge.Marker};class Hd{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const r=[],n=t.length,a=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let u=0;u<this.entries.length;u++){const o=this.entries[u];if(o.type===ge.Marker)break;const{element:l}=o;if(this.treeAdapter.getTagName(l)===a&&this.treeAdapter.getNamespaceURI(l)===s){const f=this.treeAdapter.getAttrList(l);f.length===n&&r.push({idx:u,attrs:f})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<Wa)return;const t=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,t);if(r.length<Wa)return;const n=new Map(t.map(s=>[s.name,s.value]));let a=0;for(let s=0;s<r.length;s++){const u=r[s];u.attrs.every(o=>n.get(o.name)===o.value)&&(a+=1,a>=Wa&&this.entries.splice(u.idx,1))}}insertMarker(){this.entries.unshift(yu)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:ge.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ge.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);t>=0&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(yu);e>=0?this.entries.splice(0,e+1):this.entries.length=0}getElementEntryInScopeWithTagName(e){const t=this.entries.find(r=>r.type===ge.Marker||this.treeAdapter.getTagName(r.element)===e);return t&&t.type===ge.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===ge.Element&&t.element===e)}}const Ue={createDocument(){return{nodeName:"#document",mode:Ae.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(A,e,t){return{nodeName:A,tagName:A,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(A){return{nodeName:"#comment",data:A,parentNode:null}},createTextNode(A){return{nodeName:"#text",value:A,parentNode:null}},appendChild(A,e){A.childNodes.push(e),e.parentNode=A},insertBefore(A,e,t){const r=A.childNodes.indexOf(t);A.childNodes.splice(r,0,e),e.parentNode=A},setTemplateContent(A,e){A.content=e},getTemplateContent(A){return A.content},setDocumentType(A,e,t,r){const n=A.childNodes.find(a=>a.nodeName==="#documentType");if(n)n.name=e,n.publicId=t,n.systemId=r;else{const a={nodeName:"#documentType",name:e,publicId:t,systemId:r,parentNode:null};Ue.appendChild(A,a)}},setDocumentMode(A,e){A.mode=e},getDocumentMode(A){return A.mode},detachNode(A){if(A.parentNode){const e=A.parentNode.childNodes.indexOf(A);A.parentNode.childNodes.splice(e,1),A.parentNode=null}},insertText(A,e){if(A.childNodes.length>0){const t=A.childNodes[A.childNodes.length-1];if(Ue.isTextNode(t)){t.value+=e;return}}Ue.appendChild(A,Ue.createTextNode(e))},insertTextBefore(A,e,t){const r=A.childNodes[A.childNodes.indexOf(t)-1];r&&Ue.isTextNode(r)?r.value+=e:Ue.insertBefore(A,Ue.createTextNode(e),t)},adoptAttributes(A,e){const t=new Set(A.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)t.has(e[r].name)||A.attrs.push(e[r])},getFirstChild(A){return A.childNodes[0]},getChildNodes(A){return A.childNodes},getParentNode(A){return A.parentNode},getAttrList(A){return A.attrs},getTagName(A){return A.tagName},getNamespaceURI(A){return A.namespaceURI},getTextNodeContent(A){return A.value},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){return A.name},getDocumentTypeNodePublicId(A){return A.publicId},getDocumentTypeNodeSystemId(A){return A.systemId},isTextNode(A){return A.nodeName==="#text"},isCommentNode(A){return A.nodeName==="#comment"},isDocumentTypeNode(A){return A.nodeName==="#documentType"},isElementNode(A){return Object.prototype.hasOwnProperty.call(A,"tagName")},setNodeSourceCodeLocation(A,e){A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){A.sourceCodeLocation={...A.sourceCodeLocation,...e}}},Nu="html",Dd="about:legacy-compat",Od="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Su=["+//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//"],Rd=[...Su,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],Md=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),vu=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],kd=[...vu,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Lu(A,e){return e.some(t=>A.startsWith(t))}function Pd(A){return A.name===Nu&&A.publicId===null&&(A.systemId===null||A.systemId===Dd)}function Kd(A){if(A.name!==Nu)return Ae.QUIRKS;const{systemId:e}=A;if(e&&e.toLowerCase()===Od)return Ae.QUIRKS;let{publicId:t}=A;if(t!==null){if(t=t.toLowerCase(),Md.has(t))return Ae.QUIRKS;let r=e===null?Rd:Su;if(Lu(t,r))return Ae.QUIRKS;if(r=e===null?vu:kd,Lu(t,r))return Ae.LIMITED_QUIRKS}return Ae.NO_QUIRKS}const xu={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Vd="definitionurl",Gd="definitionURL",Yd=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(A=>[A.toLowerCase(),A])),Xd=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Q.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Q.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Q.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Q.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Q.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Q.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Q.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Q.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Q.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Q.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Q.XMLNS}]]),Wd=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(A=>[A.toLowerCase(),A])),Jd=new Set([i.B,i.BIG,i.BLOCKQUOTE,i.BODY,i.BR,i.CENTER,i.CODE,i.DD,i.DIV,i.DL,i.DT,i.EM,i.EMBED,i.H1,i.H2,i.H3,i.H4,i.H5,i.H6,i.HEAD,i.HR,i.I,i.IMG,i.LI,i.LISTING,i.MENU,i.META,i.NOBR,i.OL,i.P,i.PRE,i.RUBY,i.S,i.SMALL,i.SPAN,i.STRONG,i.STRIKE,i.SUB,i.SUP,i.TABLE,i.TT,i.U,i.UL,i.VAR]);function qd(A){const e=A.tagID;return e===i.FONT&&A.attrs.some(({name:r})=>r===rt.COLOR||r===rt.SIZE||r===rt.FACE)||Jd.has(e)}function Hu(A){for(let e=0;e<A.attrs.length;e++)if(A.attrs[e].name===Vd){A.attrs[e].name=Gd;break}}function Du(A){for(let e=0;e<A.attrs.length;e++){const t=Yd.get(A.attrs[e].name);t!=null&&(A.attrs[e].name=t)}}function Ja(A){for(let e=0;e<A.attrs.length;e++){const t=Xd.get(A.attrs[e].name);t&&(A.attrs[e].prefix=t.prefix,A.attrs[e].name=t.name,A.attrs[e].namespace=t.namespace)}}function jd(A){const e=Wd.get(A.tagName);e!=null&&(A.tagName=e,A.tagID=zr(A.tagName))}function $d(A,e){return e===Q.MATHML&&(A===i.MI||A===i.MO||A===i.MN||A===i.MS||A===i.MTEXT)}function Zd(A,e,t){if(e===Q.MATHML&&A===i.ANNOTATION_XML){for(let r=0;r<t.length;r++)if(t[r].name===rt.ENCODING){const n=t[r].value.toLowerCase();return n===xu.TEXT_HTML||n===xu.APPLICATION_XML}}return e===Q.SVG&&(A===i.FOREIGN_OBJECT||A===i.DESC||A===i.TITLE)}function zd(A,e,t,r){return(!r||r===Q.HTML)&&Zd(A,e,t)||(!r||r===Q.MATHML)&&$d(A,e)}const AB="hidden",eB=8,tB=3;var E;(function(A){A[A.INITIAL=0]="INITIAL",A[A.BEFORE_HTML=1]="BEFORE_HTML",A[A.BEFORE_HEAD=2]="BEFORE_HEAD",A[A.IN_HEAD=3]="IN_HEAD",A[A.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",A[A.AFTER_HEAD=5]="AFTER_HEAD",A[A.IN_BODY=6]="IN_BODY",A[A.TEXT=7]="TEXT",A[A.IN_TABLE=8]="IN_TABLE",A[A.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",A[A.IN_CAPTION=10]="IN_CAPTION",A[A.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",A[A.IN_TABLE_BODY=12]="IN_TABLE_BODY",A[A.IN_ROW=13]="IN_ROW",A[A.IN_CELL=14]="IN_CELL",A[A.IN_SELECT=15]="IN_SELECT",A[A.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",A[A.IN_TEMPLATE=17]="IN_TEMPLATE",A[A.AFTER_BODY=18]="AFTER_BODY",A[A.IN_FRAMESET=19]="IN_FRAMESET",A[A.AFTER_FRAMESET=20]="AFTER_FRAMESET",A[A.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",A[A.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(E||(E={}));const rB={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Ou=new Set([i.TABLE,i.TBODY,i.TFOOT,i.THEAD,i.TR]),Ru={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ue,onParseError:null};let Mu=class{constructor(e,t,r=null,n=null){this.fragmentContext=r,this.scriptHandler=n,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={...Ru,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Id(this.options,this),this.activeFormattingElements=new Hd(this.treeAdapter),this.fragmentContextID=r?zr(this.treeAdapter.getTagName(r)):i.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new xd(this.document,this.treeAdapter,this)}static parse(e,t){const r=new this(t);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,t){const r={...Ru,...t};e??(e=r.treeAdapter.createElement(w.TEMPLATE,Q.HTML,[]));const n=r.treeAdapter.createElement("documentmock",Q.HTML,[]),a=new this(r,n,e);return a.fragmentContextID===i.TEMPLATE&&a.tmplInsertionModeStack.unshift(E.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,r){var n;if(!this.onParseError)return;const a=(n=e.location)!==null&&n!==void 0?n:rB,s={code:t,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:r?a.startLine:a.endLine,endCol:r?a.startCol:a.endCol,endOffset:r?a.startOffset:a.endOffset};this.onParseError(s)}onItemPush(e,t,r){var n,a;(a=(n=this.treeAdapter).onItemPush)===null||a===void 0||a.call(n,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var r,n;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(n=(r=this.treeAdapter).onItemPop)===null||n===void 0||n.call(r,e,this.openElements.current),t){let a,s;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,s=this.fragmentContextID):{current:a,currentTagId:s}=this.openElements,this._setContextModes(a,s)}}_setContextModes(e,t){const r=e===this.document||this.treeAdapter.getNamespaceURI(e)===Q.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,Q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=E.TEXT}switchToPlaintextParsing(){this.insertionMode=E.TEXT,this.originalInsertionMode=E.IN_BODY,this.tokenizer.state=JA.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===w.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Q.HTML))switch(this.fragmentContextID){case i.TITLE:case i.TEXTAREA:{this.tokenizer.state=JA.RCDATA;break}case i.STYLE:case i.XMP:case i.IFRAME:case i.NOEMBED:case i.NOFRAMES:case i.NOSCRIPT:{this.tokenizer.state=JA.RAWTEXT;break}case i.SCRIPT:{this.tokenizer.state=JA.SCRIPT_DATA;break}case i.PLAINTEXT:{this.tokenizer.state=JA.PLAINTEXT;break}}}_setDocumentType(e){const t=e.name||"",r=e.publicId||"",n=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,r,n),e.location){const s=this.treeAdapter.getChildNodes(this.document).find(u=>this.treeAdapter.isDocumentTypeNode(u));s&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const r=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r,e)}}_appendElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,t){const r=this.treeAdapter.createElement(e,Q.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,Q.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,r),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(w.HTML,Q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,i.HTML)}_appendCommentNode(e,t){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let t,r;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(t,e.chars,r):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const n=this.treeAdapter.getChildNodes(t),a=r?n.lastIndexOf(r):n.length,s=n[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:o,endCol:l,endOffset:f}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:o,endCol:l,endOffset:f})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}_adoptNodes(e,t){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(t,r)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const r=t.location,n=this.treeAdapter.getTagName(e),a=t.type===tA.END_TAG&&n===t.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,a)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,r;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,r=this.fragmentContextID):{current:t,currentTagId:r}=this.openElements,e.tagID===i.SVG&&this.treeAdapter.getTagName(t)===w.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===Q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===i.MGLYPH||e.tagID===i.MALIGNMARK)&&!this._isIntegrationPoint(r,t,Q.HTML)}_processToken(e){switch(e.type){case tA.CHARACTER:{this.onCharacter(e);break}case tA.NULL_CHARACTER:{this.onNullCharacter(e);break}case tA.COMMENT:{this.onComment(e);break}case tA.DOCTYPE:{this.onDoctype(e);break}case tA.START_TAG:{this._processStartTag(e);break}case tA.END_TAG:{this.onEndTag(e);break}case tA.EOF:{this.onEof(e);break}case tA.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,t,r){const n=this.treeAdapter.getNamespaceURI(t),a=this.treeAdapter.getAttrList(t);return zd(e,n,a,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(n=>n.type===ge.Marker||this.openElements.contains(n.element)),r=t<0?e-1:t-1;for(let n=r;n>=0;n--){const a=this.activeFormattingElements.entries[n];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=E.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(i.P),this.openElements.popUntilTagNamePopped(i.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case i.TR:{this.insertionMode=E.IN_ROW;return}case i.TBODY:case i.THEAD:case i.TFOOT:{this.insertionMode=E.IN_TABLE_BODY;return}case i.CAPTION:{this.insertionMode=E.IN_CAPTION;return}case i.COLGROUP:{this.insertionMode=E.IN_COLUMN_GROUP;return}case i.TABLE:{this.insertionMode=E.IN_TABLE;return}case i.BODY:{this.insertionMode=E.IN_BODY;return}case i.FRAMESET:{this.insertionMode=E.IN_FRAMESET;return}case i.SELECT:{this._resetInsertionModeForSelect(e);return}case i.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case i.HTML:{this.insertionMode=this.headElement?E.AFTER_HEAD:E.BEFORE_HEAD;return}case i.TD:case i.TH:{if(e>0){this.insertionMode=E.IN_CELL;return}break}case i.HEAD:{if(e>0){this.insertionMode=E.IN_HEAD;return}break}}this.insertionMode=E.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const r=this.openElements.tagIDs[t];if(r===i.TEMPLATE)break;if(r===i.TABLE){this.insertionMode=E.IN_SELECT_IN_TABLE;return}}this.insertionMode=E.IN_SELECT}_isElementCausesFosterParenting(e){return Ou.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case i.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(t)===Q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break}case i.TABLE:{const r=this.treeAdapter.getParentNode(t);return r?{parent:r,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const r=this.treeAdapter.getNamespaceURI(e);return wd[r].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Lg(this,e);return}switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:{Pu(this,e);break}case E.TEXT:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_TABLE_TEXT:{qu(this,e);break}case E.IN_COLUMN_GROUP:{nn(this,e);break}case E.AFTER_BODY:{un(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){vg(this,e);return}switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);break}case E.TEXT:{this._insertCharacters(e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_COLUMN_GROUP:{nn(this,e);break}case E.AFTER_BODY:{un(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){ja(this,e);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:{ja(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.AFTER_BODY:{cB(this,e);break}case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{lB(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case E.INITIAL:{fB(this,e);break}case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:{this._err(e,b.misplacedDoctype);break}case E.IN_TABLE_TEXT:{nr(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,b.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?xg(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{hB(this,e);break}case E.BEFORE_HEAD:{BB(this,e);break}case E.IN_HEAD:{ce(this,e);break}case E.IN_HEAD_NO_SCRIPT:{mB(this,e);break}case E.AFTER_HEAD:{CB(this,e);break}case E.IN_BODY:{MA(this,e);break}case E.IN_TABLE:{mt(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_CAPTION:{gg(this,e);break}case E.IN_COLUMN_GROUP:{za(this,e);break}case E.IN_TABLE_BODY:{an(this,e);break}case E.IN_ROW:{sn(this,e);break}case E.IN_CELL:{pg(this,e);break}case E.IN_SELECT:{Zu(this,e);break}case E.IN_SELECT_IN_TABLE:{wg(this,e);break}case E.IN_TEMPLATE:{bg(this,e);break}case E.AFTER_BODY:{Qg(this,e);break}case E.IN_FRAMESET:{Fg(this,e);break}case E.AFTER_FRAMESET:{_g(this,e);break}case E.AFTER_AFTER_BODY:{Ng(this,e);break}case E.AFTER_AFTER_FRAMESET:{Sg(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Hg(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{dB(this,e);break}case E.BEFORE_HEAD:{gB(this,e);break}case E.IN_HEAD:{EB(this,e);break}case E.IN_HEAD_NO_SCRIPT:{pB(this,e);break}case E.AFTER_HEAD:{wB(this,e);break}case E.IN_BODY:{rn(this,e);break}case E.TEXT:{sg(this,e);break}case E.IN_TABLE:{tr(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_CAPTION:{Eg(this,e);break}case E.IN_COLUMN_GROUP:{mg(this,e);break}case E.IN_TABLE_BODY:{As(this,e);break}case E.IN_ROW:{$u(this,e);break}case E.IN_CELL:{Cg(this,e);break}case E.IN_SELECT:{zu(this,e);break}case E.IN_SELECT_IN_TABLE:{Tg(this,e);break}case E.IN_TEMPLATE:{Ug(this,e);break}case E.AFTER_BODY:{eo(this,e);break}case E.IN_FRAMESET:{Ig(this,e);break}case E.AFTER_FRAMESET:{yg(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onEof(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);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:{Wu(this,e);break}case E.TEXT:{ig(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_TEMPLATE:{Ao(this,e);break}case E.AFTER_BODY:case E.IN_FRAMESET:case E.AFTER_FRAMESET:case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{$a(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===B.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);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(e);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:{ku(this,e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_TABLE_TEXT:{Ju(this,e);break}}}};function nB(A,e){let t=A.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return t?A.openElements.contains(t.element)?A.openElements.hasInScope(e.tagID)||(t=null):(A.activeFormattingElements.removeEntry(t),t=null):Xu(A,e),t}function aB(A,e){let t=null,r=A.openElements.stackTop;for(;r>=0;r--){const n=A.openElements.items[r];if(n===e.element)break;A._isSpecialElement(n,A.openElements.tagIDs[r])&&(t=n)}return t||(A.openElements.shortenToLength(r<0?0:r),A.activeFormattingElements.removeEntry(e)),t}function sB(A,e,t){let r=e,n=A.openElements.getCommonAncestor(e);for(let a=0,s=n;s!==t;a++,s=n){n=A.openElements.getCommonAncestor(s);const u=A.activeFormattingElements.getElementEntry(s),o=u&&a>=tB;!u||o?(o&&A.activeFormattingElements.removeEntry(u),A.openElements.remove(s)):(s=iB(A,u),r===e&&(A.activeFormattingElements.bookmark=u),A.treeAdapter.detachNode(r),A.treeAdapter.appendChild(s,r),r=s)}return r}function iB(A,e){const t=A.treeAdapter.getNamespaceURI(e.element),r=A.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);return A.openElements.replace(e.element,r),e.element=r,r}function uB(A,e,t){const r=A.treeAdapter.getTagName(e),n=zr(r);if(A._isElementCausesFosterParenting(n))A._fosterParentElement(t);else{const a=A.treeAdapter.getNamespaceURI(e);n===i.TEMPLATE&&a===Q.HTML&&(e=A.treeAdapter.getTemplateContent(e)),A.treeAdapter.appendChild(e,t)}}function oB(A,e,t){const r=A.treeAdapter.getNamespaceURI(t.element),{token:n}=t,a=A.treeAdapter.createElement(n.tagName,r,n.attrs);A._adoptNodes(e,a),A.treeAdapter.appendChild(e,a),A.activeFormattingElements.insertElementAfterBookmark(a,n),A.activeFormattingElements.removeEntry(t),A.openElements.remove(t.element),A.openElements.insertAfter(e,a,n.tagID)}function qa(A,e){for(let t=0;t<eB;t++){const r=nB(A,e);if(!r)break;const n=aB(A,r);if(!n)break;A.activeFormattingElements.bookmark=r;const a=sB(A,n,r.element),s=A.openElements.getCommonAncestor(r.element);A.treeAdapter.detachNode(a),s&&uB(A,s,a),oB(A,n,r)}}function ja(A,e){A._appendCommentNode(e,A.openElements.currentTmplContentOrNode)}function cB(A,e){A._appendCommentNode(e,A.openElements.items[0])}function lB(A,e){A._appendCommentNode(e,A.document)}function $a(A,e){if(A.stopped=!0,e.location){const t=A.fragmentContext?0:2;for(let r=A.openElements.stackTop;r>=t;r--)A._setEndLocation(A.openElements.items[r],e);if(!A.fragmentContext&&A.openElements.stackTop>=0){const r=A.openElements.items[0],n=A.treeAdapter.getNodeSourceCodeLocation(r);if(n&&!n.endTag&&(A._setEndLocation(r,e),A.openElements.stackTop>=1)){const a=A.openElements.items[1],s=A.treeAdapter.getNodeSourceCodeLocation(a);s&&!s.endTag&&A._setEndLocation(a,e)}}}}function fB(A,e){A._setDocumentType(e);const t=e.forceQuirks?Ae.QUIRKS:Kd(e);Pd(e)||A._err(e,b.nonConformingDoctype),A.treeAdapter.setDocumentMode(A.document,t),A.insertionMode=E.BEFORE_HTML}function jt(A,e){A._err(e,b.missingDoctype,!0),A.treeAdapter.setDocumentMode(A.document,Ae.QUIRKS),A.insertionMode=E.BEFORE_HTML,A._processToken(e)}function hB(A,e){e.tagID===i.HTML?(A._insertElement(e,Q.HTML),A.insertionMode=E.BEFORE_HEAD):$t(A,e)}function dB(A,e){const t=e.tagID;(t===i.HTML||t===i.HEAD||t===i.BODY||t===i.BR)&&$t(A,e)}function $t(A,e){A._insertFakeRootElement(),A.insertionMode=E.BEFORE_HEAD,A._processToken(e)}function BB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.HEAD:{A._insertElement(e,Q.HTML),A.headElement=A.openElements.current,A.insertionMode=E.IN_HEAD;break}default:Zt(A,e)}}function gB(A,e){const t=e.tagID;t===i.HEAD||t===i.BODY||t===i.HTML||t===i.BR?Zt(A,e):A._err(e,b.endTagWithoutMatchingOpenElement)}function Zt(A,e){A._insertFakeElement(w.HEAD,i.HEAD),A.headElement=A.openElements.current,A.insertionMode=E.IN_HEAD,A._processToken(e)}function ce(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.TITLE:{A._switchToTextParsing(e,JA.RCDATA);break}case i.NOSCRIPT:{A.options.scriptingEnabled?A._switchToTextParsing(e,JA.RAWTEXT):(A._insertElement(e,Q.HTML),A.insertionMode=E.IN_HEAD_NO_SCRIPT);break}case i.NOFRAMES:case i.STYLE:{A._switchToTextParsing(e,JA.RAWTEXT);break}case i.SCRIPT:{A._switchToTextParsing(e,JA.SCRIPT_DATA);break}case i.TEMPLATE:{A._insertTemplate(e),A.activeFormattingElements.insertMarker(),A.framesetOk=!1,A.insertionMode=E.IN_TEMPLATE,A.tmplInsertionModeStack.unshift(E.IN_TEMPLATE);break}case i.HEAD:{A._err(e,b.misplacedStartTagForHeadElement);break}default:zt(A,e)}}function EB(A,e){switch(e.tagID){case i.HEAD:{A.openElements.pop(),A.insertionMode=E.AFTER_HEAD;break}case i.BODY:case i.BR:case i.HTML:{zt(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function nt(A,e){A.openElements.tmplCount>0?(A.openElements.generateImpliedEndTagsThoroughly(),A.openElements.currentTagId!==i.TEMPLATE&&A._err(e,b.closingOfElementWithOpenChildElements),A.openElements.popUntilTagNamePopped(i.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode()):A._err(e,b.endTagWithoutMatchingOpenElement)}function zt(A,e){A.openElements.pop(),A.insertionMode=E.AFTER_HEAD,A._processToken(e)}function mB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BASEFONT:case i.BGSOUND:case i.HEAD:case i.LINK:case i.META:case i.NOFRAMES:case i.STYLE:{ce(A,e);break}case i.NOSCRIPT:{A._err(e,b.nestedNoscriptInHead);break}default:Ar(A,e)}}function pB(A,e){switch(e.tagID){case i.NOSCRIPT:{A.openElements.pop(),A.insertionMode=E.IN_HEAD;break}case i.BR:{Ar(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function Ar(A,e){const t=e.type===tA.EOF?b.openElementsLeftAfterEof:b.disallowedContentInNoscriptInHead;A._err(e,t),A.openElements.pop(),A.insertionMode=E.IN_HEAD,A._processToken(e)}function CB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BODY:{A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=E.IN_BODY;break}case i.FRAMESET:{A._insertElement(e,Q.HTML),A.insertionMode=E.IN_FRAMESET;break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{A._err(e,b.abandonedHeadElementChild),A.openElements.push(A.headElement,i.HEAD),ce(A,e),A.openElements.remove(A.headElement);break}case i.HEAD:{A._err(e,b.misplacedStartTagForHeadElement);break}default:er(A,e)}}function wB(A,e){switch(e.tagID){case i.BODY:case i.HTML:case i.BR:{er(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function er(A,e){A._insertFakeElement(w.BODY,i.BODY),A.insertionMode=E.IN_BODY,tn(A,e)}function tn(A,e){switch(e.type){case tA.CHARACTER:{Pu(A,e);break}case tA.WHITESPACE_CHARACTER:{ku(A,e);break}case tA.COMMENT:{ja(A,e);break}case tA.START_TAG:{MA(A,e);break}case tA.END_TAG:{rn(A,e);break}case tA.EOF:{Wu(A,e);break}}}function ku(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e)}function Pu(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e),A.framesetOk=!1}function TB(A,e){A.openElements.tmplCount===0&&A.treeAdapter.adoptAttributes(A.openElements.items[0],e.attrs)}function bB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A.openElements.tmplCount===0&&(A.framesetOk=!1,A.treeAdapter.adoptAttributes(t,e.attrs))}function UB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();A.framesetOk&&t&&(A.treeAdapter.detachNode(t),A.openElements.popAllUpToHtmlElement(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_FRAMESET)}function QB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML)}function FB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),Xa.has(A.openElements.currentTagId)&&A.openElements.pop(),A._insertElement(e,Q.HTML)}function IB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.skipNextNewLine=!0,A.framesetOk=!1}function _B(A,e){const t=A.openElements.tmplCount>0;(!A.formElement||t)&&(A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),t||(A.formElement=A.openElements.current))}function yB(A,e){A.framesetOk=!1;const t=e.tagID;for(let r=A.openElements.stackTop;r>=0;r--){const n=A.openElements.tagIDs[r];if(t===i.LI&&n===i.LI||(t===i.DD||t===i.DT)&&(n===i.DD||n===i.DT)){A.openElements.generateImpliedEndTagsWithExclusion(n),A.openElements.popUntilTagNamePopped(n);break}if(n!==i.ADDRESS&&n!==i.DIV&&n!==i.P&&A._isSpecialElement(A.openElements.items[r],n))break}A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML)}function NB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.tokenizer.state=JA.PLAINTEXT}function SB(A,e){A.openElements.hasInScope(i.BUTTON)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.BUTTON)),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.framesetOk=!1}function vB(A,e){const t=A.activeFormattingElements.getElementEntryInScopeWithTagName(w.A);t&&(qa(A,e),A.openElements.remove(t.element),A.activeFormattingElements.removeEntry(t)),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function LB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function xB(A,e){A._reconstructActiveFormattingElements(),A.openElements.hasInScope(i.NOBR)&&(qa(A,e),A._reconstructActiveFormattingElements()),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function HB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.insertMarker(),A.framesetOk=!1}function DB(A,e){A.treeAdapter.getDocumentMode(A.document)!==Ae.QUIRKS&&A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=E.IN_TABLE}function Ku(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,Q.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function Vu(A){const e=wu(A,rt.TYPE);return e!=null&&e.toLowerCase()===AB}function OB(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,Q.HTML),Vu(e)||(A.framesetOk=!1),e.ackSelfClosing=!0}function RB(A,e){A._appendElement(e,Q.HTML),e.ackSelfClosing=!0}function MB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._appendElement(e,Q.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function kB(A,e){e.tagName=w.IMG,e.tagID=i.IMG,Ku(A,e)}function PB(A,e){A._insertElement(e,Q.HTML),A.skipNextNewLine=!0,A.tokenizer.state=JA.RCDATA,A.originalInsertionMode=A.insertionMode,A.framesetOk=!1,A.insertionMode=E.TEXT}function KB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._reconstructActiveFormattingElements(),A.framesetOk=!1,A._switchToTextParsing(e,JA.RAWTEXT)}function VB(A,e){A.framesetOk=!1,A._switchToTextParsing(e,JA.RAWTEXT)}function Gu(A,e){A._switchToTextParsing(e,JA.RAWTEXT)}function GB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=A.insertionMode===E.IN_TABLE||A.insertionMode===E.IN_CAPTION||A.insertionMode===E.IN_TABLE_BODY||A.insertionMode===E.IN_ROW||A.insertionMode===E.IN_CELL?E.IN_SELECT_IN_TABLE:E.IN_SELECT}function YB(A,e){A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML)}function XB(A,e){A.openElements.hasInScope(i.RUBY)&&A.openElements.generateImpliedEndTags(),A._insertElement(e,Q.HTML)}function WB(A,e){A.openElements.hasInScope(i.RUBY)&&A.openElements.generateImpliedEndTagsWithExclusion(i.RTC),A._insertElement(e,Q.HTML)}function JB(A,e){A._reconstructActiveFormattingElements(),Hu(e),Ja(e),e.selfClosing?A._appendElement(e,Q.MATHML):A._insertElement(e,Q.MATHML),e.ackSelfClosing=!0}function qB(A,e){A._reconstructActiveFormattingElements(),Du(e),Ja(e),e.selfClosing?A._appendElement(e,Q.SVG):A._insertElement(e,Q.SVG),e.ackSelfClosing=!0}function Yu(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML)}function MA(A,e){switch(e.tagID){case i.I:case i.S:case i.B:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.SMALL:case i.STRIKE:case i.STRONG:{LB(A,e);break}case i.A:{vB(A,e);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{FB(A,e);break}case i.P:case i.DL:case i.OL:case i.UL:case i.DIV:case i.DIR:case i.NAV:case i.MAIN:case i.MENU:case i.ASIDE:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.DETAILS:case i.ADDRESS:case i.ARTICLE:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{QB(A,e);break}case i.LI:case i.DD:case i.DT:{yB(A,e);break}case i.BR:case i.IMG:case i.WBR:case i.AREA:case i.EMBED:case i.KEYGEN:{Ku(A,e);break}case i.HR:{MB(A,e);break}case i.RB:case i.RTC:{XB(A,e);break}case i.RT:case i.RP:{WB(A,e);break}case i.PRE:case i.LISTING:{IB(A,e);break}case i.XMP:{KB(A,e);break}case i.SVG:{qB(A,e);break}case i.HTML:{TB(A,e);break}case i.BASE:case i.LINK:case i.META:case i.STYLE:case i.TITLE:case i.SCRIPT:case i.BGSOUND:case i.BASEFONT:case i.TEMPLATE:{ce(A,e);break}case i.BODY:{bB(A,e);break}case i.FORM:{_B(A,e);break}case i.NOBR:{xB(A,e);break}case i.MATH:{JB(A,e);break}case i.TABLE:{DB(A,e);break}case i.INPUT:{OB(A,e);break}case i.PARAM:case i.TRACK:case i.SOURCE:{RB(A,e);break}case i.IMAGE:{kB(A,e);break}case i.BUTTON:{SB(A,e);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{HB(A,e);break}case i.IFRAME:{VB(A,e);break}case i.SELECT:{GB(A,e);break}case i.OPTION:case i.OPTGROUP:{YB(A,e);break}case i.NOEMBED:case i.NOFRAMES:{Gu(A,e);break}case i.FRAMESET:{UB(A,e);break}case i.TEXTAREA:{PB(A,e);break}case i.NOSCRIPT:{A.options.scriptingEnabled?Gu(A,e):Yu(A,e);break}case i.PLAINTEXT:{NB(A,e);break}case i.COL:case i.TH:case i.TD:case i.TR:case i.HEAD:case i.FRAME:case i.TBODY:case i.TFOOT:case i.THEAD:case i.CAPTION:case i.COLGROUP:break;default:Yu(A,e)}}function jB(A,e){if(A.openElements.hasInScope(i.BODY)&&(A.insertionMode=E.AFTER_BODY,A.options.sourceCodeLocationInfo)){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A._setEndLocation(t,e)}}function $B(A,e){A.openElements.hasInScope(i.BODY)&&(A.insertionMode=E.AFTER_BODY,eo(A,e))}function ZB(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t))}function zB(A){const e=A.openElements.tmplCount>0,{formElement:t}=A;e||(A.formElement=null),(t||e)&&A.openElements.hasInScope(i.FORM)&&(A.openElements.generateImpliedEndTags(),e?A.openElements.popUntilTagNamePopped(i.FORM):t&&A.openElements.remove(t))}function Ag(A){A.openElements.hasInButtonScope(i.P)||A._insertFakeElement(w.P,i.P),A._closePElement()}function eg(A){A.openElements.hasInListItemScope(i.LI)&&(A.openElements.generateImpliedEndTagsWithExclusion(i.LI),A.openElements.popUntilTagNamePopped(i.LI))}function tg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTagsWithExclusion(t),A.openElements.popUntilTagNamePopped(t))}function rg(A){A.openElements.hasNumberedHeaderInScope()&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilNumberedHeaderPopped())}function ng(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker())}function ag(A){A._reconstructActiveFormattingElements(),A._insertFakeElement(w.BR,i.BR),A.openElements.pop(),A.framesetOk=!1}function Xu(A,e){const t=e.tagName,r=e.tagID;for(let n=A.openElements.stackTop;n>0;n--){const a=A.openElements.items[n],s=A.openElements.tagIDs[n];if(r===s&&(r!==i.UNKNOWN||A.treeAdapter.getTagName(a)===t)){A.openElements.generateImpliedEndTagsWithExclusion(r),A.openElements.stackTop>=n&&A.openElements.shortenToLength(n);break}if(A._isSpecialElement(a,s))break}}function rn(A,e){switch(e.tagID){case i.A:case i.B:case i.I:case i.S:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.NOBR:case i.SMALL:case i.STRIKE:case i.STRONG:{qa(A,e);break}case i.P:{Ag(A);break}case i.DL:case i.UL:case i.OL:case i.DIR:case i.DIV:case i.NAV:case i.PRE:case i.MAIN:case i.MENU:case i.ASIDE:case i.BUTTON:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.ADDRESS:case i.ARTICLE:case i.DETAILS:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.LISTING:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{ZB(A,e);break}case i.LI:{eg(A);break}case i.DD:case i.DT:{tg(A,e);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{rg(A);break}case i.BR:{ag(A);break}case i.BODY:{jB(A,e);break}case i.HTML:{$B(A,e);break}case i.FORM:{zB(A);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{ng(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:Xu(A,e)}}function Wu(A,e){A.tmplInsertionModeStack.length>0?Ao(A,e):$a(A,e)}function sg(A,e){var t;e.tagID===i.SCRIPT&&((t=A.scriptHandler)===null||t===void 0||t.call(A,A.openElements.current)),A.openElements.pop(),A.insertionMode=A.originalInsertionMode}function ig(A,e){A._err(e,b.eofInElementThatCanContainOnlyText),A.openElements.pop(),A.insertionMode=A.originalInsertionMode,A.onEof(e)}function Za(A,e){if(Ou.has(A.openElements.currentTagId))switch(A.pendingCharacterTokens.length=0,A.hasNonWhitespacePendingCharacterToken=!1,A.originalInsertionMode=A.insertionMode,A.insertionMode=E.IN_TABLE_TEXT,e.type){case tA.CHARACTER:{qu(A,e);break}case tA.WHITESPACE_CHARACTER:{Ju(A,e);break}}else rr(A,e)}function ug(A,e){A.openElements.clearBackToTableContext(),A.activeFormattingElements.insertMarker(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_CAPTION}function og(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_COLUMN_GROUP}function cg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.COLGROUP,i.COLGROUP),A.insertionMode=E.IN_COLUMN_GROUP,za(A,e)}function lg(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_TABLE_BODY}function fg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.TBODY,i.TBODY),A.insertionMode=E.IN_TABLE_BODY,an(A,e)}function hg(A,e){A.openElements.hasInTableScope(i.TABLE)&&(A.openElements.popUntilTagNamePopped(i.TABLE),A._resetInsertionMode(),A._processStartTag(e))}function dg(A,e){Vu(e)?A._appendElement(e,Q.HTML):rr(A,e),e.ackSelfClosing=!0}function Bg(A,e){!A.formElement&&A.openElements.tmplCount===0&&(A._insertElement(e,Q.HTML),A.formElement=A.openElements.current,A.openElements.pop())}function mt(A,e){switch(e.tagID){case i.TD:case i.TH:case i.TR:{fg(A,e);break}case i.STYLE:case i.SCRIPT:case i.TEMPLATE:{ce(A,e);break}case i.COL:{cg(A,e);break}case i.FORM:{Bg(A,e);break}case i.TABLE:{hg(A,e);break}case i.TBODY:case i.TFOOT:case i.THEAD:{lg(A,e);break}case i.INPUT:{dg(A,e);break}case i.CAPTION:{ug(A,e);break}case i.COLGROUP:{og(A,e);break}default:rr(A,e)}}function tr(A,e){switch(e.tagID){case i.TABLE:{A.openElements.hasInTableScope(i.TABLE)&&(A.openElements.popUntilTagNamePopped(i.TABLE),A._resetInsertionMode());break}case i.TEMPLATE:{nt(A,e);break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:rr(A,e)}}function rr(A,e){const t=A.fosterParentingEnabled;A.fosterParentingEnabled=!0,tn(A,e),A.fosterParentingEnabled=t}function Ju(A,e){A.pendingCharacterTokens.push(e)}function qu(A,e){A.pendingCharacterTokens.push(e),A.hasNonWhitespacePendingCharacterToken=!0}function nr(A,e){let t=0;if(A.hasNonWhitespacePendingCharacterToken)for(;t<A.pendingCharacterTokens.length;t++)rr(A,A.pendingCharacterTokens[t]);else for(;t<A.pendingCharacterTokens.length;t++)A._insertCharacters(A.pendingCharacterTokens[t]);A.insertionMode=A.originalInsertionMode,A._processToken(e)}const ju=new Set([i.CAPTION,i.COL,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]);function gg(A,e){const t=e.tagID;ju.has(t)?A.openElements.hasInTableScope(i.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_TABLE,mt(A,e)):MA(A,e)}function Eg(A,e){const t=e.tagID;switch(t){case i.CAPTION:case i.TABLE:{A.openElements.hasInTableScope(i.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_TABLE,t===i.TABLE&&tr(A,e));break}case i.BODY:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:rn(A,e)}}function za(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.COL:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.TEMPLATE:{ce(A,e);break}default:nn(A,e)}}function mg(A,e){switch(e.tagID){case i.COLGROUP:{A.openElements.currentTagId===i.COLGROUP&&(A.openElements.pop(),A.insertionMode=E.IN_TABLE);break}case i.TEMPLATE:{nt(A,e);break}case i.COL:break;default:nn(A,e)}}function nn(A,e){A.openElements.currentTagId===i.COLGROUP&&(A.openElements.pop(),A.insertionMode=E.IN_TABLE,A._processToken(e))}function an(A,e){switch(e.tagID){case i.TR:{A.openElements.clearBackToTableBodyContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_ROW;break}case i.TH:case i.TD:{A.openElements.clearBackToTableBodyContext(),A._insertFakeElement(w.TR,i.TR),A.insertionMode=E.IN_ROW,sn(A,e);break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE,mt(A,e));break}default:mt(A,e)}}function As(A,e){const t=e.tagID;switch(e.tagID){case i.TBODY:case i.TFOOT:case i.THEAD:{A.openElements.hasInTableScope(t)&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE);break}case i.TABLE:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE,tr(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:case i.TR:break;default:tr(A,e)}}function sn(A,e){switch(e.tagID){case i.TH:case i.TD:{A.openElements.clearBackToTableRowContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_CELL,A.activeFormattingElements.insertMarker();break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,an(A,e));break}default:mt(A,e)}}function $u(A,e){switch(e.tagID){case i.TR:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY);break}case i.TABLE:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,As(A,e));break}case i.TBODY:case i.TFOOT:case i.THEAD:{(A.openElements.hasInTableScope(e.tagID)||A.openElements.hasInTableScope(i.TR))&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,As(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:break;default:tr(A,e)}}function pg(A,e){const t=e.tagID;ju.has(t)?(A.openElements.hasInTableScope(i.TD)||A.openElements.hasInTableScope(i.TH))&&(A._closeTableCell(),sn(A,e)):MA(A,e)}function Cg(A,e){const t=e.tagID;switch(t){case i.TD:case i.TH:{A.openElements.hasInTableScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_ROW);break}case i.TABLE:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{A.openElements.hasInTableScope(t)&&(A._closeTableCell(),$u(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:break;default:rn(A,e)}}function Zu(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.OPTION:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A._insertElement(e,Q.HTML);break}case i.OPTGROUP:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop(),A._insertElement(e,Q.HTML);break}case i.HR:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop(),A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.INPUT:case i.KEYGEN:case i.TEXTAREA:case i.SELECT:{A.openElements.hasInSelectScope(i.SELECT)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),e.tagID!==i.SELECT&&A._processStartTag(e));break}case i.SCRIPT:case i.TEMPLATE:{ce(A,e);break}}}function zu(A,e){switch(e.tagID){case i.OPTGROUP:{A.openElements.stackTop>0&&A.openElements.currentTagId===i.OPTION&&A.openElements.tagIDs[A.openElements.stackTop-1]===i.OPTGROUP&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop();break}case i.OPTION:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop();break}case i.SELECT:{A.openElements.hasInSelectScope(i.SELECT)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode());break}case i.TEMPLATE:{nt(A,e);break}}}function wg(A,e){const t=e.tagID;t===i.CAPTION||t===i.TABLE||t===i.TBODY||t===i.TFOOT||t===i.THEAD||t===i.TR||t===i.TD||t===i.TH?(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),A._processStartTag(e)):Zu(A,e)}function Tg(A,e){const t=e.tagID;t===i.CAPTION||t===i.TABLE||t===i.TBODY||t===i.TFOOT||t===i.THEAD||t===i.TR||t===i.TD||t===i.TH?A.openElements.hasInTableScope(t)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),A.onEndTag(e)):zu(A,e)}function bg(A,e){switch(e.tagID){case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{ce(A,e);break}case i.CAPTION:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{A.tmplInsertionModeStack[0]=E.IN_TABLE,A.insertionMode=E.IN_TABLE,mt(A,e);break}case i.COL:{A.tmplInsertionModeStack[0]=E.IN_COLUMN_GROUP,A.insertionMode=E.IN_COLUMN_GROUP,za(A,e);break}case i.TR:{A.tmplInsertionModeStack[0]=E.IN_TABLE_BODY,A.insertionMode=E.IN_TABLE_BODY,an(A,e);break}case i.TD:case i.TH:{A.tmplInsertionModeStack[0]=E.IN_ROW,A.insertionMode=E.IN_ROW,sn(A,e);break}default:A.tmplInsertionModeStack[0]=E.IN_BODY,A.insertionMode=E.IN_BODY,MA(A,e)}}function Ug(A,e){e.tagID===i.TEMPLATE&&nt(A,e)}function Ao(A,e){A.openElements.tmplCount>0?(A.openElements.popUntilTagNamePopped(i.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode(),A.onEof(e)):$a(A,e)}function Qg(A,e){e.tagID===i.HTML?MA(A,e):un(A,e)}function eo(A,e){var t;if(e.tagID===i.HTML){if(A.fragmentContext||(A.insertionMode=E.AFTER_AFTER_BODY),A.options.sourceCodeLocationInfo&&A.openElements.tagIDs[0]===i.HTML){A._setEndLocation(A.openElements.items[0],e);const r=A.openElements.items[1];r&&!(!((t=A.treeAdapter.getNodeSourceCodeLocation(r))===null||t===void 0)&&t.endTag)&&A._setEndLocation(r,e)}}else un(A,e)}function un(A,e){A.insertionMode=E.IN_BODY,tn(A,e)}function Fg(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.FRAMESET:{A._insertElement(e,Q.HTML);break}case i.FRAME:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.NOFRAMES:{ce(A,e);break}}}function Ig(A,e){e.tagID===i.FRAMESET&&!A.openElements.isRootHtmlElementCurrent()&&(A.openElements.pop(),!A.fragmentContext&&A.openElements.currentTagId!==i.FRAMESET&&(A.insertionMode=E.AFTER_FRAMESET))}function _g(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.NOFRAMES:{ce(A,e);break}}}function yg(A,e){e.tagID===i.HTML&&(A.insertionMode=E.AFTER_AFTER_FRAMESET)}function Ng(A,e){e.tagID===i.HTML?MA(A,e):on(A,e)}function on(A,e){A.insertionMode=E.IN_BODY,tn(A,e)}function Sg(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.NOFRAMES:{ce(A,e);break}}}function vg(A,e){e.chars=dA,A._insertCharacters(e)}function Lg(A,e){A._insertCharacters(e),A.framesetOk=!1}function to(A){for(;A.treeAdapter.getNamespaceURI(A.openElements.current)!==Q.HTML&&!A._isIntegrationPoint(A.openElements.currentTagId,A.openElements.current);)A.openElements.pop()}function xg(A,e){if(qd(e))to(A),A._startTagOutsideForeignContent(e);else{const t=A._getAdjustedCurrentElement(),r=A.treeAdapter.getNamespaceURI(t);r===Q.MATHML?Hu(e):r===Q.SVG&&(jd(e),Du(e)),Ja(e),e.selfClosing?A._appendElement(e,r):A._insertElement(e,r),e.ackSelfClosing=!0}}function Hg(A,e){if(e.tagID===i.P||e.tagID===i.BR){to(A),A._endTagOutsideForeignContent(e);return}for(let t=A.openElements.stackTop;t>0;t--){const r=A.openElements.items[t];if(A.treeAdapter.getNamespaceURI(r)===Q.HTML){A._endTagOutsideForeignContent(e);break}const n=A.treeAdapter.getTagName(r);if(n.toLowerCase()===e.tagName){e.tagName=n,A.openElements.shortenToLength(t);break}}}const Dg=new Set([w.AREA,w.BASE,w.BASEFONT,w.BGSOUND,w.BR,w.COL,w.EMBED,w.FRAME,w.HR,w.IMG,w.INPUT,w.KEYGEN,w.LINK,w.META,w.PARAM,w.SOURCE,w.TRACK,w.WBR]);function Og(A,e){return e.treeAdapter.isElementNode(A)&&e.treeAdapter.getNamespaceURI(A)===Q.HTML&&Dg.has(e.treeAdapter.getTagName(A))}const Rg={treeAdapter:Ue,scriptingEnabled:!0};function Mg(A,e){const t={...Rg,...e};return ro(A,t)}function kg(A,e){let t="";const r=e.treeAdapter.isElementNode(A)&&e.treeAdapter.getTagName(A)===w.TEMPLATE&&e.treeAdapter.getNamespaceURI(A)===Q.HTML?e.treeAdapter.getTemplateContent(A):A,n=e.treeAdapter.getChildNodes(r);if(n)for(const a of n)t+=ro(a,e);return t}function ro(A,e){return e.treeAdapter.isElementNode(A)?Pg(A,e):e.treeAdapter.isTextNode(A)?Vg(A,e):e.treeAdapter.isCommentNode(A)?Gg(A,e):e.treeAdapter.isDocumentTypeNode(A)?Yg(A,e):""}function Pg(A,e){const t=e.treeAdapter.getTagName(A);return`<${t}${Kg(A,e)}>${Og(A,e)?"":`${kg(A,e)}</${t}>`}`}function Kg(A,{treeAdapter:e}){let t="";for(const r of e.getAttrList(A)){if(t+=" ",r.namespace)switch(r.namespace){case Q.XML:{t+=`xml:${r.name}`;break}case Q.XMLNS:{r.name!=="xmlns"&&(t+="xmlns:"),t+=r.name;break}case Q.XLINK:{t+=`xlink:${r.name}`;break}default:t+=`${r.prefix}:${r.name}`}else t+=r.name;t+=`="${Ui(r.value)}"`}return t}function Vg(A,e){const{treeAdapter:t}=e,r=t.getTextNodeContent(A),n=t.getParentNode(A),a=n&&t.isElementNode(n)&&t.getTagName(n);return a&&t.getNamespaceURI(n)===Q.HTML&&bd(a,e.scriptingEnabled)?r:Qi(r)}function Gg(A,{treeAdapter:e}){return`<!--${e.getCommentNodeContent(A)}-->`}function Yg(A,{treeAdapter:e}){return`<!DOCTYPE ${e.getDocumentTypeNodeName(A)}>`}function Xg(A,e){return Mu.parse(A,e)}function Wg(A,e,t){typeof A=="string"&&(t=e,e=A,A=null);const r=Mu.getFragmentParser(A,t);return r.tokenizer.write(e,!0),r.getFragment()}function no(A){const e=A.includes('"')?"'":'"';return e+A+e}function Jg(A,e,t){let r="!DOCTYPE ";return A&&(r+=A),e?r+=` PUBLIC ${no(e)}`:t&&(r+=" SYSTEM"),t&&(r+=` ${no(t)}`),r}const De={isCommentNode:Dr,isElementNode:X,isTextNode:Be,createDocument(){const A=new Ze([]);return A["x-mode"]=Ae.NO_QUIRKS,A},createDocumentFragment(){return new Ze([])},createElement(A,e,t){const r=Object.create(null),n=Object.create(null),a=Object.create(null);for(let u=0;u<t.length;u++){const o=t[u].name;r[o]=t[u].value,n[o]=t[u].namespace,a[o]=t[u].prefix}const s=new ha(A,r,[]);return s.namespace=e,s["x-attribsNamespace"]=n,s["x-attribsPrefix"]=a,s},createCommentNode(A){return new ca(A)},createTextNode(A){return new Mt(A)},appendChild(A,e){const t=A.children[A.children.length-1];t&&(t.next=e,e.prev=t),A.children.push(e),e.parent=A},insertBefore(A,e,t){const r=A.children.indexOf(t),{prev:n}=t;n&&(n.next=e,e.prev=n),t.prev=e,e.next=t,A.children.splice(r,0,e),e.parent=A},setTemplateContent(A,e){De.appendChild(A,e)},getTemplateContent(A){return A.children[0]},setDocumentType(A,e,t,r){const n=Jg(e,t,r);let a=A.children.find(s=>da(s)&&s.name==="!doctype");a?a.data=n??null:(a=new la("!doctype",n),De.appendChild(A,a)),a["x-name"]=e,a["x-publicId"]=t,a["x-systemId"]=r},setDocumentMode(A,e){A["x-mode"]=e},getDocumentMode(A){return A["x-mode"]},detachNode(A){if(A.parent){const e=A.parent.children.indexOf(A),{prev:t,next:r}=A;A.prev=null,A.next=null,t&&(t.next=r),r&&(r.prev=t),A.parent.children.splice(e,1),A.parent=null}},insertText(A,e){const t=A.children[A.children.length-1];t&&Be(t)?t.data+=e:De.appendChild(A,De.createTextNode(e))},insertTextBefore(A,e,t){const r=A.children[A.children.indexOf(t)-1];r&&Be(r)?r.data+=e:De.insertBefore(A,De.createTextNode(e),t)},adoptAttributes(A,e){for(let t=0;t<e.length;t++){const r=e[t].name;A.attribs[r]===void 0&&(A.attribs[r]=e[t].value,A["x-attribsNamespace"][r]=e[t].namespace,A["x-attribsPrefix"][r]=e[t].prefix)}},getFirstChild(A){return A.children[0]},getChildNodes(A){return A.children},getParentNode(A){return A.parent},getAttrList(A){return A.attributes},getTagName(A){return A.name},getNamespaceURI(A){return A.namespace},getTextNodeContent(A){return A.data},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){var e;return(e=A["x-name"])!==null&&e!==void 0?e:""},getDocumentTypeNodePublicId(A){var e;return(e=A["x-publicId"])!==null&&e!==void 0?e:""},getDocumentTypeNodeSystemId(A){var e;return(e=A["x-systemId"])!==null&&e!==void 0?e:""},isDocumentTypeNode(A){return da(A)&&A.name==="!doctype"},setNodeSourceCodeLocation(A,e){e&&(A.startIndex=e.startOffset,A.endIndex=e.endOffset),A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){e.endOffset!=null&&(A.endIndex=e.endOffset),A.sourceCodeLocation={...A.sourceCodeLocation,...e}}};function qg(A,e,t,r){var n;return(n=e.treeAdapter)!==null&&n!==void 0||(e.treeAdapter=De),e.scriptingEnabled!==!1&&(e.scriptingEnabled=!0),t?Xg(A,e):Wg(r,A,e)}const jg={treeAdapter:De};function $g(A){const e="length"in A?A:[A];for(let r=0;r<e.length;r+=1){const n=e[r];Se(n)&&Array.prototype.splice.call(e,r,1,...n.children)}let t="";for(let r=0;r<e.length;r+=1){const n=e[r];t+=Mg(n,jg)}return t}var Y;(function(A){A[A.Tab=9]="Tab",A[A.NewLine=10]="NewLine",A[A.FormFeed=12]="FormFeed",A[A.CarriageReturn=13]="CarriageReturn",A[A.Space=32]="Space",A[A.ExclamationMark=33]="ExclamationMark",A[A.Number=35]="Number",A[A.Amp=38]="Amp",A[A.SingleQuote=39]="SingleQuote",A[A.DoubleQuote=34]="DoubleQuote",A[A.Dash=45]="Dash",A[A.Slash=47]="Slash",A[A.Zero=48]="Zero",A[A.Nine=57]="Nine",A[A.Semi=59]="Semi",A[A.Lt=60]="Lt",A[A.Eq=61]="Eq",A[A.Gt=62]="Gt",A[A.Questionmark=63]="Questionmark",A[A.UpperA=65]="UpperA",A[A.LowerA=97]="LowerA",A[A.UpperF=70]="UpperF",A[A.LowerF=102]="LowerF",A[A.UpperZ=90]="UpperZ",A[A.LowerZ=122]="LowerZ",A[A.LowerX=120]="LowerX",A[A.OpeningSquareBracket=91]="OpeningSquareBracket"})(Y||(Y={}));var y;(function(A){A[A.Text=1]="Text",A[A.BeforeTagName=2]="BeforeTagName",A[A.InTagName=3]="InTagName",A[A.InSelfClosingTag=4]="InSelfClosingTag",A[A.BeforeClosingTagName=5]="BeforeClosingTagName",A[A.InClosingTagName=6]="InClosingTagName",A[A.AfterClosingTagName=7]="AfterClosingTagName",A[A.BeforeAttributeName=8]="BeforeAttributeName",A[A.InAttributeName=9]="InAttributeName",A[A.AfterAttributeName=10]="AfterAttributeName",A[A.BeforeAttributeValue=11]="BeforeAttributeValue",A[A.InAttributeValueDq=12]="InAttributeValueDq",A[A.InAttributeValueSq=13]="InAttributeValueSq",A[A.InAttributeValueNq=14]="InAttributeValueNq",A[A.BeforeDeclaration=15]="BeforeDeclaration",A[A.InDeclaration=16]="InDeclaration",A[A.InProcessingInstruction=17]="InProcessingInstruction",A[A.BeforeComment=18]="BeforeComment",A[A.CDATASequence=19]="CDATASequence",A[A.InSpecialComment=20]="InSpecialComment",A[A.InCommentLike=21]="InCommentLike",A[A.BeforeSpecialS=22]="BeforeSpecialS",A[A.BeforeSpecialT=23]="BeforeSpecialT",A[A.SpecialStartSequence=24]="SpecialStartSequence",A[A.InSpecialTag=25]="InSpecialTag",A[A.InEntity=26]="InEntity"})(y||(y={}));function Qe(A){return A===Y.Space||A===Y.NewLine||A===Y.Tab||A===Y.FormFeed||A===Y.CarriageReturn}function cn(A){return A===Y.Slash||A===Y.Gt||Qe(A)}function Zg(A){return A>=Y.LowerA&&A<=Y.LowerZ||A>=Y.UpperA&&A<=Y.UpperZ}var Ee;(function(A){A[A.NoValue=0]="NoValue",A[A.Unquoted=1]="Unquoted",A[A.Single=2]="Single",A[A.Double=3]="Double"})(Ee||(Ee={}));const DA={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])};let zg=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},r){this.cbs=r,this.state=y.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=y.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new Ca(e?pi:ga,(n,a)=>this.emitCodePoint(n,a))}reset(){this.state=y.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=y.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,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(e){e===Y.Lt||!this.decodeEntities&&this.fastForwardTo(Y.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=y.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateSpecialStartSequence(e){const t=this.sequenceIndex===this.currentSequence.length;if(!(t?cn(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=y.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===Y.Gt||Qe(e)){const t=this.index-this.currentSequence.length;if(this.sectionStart<t){const r=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=r}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===DA.TitleEnd?this.decodeEntities&&e===Y.Amp&&this.startEntity():this.fastForwardTo(Y.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(e===Y.Lt)}stateCDATASequence(e){e===DA.Cdata[this.sequenceIndex]?++this.sequenceIndex===DA.Cdata.length&&(this.state=y.InCommentLike,this.currentSequence=DA.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=y.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===DA.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=y.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!cn(e):Zg(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=y.SpecialStartSequence}stateBeforeTagName(e){if(e===Y.ExclamationMark)this.state=y.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===Y.Questionmark)this.state=y.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){const t=e|32;this.sectionStart=this.index,this.xmlMode?this.state=y.InTagName:t===DA.ScriptEnd[2]?this.state=y.BeforeSpecialS:t===DA.TitleEnd[2]?this.state=y.BeforeSpecialT:this.state=y.InTagName}else e===Y.Slash?this.state=y.BeforeClosingTagName:(this.state=y.Text,this.stateText(e))}stateInTagName(e){cn(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Qe(e)||(e===Y.Gt?this.state=y.Text:(this.state=this.isTagStartChar(e)?y.InClosingTagName:y.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===Y.Gt||Qe(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=y.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===Y.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=y.InSpecialTag,this.sequenceIndex=0):this.state=y.Text,this.sectionStart=this.index+1):e===Y.Slash?this.state=y.InSelfClosingTag:Qe(e)||(this.state=y.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===Y.Gt?(this.cbs.onselfclosingtag(this.index),this.state=y.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Qe(e)||(this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===Y.Eq||cn(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=y.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===Y.Eq?this.state=y.BeforeAttributeValue:e===Y.Slash||e===Y.Gt?(this.cbs.onattribend(Ee.NoValue,this.sectionStart),this.sectionStart=-1,this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e)):Qe(e)||(this.cbs.onattribend(Ee.NoValue,this.sectionStart),this.state=y.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===Y.DoubleQuote?(this.state=y.InAttributeValueDq,this.sectionStart=this.index+1):e===Y.SingleQuote?(this.state=y.InAttributeValueSq,this.sectionStart=this.index+1):Qe(e)||(this.sectionStart=this.index,this.state=y.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===Y.DoubleQuote?Ee.Double:Ee.Single,this.index+1),this.state=y.BeforeAttributeName):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,Y.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,Y.SingleQuote)}stateInAttributeValueNoQuotes(e){Qe(e)||e===Y.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ee.Unquoted,this.index),this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===Y.OpeningSquareBracket?(this.state=y.CDATASequence,this.sequenceIndex=0):this.state=e===Y.Dash?y.BeforeComment:y.InDeclaration}stateInDeclaration(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=y.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===Y.Dash?(this.state=y.InCommentLike,this.currentSequence=DA.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=y.InDeclaration}stateInSpecialComment(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){const t=e|32;t===DA.ScriptEnd[3]?this.startSpecial(DA.ScriptEnd,4):t===DA.StyleEnd[3]?this.startSpecial(DA.StyleEnd,4):(this.state=y.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){const t=e|32;t===DA.TitleEnd[3]?this.startSpecial(DA.TitleEnd,4):t===DA.TextareaEnd[3]?this.startSpecial(DA.TextareaEnd,4):(this.state=y.InTagName,this.stateInTagName(e))}startEntity(){this.baseState=this.state,this.state=y.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?re.Strict:this.baseState===y.Text||this.baseState===y.InSpecialTag?re.Legacy:re.Attribute)}stateInEntity(){const e=this.entityDecoder.write(this.buffer,this.index-this.offset);e>=0?(this.state=this.baseState,e===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===y.Text||this.state===y.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===y.InAttributeValueDq||this.state===y.InAttributeValueSq||this.state===y.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 e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case y.Text:{this.stateText(e);break}case y.SpecialStartSequence:{this.stateSpecialStartSequence(e);break}case y.InSpecialTag:{this.stateInSpecialTag(e);break}case y.CDATASequence:{this.stateCDATASequence(e);break}case y.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(e);break}case y.InAttributeName:{this.stateInAttributeName(e);break}case y.InCommentLike:{this.stateInCommentLike(e);break}case y.InSpecialComment:{this.stateInSpecialComment(e);break}case y.BeforeAttributeName:{this.stateBeforeAttributeName(e);break}case y.InTagName:{this.stateInTagName(e);break}case y.InClosingTagName:{this.stateInClosingTagName(e);break}case y.BeforeTagName:{this.stateBeforeTagName(e);break}case y.AfterAttributeName:{this.stateAfterAttributeName(e);break}case y.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(e);break}case y.BeforeAttributeValue:{this.stateBeforeAttributeValue(e);break}case y.BeforeClosingTagName:{this.stateBeforeClosingTagName(e);break}case y.AfterClosingTagName:{this.stateAfterClosingTagName(e);break}case y.BeforeSpecialS:{this.stateBeforeSpecialS(e);break}case y.BeforeSpecialT:{this.stateBeforeSpecialT(e);break}case y.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(e);break}case y.InSelfClosingTag:{this.stateInSelfClosingTag(e);break}case y.InDeclaration:{this.stateInDeclaration(e);break}case y.BeforeDeclaration:{this.stateBeforeDeclaration(e);break}case y.BeforeComment:{this.stateBeforeComment(e);break}case y.InProcessingInstruction:{this.stateInProcessingInstruction(e);break}case y.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===y.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===y.InCommentLike?this.currentSequence===DA.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===y.InTagName||this.state===y.BeforeAttributeName||this.state===y.BeforeAttributeValue||this.state===y.AfterAttributeName||this.state===y.InAttributeName||this.state===y.InAttributeValueSq||this.state===y.InAttributeValueDq||this.state===y.InAttributeValueNq||this.state===y.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==y.Text&&this.baseState!==y.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const pt=new Set(["input","option","optgroup","select","button","datalist","textarea"]),sA=new Set(["p"]),ao=new Set(["thead","tbody"]),so=new Set(["dd","dt"]),io=new Set(["rt","rp"]),AE=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",sA],["h1",sA],["h2",sA],["h3",sA],["h4",sA],["h5",sA],["h6",sA],["select",pt],["input",pt],["output",pt],["button",pt],["datalist",pt],["textarea",pt],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",so],["dt",so],["address",sA],["article",sA],["aside",sA],["blockquote",sA],["details",sA],["div",sA],["dl",sA],["fieldset",sA],["figcaption",sA],["figure",sA],["footer",sA],["form",sA],["header",sA],["hr",sA],["main",sA],["nav",sA],["ol",sA],["pre",sA],["section",sA],["table",sA],["ul",sA],["rt",io],["rp",io],["tbody",ao],["tfoot",ao]]),eE=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),uo=new Set(["math","svg"]),oo=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),tE=/\s|\//;let rE=class{constructor(e,t={}){var r,n,a,s,u,o;this.options=t,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=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(r=t.lowerCaseTags)!==null&&r!==void 0?r:this.htmlMode,this.lowerCaseAttributeNames=(n=t.lowerCaseAttributeNames)!==null&&n!==void 0?n:this.htmlMode,this.recognizeSelfClosing=(a=t.recognizeSelfClosing)!==null&&a!==void 0?a:!this.htmlMode,this.tokenizer=new((s=t.Tokenizer)!==null&&s!==void 0?s:zg)(this.options,this),this.foreignContext=[!this.htmlMode],(o=(u=this.cbs).onparserinit)===null||o===void 0||o.call(u,this)}ontext(e,t){var r,n;const a=this.getSlice(e,t);this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,a),this.startIndex=t}ontextentity(e,t){var r,n;this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,ma(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&eE.has(e)}onopentagname(e,t){this.endIndex=t;let r=this.getSlice(e,t);this.lowerCaseTagNames&&(r=r.toLowerCase()),this.emitOpenTag(r)}emitOpenTag(e){var t,r,n,a;this.openTagStart=this.startIndex,this.tagname=e;const s=this.htmlMode&&AE.get(e);if(s)for(;this.stack.length>0&&s.has(this.stack[0]);){const u=this.stack.shift();(r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,u,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(uo.has(e)?this.foreignContext.unshift(!0):oo.has(e)&&this.foreignContext.unshift(!1))),(a=(n=this.cbs).onopentagname)===null||a===void 0||a.call(n,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,r;this.startIndex=this.openTagStart,this.attribs&&((r=(t=this.cbs).onopentag)===null||r===void 0||r.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var r,n,a,s,u,o,l,f;this.endIndex=t;let h=this.getSlice(e,t);if(this.lowerCaseTagNames&&(h=h.toLowerCase()),this.htmlMode&&(uo.has(h)||oo.has(h))&&this.foreignContext.shift(),this.isVoidElement(h))this.htmlMode&&h==="br"&&((s=(a=this.cbs).onopentagname)===null||s===void 0||s.call(a,"br"),(o=(u=this.cbs).onopentag)===null||o===void 0||o.call(u,"br",{},!0),(f=(l=this.cbs).onclosetag)===null||f===void 0||f.call(l,"br",!1));else{const d=this.stack.indexOf(h);if(d!==-1)for(let C=0;C<=d;C++){const p=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,p,C!==d)}else this.htmlMode&&h==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,r;const n=this.tagname;this.endOpenTag(e),this.stack[0]===n&&((r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,n,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;const r=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?r.toLowerCase():r}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=ma(e)}onattribend(e,t){var r,n;this.endIndex=t,(n=(r=this.cbs).onattribute)===null||n===void 0||n.call(r,this.attribname,this.attribvalue,e===Ee.Double?'"':e===Ee.Single?"'":e===Ee.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){const t=e.search(tE);let r=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(r=r.toLowerCase()),r}ondeclaration(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`!${n}`,`!${r}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`?${n}`,`?${r}`)}this.startIndex=t+1}oncomment(e,t,r){var n,a,s,u;this.endIndex=t,(a=(n=this.cbs).oncomment)===null||a===void 0||a.call(n,this.getSlice(e,t-r)),(u=(s=this.cbs).oncommentend)===null||u===void 0||u.call(s),this.startIndex=t+1}oncdata(e,t,r){var n,a,s,u,o,l,f,h,d,C;this.endIndex=t;const p=this.getSlice(e,t-r);!this.htmlMode||this.options.recognizeCDATA?((a=(n=this.cbs).oncdatastart)===null||a===void 0||a.call(n),(u=(s=this.cbs).ontext)===null||u===void 0||u.call(s,p),(l=(o=this.cbs).oncdataend)===null||l===void 0||l.call(o)):((h=(f=this.cbs).oncomment)===null||h===void 0||h.call(f,`[CDATA[${p}]]`),(C=(d=this.cbs).oncommentend)===null||C===void 0||C.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let r=0;r<this.stack.length;r++)this.cbs.onclosetag(this.stack[r],!0)}(t=(e=this.cbs).onend)===null||t===void 0||t.call(e)}reset(){var e,t,r,n;(t=(e=this.cbs).onreset)===null||t===void 0||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(n=(r=this.cbs).onparserinit)===null||n===void 0||n.call(r,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let r=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),r+=this.buffers[0].slice(0,t-this.bufferOffset);return r}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".end() after done!"));return}e&&this.write(e),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(e){this.write(e)}done(e){this.end(e)}};function nE(A,e){const t=new a0(void 0,e);return new rE(t,e).end(A),t.root}const aE=xh((A,e,t,r)=>e._useHtmlParser2?nE(A,e):qg(A,e,t,r)),co=hd(aE,(A,e)=>e._useHtmlParser2?Or(A,e):$g(A));var W=(A=>(A[A.None=0]="None",A[A.Text=1]="Text",A[A.Image=2]="Image",A[A.Video=3]="Video",A[A.Icon=4]="Icon",A[A.Link=5]="Link",A[A.Button=6]="Button",A[A.Block=10]="Block",A))(W||{}),le;(A=>{A.THEME_TEXT_COLOR_CLASS="gp-designer-theme-text",A.THEME_BUTTON_COLOR_CLASS="gp-designer-theme-button",A.THEME_ICON_COLOR_CLASS="gp-designer-theme-icon",A.THEME_COLOR="#3574e6"})(le||(le={}));const sE=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(A){const e=c.ref(!1),t=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"})[A.type]),r=()=>{e.value=!1,A.onClose()};return setTimeout(()=>{r()},A.duration),e.value=!0,{visible:e,typeClass:t,closeMessage:r}}}),Oe=(A,e)=>{const t=A.__vccOpts||A;for(const[r,n]of e)t[r]=n;return t},iE={key:0,class:"gp-message"},uE={key:0,class:"mr-2"},oE={key:0,class:"text-green-500"},cE={key:1,class:"text-red-500"},lE={key:2,class:"text-blue-500"},fE={key:3,class:"text-yellow-500"};function hE(A,e,t,r,n,a){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[A.visible?(c.openBlock(),c.createElementBlock("div",iE,[c.createElementVNode("div",{class:c.normalizeClass([A.typeClass,"message-content"])},[A.icon?(c.openBlock(),c.createElementBlock("span",uE,[c.renderSlot(A.$slots,"icon",{},()=>[A.type==="success"?(c.openBlock(),c.createElementBlock("span",oE,"✔")):c.createCommentVNode("",!0),A.type==="error"?(c.openBlock(),c.createElementBlock("span",cE,"✖")):c.createCommentVNode("",!0),A.type==="info"?(c.openBlock(),c.createElementBlock("span",lE,"ℹ")):c.createCommentVNode("",!0),A.type==="warning"?(c.openBlock(),c.createElementBlock("span",fE,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(A.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:e[0]||(e[0]=(...s)=>A.closeMessage&&A.closeMessage(...s))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const dE=Oe(sE,[["render",hE],["__scopeId","data-v-a234b03c"]]),Ct=c.reactive([]);let es=null;const BE=()=>{const A=document.createElement("div");return A.id="global-message-container",document.body.appendChild(A),A},gE=()=>{if(es)return;const A=BE();es=c.createApp({setup(){return{messageQueue:Ct}},render(){const e=c.computed(()=>{var r;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"}[((r=Ct[0])==null?void 0:r.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${e.value}`},Ct.map(t=>c.h(dE,{key:t.id,...t.options,onClose:()=>lo(t.id)})))}}),es.mount(A)},lo=A=>{const e=Ct.findIndex(t=>t.id===A);e!==-1&&Ct.splice(e,1)};let EE=0;const j=A=>{gE();const e=EE++;Ct.push({id:e,options:A}),setTimeout(()=>{lo(e)},A.duration||3e3)};j.success=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"success",duration:e,icon:t}:{...A,type:"success"})},j.error=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"error",duration:e,icon:t}:{...A,type:"error"})},j.info=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"info",duration:e,icon:t}:{...A,type:"info"})},j.warning=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"warning",duration:e,icon:t}:{...A,type:"warning"})};const mE=["onClick"],pE={key:0,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},CE=Oe(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},upload:{type:Object,required:!1},r:{type:String,required:!1},showMargin:{type:Boolean,default:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","updateElementRule"],setup(A,{emit:e}){const t=A,r=e,n=c.computed(()=>t.element.editText||t.element.text),a=c.computed(()=>t.selectedElement===t.element),s=c.computed(()=>t.hoveredElement===t.element),u=c.ref(!1),o=c.ref(!1),l=c.ref(""),f=c.computed(()=>t.element.rule.minText||0),h=c.computed(()=>t.element.rule.maxText||1/0),d=v=>{let S="";if(v.children&&v.children.length&&v.children[0].type===W.Block){const q=v.children[0].rule.flexColumn||v.children[0].rule.mobileFlexColumn;Math.min(q,v.children.length)&&(S+=" flex pc:justify-center flex-wrap ",v.children[0].rule.mobileFlexColumn?S+=" justify-center ":S+=" gp-designer-m-swiper swiper-wrapper justify-normal ")}if(v.type===W.Block){const q=v.rule.flexColumn,$=v.rule.mobileFlexColumn;($||q)&&(S+=" box-border "),$>1&&$<=12?S+=` basis-1/${$} `:$==1?S+=" basis-full ":$||(S+=" gp-designer-m-swiper-slide swiper-slide "),q>1&&q<=12?S+=` pc:basis-1/${q} `:q==1&&(S+=" pc:basis-full ")}return S};c.watch(()=>t.r,()=>{r("contentUpdated",D())},{immediate:!0});function C(v){v.xpath!="/div[1]"&&t.mode!=="preview"&&(t.mode==="edit"?v.type===W.Text&&r("selectElement",v):r("selectElement",v),!v.rule.isReadOnly&&v.type===W.Text&&(u.value=!0))}function p(v){r("selectElement",v)}function T(v,S){r("hoverElement",v,S)}function U(v){r("hoverElement",v)}function _(v){v.currentTarget.contains(v.relatedTarget)?r("hoverElement",null):t.hoveredElement?r("hoverElement",null,t.hoveredElement.parentxpath):r("hoverElement",null)}function I(){u.value=!1,r("contentUpdated",D())}function D(){function v(q){var te;const $=q,zA=$.rule.isThemeColor&&$.type==W.Text?le.THEME_TEXT_COLOR_CLASS:$.rule.isThemeColor&&$.type==W.Button?le.THEME_BUTTON_COLOR_CLASS:$.rule.isThemeColor&&$.type==W.Icon?le.THEME_ICON_COLOR_CLASS:"";zA?$.attrs.class=$.attrs.class?$.attrs.class+" "+zA:zA:$.attrs.class=(te=$.attrs.class)==null?void 0:te.replace(new RegExp(`${le.THEME_TEXT_COLOR_CLASS}|${le.THEME_BUTTON_COLOR_CLASS}|${le.THEME_ICON_COLOR_CLASS}`,"g"),"");const je={class:$.attrs.class||""},Lr=d($);Lr&&(je.class+=" "+Lr);const xr=Object.entries(q.attrs||{}).filter(([YA,HA])=>YA!=="class").map(([YA,HA])=>`${YA}="${HA}"`).join(" "),F=Object.entries(je||{}).map(([YA,HA])=>`${YA}="${HA}"`).join(" "),L=`<${q.tag}${xr?" "+xr:""}${F?" "+F:""}>`,K=`</${q.tag}>`,V=(q.children||[]).map(YA=>v(YA)).join("");let CA=q.editText||q.text||"";return CA=CA.replace(/\r\n/g,`
|
9
|
-
`).replace(/\n/g,"<br>"),`${L}${CA}${V}${K}`}return v(t.element)}function k(v){var zA,je;v.preventDefault(),v.stopPropagation();let S=((zA=v.clipboardData)==null?void 0:zA.getData("text/plain"))||"";(je=t.element.rule)!=null&&je.allowWrap?(S=S==null?void 0:S.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,S)):(S=S==null?void 0:S.replace(/\n/g," "),document.execCommand("insertText",!1,S));const q=v.target,$=q.innerText||q.textContent||"";H($)}function x(v){var S;v.key==="Enter"&&(v.preventDefault(),v.stopPropagation(),(S=t.element.rule)!=null&&S.allowWrap?document.execCommand("insertLineBreak"):j.error("当前节点不允许换行"))}function m(v){v.stopPropagation();const S=v.target,q=S.innerText||S.textContent||"";H(q)}function H(v){if(v.length<f.value){o.value=!0,l.value=`最少输入 ${f.value} 个字符`;return}else if(v.length>h.value){o.value=!0,l.value=`最多输入 ${h.value} 个字符`;return}else o.value=!1,l.value="";r("updateText",{element:t.element,newText:v}),r("contentUpdated",D());const S=c.toRaw(t.element);S.editText=v}function P(v){r("updateText",v),r("contentUpdated",D())}function M(){const v={...t.element};r("blockAction",{action:"add",element:t.element,newBlock:v})}function eA(){uA(t.element),r("blockAction",{action:"moveUp",element:t.element})}function uA(v){v.children&&v.children.length>0&&v.children.forEach(S=>{S.type==W.Text&&(S.text!==S.editText&&(S.text=S.editText),uA(S))})}function fA(){uA(t.element),r("blockAction",{action:"moveDown",element:t.element})}function J(){r("blockAction",{action:"delete",element:t.element})}function rA(v){r("blockAction",v),r("contentUpdated",D())}function oA(v){IA.value.openModal(v)}function hA(v){KA.value.openModal(v)}function pA(v,S){r("addIcon",v,S),r("contentUpdated",D())}function GA(v){r("updateElementRule",v)}const IA=c.ref(t.icon);c.watch(()=>t.icon,v=>{IA.value=v},{immediate:!0});const KA=c.ref(t.upload);c.watch(()=>t.upload,v=>{KA.value=v},{immediate:!0});const xA=c.computed(()=>{const v=d(t.element);return t.element.css=v,v}),ZA=(v,S)=>{S.children&&S.children.length&&S.children[0].type===W.Block&&S.children.map(q=>{q.rule.flexColumn=v}),r("updateElementRule",S)},_A=c.computed(()=>{let v="";if(t.mode==="design"){const S=t.element;if(S.type===W.Block){const q=S.rule.flexColumn;q>1&&q<=12&&(v+=`flex-basis: calc(100% / ${q} - 10px);`)}}return v});return(v,S)=>{const q=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",s.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",o.value?"border-dashed border-red-500":"",(!s.value&&!a.value&&!o.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Text?c.unref(le).THEME_TEXT_COLOR_CLASS:"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Button?c.unref(le).THEME_BUTTON_COLOR_CLASS:"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Icon?c.unref(le).THEME_ICON_COLOR_CLASS:"",xA.value],style:_A.value},t.element.attrs,{contenteditable:u.value,onClick:S[3]||(S[3]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:S[4]||(S[4]=()=>U(t.element)),onMouseleave:_,onBlur:I,onInput:m,onPaste:k,onKeydown:c.withModifiers(x,["stop"])}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.value),1),t.element.children&&t.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children,($,zA)=>(c.openBlock(),c.createBlock(q,{"show-margin":A.showMargin,key:zA,r:A.r,mode:A.mode,icons:A.icons,element:$,selectedElement:t.selectedElement,hoveredElement:t.hoveredElement,cropper:A.cropper,icon:A.icon,upload:A.upload,"upload-by-file":A.uploadByFile,onSelectElement:p,onHoverElement:T,onUpdateText:P,onBlockAction:rA,onAddIcon:pA,onUpdateElementRule:()=>GA($)},null,8,["show-margin","r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload","upload-by-file","onUpdateElementRule"]))),128)),t.element.type===c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:S[0]||(S[0]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute left-2 top-2 text-sm"},[c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-green-500/80 text-white rounded hover:bg-green-500",onClick:c.withModifiers(M,["stop"])},S[7]||(S[7]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"white","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(eA,["stop"])},S[8]||(S[8]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M244 400L100 256l144-144M120 256h292"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(fA,["stop"])},S[9]||(S[9]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m268 112l144 144l-144 144m124-144H100"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-red-500/80 text-white rounded hover:bg-red-500",onClick:c.withModifiers(J,["stop"])},S[10]||(S[10]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"})],-1)]))])):c.createCommentVNode("",!0),t.element.children&&t.element.children.length&&t.element.children[0].type===c.unref(W).Block&&t.element.children[0].rule&&t.element.children[0].rule.flexColumns&&t.element.children[0].rule.flexColumns.length>0?(c.openBlock(),c.createElementBlock("div",{key:1,"date-action":"1",contenteditable:"false",onClick:S[1]||(S[1]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute right-0 -top-6 items-center"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children[0].rule.flexColumns,($,zA)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["text-xs w-6 h-6 flex-none content-center items-center justify-center bg-purple-400/80 text-white rounded hover:bg-purple-600",t.element.children[0].rule.flexColumn===$?"bg-purple-700":""]),onClick:c.withModifiers(()=>ZA($,t.element),["stop"])},c.toDisplayString($),11,mE))),256))])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),t.element.type===c.unref(W).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 hover:bg-black",contenteditable:"false",onClick:S[2]||(S[2]=c.withModifiers(()=>oA(t.element),["stop"]))},S[11]||(S[11]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))):c.createCommentVNode("",!0)]),_:1},16,["class","style","contenteditable"])),t.element.type==c.unref(W).Text&&o.value?(c.openBlock(),c.createElementBlock("div",pE,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),t.element.type===c.unref(W).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 hover:bg-black",onClick:S[6]||(S[6]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createElementVNode("div",{class:"p-1",onClick:S[5]||(S[5]=c.withModifiers(()=>hA(t.element),["stop"]))},S[12]||(S[12]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-7ef7ba89"]]),wE=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(A,{emit:e}){return{updateValue:r=>{e("update:modelValue",r.target.checked)}}}}),TE={class:"form-group"},bE={class:"flex items-center space-x-2 cursor-pointer"},UE=["checked","aria-checked"],QE={class:"checkbox-label text-sm text-gray-700"};function FE(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",TE,[c.createElementVNode("label",bE,[c.createElementVNode("input",{type:"checkbox",checked:A.modelValue,onChange:e[0]||(e[0]=(...s)=>A.updateValue&&A.updateValue(...s)),class:"custom-checkbox","aria-checked":A.modelValue},null,40,UE),c.createElementVNode("span",QE,c.toDisplayString(A.label),1)])])}const wt=Oe(wE,[["render",FE],["__scopeId","data-v-68b8f276"]]),IE={class:"text-sm"},_E={key:0},yE={key:0},NE={class:"text-gray-500 my-2 truncate"},SE={class:"text-gray-500 my-2 break-words"},vE={key:1},LE={key:2},xE={key:3},HE={key:4},DE={key:5},OE={key:6},RE={key:7},ME={key:8},kE={key:9},PE={key:10},KE={key:11},VE={key:12},GE={key:13},YE=Oe(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(A,{emit:e}){const t=A,r=e,n=c.ref({rule:{},...t.element});c.watch(()=>t.element,s=>{n.value={rule:{},...s}},{immediate:!0});function a(){var s;if(n.value.type===W.Icon&&!n.value.attrs.class.includes("iconfont")){j.error("图标仅支持 iconfont 图标");return}if(n.value.type===W.Image&&n.value.tag!=="img"){j.error("节点类型错误");return}if(n.value.type===W.Video&&n.value.tag!=="video"){j.error("节点类型错误");return}if(n.value.type===W.Link&&n.value.tag!=="a"){j.error("节点类型错误");return}if(n.value.type===W.Text){if(Number(n.value.rule.minText)>Number(n.value.rule.maxText)){j.error("最小文本长度不能大于最大文本长度");return}if(n.value.tag!=="p"&&n.value.tag!=="div"&&n.value.tag!=="span"&&n.value.tag!=="h1"&&n.value.tag!=="h2"&&n.value.tag!=="h3"&&n.value.tag!=="h4"&&n.value.tag!=="h5"&&n.value.tag!=="h6"){j.error("节点类型错误");return}}if(n.value.type===W.Block){if(Number(n.value.rule.minBlock)>Number(n.value.rule.maxBlock)){j.error("最小块数量不能大于最大块数量");return}if(n.value.tag!=="div"&&n.value.tag!=="section"&&n.value.tag!=="article"&&n.value.tag!=="nav"&&n.value.tag!=="header"&&n.value.tag!=="footer"&&n.value.tag!=="span"&&n.value.tag!=="p"&&n.value.tag!=="img"){j.error("节点类型错误");return}if(!n.value.children||n.value.children.length<1){j.error("节点错误,必须包含子元素");return}!n.value.rule.flexColumn&&((s=n.value.rule.flexColumns)==null?void 0:s.length)>0&&(n.value.rule.flexColumn=n.value.rule.flexColumns[0])}n.value.rule.minText?n.value.rule.minText=Number(n.value.rule.minText):n.value.rule.minText=void 0,n.value.rule.maxText?n.value.rule.maxText=Number(n.value.rule.maxText):n.value.rule.maxText=void 0,n.value.rule.minBlock?n.value.rule.minBlock=Number(n.value.rule.minBlock):n.value.rule.minBlock=void 0,n.value.rule.maxBlock?n.value.rule.maxBlock=Number(n.value.rule.maxBlock):n.value.rule.maxBlock=void 0,n.value.rule.flexColumn?n.value.rule.flexColumn=Number(n.value.rule.flexColumn):n.value.rule.flexColumn=void 0,n.value.rule.mobileFlexColumn?n.value.rule.mobileFlexColumn=Number(n.value.rule.mobileFlexColumn):n.value.rule.mobileFlexColumn=void 0,r("updateElement",n.value)}return(s,u)=>(c.openBlock(),c.createElementBlock("div",IE,[n.value?(c.openBlock(),c.createElementBlock("div",_E,[n.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",yE,[u[16]||(u[16]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",NE,c.toDisplayString(n.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[u[17]||(u[17]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",SE,c.toDisplayString(n.value.xpath),1)]),c.createElementVNode("div",null,[u[19]||(u[19]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":u[0]||(u[0]=o=>n.value.type=o),class:"border rounded p-1 w-full"},u[18]||(u[18]=[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,n.value.type]])]),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",vE,[u[20]||(u[20]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[1]||(u[1]=o=>n.value.rule.minText=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",LE,[u[21]||(u[21]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[2]||(u[2]=o=>n.value.rule.maxText=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",xE,[u[22]||(u[22]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.crop,"onUpdate:modelValue":u[3]||(u[3]=o=>n.value.rule.crop=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",HE,[u[23]||(u[23]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[4]||(u[4]=o=>n.value.rule.minImageWidth=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",DE,[u[24]||(u[24]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[5]||(u[5]=o=>n.value.rule.maxImageHeight=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",OE,[u[25]||(u[25]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[6]||(u[6]=o=>n.value.rule.minBlock=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",RE,[u[26]||(u[26]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[7]||(u[7]=o=>n.value.rule.maxBlock=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",ME,[u[28]||(u[28]=c.createElementVNode("label",{class:"block mt-4"},"PC端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{multiple:"","onUpdate:modelValue":u[8]||(u[8]=o=>n.value.rule.flexColumns=o),class:"border rounded p-1 w-full"},u[27]||(u[27]=[c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1),c.createElementVNode("option",{value:7},"7",-1),c.createElementVNode("option",{value:8},"8",-1),c.createElementVNode("option",{value:9},"9",-1),c.createElementVNode("option",{value:10},"10",-1),c.createElementVNode("option",{value:11},"11",-1),c.createElementVNode("option",{value:12},"12",-1)]),512),[[c.vModelSelect,n.value.rule.flexColumns]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",kE,[u[29]||(u[29]=c.createElementVNode("label",{class:"block mt-4"},"移动端每行列数",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[9]||(u[9]=o=>n.value.rule.mobileFlexColumn=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.mobileFlexColumn]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text||n.value.type==c.unref(W).Icon||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",PE,[u[30]||(u[30]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isThemeColor,"onUpdate:modelValue":u[10]||(u[10]=o=>n.value.rule.isThemeColor=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[u[31]||(u[31]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isRequired,"onUpdate:modelValue":u[11]||(u[11]=o=>n.value.rule.isRequired=o),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[u[32]||(u[32]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isReadOnly,"onUpdate:modelValue":u[12]||(u[12]=o=>n.value.rule.isReadOnly=o),label:"是"},null,8,["modelValue"])]),n.value.type==c.unref(W).Link||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",KE,[u[33]||(u[33]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.openMeiqia,"onUpdate:modelValue":u[13]||(u[13]=o=>n.value.rule.openMeiqia=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Link||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",VE,[u[34]||(u[34]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[14]||(u[14]=o=>n.value.rule.linkUrl=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.linkUrl]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",GE,[u[35]||(u[35]=c.createElementVNode("label",{class:"block mt-4"},"允许换行(回车/粘贴多段文本等)",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.allowWrap,"onUpdate:modelValue":u[15]||(u[15]=o=>n.value.rule.allowWrap=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:a,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-05a888f2"]]);/*!
|
8
|
+
`)}}).toArray()}const od=Object.freeze(Object.defineProperty({__proto__:null,serialize:id,serializeArray:ud},Symbol.toStringTag,{value:"Module"}));function cd(A){var e;return typeof A=="string"?{selector:A,value:"textContent"}:{selector:A.selector,value:(e=A.value)!==null&&e!==void 0?e:"textContent"}}function ld(A){const e={};for(const t in A){const r=A[t],n=Array.isArray(r),{selector:a,value:s}=cd(n?r[0]:r),u=typeof s=="function"?s:typeof s=="string"?o=>this._make(o).prop(s):o=>this._make(o).extract(s);if(n)e[t]=this._findBySelector(a,Number.POSITIVE_INFINITY).map((o,l)=>u(l,t,e)).get();else{const o=this._findBySelector(a,1);e[t]=o.length>0?u(o[0],t,e):void 0}}return e}const fd=Object.freeze(Object.defineProperty({__proto__:null,extract:ld},Symbol.toStringTag,{value:"Module"}));class Jt{constructor(e,t,r){if(this.length=0,this.options=r,this._root=t,e){for(let n=0;n<e.length;n++)this[n]=e[n];this.length=e.length}}}Jt.prototype.cheerio="[cheerio object]",Jt.prototype.splice=Array.prototype.splice,Jt.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(Jt.prototype,mf,Lh,ed,ad,od,fd);function hd(A,e){return function t(r,n,a=!0){if(r==null)throw new Error("cheerio.load() expects a string");const s=Qa(n),u=A(r,s,a,null);class o extends Jt{_make(h,d){const C=l(h,d);return C.prevObject=this,C}_parse(h,d,C,p){return A(h,d,C,p)}_render(h){return e(h,this.options)}}function l(f,h,d=u,C){if(f&&be(f))return f;const p=Qa(C,s),T=typeof d=="string"?[A(d,p,!1,null)]:"length"in d?d:[d],U=be(T)?T:new o(T,null,p);if(U._root=U,!f)return new o(void 0,U,p);const _=typeof f=="string"&&Fa(f)?A(f,p,!1,null).children:dd(f)?[f]:Array.isArray(f)?f:void 0,I=new o(_,U,p);if(_)return I;if(typeof f!="string")throw new TypeError("Unexpected type of selector");let D=f;const k=h?typeof h=="string"?Fa(h)?new o([A(h,p,!1,null)],U,p):(D=`${h} ${D}`,U):be(h)?h:new o(Array.isArray(h)?h:[h],U,p):U;return k?k.find(D):I}return Object.assign(l,af,{load:t,_root:u,_options:s,fn:o.prototype,prototype:o.prototype}),l}}function dd(A){return!!A.name||A.type==="root"||A.type==="text"||A.type==="comment"}const Bd=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]),dA="�";var B;(function(A){A[A.EOF=-1]="EOF",A[A.NULL=0]="NULL",A[A.TABULATION=9]="TABULATION",A[A.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",A[A.LINE_FEED=10]="LINE_FEED",A[A.FORM_FEED=12]="FORM_FEED",A[A.SPACE=32]="SPACE",A[A.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",A[A.QUOTATION_MARK=34]="QUOTATION_MARK",A[A.AMPERSAND=38]="AMPERSAND",A[A.APOSTROPHE=39]="APOSTROPHE",A[A.HYPHEN_MINUS=45]="HYPHEN_MINUS",A[A.SOLIDUS=47]="SOLIDUS",A[A.DIGIT_0=48]="DIGIT_0",A[A.DIGIT_9=57]="DIGIT_9",A[A.SEMICOLON=59]="SEMICOLON",A[A.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",A[A.EQUALS_SIGN=61]="EQUALS_SIGN",A[A.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",A[A.QUESTION_MARK=63]="QUESTION_MARK",A[A.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",A[A.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",A[A.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",A[A.GRAVE_ACCENT=96]="GRAVE_ACCENT",A[A.LATIN_SMALL_A=97]="LATIN_SMALL_A",A[A.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(B||(B={}));const WA={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function mu(A){return A>=55296&&A<=57343}function gd(A){return A>=56320&&A<=57343}function Ed(A,e){return(A-55296)*1024+9216+e}function pu(A){return A!==32&&A!==10&&A!==13&&A!==9&&A!==12&&A>=1&&A<=31||A>=127&&A<=159}function Cu(A){return A>=64976&&A<=65007||Bd.has(A)}var b;(function(A){A.controlCharacterInInputStream="control-character-in-input-stream",A.noncharacterInInputStream="noncharacter-in-input-stream",A.surrogateInInputStream="surrogate-in-input-stream",A.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",A.endTagWithAttributes="end-tag-with-attributes",A.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",A.unexpectedSolidusInTag="unexpected-solidus-in-tag",A.unexpectedNullCharacter="unexpected-null-character",A.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",A.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",A.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",A.missingEndTagName="missing-end-tag-name",A.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",A.unknownNamedCharacterReference="unknown-named-character-reference",A.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",A.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",A.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",A.eofBeforeTagName="eof-before-tag-name",A.eofInTag="eof-in-tag",A.missingAttributeValue="missing-attribute-value",A.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",A.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",A.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",A.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",A.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",A.missingDoctypePublicIdentifier="missing-doctype-public-identifier",A.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",A.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",A.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",A.cdataInHtmlContent="cdata-in-html-content",A.incorrectlyOpenedComment="incorrectly-opened-comment",A.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",A.eofInDoctype="eof-in-doctype",A.nestedComment="nested-comment",A.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",A.eofInComment="eof-in-comment",A.incorrectlyClosedComment="incorrectly-closed-comment",A.eofInCdata="eof-in-cdata",A.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",A.nullCharacterReference="null-character-reference",A.surrogateCharacterReference="surrogate-character-reference",A.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",A.controlCharacterReference="control-character-reference",A.noncharacterCharacterReference="noncharacter-character-reference",A.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",A.missingDoctypeName="missing-doctype-name",A.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",A.duplicateAttribute="duplicate-attribute",A.nonConformingDoctype="non-conforming-doctype",A.missingDoctype="missing-doctype",A.misplacedDoctype="misplaced-doctype",A.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",A.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",A.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",A.openElementsLeftAfterEof="open-elements-left-after-eof",A.abandonedHeadElementChild="abandoned-head-element-child",A.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",A.nestedNoscriptInHead="nested-noscript-in-head",A.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(b||(b={}));const md=65536;class pd{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=md,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(e,t){const{line:r,col:n,offset:a}=this,s=n+t,u=a+t;return{code:e,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:u,endOffset:u}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(gd(t))return this.pos++,this._addGap(),Ed(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(b.surrogateInInputStream),e}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(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;const r=this.html.charCodeAt(t);return r===B.CARRIAGE_RETURN?B.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let e=this.html.charCodeAt(this.pos);return e===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):e===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,mu(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===B.LINE_FEED||e===B.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){pu(e)?this._err(b.controlCharacterInInputStream):Cu(e)&&this._err(b.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var tA;(function(A){A[A.CHARACTER=0]="CHARACTER",A[A.NULL_CHARACTER=1]="NULL_CHARACTER",A[A.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",A[A.START_TAG=3]="START_TAG",A[A.END_TAG=4]="END_TAG",A[A.COMMENT=5]="COMMENT",A[A.DOCTYPE=6]="DOCTYPE",A[A.EOF=7]="EOF",A[A.HIBERNATION=8]="HIBERNATION"})(tA||(tA={}));function wu(A,e){for(let t=A.attrs.length-1;t>=0;t--)if(A.attrs[t].name===e)return A.attrs[t].value;return null}var Q;(function(A){A.HTML="http://www.w3.org/1999/xhtml",A.MATHML="http://www.w3.org/1998/Math/MathML",A.SVG="http://www.w3.org/2000/svg",A.XLINK="http://www.w3.org/1999/xlink",A.XML="http://www.w3.org/XML/1998/namespace",A.XMLNS="http://www.w3.org/2000/xmlns/"})(Q||(Q={}));var rt;(function(A){A.TYPE="type",A.ACTION="action",A.ENCODING="encoding",A.PROMPT="prompt",A.NAME="name",A.COLOR="color",A.FACE="face",A.SIZE="size"})(rt||(rt={}));var Ae;(function(A){A.NO_QUIRKS="no-quirks",A.QUIRKS="quirks",A.LIMITED_QUIRKS="limited-quirks"})(Ae||(Ae={}));var w;(function(A){A.A="a",A.ADDRESS="address",A.ANNOTATION_XML="annotation-xml",A.APPLET="applet",A.AREA="area",A.ARTICLE="article",A.ASIDE="aside",A.B="b",A.BASE="base",A.BASEFONT="basefont",A.BGSOUND="bgsound",A.BIG="big",A.BLOCKQUOTE="blockquote",A.BODY="body",A.BR="br",A.BUTTON="button",A.CAPTION="caption",A.CENTER="center",A.CODE="code",A.COL="col",A.COLGROUP="colgroup",A.DD="dd",A.DESC="desc",A.DETAILS="details",A.DIALOG="dialog",A.DIR="dir",A.DIV="div",A.DL="dl",A.DT="dt",A.EM="em",A.EMBED="embed",A.FIELDSET="fieldset",A.FIGCAPTION="figcaption",A.FIGURE="figure",A.FONT="font",A.FOOTER="footer",A.FOREIGN_OBJECT="foreignObject",A.FORM="form",A.FRAME="frame",A.FRAMESET="frameset",A.H1="h1",A.H2="h2",A.H3="h3",A.H4="h4",A.H5="h5",A.H6="h6",A.HEAD="head",A.HEADER="header",A.HGROUP="hgroup",A.HR="hr",A.HTML="html",A.I="i",A.IMG="img",A.IMAGE="image",A.INPUT="input",A.IFRAME="iframe",A.KEYGEN="keygen",A.LABEL="label",A.LI="li",A.LINK="link",A.LISTING="listing",A.MAIN="main",A.MALIGNMARK="malignmark",A.MARQUEE="marquee",A.MATH="math",A.MENU="menu",A.META="meta",A.MGLYPH="mglyph",A.MI="mi",A.MO="mo",A.MN="mn",A.MS="ms",A.MTEXT="mtext",A.NAV="nav",A.NOBR="nobr",A.NOFRAMES="noframes",A.NOEMBED="noembed",A.NOSCRIPT="noscript",A.OBJECT="object",A.OL="ol",A.OPTGROUP="optgroup",A.OPTION="option",A.P="p",A.PARAM="param",A.PLAINTEXT="plaintext",A.PRE="pre",A.RB="rb",A.RP="rp",A.RT="rt",A.RTC="rtc",A.RUBY="ruby",A.S="s",A.SCRIPT="script",A.SEARCH="search",A.SECTION="section",A.SELECT="select",A.SOURCE="source",A.SMALL="small",A.SPAN="span",A.STRIKE="strike",A.STRONG="strong",A.STYLE="style",A.SUB="sub",A.SUMMARY="summary",A.SUP="sup",A.TABLE="table",A.TBODY="tbody",A.TEMPLATE="template",A.TEXTAREA="textarea",A.TFOOT="tfoot",A.TD="td",A.TH="th",A.THEAD="thead",A.TITLE="title",A.TR="tr",A.TRACK="track",A.TT="tt",A.U="u",A.UL="ul",A.SVG="svg",A.VAR="var",A.WBR="wbr",A.XMP="xmp"})(w||(w={}));var i;(function(A){A[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP"})(i||(i={}));const Cd=new Map([[w.A,i.A],[w.ADDRESS,i.ADDRESS],[w.ANNOTATION_XML,i.ANNOTATION_XML],[w.APPLET,i.APPLET],[w.AREA,i.AREA],[w.ARTICLE,i.ARTICLE],[w.ASIDE,i.ASIDE],[w.B,i.B],[w.BASE,i.BASE],[w.BASEFONT,i.BASEFONT],[w.BGSOUND,i.BGSOUND],[w.BIG,i.BIG],[w.BLOCKQUOTE,i.BLOCKQUOTE],[w.BODY,i.BODY],[w.BR,i.BR],[w.BUTTON,i.BUTTON],[w.CAPTION,i.CAPTION],[w.CENTER,i.CENTER],[w.CODE,i.CODE],[w.COL,i.COL],[w.COLGROUP,i.COLGROUP],[w.DD,i.DD],[w.DESC,i.DESC],[w.DETAILS,i.DETAILS],[w.DIALOG,i.DIALOG],[w.DIR,i.DIR],[w.DIV,i.DIV],[w.DL,i.DL],[w.DT,i.DT],[w.EM,i.EM],[w.EMBED,i.EMBED],[w.FIELDSET,i.FIELDSET],[w.FIGCAPTION,i.FIGCAPTION],[w.FIGURE,i.FIGURE],[w.FONT,i.FONT],[w.FOOTER,i.FOOTER],[w.FOREIGN_OBJECT,i.FOREIGN_OBJECT],[w.FORM,i.FORM],[w.FRAME,i.FRAME],[w.FRAMESET,i.FRAMESET],[w.H1,i.H1],[w.H2,i.H2],[w.H3,i.H3],[w.H4,i.H4],[w.H5,i.H5],[w.H6,i.H6],[w.HEAD,i.HEAD],[w.HEADER,i.HEADER],[w.HGROUP,i.HGROUP],[w.HR,i.HR],[w.HTML,i.HTML],[w.I,i.I],[w.IMG,i.IMG],[w.IMAGE,i.IMAGE],[w.INPUT,i.INPUT],[w.IFRAME,i.IFRAME],[w.KEYGEN,i.KEYGEN],[w.LABEL,i.LABEL],[w.LI,i.LI],[w.LINK,i.LINK],[w.LISTING,i.LISTING],[w.MAIN,i.MAIN],[w.MALIGNMARK,i.MALIGNMARK],[w.MARQUEE,i.MARQUEE],[w.MATH,i.MATH],[w.MENU,i.MENU],[w.META,i.META],[w.MGLYPH,i.MGLYPH],[w.MI,i.MI],[w.MO,i.MO],[w.MN,i.MN],[w.MS,i.MS],[w.MTEXT,i.MTEXT],[w.NAV,i.NAV],[w.NOBR,i.NOBR],[w.NOFRAMES,i.NOFRAMES],[w.NOEMBED,i.NOEMBED],[w.NOSCRIPT,i.NOSCRIPT],[w.OBJECT,i.OBJECT],[w.OL,i.OL],[w.OPTGROUP,i.OPTGROUP],[w.OPTION,i.OPTION],[w.P,i.P],[w.PARAM,i.PARAM],[w.PLAINTEXT,i.PLAINTEXT],[w.PRE,i.PRE],[w.RB,i.RB],[w.RP,i.RP],[w.RT,i.RT],[w.RTC,i.RTC],[w.RUBY,i.RUBY],[w.S,i.S],[w.SCRIPT,i.SCRIPT],[w.SEARCH,i.SEARCH],[w.SECTION,i.SECTION],[w.SELECT,i.SELECT],[w.SOURCE,i.SOURCE],[w.SMALL,i.SMALL],[w.SPAN,i.SPAN],[w.STRIKE,i.STRIKE],[w.STRONG,i.STRONG],[w.STYLE,i.STYLE],[w.SUB,i.SUB],[w.SUMMARY,i.SUMMARY],[w.SUP,i.SUP],[w.TABLE,i.TABLE],[w.TBODY,i.TBODY],[w.TEMPLATE,i.TEMPLATE],[w.TEXTAREA,i.TEXTAREA],[w.TFOOT,i.TFOOT],[w.TD,i.TD],[w.TH,i.TH],[w.THEAD,i.THEAD],[w.TITLE,i.TITLE],[w.TR,i.TR],[w.TRACK,i.TRACK],[w.TT,i.TT],[w.U,i.U],[w.UL,i.UL],[w.SVG,i.SVG],[w.VAR,i.VAR],[w.WBR,i.WBR],[w.XMP,i.XMP]]);function zr(A){var e;return(e=Cd.get(A))!==null&&e!==void 0?e:i.UNKNOWN}const N=i,wd={[Q.HTML]:new Set([N.ADDRESS,N.APPLET,N.AREA,N.ARTICLE,N.ASIDE,N.BASE,N.BASEFONT,N.BGSOUND,N.BLOCKQUOTE,N.BODY,N.BR,N.BUTTON,N.CAPTION,N.CENTER,N.COL,N.COLGROUP,N.DD,N.DETAILS,N.DIR,N.DIV,N.DL,N.DT,N.EMBED,N.FIELDSET,N.FIGCAPTION,N.FIGURE,N.FOOTER,N.FORM,N.FRAME,N.FRAMESET,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HEADER,N.HGROUP,N.HR,N.HTML,N.IFRAME,N.IMG,N.INPUT,N.LI,N.LINK,N.LISTING,N.MAIN,N.MARQUEE,N.MENU,N.META,N.NAV,N.NOEMBED,N.NOFRAMES,N.NOSCRIPT,N.OBJECT,N.OL,N.P,N.PARAM,N.PLAINTEXT,N.PRE,N.SCRIPT,N.SECTION,N.SELECT,N.SOURCE,N.STYLE,N.SUMMARY,N.TABLE,N.TBODY,N.TD,N.TEMPLATE,N.TEXTAREA,N.TFOOT,N.TH,N.THEAD,N.TITLE,N.TR,N.TRACK,N.UL,N.WBR,N.XMP]),[Q.MATHML]:new Set([N.MI,N.MO,N.MN,N.MS,N.MTEXT,N.ANNOTATION_XML]),[Q.SVG]:new Set([N.TITLE,N.FOREIGN_OBJECT,N.DESC]),[Q.XLINK]:new Set,[Q.XML]:new Set,[Q.XMLNS]:new Set},Xa=new Set([N.H1,N.H2,N.H3,N.H4,N.H5,N.H6]),Td=new Set([w.STYLE,w.SCRIPT,w.XMP,w.IFRAME,w.NOEMBED,w.NOFRAMES,w.PLAINTEXT]);function bd(A,e){return Td.has(A)||e&&A===w.NOSCRIPT}var g;(function(A){A[A.DATA=0]="DATA",A[A.RCDATA=1]="RCDATA",A[A.RAWTEXT=2]="RAWTEXT",A[A.SCRIPT_DATA=3]="SCRIPT_DATA",A[A.PLAINTEXT=4]="PLAINTEXT",A[A.TAG_OPEN=5]="TAG_OPEN",A[A.END_TAG_OPEN=6]="END_TAG_OPEN",A[A.TAG_NAME=7]="TAG_NAME",A[A.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",A[A.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",A[A.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",A[A.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",A[A.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",A[A.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",A[A.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",A[A.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",A[A.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",A[A.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",A[A.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",A[A.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",A[A.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",A[A.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",A[A.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",A[A.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",A[A.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",A[A.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",A[A.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",A[A.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",A[A.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",A[A.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",A[A.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",A[A.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",A[A.BOGUS_COMMENT=40]="BOGUS_COMMENT",A[A.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",A[A.COMMENT_START=42]="COMMENT_START",A[A.COMMENT_START_DASH=43]="COMMENT_START_DASH",A[A.COMMENT=44]="COMMENT",A[A.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",A[A.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",A[A.COMMENT_END_DASH=49]="COMMENT_END_DASH",A[A.COMMENT_END=50]="COMMENT_END",A[A.COMMENT_END_BANG=51]="COMMENT_END_BANG",A[A.DOCTYPE=52]="DOCTYPE",A[A.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",A[A.DOCTYPE_NAME=54]="DOCTYPE_NAME",A[A.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",A[A.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",A[A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",A[A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",A[A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",A[A.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",A[A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",A[A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",A[A.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",A[A.CDATA_SECTION=68]="CDATA_SECTION",A[A.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",A[A.CDATA_SECTION_END=70]="CDATA_SECTION_END",A[A.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",A[A.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(g||(g={}));const JA={DATA:g.DATA,RCDATA:g.RCDATA,RAWTEXT:g.RAWTEXT,SCRIPT_DATA:g.SCRIPT_DATA,PLAINTEXT:g.PLAINTEXT,CDATA_SECTION:g.CDATA_SECTION};function Ud(A){return A>=B.DIGIT_0&&A<=B.DIGIT_9}function qt(A){return A>=B.LATIN_CAPITAL_A&&A<=B.LATIN_CAPITAL_Z}function Qd(A){return A>=B.LATIN_SMALL_A&&A<=B.LATIN_SMALL_Z}function He(A){return Qd(A)||qt(A)}function Tu(A){return He(A)||Ud(A)}function An(A){return A+32}function bu(A){return A===B.SPACE||A===B.LINE_FEED||A===B.TABULATION||A===B.FORM_FEED}function Uu(A){return bu(A)||A===B.SOLIDUS||A===B.GREATER_THAN_SIGN}function Fd(A){return A===B.NULL?b.nullCharacterReference:A>1114111?b.characterReferenceOutsideUnicodeRange:mu(A)?b.surrogateCharacterReference:Cu(A)?b.noncharacterCharacterReference:pu(A)||A===B.CARRIAGE_RETURN?b.controlCharacterReference:null}let Id=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=g.DATA,this.returnState=g.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new pd(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ca(ga,(r,n)=>{this.preprocessor.pos=this.entityStartPos+n-1,this._flushCodePointConsumedAsCharacterReference(r)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(b.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(b.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const n=Fd(r);n&&this._err(n,1)}}:void 0)}_err(e,t=0){var r,n;(n=(r=this.handler).onParseError)===null||n===void 0||n.call(r,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e==null||e())}write(e,t,r){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),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(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:tA.START_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:tA.END_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:tA.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:tA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const r=this.currentToken;if(wu(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const n=(e=(t=r.location).attrs)!==null&&e!==void 0?e:t.attrs=Object.create(null);n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(b.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=zr(e.tagName),e.type===tA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(b.endTagWithAttributes),e.selfClosing&&this._err(b.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case tA.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case tA.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case tA.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:tA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){const t=bu(e)?tA.WHITESPACE_CHARACTER:e===B.NULL?tA.NULL_CHARACTER:tA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(tA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=g.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?re.Attribute:re.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===g.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case g.DATA:{this._stateData(e);break}case g.RCDATA:{this._stateRcdata(e);break}case g.RAWTEXT:{this._stateRawtext(e);break}case g.SCRIPT_DATA:{this._stateScriptData(e);break}case g.PLAINTEXT:{this._statePlaintext(e);break}case g.TAG_OPEN:{this._stateTagOpen(e);break}case g.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case g.TAG_NAME:{this._stateTagName(e);break}case g.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case g.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case g.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case g.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case g.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case g.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case g.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case g.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case g.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case g.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case g.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case g.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case g.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case g.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case g.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case g.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case g.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case g.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case g.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case g.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case g.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case g.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case g.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case g.BOGUS_COMMENT:{this._stateBogusComment(e);break}case g.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case g.COMMENT_START:{this._stateCommentStart(e);break}case g.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case g.COMMENT:{this._stateComment(e);break}case g.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case g.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case g.COMMENT_END:{this._stateCommentEnd(e);break}case g.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case g.DOCTYPE:{this._stateDoctype(e);break}case g.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case g.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case g.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case g.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case g.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case g.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case g.CDATA_SECTION:{this._stateCdataSection(e);break}case g.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case g.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case g.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case g.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.TAG_OPEN;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitCodePoint(e);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case B.AMPERSAND:{this._startCharacterReference();break}case B.LESS_THAN_SIGN:{this.state=g.RCDATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.RAWTEXT_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(He(e))this._createStartTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:{this.state=g.MARKUP_DECLARATION_OPEN;break}case B.SOLIDUS:{this.state=g.END_TAG_OPEN;break}case B.QUESTION_MARK:{this._err(b.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e);break}case B.EOF:{this._err(b.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(b.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=g.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(He(e))this._createEndTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:{this._err(b.missingEndTagName),this.state=g.DATA;break}case B.EOF:{this._err(b.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(b.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.tagName+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:t.tagName+=String.fromCodePoint(qt(e)?An(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=g.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){He(e)?(this.state=g.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=g.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=g.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=g.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=g.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){He(e)?(this.state=g.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:{this.state=g.SCRIPT_DATA_END_TAG_OPEN;break}case B.EXCLAMATION_MARK:{this.state=g.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=g.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){He(e)?(this.state=g.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:He(e)?(this._emitChars("<"),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){He(e)?(this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(WA.SCRIPT,!1)&&Uu(this.preprocessor.peek(WA.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<WA.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(dA);break}case B.EOF:{this._err(b.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(WA.SCRIPT,!1)&&Uu(this.preprocessor.peek(WA.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<WA.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._err(b.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=g.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this._leaveAttrName(),this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._leaveAttrName(),this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:{this._err(b.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.name+=dA;break}default:this.currentAttr.name+=String.fromCodePoint(qt(e)?An(e):e)}}_stateAfterAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.EQUALS_SIGN:{this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{this.state=g.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this.state=g.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingAttributeValue),this.state=g.DATA,this.emitCurrentTagToken();break}default:this.state=g.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),this.currentAttr.value+=dA;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:{this._err(b.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this._leaveAttrValue(),this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._err(b.missingWhitespaceBetweenAttributes),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{const t=this.currentToken;t.selfClosing=!0,this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(b.eofInTag),this._emitEOFToken();break}default:this._err(b.unexpectedSolidusInTag),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this.emitCurrentComment(t),this._emitEOFToken();break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.data+=dA;break}default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(WA.DASH_DASH,!0)?(this._createCommentToken(WA.DASH_DASH.length+1),this.state=g.COMMENT_START):this._consumeSequenceIfMatch(WA.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(WA.DOCTYPE.length+1),this.state=g.DOCTYPE):this._consumeSequenceIfMatch(WA.CDATA_START,!0)?this.inForeignNode?this.state=g.CDATA_SECTION:(this._err(b.cdataInHtmlContent),this._createCommentToken(WA.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=g.BOGUS_COMMENT):this._ensureHibernation()||(this._err(b.incorrectlyOpenedComment),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_START_DASH;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptClosingOfEmptyComment),this.state=g.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptClosingOfEmptyComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END_DASH;break}case B.LESS_THAN_SIGN:{t.data+="<",this.state=g.COMMENT_LESS_THAN_SIGN;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.data+=dA;break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:{t.data+="!",this.state=g.COMMENT_LESS_THAN_SIGN_BANG;break}case B.LESS_THAN_SIGN:{t.data+="<";break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=g.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=g.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(b.nestedComment),this.state=g.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EXCLAMATION_MARK:{this.state=g.COMMENT_END_BANG;break}case B.HYPHEN_MINUS:{t.data+="-";break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{t.data+="--!",this.state=g.COMMENT_END_DASH;break}case B.GREATER_THAN_SIGN:{this._err(b.incorrectlyClosedComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(b.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--!",this.state=g.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case B.EOF:{this._err(b.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingWhitespaceBeforeDoctypeName),this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(qt(e))this._createDoctypeToken(String.fromCharCode(An(e))),this.state=g.DOCTYPE_NAME;else switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:{this._err(b.unexpectedNullCharacter),this._createDoctypeToken(dA),this.state=g.DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=g.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.AFTER_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.name+=dA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.name+=String.fromCodePoint(qt(e)?An(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(WA.PUBLIC,!1)?this.state=g.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(WA.SYSTEM,!1)?this.state=g.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(b.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.publicId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.publicId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(b.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(b.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(b.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.systemId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(b.unexpectedNullCharacter),t.systemId+=dA;break}case B.GREATER_THAN_SIGN:{this._err(b.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(b.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(b.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.NULL:{this._err(b.unexpectedNullCharacter);break}case B.EOF:{this.emitCurrentDoctype(t),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:{this.state=g.CDATA_SECTION_BRACKET;break}case B.EOF:{this._err(b.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=g.CDATA_SECTION_END:(this._emitChars("]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA;break}case B.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Tu(this.preprocessor.peek(1))?g.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Tu(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(b.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}};const Qu=new Set([i.DD,i.DT,i.LI,i.OPTGROUP,i.OPTION,i.P,i.RB,i.RP,i.RT,i.RTC]),Fu=new Set([...Qu,i.CAPTION,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]),en=new Set([i.APPLET,i.CAPTION,i.HTML,i.MARQUEE,i.OBJECT,i.TABLE,i.TD,i.TEMPLATE,i.TH]),_d=new Set([...en,i.OL,i.UL]),yd=new Set([...en,i.BUTTON]),Iu=new Set([i.ANNOTATION_XML,i.MI,i.MN,i.MO,i.MS,i.MTEXT]),_u=new Set([i.DESC,i.FOREIGN_OBJECT,i.TITLE]),Nd=new Set([i.TR,i.TEMPLATE,i.HTML]),Sd=new Set([i.TBODY,i.TFOOT,i.THEAD,i.TEMPLATE,i.HTML]),vd=new Set([i.TABLE,i.TEMPLATE,i.HTML]),Ld=new Set([i.TD,i.TH]);class xd{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,r){this.treeAdapter=t,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=i.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===i.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const r=this._indexOf(e);this.items[r]=t,r===this.stackTop&&(this.current=t)}insertAfter(e,t,r){const n=this._indexOf(e)+1;this.items.splice(n,0,t),this.tagIDs.splice(n,0,r),this.stackTop++,n===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,n===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==Q.HTML);this.shortenToLength(t<0?0:t)}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(t<0?0:t)}popUntilPopped(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r<0?0:r)}popUntilNumberedHeaderPopped(){this.popUntilPopped(Xa,Q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Ld,Q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===t)return r;return-1}clearBackTo(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(vd,Q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Sd,Q.HTML)}clearBackToTableRowContext(){this.clearBackTo(Nd,Q.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===i.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===i.HTML}hasInDynamicScope(e,t){for(let r=this.stackTop;r>=0;r--){const n=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case Q.HTML:{if(n===e)return!0;if(t.has(n))return!1;break}case Q.SVG:{if(_u.has(n))return!1;break}case Q.MATHML:{if(Iu.has(n))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,en)}hasInListItemScope(e){return this.hasInDynamicScope(e,_d)}hasInButtonScope(e){return this.hasInDynamicScope(e,yd)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case Q.HTML:{if(Xa.has(t))return!0;if(en.has(t))return!1;break}case Q.SVG:{if(_u.has(t))return!1;break}case Q.MATHML:{if(Iu.has(t))return!1;break}}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Q.HTML)switch(this.tagIDs[t]){case e:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Q.HTML)switch(this.tagIDs[e]){case i.TBODY:case i.THEAD:case i.TFOOT:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Q.HTML)switch(this.tagIDs[t]){case e:return!0;case i.OPTION:case i.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;Qu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;Fu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==e&&Fu.has(this.currentTagId);)this.pop()}}const Wa=3;var ge;(function(A){A[A.Marker=0]="Marker",A[A.Element=1]="Element"})(ge||(ge={}));const yu={type:ge.Marker};class Hd{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const r=[],n=t.length,a=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let u=0;u<this.entries.length;u++){const o=this.entries[u];if(o.type===ge.Marker)break;const{element:l}=o;if(this.treeAdapter.getTagName(l)===a&&this.treeAdapter.getNamespaceURI(l)===s){const f=this.treeAdapter.getAttrList(l);f.length===n&&r.push({idx:u,attrs:f})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<Wa)return;const t=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,t);if(r.length<Wa)return;const n=new Map(t.map(s=>[s.name,s.value]));let a=0;for(let s=0;s<r.length;s++){const u=r[s];u.attrs.every(o=>n.get(o.name)===o.value)&&(a+=1,a>=Wa&&this.entries.splice(u.idx,1))}}insertMarker(){this.entries.unshift(yu)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:ge.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ge.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);t>=0&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(yu);e>=0?this.entries.splice(0,e+1):this.entries.length=0}getElementEntryInScopeWithTagName(e){const t=this.entries.find(r=>r.type===ge.Marker||this.treeAdapter.getTagName(r.element)===e);return t&&t.type===ge.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===ge.Element&&t.element===e)}}const Ue={createDocument(){return{nodeName:"#document",mode:Ae.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(A,e,t){return{nodeName:A,tagName:A,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(A){return{nodeName:"#comment",data:A,parentNode:null}},createTextNode(A){return{nodeName:"#text",value:A,parentNode:null}},appendChild(A,e){A.childNodes.push(e),e.parentNode=A},insertBefore(A,e,t){const r=A.childNodes.indexOf(t);A.childNodes.splice(r,0,e),e.parentNode=A},setTemplateContent(A,e){A.content=e},getTemplateContent(A){return A.content},setDocumentType(A,e,t,r){const n=A.childNodes.find(a=>a.nodeName==="#documentType");if(n)n.name=e,n.publicId=t,n.systemId=r;else{const a={nodeName:"#documentType",name:e,publicId:t,systemId:r,parentNode:null};Ue.appendChild(A,a)}},setDocumentMode(A,e){A.mode=e},getDocumentMode(A){return A.mode},detachNode(A){if(A.parentNode){const e=A.parentNode.childNodes.indexOf(A);A.parentNode.childNodes.splice(e,1),A.parentNode=null}},insertText(A,e){if(A.childNodes.length>0){const t=A.childNodes[A.childNodes.length-1];if(Ue.isTextNode(t)){t.value+=e;return}}Ue.appendChild(A,Ue.createTextNode(e))},insertTextBefore(A,e,t){const r=A.childNodes[A.childNodes.indexOf(t)-1];r&&Ue.isTextNode(r)?r.value+=e:Ue.insertBefore(A,Ue.createTextNode(e),t)},adoptAttributes(A,e){const t=new Set(A.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)t.has(e[r].name)||A.attrs.push(e[r])},getFirstChild(A){return A.childNodes[0]},getChildNodes(A){return A.childNodes},getParentNode(A){return A.parentNode},getAttrList(A){return A.attrs},getTagName(A){return A.tagName},getNamespaceURI(A){return A.namespaceURI},getTextNodeContent(A){return A.value},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){return A.name},getDocumentTypeNodePublicId(A){return A.publicId},getDocumentTypeNodeSystemId(A){return A.systemId},isTextNode(A){return A.nodeName==="#text"},isCommentNode(A){return A.nodeName==="#comment"},isDocumentTypeNode(A){return A.nodeName==="#documentType"},isElementNode(A){return Object.prototype.hasOwnProperty.call(A,"tagName")},setNodeSourceCodeLocation(A,e){A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){A.sourceCodeLocation={...A.sourceCodeLocation,...e}}},Nu="html",Dd="about:legacy-compat",Od="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Su=["+//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//"],Rd=[...Su,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],Md=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),vu=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],kd=[...vu,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Lu(A,e){return e.some(t=>A.startsWith(t))}function Pd(A){return A.name===Nu&&A.publicId===null&&(A.systemId===null||A.systemId===Dd)}function Kd(A){if(A.name!==Nu)return Ae.QUIRKS;const{systemId:e}=A;if(e&&e.toLowerCase()===Od)return Ae.QUIRKS;let{publicId:t}=A;if(t!==null){if(t=t.toLowerCase(),Md.has(t))return Ae.QUIRKS;let r=e===null?Rd:Su;if(Lu(t,r))return Ae.QUIRKS;if(r=e===null?vu:kd,Lu(t,r))return Ae.LIMITED_QUIRKS}return Ae.NO_QUIRKS}const xu={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Vd="definitionurl",Gd="definitionURL",Yd=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(A=>[A.toLowerCase(),A])),Xd=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Q.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Q.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Q.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Q.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Q.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Q.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Q.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Q.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Q.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Q.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Q.XMLNS}]]),Wd=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(A=>[A.toLowerCase(),A])),Jd=new Set([i.B,i.BIG,i.BLOCKQUOTE,i.BODY,i.BR,i.CENTER,i.CODE,i.DD,i.DIV,i.DL,i.DT,i.EM,i.EMBED,i.H1,i.H2,i.H3,i.H4,i.H5,i.H6,i.HEAD,i.HR,i.I,i.IMG,i.LI,i.LISTING,i.MENU,i.META,i.NOBR,i.OL,i.P,i.PRE,i.RUBY,i.S,i.SMALL,i.SPAN,i.STRONG,i.STRIKE,i.SUB,i.SUP,i.TABLE,i.TT,i.U,i.UL,i.VAR]);function qd(A){const e=A.tagID;return e===i.FONT&&A.attrs.some(({name:r})=>r===rt.COLOR||r===rt.SIZE||r===rt.FACE)||Jd.has(e)}function Hu(A){for(let e=0;e<A.attrs.length;e++)if(A.attrs[e].name===Vd){A.attrs[e].name=Gd;break}}function Du(A){for(let e=0;e<A.attrs.length;e++){const t=Yd.get(A.attrs[e].name);t!=null&&(A.attrs[e].name=t)}}function Ja(A){for(let e=0;e<A.attrs.length;e++){const t=Xd.get(A.attrs[e].name);t&&(A.attrs[e].prefix=t.prefix,A.attrs[e].name=t.name,A.attrs[e].namespace=t.namespace)}}function jd(A){const e=Wd.get(A.tagName);e!=null&&(A.tagName=e,A.tagID=zr(A.tagName))}function $d(A,e){return e===Q.MATHML&&(A===i.MI||A===i.MO||A===i.MN||A===i.MS||A===i.MTEXT)}function Zd(A,e,t){if(e===Q.MATHML&&A===i.ANNOTATION_XML){for(let r=0;r<t.length;r++)if(t[r].name===rt.ENCODING){const n=t[r].value.toLowerCase();return n===xu.TEXT_HTML||n===xu.APPLICATION_XML}}return e===Q.SVG&&(A===i.FOREIGN_OBJECT||A===i.DESC||A===i.TITLE)}function zd(A,e,t,r){return(!r||r===Q.HTML)&&Zd(A,e,t)||(!r||r===Q.MATHML)&&$d(A,e)}const AB="hidden",eB=8,tB=3;var E;(function(A){A[A.INITIAL=0]="INITIAL",A[A.BEFORE_HTML=1]="BEFORE_HTML",A[A.BEFORE_HEAD=2]="BEFORE_HEAD",A[A.IN_HEAD=3]="IN_HEAD",A[A.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",A[A.AFTER_HEAD=5]="AFTER_HEAD",A[A.IN_BODY=6]="IN_BODY",A[A.TEXT=7]="TEXT",A[A.IN_TABLE=8]="IN_TABLE",A[A.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",A[A.IN_CAPTION=10]="IN_CAPTION",A[A.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",A[A.IN_TABLE_BODY=12]="IN_TABLE_BODY",A[A.IN_ROW=13]="IN_ROW",A[A.IN_CELL=14]="IN_CELL",A[A.IN_SELECT=15]="IN_SELECT",A[A.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",A[A.IN_TEMPLATE=17]="IN_TEMPLATE",A[A.AFTER_BODY=18]="AFTER_BODY",A[A.IN_FRAMESET=19]="IN_FRAMESET",A[A.AFTER_FRAMESET=20]="AFTER_FRAMESET",A[A.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",A[A.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(E||(E={}));const rB={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Ou=new Set([i.TABLE,i.TBODY,i.TFOOT,i.THEAD,i.TR]),Ru={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ue,onParseError:null};let Mu=class{constructor(e,t,r=null,n=null){this.fragmentContext=r,this.scriptHandler=n,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={...Ru,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Id(this.options,this),this.activeFormattingElements=new Hd(this.treeAdapter),this.fragmentContextID=r?zr(this.treeAdapter.getTagName(r)):i.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new xd(this.document,this.treeAdapter,this)}static parse(e,t){const r=new this(t);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,t){const r={...Ru,...t};e??(e=r.treeAdapter.createElement(w.TEMPLATE,Q.HTML,[]));const n=r.treeAdapter.createElement("documentmock",Q.HTML,[]),a=new this(r,n,e);return a.fragmentContextID===i.TEMPLATE&&a.tmplInsertionModeStack.unshift(E.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,r){var n;if(!this.onParseError)return;const a=(n=e.location)!==null&&n!==void 0?n:rB,s={code:t,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:r?a.startLine:a.endLine,endCol:r?a.startCol:a.endCol,endOffset:r?a.startOffset:a.endOffset};this.onParseError(s)}onItemPush(e,t,r){var n,a;(a=(n=this.treeAdapter).onItemPush)===null||a===void 0||a.call(n,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var r,n;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(n=(r=this.treeAdapter).onItemPop)===null||n===void 0||n.call(r,e,this.openElements.current),t){let a,s;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,s=this.fragmentContextID):{current:a,currentTagId:s}=this.openElements,this._setContextModes(a,s)}}_setContextModes(e,t){const r=e===this.document||this.treeAdapter.getNamespaceURI(e)===Q.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,Q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=E.TEXT}switchToPlaintextParsing(){this.insertionMode=E.TEXT,this.originalInsertionMode=E.IN_BODY,this.tokenizer.state=JA.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===w.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Q.HTML))switch(this.fragmentContextID){case i.TITLE:case i.TEXTAREA:{this.tokenizer.state=JA.RCDATA;break}case i.STYLE:case i.XMP:case i.IFRAME:case i.NOEMBED:case i.NOFRAMES:case i.NOSCRIPT:{this.tokenizer.state=JA.RAWTEXT;break}case i.SCRIPT:{this.tokenizer.state=JA.SCRIPT_DATA;break}case i.PLAINTEXT:{this.tokenizer.state=JA.PLAINTEXT;break}}}_setDocumentType(e){const t=e.name||"",r=e.publicId||"",n=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,r,n),e.location){const s=this.treeAdapter.getChildNodes(this.document).find(u=>this.treeAdapter.isDocumentTypeNode(u));s&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const r=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r,e)}}_appendElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,t){const r=this.treeAdapter.createElement(e,Q.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,Q.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,r),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(w.HTML,Q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,i.HTML)}_appendCommentNode(e,t){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let t,r;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(t,e.chars,r):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const n=this.treeAdapter.getChildNodes(t),a=r?n.lastIndexOf(r):n.length,s=n[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:o,endCol:l,endOffset:f}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:o,endCol:l,endOffset:f})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}_adoptNodes(e,t){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(t,r)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const r=t.location,n=this.treeAdapter.getTagName(e),a=t.type===tA.END_TAG&&n===t.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,a)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,r;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,r=this.fragmentContextID):{current:t,currentTagId:r}=this.openElements,e.tagID===i.SVG&&this.treeAdapter.getTagName(t)===w.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===Q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===i.MGLYPH||e.tagID===i.MALIGNMARK)&&!this._isIntegrationPoint(r,t,Q.HTML)}_processToken(e){switch(e.type){case tA.CHARACTER:{this.onCharacter(e);break}case tA.NULL_CHARACTER:{this.onNullCharacter(e);break}case tA.COMMENT:{this.onComment(e);break}case tA.DOCTYPE:{this.onDoctype(e);break}case tA.START_TAG:{this._processStartTag(e);break}case tA.END_TAG:{this.onEndTag(e);break}case tA.EOF:{this.onEof(e);break}case tA.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,t,r){const n=this.treeAdapter.getNamespaceURI(t),a=this.treeAdapter.getAttrList(t);return zd(e,n,a,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(n=>n.type===ge.Marker||this.openElements.contains(n.element)),r=t<0?e-1:t-1;for(let n=r;n>=0;n--){const a=this.activeFormattingElements.entries[n];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=E.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(i.P),this.openElements.popUntilTagNamePopped(i.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case i.TR:{this.insertionMode=E.IN_ROW;return}case i.TBODY:case i.THEAD:case i.TFOOT:{this.insertionMode=E.IN_TABLE_BODY;return}case i.CAPTION:{this.insertionMode=E.IN_CAPTION;return}case i.COLGROUP:{this.insertionMode=E.IN_COLUMN_GROUP;return}case i.TABLE:{this.insertionMode=E.IN_TABLE;return}case i.BODY:{this.insertionMode=E.IN_BODY;return}case i.FRAMESET:{this.insertionMode=E.IN_FRAMESET;return}case i.SELECT:{this._resetInsertionModeForSelect(e);return}case i.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case i.HTML:{this.insertionMode=this.headElement?E.AFTER_HEAD:E.BEFORE_HEAD;return}case i.TD:case i.TH:{if(e>0){this.insertionMode=E.IN_CELL;return}break}case i.HEAD:{if(e>0){this.insertionMode=E.IN_HEAD;return}break}}this.insertionMode=E.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const r=this.openElements.tagIDs[t];if(r===i.TEMPLATE)break;if(r===i.TABLE){this.insertionMode=E.IN_SELECT_IN_TABLE;return}}this.insertionMode=E.IN_SELECT}_isElementCausesFosterParenting(e){return Ou.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case i.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(t)===Q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break}case i.TABLE:{const r=this.treeAdapter.getParentNode(t);return r?{parent:r,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const r=this.treeAdapter.getNamespaceURI(e);return wd[r].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Lg(this,e);return}switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);break}case E.IN_BODY:case E.IN_CAPTION:case E.IN_CELL:case E.IN_TEMPLATE:{Pu(this,e);break}case E.TEXT:case E.IN_SELECT:case E.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_TABLE_TEXT:{qu(this,e);break}case E.IN_COLUMN_GROUP:{nn(this,e);break}case E.AFTER_BODY:{un(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){vg(this,e);return}switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);break}case E.TEXT:{this._insertCharacters(e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_COLUMN_GROUP:{nn(this,e);break}case E.AFTER_BODY:{un(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){ja(this,e);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:{ja(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.AFTER_BODY:{cB(this,e);break}case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{lB(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case E.INITIAL:{fB(this,e);break}case E.BEFORE_HEAD:case E.IN_HEAD:case E.IN_HEAD_NO_SCRIPT:case E.AFTER_HEAD:{this._err(e,b.misplacedDoctype);break}case E.IN_TABLE_TEXT:{nr(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,b.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?xg(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{hB(this,e);break}case E.BEFORE_HEAD:{BB(this,e);break}case E.IN_HEAD:{ce(this,e);break}case E.IN_HEAD_NO_SCRIPT:{mB(this,e);break}case E.AFTER_HEAD:{CB(this,e);break}case E.IN_BODY:{MA(this,e);break}case E.IN_TABLE:{mt(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_CAPTION:{gg(this,e);break}case E.IN_COLUMN_GROUP:{za(this,e);break}case E.IN_TABLE_BODY:{an(this,e);break}case E.IN_ROW:{sn(this,e);break}case E.IN_CELL:{pg(this,e);break}case E.IN_SELECT:{Zu(this,e);break}case E.IN_SELECT_IN_TABLE:{wg(this,e);break}case E.IN_TEMPLATE:{bg(this,e);break}case E.AFTER_BODY:{Qg(this,e);break}case E.IN_FRAMESET:{Fg(this,e);break}case E.AFTER_FRAMESET:{_g(this,e);break}case E.AFTER_AFTER_BODY:{Ng(this,e);break}case E.AFTER_AFTER_FRAMESET:{Sg(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Hg(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{dB(this,e);break}case E.BEFORE_HEAD:{gB(this,e);break}case E.IN_HEAD:{EB(this,e);break}case E.IN_HEAD_NO_SCRIPT:{pB(this,e);break}case E.AFTER_HEAD:{wB(this,e);break}case E.IN_BODY:{rn(this,e);break}case E.TEXT:{sg(this,e);break}case E.IN_TABLE:{tr(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_CAPTION:{Eg(this,e);break}case E.IN_COLUMN_GROUP:{mg(this,e);break}case E.IN_TABLE_BODY:{As(this,e);break}case E.IN_ROW:{$u(this,e);break}case E.IN_CELL:{Cg(this,e);break}case E.IN_SELECT:{zu(this,e);break}case E.IN_SELECT_IN_TABLE:{Tg(this,e);break}case E.IN_TEMPLATE:{Ug(this,e);break}case E.AFTER_BODY:{eo(this,e);break}case E.IN_FRAMESET:{Ig(this,e);break}case E.AFTER_FRAMESET:{yg(this,e);break}case E.AFTER_AFTER_BODY:{on(this,e);break}}}onEof(e){switch(this.insertionMode){case E.INITIAL:{jt(this,e);break}case E.BEFORE_HTML:{$t(this,e);break}case E.BEFORE_HEAD:{Zt(this,e);break}case E.IN_HEAD:{zt(this,e);break}case E.IN_HEAD_NO_SCRIPT:{Ar(this,e);break}case E.AFTER_HEAD:{er(this,e);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:{Wu(this,e);break}case E.TEXT:{ig(this,e);break}case E.IN_TABLE_TEXT:{nr(this,e);break}case E.IN_TEMPLATE:{Ao(this,e);break}case E.AFTER_BODY:case E.IN_FRAMESET:case E.AFTER_FRAMESET:case E.AFTER_AFTER_BODY:case E.AFTER_AFTER_FRAMESET:{$a(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===B.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);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(e);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:{ku(this,e);break}case E.IN_TABLE:case E.IN_TABLE_BODY:case E.IN_ROW:{Za(this,e);break}case E.IN_TABLE_TEXT:{Ju(this,e);break}}}};function nB(A,e){let t=A.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return t?A.openElements.contains(t.element)?A.openElements.hasInScope(e.tagID)||(t=null):(A.activeFormattingElements.removeEntry(t),t=null):Xu(A,e),t}function aB(A,e){let t=null,r=A.openElements.stackTop;for(;r>=0;r--){const n=A.openElements.items[r];if(n===e.element)break;A._isSpecialElement(n,A.openElements.tagIDs[r])&&(t=n)}return t||(A.openElements.shortenToLength(r<0?0:r),A.activeFormattingElements.removeEntry(e)),t}function sB(A,e,t){let r=e,n=A.openElements.getCommonAncestor(e);for(let a=0,s=n;s!==t;a++,s=n){n=A.openElements.getCommonAncestor(s);const u=A.activeFormattingElements.getElementEntry(s),o=u&&a>=tB;!u||o?(o&&A.activeFormattingElements.removeEntry(u),A.openElements.remove(s)):(s=iB(A,u),r===e&&(A.activeFormattingElements.bookmark=u),A.treeAdapter.detachNode(r),A.treeAdapter.appendChild(s,r),r=s)}return r}function iB(A,e){const t=A.treeAdapter.getNamespaceURI(e.element),r=A.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);return A.openElements.replace(e.element,r),e.element=r,r}function uB(A,e,t){const r=A.treeAdapter.getTagName(e),n=zr(r);if(A._isElementCausesFosterParenting(n))A._fosterParentElement(t);else{const a=A.treeAdapter.getNamespaceURI(e);n===i.TEMPLATE&&a===Q.HTML&&(e=A.treeAdapter.getTemplateContent(e)),A.treeAdapter.appendChild(e,t)}}function oB(A,e,t){const r=A.treeAdapter.getNamespaceURI(t.element),{token:n}=t,a=A.treeAdapter.createElement(n.tagName,r,n.attrs);A._adoptNodes(e,a),A.treeAdapter.appendChild(e,a),A.activeFormattingElements.insertElementAfterBookmark(a,n),A.activeFormattingElements.removeEntry(t),A.openElements.remove(t.element),A.openElements.insertAfter(e,a,n.tagID)}function qa(A,e){for(let t=0;t<eB;t++){const r=nB(A,e);if(!r)break;const n=aB(A,r);if(!n)break;A.activeFormattingElements.bookmark=r;const a=sB(A,n,r.element),s=A.openElements.getCommonAncestor(r.element);A.treeAdapter.detachNode(a),s&&uB(A,s,a),oB(A,n,r)}}function ja(A,e){A._appendCommentNode(e,A.openElements.currentTmplContentOrNode)}function cB(A,e){A._appendCommentNode(e,A.openElements.items[0])}function lB(A,e){A._appendCommentNode(e,A.document)}function $a(A,e){if(A.stopped=!0,e.location){const t=A.fragmentContext?0:2;for(let r=A.openElements.stackTop;r>=t;r--)A._setEndLocation(A.openElements.items[r],e);if(!A.fragmentContext&&A.openElements.stackTop>=0){const r=A.openElements.items[0],n=A.treeAdapter.getNodeSourceCodeLocation(r);if(n&&!n.endTag&&(A._setEndLocation(r,e),A.openElements.stackTop>=1)){const a=A.openElements.items[1],s=A.treeAdapter.getNodeSourceCodeLocation(a);s&&!s.endTag&&A._setEndLocation(a,e)}}}}function fB(A,e){A._setDocumentType(e);const t=e.forceQuirks?Ae.QUIRKS:Kd(e);Pd(e)||A._err(e,b.nonConformingDoctype),A.treeAdapter.setDocumentMode(A.document,t),A.insertionMode=E.BEFORE_HTML}function jt(A,e){A._err(e,b.missingDoctype,!0),A.treeAdapter.setDocumentMode(A.document,Ae.QUIRKS),A.insertionMode=E.BEFORE_HTML,A._processToken(e)}function hB(A,e){e.tagID===i.HTML?(A._insertElement(e,Q.HTML),A.insertionMode=E.BEFORE_HEAD):$t(A,e)}function dB(A,e){const t=e.tagID;(t===i.HTML||t===i.HEAD||t===i.BODY||t===i.BR)&&$t(A,e)}function $t(A,e){A._insertFakeRootElement(),A.insertionMode=E.BEFORE_HEAD,A._processToken(e)}function BB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.HEAD:{A._insertElement(e,Q.HTML),A.headElement=A.openElements.current,A.insertionMode=E.IN_HEAD;break}default:Zt(A,e)}}function gB(A,e){const t=e.tagID;t===i.HEAD||t===i.BODY||t===i.HTML||t===i.BR?Zt(A,e):A._err(e,b.endTagWithoutMatchingOpenElement)}function Zt(A,e){A._insertFakeElement(w.HEAD,i.HEAD),A.headElement=A.openElements.current,A.insertionMode=E.IN_HEAD,A._processToken(e)}function ce(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.TITLE:{A._switchToTextParsing(e,JA.RCDATA);break}case i.NOSCRIPT:{A.options.scriptingEnabled?A._switchToTextParsing(e,JA.RAWTEXT):(A._insertElement(e,Q.HTML),A.insertionMode=E.IN_HEAD_NO_SCRIPT);break}case i.NOFRAMES:case i.STYLE:{A._switchToTextParsing(e,JA.RAWTEXT);break}case i.SCRIPT:{A._switchToTextParsing(e,JA.SCRIPT_DATA);break}case i.TEMPLATE:{A._insertTemplate(e),A.activeFormattingElements.insertMarker(),A.framesetOk=!1,A.insertionMode=E.IN_TEMPLATE,A.tmplInsertionModeStack.unshift(E.IN_TEMPLATE);break}case i.HEAD:{A._err(e,b.misplacedStartTagForHeadElement);break}default:zt(A,e)}}function EB(A,e){switch(e.tagID){case i.HEAD:{A.openElements.pop(),A.insertionMode=E.AFTER_HEAD;break}case i.BODY:case i.BR:case i.HTML:{zt(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function nt(A,e){A.openElements.tmplCount>0?(A.openElements.generateImpliedEndTagsThoroughly(),A.openElements.currentTagId!==i.TEMPLATE&&A._err(e,b.closingOfElementWithOpenChildElements),A.openElements.popUntilTagNamePopped(i.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode()):A._err(e,b.endTagWithoutMatchingOpenElement)}function zt(A,e){A.openElements.pop(),A.insertionMode=E.AFTER_HEAD,A._processToken(e)}function mB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BASEFONT:case i.BGSOUND:case i.HEAD:case i.LINK:case i.META:case i.NOFRAMES:case i.STYLE:{ce(A,e);break}case i.NOSCRIPT:{A._err(e,b.nestedNoscriptInHead);break}default:Ar(A,e)}}function pB(A,e){switch(e.tagID){case i.NOSCRIPT:{A.openElements.pop(),A.insertionMode=E.IN_HEAD;break}case i.BR:{Ar(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function Ar(A,e){const t=e.type===tA.EOF?b.openElementsLeftAfterEof:b.disallowedContentInNoscriptInHead;A._err(e,t),A.openElements.pop(),A.insertionMode=E.IN_HEAD,A._processToken(e)}function CB(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.BODY:{A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=E.IN_BODY;break}case i.FRAMESET:{A._insertElement(e,Q.HTML),A.insertionMode=E.IN_FRAMESET;break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{A._err(e,b.abandonedHeadElementChild),A.openElements.push(A.headElement,i.HEAD),ce(A,e),A.openElements.remove(A.headElement);break}case i.HEAD:{A._err(e,b.misplacedStartTagForHeadElement);break}default:er(A,e)}}function wB(A,e){switch(e.tagID){case i.BODY:case i.HTML:case i.BR:{er(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:A._err(e,b.endTagWithoutMatchingOpenElement)}}function er(A,e){A._insertFakeElement(w.BODY,i.BODY),A.insertionMode=E.IN_BODY,tn(A,e)}function tn(A,e){switch(e.type){case tA.CHARACTER:{Pu(A,e);break}case tA.WHITESPACE_CHARACTER:{ku(A,e);break}case tA.COMMENT:{ja(A,e);break}case tA.START_TAG:{MA(A,e);break}case tA.END_TAG:{rn(A,e);break}case tA.EOF:{Wu(A,e);break}}}function ku(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e)}function Pu(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e),A.framesetOk=!1}function TB(A,e){A.openElements.tmplCount===0&&A.treeAdapter.adoptAttributes(A.openElements.items[0],e.attrs)}function bB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A.openElements.tmplCount===0&&(A.framesetOk=!1,A.treeAdapter.adoptAttributes(t,e.attrs))}function UB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();A.framesetOk&&t&&(A.treeAdapter.detachNode(t),A.openElements.popAllUpToHtmlElement(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_FRAMESET)}function QB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML)}function FB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),Xa.has(A.openElements.currentTagId)&&A.openElements.pop(),A._insertElement(e,Q.HTML)}function IB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.skipNextNewLine=!0,A.framesetOk=!1}function _B(A,e){const t=A.openElements.tmplCount>0;(!A.formElement||t)&&(A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),t||(A.formElement=A.openElements.current))}function yB(A,e){A.framesetOk=!1;const t=e.tagID;for(let r=A.openElements.stackTop;r>=0;r--){const n=A.openElements.tagIDs[r];if(t===i.LI&&n===i.LI||(t===i.DD||t===i.DT)&&(n===i.DD||n===i.DT)){A.openElements.generateImpliedEndTagsWithExclusion(n),A.openElements.popUntilTagNamePopped(n);break}if(n!==i.ADDRESS&&n!==i.DIV&&n!==i.P&&A._isSpecialElement(A.openElements.items[r],n))break}A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML)}function NB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.tokenizer.state=JA.PLAINTEXT}function SB(A,e){A.openElements.hasInScope(i.BUTTON)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.BUTTON)),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.framesetOk=!1}function vB(A,e){const t=A.activeFormattingElements.getElementEntryInScopeWithTagName(w.A);t&&(qa(A,e),A.openElements.remove(t.element),A.activeFormattingElements.removeEntry(t)),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function LB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function xB(A,e){A._reconstructActiveFormattingElements(),A.openElements.hasInScope(i.NOBR)&&(qa(A,e),A._reconstructActiveFormattingElements()),A._insertElement(e,Q.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function HB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.activeFormattingElements.insertMarker(),A.framesetOk=!1}function DB(A,e){A.treeAdapter.getDocumentMode(A.document)!==Ae.QUIRKS&&A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=E.IN_TABLE}function Ku(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,Q.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function Vu(A){const e=wu(A,rt.TYPE);return e!=null&&e.toLowerCase()===AB}function OB(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,Q.HTML),Vu(e)||(A.framesetOk=!1),e.ackSelfClosing=!0}function RB(A,e){A._appendElement(e,Q.HTML),e.ackSelfClosing=!0}function MB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._appendElement(e,Q.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function kB(A,e){e.tagName=w.IMG,e.tagID=i.IMG,Ku(A,e)}function PB(A,e){A._insertElement(e,Q.HTML),A.skipNextNewLine=!0,A.tokenizer.state=JA.RCDATA,A.originalInsertionMode=A.insertionMode,A.framesetOk=!1,A.insertionMode=E.TEXT}function KB(A,e){A.openElements.hasInButtonScope(i.P)&&A._closePElement(),A._reconstructActiveFormattingElements(),A.framesetOk=!1,A._switchToTextParsing(e,JA.RAWTEXT)}function VB(A,e){A.framesetOk=!1,A._switchToTextParsing(e,JA.RAWTEXT)}function Gu(A,e){A._switchToTextParsing(e,JA.RAWTEXT)}function GB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML),A.framesetOk=!1,A.insertionMode=A.insertionMode===E.IN_TABLE||A.insertionMode===E.IN_CAPTION||A.insertionMode===E.IN_TABLE_BODY||A.insertionMode===E.IN_ROW||A.insertionMode===E.IN_CELL?E.IN_SELECT_IN_TABLE:E.IN_SELECT}function YB(A,e){A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML)}function XB(A,e){A.openElements.hasInScope(i.RUBY)&&A.openElements.generateImpliedEndTags(),A._insertElement(e,Q.HTML)}function WB(A,e){A.openElements.hasInScope(i.RUBY)&&A.openElements.generateImpliedEndTagsWithExclusion(i.RTC),A._insertElement(e,Q.HTML)}function JB(A,e){A._reconstructActiveFormattingElements(),Hu(e),Ja(e),e.selfClosing?A._appendElement(e,Q.MATHML):A._insertElement(e,Q.MATHML),e.ackSelfClosing=!0}function qB(A,e){A._reconstructActiveFormattingElements(),Du(e),Ja(e),e.selfClosing?A._appendElement(e,Q.SVG):A._insertElement(e,Q.SVG),e.ackSelfClosing=!0}function Yu(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,Q.HTML)}function MA(A,e){switch(e.tagID){case i.I:case i.S:case i.B:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.SMALL:case i.STRIKE:case i.STRONG:{LB(A,e);break}case i.A:{vB(A,e);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{FB(A,e);break}case i.P:case i.DL:case i.OL:case i.UL:case i.DIV:case i.DIR:case i.NAV:case i.MAIN:case i.MENU:case i.ASIDE:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.DETAILS:case i.ADDRESS:case i.ARTICLE:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{QB(A,e);break}case i.LI:case i.DD:case i.DT:{yB(A,e);break}case i.BR:case i.IMG:case i.WBR:case i.AREA:case i.EMBED:case i.KEYGEN:{Ku(A,e);break}case i.HR:{MB(A,e);break}case i.RB:case i.RTC:{XB(A,e);break}case i.RT:case i.RP:{WB(A,e);break}case i.PRE:case i.LISTING:{IB(A,e);break}case i.XMP:{KB(A,e);break}case i.SVG:{qB(A,e);break}case i.HTML:{TB(A,e);break}case i.BASE:case i.LINK:case i.META:case i.STYLE:case i.TITLE:case i.SCRIPT:case i.BGSOUND:case i.BASEFONT:case i.TEMPLATE:{ce(A,e);break}case i.BODY:{bB(A,e);break}case i.FORM:{_B(A,e);break}case i.NOBR:{xB(A,e);break}case i.MATH:{JB(A,e);break}case i.TABLE:{DB(A,e);break}case i.INPUT:{OB(A,e);break}case i.PARAM:case i.TRACK:case i.SOURCE:{RB(A,e);break}case i.IMAGE:{kB(A,e);break}case i.BUTTON:{SB(A,e);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{HB(A,e);break}case i.IFRAME:{VB(A,e);break}case i.SELECT:{GB(A,e);break}case i.OPTION:case i.OPTGROUP:{YB(A,e);break}case i.NOEMBED:case i.NOFRAMES:{Gu(A,e);break}case i.FRAMESET:{UB(A,e);break}case i.TEXTAREA:{PB(A,e);break}case i.NOSCRIPT:{A.options.scriptingEnabled?Gu(A,e):Yu(A,e);break}case i.PLAINTEXT:{NB(A,e);break}case i.COL:case i.TH:case i.TD:case i.TR:case i.HEAD:case i.FRAME:case i.TBODY:case i.TFOOT:case i.THEAD:case i.CAPTION:case i.COLGROUP:break;default:Yu(A,e)}}function jB(A,e){if(A.openElements.hasInScope(i.BODY)&&(A.insertionMode=E.AFTER_BODY,A.options.sourceCodeLocationInfo)){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A._setEndLocation(t,e)}}function $B(A,e){A.openElements.hasInScope(i.BODY)&&(A.insertionMode=E.AFTER_BODY,eo(A,e))}function ZB(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t))}function zB(A){const e=A.openElements.tmplCount>0,{formElement:t}=A;e||(A.formElement=null),(t||e)&&A.openElements.hasInScope(i.FORM)&&(A.openElements.generateImpliedEndTags(),e?A.openElements.popUntilTagNamePopped(i.FORM):t&&A.openElements.remove(t))}function Ag(A){A.openElements.hasInButtonScope(i.P)||A._insertFakeElement(w.P,i.P),A._closePElement()}function eg(A){A.openElements.hasInListItemScope(i.LI)&&(A.openElements.generateImpliedEndTagsWithExclusion(i.LI),A.openElements.popUntilTagNamePopped(i.LI))}function tg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTagsWithExclusion(t),A.openElements.popUntilTagNamePopped(t))}function rg(A){A.openElements.hasNumberedHeaderInScope()&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilNumberedHeaderPopped())}function ng(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker())}function ag(A){A._reconstructActiveFormattingElements(),A._insertFakeElement(w.BR,i.BR),A.openElements.pop(),A.framesetOk=!1}function Xu(A,e){const t=e.tagName,r=e.tagID;for(let n=A.openElements.stackTop;n>0;n--){const a=A.openElements.items[n],s=A.openElements.tagIDs[n];if(r===s&&(r!==i.UNKNOWN||A.treeAdapter.getTagName(a)===t)){A.openElements.generateImpliedEndTagsWithExclusion(r),A.openElements.stackTop>=n&&A.openElements.shortenToLength(n);break}if(A._isSpecialElement(a,s))break}}function rn(A,e){switch(e.tagID){case i.A:case i.B:case i.I:case i.S:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.NOBR:case i.SMALL:case i.STRIKE:case i.STRONG:{qa(A,e);break}case i.P:{Ag(A);break}case i.DL:case i.UL:case i.OL:case i.DIR:case i.DIV:case i.NAV:case i.PRE:case i.MAIN:case i.MENU:case i.ASIDE:case i.BUTTON:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.ADDRESS:case i.ARTICLE:case i.DETAILS:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.LISTING:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{ZB(A,e);break}case i.LI:{eg(A);break}case i.DD:case i.DT:{tg(A,e);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{rg(A);break}case i.BR:{ag(A);break}case i.BODY:{jB(A,e);break}case i.HTML:{$B(A,e);break}case i.FORM:{zB(A);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{ng(A,e);break}case i.TEMPLATE:{nt(A,e);break}default:Xu(A,e)}}function Wu(A,e){A.tmplInsertionModeStack.length>0?Ao(A,e):$a(A,e)}function sg(A,e){var t;e.tagID===i.SCRIPT&&((t=A.scriptHandler)===null||t===void 0||t.call(A,A.openElements.current)),A.openElements.pop(),A.insertionMode=A.originalInsertionMode}function ig(A,e){A._err(e,b.eofInElementThatCanContainOnlyText),A.openElements.pop(),A.insertionMode=A.originalInsertionMode,A.onEof(e)}function Za(A,e){if(Ou.has(A.openElements.currentTagId))switch(A.pendingCharacterTokens.length=0,A.hasNonWhitespacePendingCharacterToken=!1,A.originalInsertionMode=A.insertionMode,A.insertionMode=E.IN_TABLE_TEXT,e.type){case tA.CHARACTER:{qu(A,e);break}case tA.WHITESPACE_CHARACTER:{Ju(A,e);break}}else rr(A,e)}function ug(A,e){A.openElements.clearBackToTableContext(),A.activeFormattingElements.insertMarker(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_CAPTION}function og(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_COLUMN_GROUP}function cg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.COLGROUP,i.COLGROUP),A.insertionMode=E.IN_COLUMN_GROUP,za(A,e)}function lg(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_TABLE_BODY}function fg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.TBODY,i.TBODY),A.insertionMode=E.IN_TABLE_BODY,an(A,e)}function hg(A,e){A.openElements.hasInTableScope(i.TABLE)&&(A.openElements.popUntilTagNamePopped(i.TABLE),A._resetInsertionMode(),A._processStartTag(e))}function dg(A,e){Vu(e)?A._appendElement(e,Q.HTML):rr(A,e),e.ackSelfClosing=!0}function Bg(A,e){!A.formElement&&A.openElements.tmplCount===0&&(A._insertElement(e,Q.HTML),A.formElement=A.openElements.current,A.openElements.pop())}function mt(A,e){switch(e.tagID){case i.TD:case i.TH:case i.TR:{fg(A,e);break}case i.STYLE:case i.SCRIPT:case i.TEMPLATE:{ce(A,e);break}case i.COL:{cg(A,e);break}case i.FORM:{Bg(A,e);break}case i.TABLE:{hg(A,e);break}case i.TBODY:case i.TFOOT:case i.THEAD:{lg(A,e);break}case i.INPUT:{dg(A,e);break}case i.CAPTION:{ug(A,e);break}case i.COLGROUP:{og(A,e);break}default:rr(A,e)}}function tr(A,e){switch(e.tagID){case i.TABLE:{A.openElements.hasInTableScope(i.TABLE)&&(A.openElements.popUntilTagNamePopped(i.TABLE),A._resetInsertionMode());break}case i.TEMPLATE:{nt(A,e);break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:rr(A,e)}}function rr(A,e){const t=A.fosterParentingEnabled;A.fosterParentingEnabled=!0,tn(A,e),A.fosterParentingEnabled=t}function Ju(A,e){A.pendingCharacterTokens.push(e)}function qu(A,e){A.pendingCharacterTokens.push(e),A.hasNonWhitespacePendingCharacterToken=!0}function nr(A,e){let t=0;if(A.hasNonWhitespacePendingCharacterToken)for(;t<A.pendingCharacterTokens.length;t++)rr(A,A.pendingCharacterTokens[t]);else for(;t<A.pendingCharacterTokens.length;t++)A._insertCharacters(A.pendingCharacterTokens[t]);A.insertionMode=A.originalInsertionMode,A._processToken(e)}const ju=new Set([i.CAPTION,i.COL,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]);function gg(A,e){const t=e.tagID;ju.has(t)?A.openElements.hasInTableScope(i.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_TABLE,mt(A,e)):MA(A,e)}function Eg(A,e){const t=e.tagID;switch(t){case i.CAPTION:case i.TABLE:{A.openElements.hasInTableScope(i.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(i.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_TABLE,t===i.TABLE&&tr(A,e));break}case i.BODY:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:rn(A,e)}}function za(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.COL:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.TEMPLATE:{ce(A,e);break}default:nn(A,e)}}function mg(A,e){switch(e.tagID){case i.COLGROUP:{A.openElements.currentTagId===i.COLGROUP&&(A.openElements.pop(),A.insertionMode=E.IN_TABLE);break}case i.TEMPLATE:{nt(A,e);break}case i.COL:break;default:nn(A,e)}}function nn(A,e){A.openElements.currentTagId===i.COLGROUP&&(A.openElements.pop(),A.insertionMode=E.IN_TABLE,A._processToken(e))}function an(A,e){switch(e.tagID){case i.TR:{A.openElements.clearBackToTableBodyContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_ROW;break}case i.TH:case i.TD:{A.openElements.clearBackToTableBodyContext(),A._insertFakeElement(w.TR,i.TR),A.insertionMode=E.IN_ROW,sn(A,e);break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE,mt(A,e));break}default:mt(A,e)}}function As(A,e){const t=e.tagID;switch(e.tagID){case i.TBODY:case i.TFOOT:case i.THEAD:{A.openElements.hasInTableScope(t)&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE);break}case i.TABLE:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE,tr(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:case i.TR:break;default:tr(A,e)}}function sn(A,e){switch(e.tagID){case i.TH:case i.TD:{A.openElements.clearBackToTableRowContext(),A._insertElement(e,Q.HTML),A.insertionMode=E.IN_CELL,A.activeFormattingElements.insertMarker();break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,an(A,e));break}default:mt(A,e)}}function $u(A,e){switch(e.tagID){case i.TR:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY);break}case i.TABLE:{A.openElements.hasInTableScope(i.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,As(A,e));break}case i.TBODY:case i.TFOOT:case i.THEAD:{(A.openElements.hasInTableScope(e.tagID)||A.openElements.hasInTableScope(i.TR))&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=E.IN_TABLE_BODY,As(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:break;default:tr(A,e)}}function pg(A,e){const t=e.tagID;ju.has(t)?(A.openElements.hasInTableScope(i.TD)||A.openElements.hasInTableScope(i.TH))&&(A._closeTableCell(),sn(A,e)):MA(A,e)}function Cg(A,e){const t=e.tagID;switch(t){case i.TD:case i.TH:{A.openElements.hasInTableScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=E.IN_ROW);break}case i.TABLE:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{A.openElements.hasInTableScope(t)&&(A._closeTableCell(),$u(A,e));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:break;default:rn(A,e)}}function Zu(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.OPTION:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A._insertElement(e,Q.HTML);break}case i.OPTGROUP:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop(),A._insertElement(e,Q.HTML);break}case i.HR:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop(),A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.INPUT:case i.KEYGEN:case i.TEXTAREA:case i.SELECT:{A.openElements.hasInSelectScope(i.SELECT)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),e.tagID!==i.SELECT&&A._processStartTag(e));break}case i.SCRIPT:case i.TEMPLATE:{ce(A,e);break}}}function zu(A,e){switch(e.tagID){case i.OPTGROUP:{A.openElements.stackTop>0&&A.openElements.currentTagId===i.OPTION&&A.openElements.tagIDs[A.openElements.stackTop-1]===i.OPTGROUP&&A.openElements.pop(),A.openElements.currentTagId===i.OPTGROUP&&A.openElements.pop();break}case i.OPTION:{A.openElements.currentTagId===i.OPTION&&A.openElements.pop();break}case i.SELECT:{A.openElements.hasInSelectScope(i.SELECT)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode());break}case i.TEMPLATE:{nt(A,e);break}}}function wg(A,e){const t=e.tagID;t===i.CAPTION||t===i.TABLE||t===i.TBODY||t===i.TFOOT||t===i.THEAD||t===i.TR||t===i.TD||t===i.TH?(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),A._processStartTag(e)):Zu(A,e)}function Tg(A,e){const t=e.tagID;t===i.CAPTION||t===i.TABLE||t===i.TBODY||t===i.TFOOT||t===i.THEAD||t===i.TR||t===i.TD||t===i.TH?A.openElements.hasInTableScope(t)&&(A.openElements.popUntilTagNamePopped(i.SELECT),A._resetInsertionMode(),A.onEndTag(e)):zu(A,e)}function bg(A,e){switch(e.tagID){case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{ce(A,e);break}case i.CAPTION:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{A.tmplInsertionModeStack[0]=E.IN_TABLE,A.insertionMode=E.IN_TABLE,mt(A,e);break}case i.COL:{A.tmplInsertionModeStack[0]=E.IN_COLUMN_GROUP,A.insertionMode=E.IN_COLUMN_GROUP,za(A,e);break}case i.TR:{A.tmplInsertionModeStack[0]=E.IN_TABLE_BODY,A.insertionMode=E.IN_TABLE_BODY,an(A,e);break}case i.TD:case i.TH:{A.tmplInsertionModeStack[0]=E.IN_ROW,A.insertionMode=E.IN_ROW,sn(A,e);break}default:A.tmplInsertionModeStack[0]=E.IN_BODY,A.insertionMode=E.IN_BODY,MA(A,e)}}function Ug(A,e){e.tagID===i.TEMPLATE&&nt(A,e)}function Ao(A,e){A.openElements.tmplCount>0?(A.openElements.popUntilTagNamePopped(i.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode(),A.onEof(e)):$a(A,e)}function Qg(A,e){e.tagID===i.HTML?MA(A,e):un(A,e)}function eo(A,e){var t;if(e.tagID===i.HTML){if(A.fragmentContext||(A.insertionMode=E.AFTER_AFTER_BODY),A.options.sourceCodeLocationInfo&&A.openElements.tagIDs[0]===i.HTML){A._setEndLocation(A.openElements.items[0],e);const r=A.openElements.items[1];r&&!(!((t=A.treeAdapter.getNodeSourceCodeLocation(r))===null||t===void 0)&&t.endTag)&&A._setEndLocation(r,e)}}else un(A,e)}function un(A,e){A.insertionMode=E.IN_BODY,tn(A,e)}function Fg(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.FRAMESET:{A._insertElement(e,Q.HTML);break}case i.FRAME:{A._appendElement(e,Q.HTML),e.ackSelfClosing=!0;break}case i.NOFRAMES:{ce(A,e);break}}}function Ig(A,e){e.tagID===i.FRAMESET&&!A.openElements.isRootHtmlElementCurrent()&&(A.openElements.pop(),!A.fragmentContext&&A.openElements.currentTagId!==i.FRAMESET&&(A.insertionMode=E.AFTER_FRAMESET))}function _g(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.NOFRAMES:{ce(A,e);break}}}function yg(A,e){e.tagID===i.HTML&&(A.insertionMode=E.AFTER_AFTER_FRAMESET)}function Ng(A,e){e.tagID===i.HTML?MA(A,e):on(A,e)}function on(A,e){A.insertionMode=E.IN_BODY,tn(A,e)}function Sg(A,e){switch(e.tagID){case i.HTML:{MA(A,e);break}case i.NOFRAMES:{ce(A,e);break}}}function vg(A,e){e.chars=dA,A._insertCharacters(e)}function Lg(A,e){A._insertCharacters(e),A.framesetOk=!1}function to(A){for(;A.treeAdapter.getNamespaceURI(A.openElements.current)!==Q.HTML&&!A._isIntegrationPoint(A.openElements.currentTagId,A.openElements.current);)A.openElements.pop()}function xg(A,e){if(qd(e))to(A),A._startTagOutsideForeignContent(e);else{const t=A._getAdjustedCurrentElement(),r=A.treeAdapter.getNamespaceURI(t);r===Q.MATHML?Hu(e):r===Q.SVG&&(jd(e),Du(e)),Ja(e),e.selfClosing?A._appendElement(e,r):A._insertElement(e,r),e.ackSelfClosing=!0}}function Hg(A,e){if(e.tagID===i.P||e.tagID===i.BR){to(A),A._endTagOutsideForeignContent(e);return}for(let t=A.openElements.stackTop;t>0;t--){const r=A.openElements.items[t];if(A.treeAdapter.getNamespaceURI(r)===Q.HTML){A._endTagOutsideForeignContent(e);break}const n=A.treeAdapter.getTagName(r);if(n.toLowerCase()===e.tagName){e.tagName=n,A.openElements.shortenToLength(t);break}}}const Dg=new Set([w.AREA,w.BASE,w.BASEFONT,w.BGSOUND,w.BR,w.COL,w.EMBED,w.FRAME,w.HR,w.IMG,w.INPUT,w.KEYGEN,w.LINK,w.META,w.PARAM,w.SOURCE,w.TRACK,w.WBR]);function Og(A,e){return e.treeAdapter.isElementNode(A)&&e.treeAdapter.getNamespaceURI(A)===Q.HTML&&Dg.has(e.treeAdapter.getTagName(A))}const Rg={treeAdapter:Ue,scriptingEnabled:!0};function Mg(A,e){const t={...Rg,...e};return ro(A,t)}function kg(A,e){let t="";const r=e.treeAdapter.isElementNode(A)&&e.treeAdapter.getTagName(A)===w.TEMPLATE&&e.treeAdapter.getNamespaceURI(A)===Q.HTML?e.treeAdapter.getTemplateContent(A):A,n=e.treeAdapter.getChildNodes(r);if(n)for(const a of n)t+=ro(a,e);return t}function ro(A,e){return e.treeAdapter.isElementNode(A)?Pg(A,e):e.treeAdapter.isTextNode(A)?Vg(A,e):e.treeAdapter.isCommentNode(A)?Gg(A,e):e.treeAdapter.isDocumentTypeNode(A)?Yg(A,e):""}function Pg(A,e){const t=e.treeAdapter.getTagName(A);return`<${t}${Kg(A,e)}>${Og(A,e)?"":`${kg(A,e)}</${t}>`}`}function Kg(A,{treeAdapter:e}){let t="";for(const r of e.getAttrList(A)){if(t+=" ",r.namespace)switch(r.namespace){case Q.XML:{t+=`xml:${r.name}`;break}case Q.XMLNS:{r.name!=="xmlns"&&(t+="xmlns:"),t+=r.name;break}case Q.XLINK:{t+=`xlink:${r.name}`;break}default:t+=`${r.prefix}:${r.name}`}else t+=r.name;t+=`="${Ui(r.value)}"`}return t}function Vg(A,e){const{treeAdapter:t}=e,r=t.getTextNodeContent(A),n=t.getParentNode(A),a=n&&t.isElementNode(n)&&t.getTagName(n);return a&&t.getNamespaceURI(n)===Q.HTML&&bd(a,e.scriptingEnabled)?r:Qi(r)}function Gg(A,{treeAdapter:e}){return`<!--${e.getCommentNodeContent(A)}-->`}function Yg(A,{treeAdapter:e}){return`<!DOCTYPE ${e.getDocumentTypeNodeName(A)}>`}function Xg(A,e){return Mu.parse(A,e)}function Wg(A,e,t){typeof A=="string"&&(t=e,e=A,A=null);const r=Mu.getFragmentParser(A,t);return r.tokenizer.write(e,!0),r.getFragment()}function no(A){const e=A.includes('"')?"'":'"';return e+A+e}function Jg(A,e,t){let r="!DOCTYPE ";return A&&(r+=A),e?r+=` PUBLIC ${no(e)}`:t&&(r+=" SYSTEM"),t&&(r+=` ${no(t)}`),r}const De={isCommentNode:Dr,isElementNode:X,isTextNode:Be,createDocument(){const A=new Ze([]);return A["x-mode"]=Ae.NO_QUIRKS,A},createDocumentFragment(){return new Ze([])},createElement(A,e,t){const r=Object.create(null),n=Object.create(null),a=Object.create(null);for(let u=0;u<t.length;u++){const o=t[u].name;r[o]=t[u].value,n[o]=t[u].namespace,a[o]=t[u].prefix}const s=new ha(A,r,[]);return s.namespace=e,s["x-attribsNamespace"]=n,s["x-attribsPrefix"]=a,s},createCommentNode(A){return new ca(A)},createTextNode(A){return new Mt(A)},appendChild(A,e){const t=A.children[A.children.length-1];t&&(t.next=e,e.prev=t),A.children.push(e),e.parent=A},insertBefore(A,e,t){const r=A.children.indexOf(t),{prev:n}=t;n&&(n.next=e,e.prev=n),t.prev=e,e.next=t,A.children.splice(r,0,e),e.parent=A},setTemplateContent(A,e){De.appendChild(A,e)},getTemplateContent(A){return A.children[0]},setDocumentType(A,e,t,r){const n=Jg(e,t,r);let a=A.children.find(s=>da(s)&&s.name==="!doctype");a?a.data=n??null:(a=new la("!doctype",n),De.appendChild(A,a)),a["x-name"]=e,a["x-publicId"]=t,a["x-systemId"]=r},setDocumentMode(A,e){A["x-mode"]=e},getDocumentMode(A){return A["x-mode"]},detachNode(A){if(A.parent){const e=A.parent.children.indexOf(A),{prev:t,next:r}=A;A.prev=null,A.next=null,t&&(t.next=r),r&&(r.prev=t),A.parent.children.splice(e,1),A.parent=null}},insertText(A,e){const t=A.children[A.children.length-1];t&&Be(t)?t.data+=e:De.appendChild(A,De.createTextNode(e))},insertTextBefore(A,e,t){const r=A.children[A.children.indexOf(t)-1];r&&Be(r)?r.data+=e:De.insertBefore(A,De.createTextNode(e),t)},adoptAttributes(A,e){for(let t=0;t<e.length;t++){const r=e[t].name;A.attribs[r]===void 0&&(A.attribs[r]=e[t].value,A["x-attribsNamespace"][r]=e[t].namespace,A["x-attribsPrefix"][r]=e[t].prefix)}},getFirstChild(A){return A.children[0]},getChildNodes(A){return A.children},getParentNode(A){return A.parent},getAttrList(A){return A.attributes},getTagName(A){return A.name},getNamespaceURI(A){return A.namespace},getTextNodeContent(A){return A.data},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){var e;return(e=A["x-name"])!==null&&e!==void 0?e:""},getDocumentTypeNodePublicId(A){var e;return(e=A["x-publicId"])!==null&&e!==void 0?e:""},getDocumentTypeNodeSystemId(A){var e;return(e=A["x-systemId"])!==null&&e!==void 0?e:""},isDocumentTypeNode(A){return da(A)&&A.name==="!doctype"},setNodeSourceCodeLocation(A,e){e&&(A.startIndex=e.startOffset,A.endIndex=e.endOffset),A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){e.endOffset!=null&&(A.endIndex=e.endOffset),A.sourceCodeLocation={...A.sourceCodeLocation,...e}}};function qg(A,e,t,r){var n;return(n=e.treeAdapter)!==null&&n!==void 0||(e.treeAdapter=De),e.scriptingEnabled!==!1&&(e.scriptingEnabled=!0),t?Xg(A,e):Wg(r,A,e)}const jg={treeAdapter:De};function $g(A){const e="length"in A?A:[A];for(let r=0;r<e.length;r+=1){const n=e[r];Se(n)&&Array.prototype.splice.call(e,r,1,...n.children)}let t="";for(let r=0;r<e.length;r+=1){const n=e[r];t+=Mg(n,jg)}return t}var Y;(function(A){A[A.Tab=9]="Tab",A[A.NewLine=10]="NewLine",A[A.FormFeed=12]="FormFeed",A[A.CarriageReturn=13]="CarriageReturn",A[A.Space=32]="Space",A[A.ExclamationMark=33]="ExclamationMark",A[A.Number=35]="Number",A[A.Amp=38]="Amp",A[A.SingleQuote=39]="SingleQuote",A[A.DoubleQuote=34]="DoubleQuote",A[A.Dash=45]="Dash",A[A.Slash=47]="Slash",A[A.Zero=48]="Zero",A[A.Nine=57]="Nine",A[A.Semi=59]="Semi",A[A.Lt=60]="Lt",A[A.Eq=61]="Eq",A[A.Gt=62]="Gt",A[A.Questionmark=63]="Questionmark",A[A.UpperA=65]="UpperA",A[A.LowerA=97]="LowerA",A[A.UpperF=70]="UpperF",A[A.LowerF=102]="LowerF",A[A.UpperZ=90]="UpperZ",A[A.LowerZ=122]="LowerZ",A[A.LowerX=120]="LowerX",A[A.OpeningSquareBracket=91]="OpeningSquareBracket"})(Y||(Y={}));var y;(function(A){A[A.Text=1]="Text",A[A.BeforeTagName=2]="BeforeTagName",A[A.InTagName=3]="InTagName",A[A.InSelfClosingTag=4]="InSelfClosingTag",A[A.BeforeClosingTagName=5]="BeforeClosingTagName",A[A.InClosingTagName=6]="InClosingTagName",A[A.AfterClosingTagName=7]="AfterClosingTagName",A[A.BeforeAttributeName=8]="BeforeAttributeName",A[A.InAttributeName=9]="InAttributeName",A[A.AfterAttributeName=10]="AfterAttributeName",A[A.BeforeAttributeValue=11]="BeforeAttributeValue",A[A.InAttributeValueDq=12]="InAttributeValueDq",A[A.InAttributeValueSq=13]="InAttributeValueSq",A[A.InAttributeValueNq=14]="InAttributeValueNq",A[A.BeforeDeclaration=15]="BeforeDeclaration",A[A.InDeclaration=16]="InDeclaration",A[A.InProcessingInstruction=17]="InProcessingInstruction",A[A.BeforeComment=18]="BeforeComment",A[A.CDATASequence=19]="CDATASequence",A[A.InSpecialComment=20]="InSpecialComment",A[A.InCommentLike=21]="InCommentLike",A[A.BeforeSpecialS=22]="BeforeSpecialS",A[A.BeforeSpecialT=23]="BeforeSpecialT",A[A.SpecialStartSequence=24]="SpecialStartSequence",A[A.InSpecialTag=25]="InSpecialTag",A[A.InEntity=26]="InEntity"})(y||(y={}));function Qe(A){return A===Y.Space||A===Y.NewLine||A===Y.Tab||A===Y.FormFeed||A===Y.CarriageReturn}function cn(A){return A===Y.Slash||A===Y.Gt||Qe(A)}function Zg(A){return A>=Y.LowerA&&A<=Y.LowerZ||A>=Y.UpperA&&A<=Y.UpperZ}var Ee;(function(A){A[A.NoValue=0]="NoValue",A[A.Unquoted=1]="Unquoted",A[A.Single=2]="Single",A[A.Double=3]="Double"})(Ee||(Ee={}));const DA={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])};let zg=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},r){this.cbs=r,this.state=y.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=y.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new Ca(e?pi:ga,(n,a)=>this.emitCodePoint(n,a))}reset(){this.state=y.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=y.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,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(e){e===Y.Lt||!this.decodeEntities&&this.fastForwardTo(Y.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=y.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateSpecialStartSequence(e){const t=this.sequenceIndex===this.currentSequence.length;if(!(t?cn(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=y.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===Y.Gt||Qe(e)){const t=this.index-this.currentSequence.length;if(this.sectionStart<t){const r=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=r}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===DA.TitleEnd?this.decodeEntities&&e===Y.Amp&&this.startEntity():this.fastForwardTo(Y.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(e===Y.Lt)}stateCDATASequence(e){e===DA.Cdata[this.sequenceIndex]?++this.sequenceIndex===DA.Cdata.length&&(this.state=y.InCommentLike,this.currentSequence=DA.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=y.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===DA.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=y.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!cn(e):Zg(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=y.SpecialStartSequence}stateBeforeTagName(e){if(e===Y.ExclamationMark)this.state=y.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===Y.Questionmark)this.state=y.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){const t=e|32;this.sectionStart=this.index,this.xmlMode?this.state=y.InTagName:t===DA.ScriptEnd[2]?this.state=y.BeforeSpecialS:t===DA.TitleEnd[2]?this.state=y.BeforeSpecialT:this.state=y.InTagName}else e===Y.Slash?this.state=y.BeforeClosingTagName:(this.state=y.Text,this.stateText(e))}stateInTagName(e){cn(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Qe(e)||(e===Y.Gt?this.state=y.Text:(this.state=this.isTagStartChar(e)?y.InClosingTagName:y.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===Y.Gt||Qe(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=y.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===Y.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=y.InSpecialTag,this.sequenceIndex=0):this.state=y.Text,this.sectionStart=this.index+1):e===Y.Slash?this.state=y.InSelfClosingTag:Qe(e)||(this.state=y.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===Y.Gt?(this.cbs.onselfclosingtag(this.index),this.state=y.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Qe(e)||(this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===Y.Eq||cn(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=y.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===Y.Eq?this.state=y.BeforeAttributeValue:e===Y.Slash||e===Y.Gt?(this.cbs.onattribend(Ee.NoValue,this.sectionStart),this.sectionStart=-1,this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e)):Qe(e)||(this.cbs.onattribend(Ee.NoValue,this.sectionStart),this.state=y.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===Y.DoubleQuote?(this.state=y.InAttributeValueDq,this.sectionStart=this.index+1):e===Y.SingleQuote?(this.state=y.InAttributeValueSq,this.sectionStart=this.index+1):Qe(e)||(this.sectionStart=this.index,this.state=y.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===Y.DoubleQuote?Ee.Double:Ee.Single,this.index+1),this.state=y.BeforeAttributeName):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,Y.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,Y.SingleQuote)}stateInAttributeValueNoQuotes(e){Qe(e)||e===Y.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ee.Unquoted,this.index),this.state=y.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===Y.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===Y.OpeningSquareBracket?(this.state=y.CDATASequence,this.sequenceIndex=0):this.state=e===Y.Dash?y.BeforeComment:y.InDeclaration}stateInDeclaration(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=y.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===Y.Dash?(this.state=y.InCommentLike,this.currentSequence=DA.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=y.InDeclaration}stateInSpecialComment(e){(e===Y.Gt||this.fastForwardTo(Y.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=y.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){const t=e|32;t===DA.ScriptEnd[3]?this.startSpecial(DA.ScriptEnd,4):t===DA.StyleEnd[3]?this.startSpecial(DA.StyleEnd,4):(this.state=y.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){const t=e|32;t===DA.TitleEnd[3]?this.startSpecial(DA.TitleEnd,4):t===DA.TextareaEnd[3]?this.startSpecial(DA.TextareaEnd,4):(this.state=y.InTagName,this.stateInTagName(e))}startEntity(){this.baseState=this.state,this.state=y.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?re.Strict:this.baseState===y.Text||this.baseState===y.InSpecialTag?re.Legacy:re.Attribute)}stateInEntity(){const e=this.entityDecoder.write(this.buffer,this.index-this.offset);e>=0?(this.state=this.baseState,e===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===y.Text||this.state===y.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===y.InAttributeValueDq||this.state===y.InAttributeValueSq||this.state===y.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 e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case y.Text:{this.stateText(e);break}case y.SpecialStartSequence:{this.stateSpecialStartSequence(e);break}case y.InSpecialTag:{this.stateInSpecialTag(e);break}case y.CDATASequence:{this.stateCDATASequence(e);break}case y.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(e);break}case y.InAttributeName:{this.stateInAttributeName(e);break}case y.InCommentLike:{this.stateInCommentLike(e);break}case y.InSpecialComment:{this.stateInSpecialComment(e);break}case y.BeforeAttributeName:{this.stateBeforeAttributeName(e);break}case y.InTagName:{this.stateInTagName(e);break}case y.InClosingTagName:{this.stateInClosingTagName(e);break}case y.BeforeTagName:{this.stateBeforeTagName(e);break}case y.AfterAttributeName:{this.stateAfterAttributeName(e);break}case y.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(e);break}case y.BeforeAttributeValue:{this.stateBeforeAttributeValue(e);break}case y.BeforeClosingTagName:{this.stateBeforeClosingTagName(e);break}case y.AfterClosingTagName:{this.stateAfterClosingTagName(e);break}case y.BeforeSpecialS:{this.stateBeforeSpecialS(e);break}case y.BeforeSpecialT:{this.stateBeforeSpecialT(e);break}case y.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(e);break}case y.InSelfClosingTag:{this.stateInSelfClosingTag(e);break}case y.InDeclaration:{this.stateInDeclaration(e);break}case y.BeforeDeclaration:{this.stateBeforeDeclaration(e);break}case y.BeforeComment:{this.stateBeforeComment(e);break}case y.InProcessingInstruction:{this.stateInProcessingInstruction(e);break}case y.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===y.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===y.InCommentLike?this.currentSequence===DA.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===y.InTagName||this.state===y.BeforeAttributeName||this.state===y.BeforeAttributeValue||this.state===y.AfterAttributeName||this.state===y.InAttributeName||this.state===y.InAttributeValueSq||this.state===y.InAttributeValueDq||this.state===y.InAttributeValueNq||this.state===y.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==y.Text&&this.baseState!==y.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const pt=new Set(["input","option","optgroup","select","button","datalist","textarea"]),sA=new Set(["p"]),ao=new Set(["thead","tbody"]),so=new Set(["dd","dt"]),io=new Set(["rt","rp"]),AE=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",sA],["h1",sA],["h2",sA],["h3",sA],["h4",sA],["h5",sA],["h6",sA],["select",pt],["input",pt],["output",pt],["button",pt],["datalist",pt],["textarea",pt],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",so],["dt",so],["address",sA],["article",sA],["aside",sA],["blockquote",sA],["details",sA],["div",sA],["dl",sA],["fieldset",sA],["figcaption",sA],["figure",sA],["footer",sA],["form",sA],["header",sA],["hr",sA],["main",sA],["nav",sA],["ol",sA],["pre",sA],["section",sA],["table",sA],["ul",sA],["rt",io],["rp",io],["tbody",ao],["tfoot",ao]]),eE=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),uo=new Set(["math","svg"]),oo=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),tE=/\s|\//;let rE=class{constructor(e,t={}){var r,n,a,s,u,o;this.options=t,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=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(r=t.lowerCaseTags)!==null&&r!==void 0?r:this.htmlMode,this.lowerCaseAttributeNames=(n=t.lowerCaseAttributeNames)!==null&&n!==void 0?n:this.htmlMode,this.recognizeSelfClosing=(a=t.recognizeSelfClosing)!==null&&a!==void 0?a:!this.htmlMode,this.tokenizer=new((s=t.Tokenizer)!==null&&s!==void 0?s:zg)(this.options,this),this.foreignContext=[!this.htmlMode],(o=(u=this.cbs).onparserinit)===null||o===void 0||o.call(u,this)}ontext(e,t){var r,n;const a=this.getSlice(e,t);this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,a),this.startIndex=t}ontextentity(e,t){var r,n;this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,ma(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&eE.has(e)}onopentagname(e,t){this.endIndex=t;let r=this.getSlice(e,t);this.lowerCaseTagNames&&(r=r.toLowerCase()),this.emitOpenTag(r)}emitOpenTag(e){var t,r,n,a;this.openTagStart=this.startIndex,this.tagname=e;const s=this.htmlMode&&AE.get(e);if(s)for(;this.stack.length>0&&s.has(this.stack[0]);){const u=this.stack.shift();(r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,u,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(uo.has(e)?this.foreignContext.unshift(!0):oo.has(e)&&this.foreignContext.unshift(!1))),(a=(n=this.cbs).onopentagname)===null||a===void 0||a.call(n,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,r;this.startIndex=this.openTagStart,this.attribs&&((r=(t=this.cbs).onopentag)===null||r===void 0||r.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var r,n,a,s,u,o,l,f;this.endIndex=t;let h=this.getSlice(e,t);if(this.lowerCaseTagNames&&(h=h.toLowerCase()),this.htmlMode&&(uo.has(h)||oo.has(h))&&this.foreignContext.shift(),this.isVoidElement(h))this.htmlMode&&h==="br"&&((s=(a=this.cbs).onopentagname)===null||s===void 0||s.call(a,"br"),(o=(u=this.cbs).onopentag)===null||o===void 0||o.call(u,"br",{},!0),(f=(l=this.cbs).onclosetag)===null||f===void 0||f.call(l,"br",!1));else{const d=this.stack.indexOf(h);if(d!==-1)for(let C=0;C<=d;C++){const p=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,p,C!==d)}else this.htmlMode&&h==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,r;const n=this.tagname;this.endOpenTag(e),this.stack[0]===n&&((r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,n,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;const r=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?r.toLowerCase():r}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=ma(e)}onattribend(e,t){var r,n;this.endIndex=t,(n=(r=this.cbs).onattribute)===null||n===void 0||n.call(r,this.attribname,this.attribvalue,e===Ee.Double?'"':e===Ee.Single?"'":e===Ee.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){const t=e.search(tE);let r=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(r=r.toLowerCase()),r}ondeclaration(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`!${n}`,`!${r}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`?${n}`,`?${r}`)}this.startIndex=t+1}oncomment(e,t,r){var n,a,s,u;this.endIndex=t,(a=(n=this.cbs).oncomment)===null||a===void 0||a.call(n,this.getSlice(e,t-r)),(u=(s=this.cbs).oncommentend)===null||u===void 0||u.call(s),this.startIndex=t+1}oncdata(e,t,r){var n,a,s,u,o,l,f,h,d,C;this.endIndex=t;const p=this.getSlice(e,t-r);!this.htmlMode||this.options.recognizeCDATA?((a=(n=this.cbs).oncdatastart)===null||a===void 0||a.call(n),(u=(s=this.cbs).ontext)===null||u===void 0||u.call(s,p),(l=(o=this.cbs).oncdataend)===null||l===void 0||l.call(o)):((h=(f=this.cbs).oncomment)===null||h===void 0||h.call(f,`[CDATA[${p}]]`),(C=(d=this.cbs).oncommentend)===null||C===void 0||C.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let r=0;r<this.stack.length;r++)this.cbs.onclosetag(this.stack[r],!0)}(t=(e=this.cbs).onend)===null||t===void 0||t.call(e)}reset(){var e,t,r,n;(t=(e=this.cbs).onreset)===null||t===void 0||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(n=(r=this.cbs).onparserinit)===null||n===void 0||n.call(r,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let r=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),r+=this.buffers[0].slice(0,t-this.bufferOffset);return r}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".end() after done!"));return}e&&this.write(e),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(e){this.write(e)}done(e){this.end(e)}};function nE(A,e){const t=new a0(void 0,e);return new rE(t,e).end(A),t.root}const aE=xh((A,e,t,r)=>e._useHtmlParser2?nE(A,e):qg(A,e,t,r)),co=hd(aE,(A,e)=>e._useHtmlParser2?Or(A,e):$g(A));var W=(A=>(A[A.None=0]="None",A[A.Text=1]="Text",A[A.Image=2]="Image",A[A.Video=3]="Video",A[A.Icon=4]="Icon",A[A.Link=5]="Link",A[A.Button=6]="Button",A[A.Block=10]="Block",A))(W||{}),le;(A=>{A.THEME_TEXT_COLOR_CLASS="gp-designer-theme-text",A.THEME_BUTTON_COLOR_CLASS="gp-designer-theme-button",A.THEME_ICON_COLOR_CLASS="gp-designer-theme-icon",A.THEME_COLOR="#3574e6"})(le||(le={}));const sE=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(A){const e=c.ref(!1),t=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"})[A.type]),r=()=>{e.value=!1,A.onClose()};return setTimeout(()=>{r()},A.duration),e.value=!0,{visible:e,typeClass:t,closeMessage:r}}}),Oe=(A,e)=>{const t=A.__vccOpts||A;for(const[r,n]of e)t[r]=n;return t},iE={key:0,class:"gp-message"},uE={key:0,class:"mr-2"},oE={key:0,class:"text-green-500"},cE={key:1,class:"text-red-500"},lE={key:2,class:"text-blue-500"},fE={key:3,class:"text-yellow-500"};function hE(A,e,t,r,n,a){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[A.visible?(c.openBlock(),c.createElementBlock("div",iE,[c.createElementVNode("div",{class:c.normalizeClass([A.typeClass,"message-content"])},[A.icon?(c.openBlock(),c.createElementBlock("span",uE,[c.renderSlot(A.$slots,"icon",{},()=>[A.type==="success"?(c.openBlock(),c.createElementBlock("span",oE,"✔")):c.createCommentVNode("",!0),A.type==="error"?(c.openBlock(),c.createElementBlock("span",cE,"✖")):c.createCommentVNode("",!0),A.type==="info"?(c.openBlock(),c.createElementBlock("span",lE,"ℹ")):c.createCommentVNode("",!0),A.type==="warning"?(c.openBlock(),c.createElementBlock("span",fE,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(A.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:e[0]||(e[0]=(...s)=>A.closeMessage&&A.closeMessage(...s))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const dE=Oe(sE,[["render",hE],["__scopeId","data-v-a234b03c"]]),Ct=c.reactive([]);let es=null;const BE=()=>{const A=document.createElement("div");return A.id="global-message-container",document.body.appendChild(A),A},gE=()=>{if(es)return;const A=BE();es=c.createApp({setup(){return{messageQueue:Ct}},render(){const e=c.computed(()=>{var r;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"}[((r=Ct[0])==null?void 0:r.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${e.value}`},Ct.map(t=>c.h(dE,{key:t.id,...t.options,onClose:()=>lo(t.id)})))}}),es.mount(A)},lo=A=>{const e=Ct.findIndex(t=>t.id===A);e!==-1&&Ct.splice(e,1)};let EE=0;const j=A=>{gE();const e=EE++;Ct.push({id:e,options:A}),setTimeout(()=>{lo(e)},A.duration||3e3)};j.success=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"success",duration:e,icon:t}:{...A,type:"success"})},j.error=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"error",duration:e,icon:t}:{...A,type:"error"})},j.info=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"info",duration:e,icon:t}:{...A,type:"info"})},j.warning=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"warning",duration:e,icon:t}:{...A,type:"warning"})};const mE=["onClick"],pE={key:0,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},CE=Oe(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},upload:{type:Object,required:!1},r:{type:String,required:!1},showMargin:{type:Boolean,default:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","updateElementRule"],setup(A,{emit:e}){const t=A,r=e,n=c.computed(()=>t.element.editText||t.element.text),a=c.computed(()=>t.selectedElement===t.element),s=c.computed(()=>t.hoveredElement===t.element),u=c.ref(!1),o=c.ref(!1),l=c.ref(""),f=c.computed(()=>t.element.rule.minText||0),h=c.computed(()=>t.element.rule.maxText||1/0),d=S=>{let v="";if(S.children&&S.children.length&&S.children[0].type===W.Block){const q=S.children[0].rule.flexColumn||S.children[0].rule.mobileFlexColumn;Math.min(q,S.children.length)&&(v+=" flex pc:justify-center flex-wrap ",S.children[0].rule.mobileFlexColumn?v+=" justify-center ":v+=" gp-designer-m-swiper swiper-wrapper justify-normal ")}if(S.type===W.Block){const q=S.rule.flexColumn,$=S.rule.mobileFlexColumn;($||q)&&(v+=" box-border "),$>1&&$<=12?v+=` basis-1/${$} `:$==1?v+=" basis-full ":$||(v+=" gp-designer-m-swiper-slide swiper-slide "),q>1&&q<=12?v+=` pc:basis-1/${q} `:q==1&&(v+=" pc:basis-full ")}return(S.type==W.Button||S.type==W.Link)&&S.rule.openMeiqia&&(v+=" gp-designer-meiqia "),v};c.watch(()=>t.r,()=>{r("contentUpdated",D())},{immediate:!0});function C(S){S.xpath!="/div[1]"&&t.mode!=="preview"&&(t.mode==="edit"?S.type===W.Text&&r("selectElement",S):r("selectElement",S),!S.rule.isReadOnly&&S.type===W.Text&&(u.value=!0))}function p(S){r("selectElement",S)}function T(S,v){r("hoverElement",S,v)}function U(S){r("hoverElement",S)}function _(S){S.currentTarget.contains(S.relatedTarget)?r("hoverElement",null):t.hoveredElement?r("hoverElement",null,t.hoveredElement.parentxpath):r("hoverElement",null)}function I(){u.value=!1,r("contentUpdated",D())}function D(){function S(q){var te;const $=q,zA=$.rule.isThemeColor&&$.type==W.Text?le.THEME_TEXT_COLOR_CLASS:$.rule.isThemeColor&&$.type==W.Button?le.THEME_BUTTON_COLOR_CLASS:$.rule.isThemeColor&&$.type==W.Icon?le.THEME_ICON_COLOR_CLASS:"";zA?$.attrs.class=$.attrs.class?$.attrs.class+" "+zA:zA:$.attrs.class=(te=$.attrs.class)==null?void 0:te.replace(new RegExp(`${le.THEME_TEXT_COLOR_CLASS}|${le.THEME_BUTTON_COLOR_CLASS}|${le.THEME_ICON_COLOR_CLASS}`,"g"),"");const je={class:$.attrs.class||""},Lr=d($);Lr&&(je.class+=" "+Lr);const xr=Object.entries(q.attrs||{}).filter(([YA,HA])=>YA!=="class").map(([YA,HA])=>`${YA}="${HA}"`).join(" "),F=Object.entries(je||{}).map(([YA,HA])=>`${YA}="${HA}"`).join(" "),L=`<${q.tag}${xr?" "+xr:""}${F?" "+F:""}>`,K=`</${q.tag}>`,V=(q.children||[]).map(YA=>S(YA)).join("");let CA=q.editText||q.text||"";return CA=CA.replace(/\r\n/g,`
|
9
|
+
`).replace(/\n/g,"<br>"),`${L}${CA}${V}${K}`}return S(t.element)}function k(S){var zA,je;S.preventDefault(),S.stopPropagation();let v=((zA=S.clipboardData)==null?void 0:zA.getData("text/plain"))||"";(je=t.element.rule)!=null&&je.allowWrap?(v=v==null?void 0:v.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,v)):(v=v==null?void 0:v.replace(/\n/g," "),document.execCommand("insertText",!1,v));const q=S.target,$=q.innerText||q.textContent||"";H($)}function x(S){var v;S.key==="Enter"&&(S.preventDefault(),S.stopPropagation(),(v=t.element.rule)!=null&&v.allowWrap?document.execCommand("insertLineBreak"):j.error("当前节点不允许换行"))}function m(S){S.stopPropagation();const v=S.target,q=v.innerText||v.textContent||"";H(q)}function H(S){if(S.length<f.value){o.value=!0,l.value=`最少输入 ${f.value} 个字符`;return}else if(S.length>h.value){o.value=!0,l.value=`最多输入 ${h.value} 个字符`;return}else o.value=!1,l.value="";r("updateText",{element:t.element,newText:S}),r("contentUpdated",D());const v=c.toRaw(t.element);v.editText=S}function P(S){r("updateText",S),r("contentUpdated",D())}function M(){const S={...t.element};r("blockAction",{action:"add",element:t.element,newBlock:S})}function eA(){uA(t.element),r("blockAction",{action:"moveUp",element:t.element})}function uA(S){S.children&&S.children.length>0&&S.children.forEach(v=>{v.type==W.Text&&(v.text!==v.editText&&(v.text=v.editText),uA(v))})}function fA(){uA(t.element),r("blockAction",{action:"moveDown",element:t.element})}function J(){r("blockAction",{action:"delete",element:t.element})}function rA(S){r("blockAction",S),r("contentUpdated",D())}function oA(S){IA.value.openModal(S)}function hA(S){KA.value.openModal(S)}function pA(S,v){r("addIcon",S,v),r("contentUpdated",D())}function GA(S){r("updateElementRule",S)}const IA=c.ref(t.icon);c.watch(()=>t.icon,S=>{IA.value=S},{immediate:!0});const KA=c.ref(t.upload);c.watch(()=>t.upload,S=>{KA.value=S},{immediate:!0});const xA=c.computed(()=>{const S=d(t.element);return t.element.css=S,S}),ZA=(S,v)=>{v.children&&v.children.length&&v.children[0].type===W.Block&&v.children.map(q=>{q.rule.flexColumn=S}),r("updateElementRule",v)},_A=c.computed(()=>{let S="";if(t.mode==="design"){const v=t.element;if(v.type===W.Block){const q=v.rule.flexColumn;q>1&&q<=12&&(S+=`flex-basis: calc(100% / ${q} - 10px);`)}}return S});return(S,v)=>{const q=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",s.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",o.value?"border-dashed border-red-500":"",(!s.value&&!a.value&&!o.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Text?c.unref(le).THEME_TEXT_COLOR_CLASS:"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Button?c.unref(le).THEME_BUTTON_COLOR_CLASS:"",t.element.rule.isThemeColor&&t.element.type===c.unref(W).Icon?c.unref(le).THEME_ICON_COLOR_CLASS:"",xA.value],style:_A.value},t.element.attrs,{contenteditable:u.value,onClick:v[3]||(v[3]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:v[4]||(v[4]=()=>U(t.element)),onMouseleave:_,onBlur:I,onInput:m,onPaste:k,onKeydown:c.withModifiers(x,["stop"])}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.value),1),t.element.children&&t.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children,($,zA)=>(c.openBlock(),c.createBlock(q,{"show-margin":A.showMargin,key:zA,r:A.r,mode:A.mode,icons:A.icons,element:$,selectedElement:t.selectedElement,hoveredElement:t.hoveredElement,cropper:A.cropper,icon:A.icon,upload:A.upload,"upload-by-file":A.uploadByFile,onSelectElement:p,onHoverElement:T,onUpdateText:P,onBlockAction:rA,onAddIcon:pA,onUpdateElementRule:()=>GA($)},null,8,["show-margin","r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload","upload-by-file","onUpdateElementRule"]))),128)),t.element.type===c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:v[0]||(v[0]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute left-2 top-2 text-sm"},[c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-green-500/80 text-white rounded hover:bg-green-500",onClick:c.withModifiers(M,["stop"])},v[7]||(v[7]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"white","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(eA,["stop"])},v[8]||(v[8]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M244 400L100 256l144-144M120 256h292"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(fA,["stop"])},v[9]||(v[9]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m268 112l144 144l-144 144m124-144H100"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-red-500/80 text-white rounded hover:bg-red-500",onClick:c.withModifiers(J,["stop"])},v[10]||(v[10]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"})],-1)]))])):c.createCommentVNode("",!0),t.element.children&&t.element.children.length&&t.element.children[0].type===c.unref(W).Block&&t.element.children[0].rule&&t.element.children[0].rule.flexColumns&&t.element.children[0].rule.flexColumns.length>0?(c.openBlock(),c.createElementBlock("div",{key:1,"date-action":"1",contenteditable:"false",onClick:v[1]||(v[1]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute right-0 -top-6 items-center"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children[0].rule.flexColumns,($,zA)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["text-xs w-6 h-6 flex-none content-center items-center justify-center bg-purple-400/80 text-white rounded hover:bg-purple-600",t.element.children[0].rule.flexColumn===$?"bg-purple-700":""]),onClick:c.withModifiers(()=>ZA($,t.element),["stop"])},c.toDisplayString($),11,mE))),256))])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),t.element.type===c.unref(W).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 hover:bg-black",contenteditable:"false",onClick:v[2]||(v[2]=c.withModifiers(()=>oA(t.element),["stop"]))},v[11]||(v[11]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))):c.createCommentVNode("",!0)]),_:1},16,["class","style","contenteditable"])),t.element.type==c.unref(W).Text&&o.value?(c.openBlock(),c.createElementBlock("div",pE,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),t.element.type===c.unref(W).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 hover:bg-black",onClick:v[6]||(v[6]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createElementVNode("div",{class:"p-1",onClick:v[5]||(v[5]=c.withModifiers(()=>hA(t.element),["stop"]))},v[12]||(v[12]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-fdc2479e"]]),wE=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(A,{emit:e}){return{updateValue:r=>{e("update:modelValue",r.target.checked)}}}}),TE={class:"form-group"},bE={class:"flex items-center space-x-2 cursor-pointer"},UE=["checked","aria-checked"],QE={class:"checkbox-label text-sm text-gray-700"};function FE(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",TE,[c.createElementVNode("label",bE,[c.createElementVNode("input",{type:"checkbox",checked:A.modelValue,onChange:e[0]||(e[0]=(...s)=>A.updateValue&&A.updateValue(...s)),class:"custom-checkbox","aria-checked":A.modelValue},null,40,UE),c.createElementVNode("span",QE,c.toDisplayString(A.label),1)])])}const wt=Oe(wE,[["render",FE],["__scopeId","data-v-68b8f276"]]),IE={class:"text-sm"},_E={key:0},yE={key:0},NE={class:"text-gray-500 my-2 truncate"},SE={class:"text-gray-500 my-2 break-words"},vE={key:1},LE={key:2},xE={key:3},HE={key:4},DE={key:5},OE={key:6},RE={key:7},ME={key:8},kE={key:9},PE={key:10},KE={key:11},VE={key:12},GE={key:13},YE=Oe(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(A,{emit:e}){const t=A,r=e,n=c.ref({rule:{},...t.element});c.watch(()=>t.element,s=>{n.value={rule:{},...s}},{immediate:!0});function a(){var s;if(n.value.type===W.Icon&&!n.value.attrs.class.includes("iconfont")){j.error("图标仅支持 iconfont 图标");return}if(n.value.type===W.Image&&n.value.tag!=="img"){j.error("节点类型错误");return}if(n.value.type===W.Video&&n.value.tag!=="video"){j.error("节点类型错误");return}if(n.value.type===W.Link&&n.value.tag!=="a"){j.error("节点类型错误");return}if(n.value.type===W.Text){if(Number(n.value.rule.minText)>Number(n.value.rule.maxText)){j.error("最小文本长度不能大于最大文本长度");return}if(n.value.tag!=="p"&&n.value.tag!=="div"&&n.value.tag!=="span"&&n.value.tag!=="h1"&&n.value.tag!=="h2"&&n.value.tag!=="h3"&&n.value.tag!=="h4"&&n.value.tag!=="h5"&&n.value.tag!=="h6"){j.error("节点类型错误");return}}if(n.value.type===W.Block){if(Number(n.value.rule.minBlock)>Number(n.value.rule.maxBlock)){j.error("最小块数量不能大于最大块数量");return}if(n.value.tag!=="div"&&n.value.tag!=="section"&&n.value.tag!=="article"&&n.value.tag!=="nav"&&n.value.tag!=="header"&&n.value.tag!=="footer"&&n.value.tag!=="span"&&n.value.tag!=="p"&&n.value.tag!=="img"){j.error("节点类型错误");return}if(!n.value.children||n.value.children.length<1){j.error("节点错误,必须包含子元素");return}!n.value.rule.flexColumn&&((s=n.value.rule.flexColumns)==null?void 0:s.length)>0&&(n.value.rule.flexColumn=n.value.rule.flexColumns[0])}n.value.rule.minText?n.value.rule.minText=Number(n.value.rule.minText):n.value.rule.minText=void 0,n.value.rule.maxText?n.value.rule.maxText=Number(n.value.rule.maxText):n.value.rule.maxText=void 0,n.value.rule.minBlock?n.value.rule.minBlock=Number(n.value.rule.minBlock):n.value.rule.minBlock=void 0,n.value.rule.maxBlock?n.value.rule.maxBlock=Number(n.value.rule.maxBlock):n.value.rule.maxBlock=void 0,n.value.rule.flexColumn?n.value.rule.flexColumn=Number(n.value.rule.flexColumn):n.value.rule.flexColumn=void 0,n.value.rule.mobileFlexColumn?n.value.rule.mobileFlexColumn=Number(n.value.rule.mobileFlexColumn):n.value.rule.mobileFlexColumn=void 0,r("updateElement",n.value)}return(s,u)=>(c.openBlock(),c.createElementBlock("div",IE,[n.value?(c.openBlock(),c.createElementBlock("div",_E,[n.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",yE,[u[16]||(u[16]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",NE,c.toDisplayString(n.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[u[17]||(u[17]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",SE,c.toDisplayString(n.value.xpath),1)]),c.createElementVNode("div",null,[u[19]||(u[19]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":u[0]||(u[0]=o=>n.value.type=o),class:"border rounded p-1 w-full"},u[18]||(u[18]=[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,n.value.type]])]),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",vE,[u[20]||(u[20]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[1]||(u[1]=o=>n.value.rule.minText=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",LE,[u[21]||(u[21]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[2]||(u[2]=o=>n.value.rule.maxText=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",xE,[u[22]||(u[22]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.crop,"onUpdate:modelValue":u[3]||(u[3]=o=>n.value.rule.crop=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",HE,[u[23]||(u[23]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[4]||(u[4]=o=>n.value.rule.minImageWidth=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Image?(c.openBlock(),c.createElementBlock("div",DE,[u[24]||(u[24]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[5]||(u[5]=o=>n.value.rule.maxImageHeight=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",OE,[u[25]||(u[25]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[6]||(u[6]=o=>n.value.rule.minBlock=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",RE,[u[26]||(u[26]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[7]||(u[7]=o=>n.value.rule.maxBlock=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",ME,[u[28]||(u[28]=c.createElementVNode("label",{class:"block mt-4"},"PC端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{multiple:"","onUpdate:modelValue":u[8]||(u[8]=o=>n.value.rule.flexColumns=o),class:"border rounded p-1 w-full h-32"},u[27]||(u[27]=[c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1),c.createElementVNode("option",{value:7},"7",-1),c.createElementVNode("option",{value:8},"8",-1),c.createElementVNode("option",{value:9},"9",-1),c.createElementVNode("option",{value:10},"10",-1),c.createElementVNode("option",{value:11},"11",-1),c.createElementVNode("option",{value:12},"12",-1)]),512),[[c.vModelSelect,n.value.rule.flexColumns]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Block?(c.openBlock(),c.createElementBlock("div",kE,[u[30]||(u[30]=c.createElementVNode("label",{class:"block mt-4"},"移动端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":u[9]||(u[9]=o=>n.value.rule.mobileFlexColumn=o),class:"border rounded p-1 w-full"},u[29]||(u[29]=[c.createElementVNode("option",{value:void 0},"无(轮播)",-1),c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1)]),512),[[c.vModelSelect,n.value.rule.mobileFlexColumn]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text||n.value.type==c.unref(W).Icon||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",PE,[u[31]||(u[31]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isThemeColor,"onUpdate:modelValue":u[10]||(u[10]=o=>n.value.rule.isThemeColor=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[u[32]||(u[32]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isRequired,"onUpdate:modelValue":u[11]||(u[11]=o=>n.value.rule.isRequired=o),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[u[33]||(u[33]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.isReadOnly,"onUpdate:modelValue":u[12]||(u[12]=o=>n.value.rule.isReadOnly=o),label:"是"},null,8,["modelValue"])]),n.value.type==c.unref(W).Link||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",KE,[u[34]||(u[34]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.openMeiqia,"onUpdate:modelValue":u[13]||(u[13]=o=>n.value.rule.openMeiqia=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Link||n.value.type==c.unref(W).Button?(c.openBlock(),c.createElementBlock("div",VE,[u[35]||(u[35]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":u[14]||(u[14]=o=>n.value.rule.linkUrl=o),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.linkUrl]])])):c.createCommentVNode("",!0),n.value.type==c.unref(W).Text?(c.openBlock(),c.createElementBlock("div",GE,[u[36]||(u[36]=c.createElementVNode("label",{class:"block mt-4"},"允许换行(回车/粘贴多段文本等)",-1)),c.createVNode(wt,{class:"py-2",modelValue:n.value.rule.allowWrap,"onUpdate:modelValue":u[15]||(u[15]=o=>n.value.rule.allowWrap=o),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:a,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-a7d2f78b"]]);/*!
|
10
10
|
* Cropper.js v1.6.2
|
11
11
|
* https://fengyuanchen.github.io/cropperjs
|
12
12
|
*
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*
|
16
16
|
* Date: 2024-04-21T07:43:05.335Z
|
17
17
|
*/function fo(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(A);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(A,n).enumerable})),t.push.apply(t,r)}return t}function ho(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fo(Object(t),!0).forEach(function(r){qE(A,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):fo(Object(t)).forEach(function(r){Object.defineProperty(A,r,Object.getOwnPropertyDescriptor(t,r))})}return A}function XE(A,e){if(typeof A!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var r=t.call(A,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function Bo(A){var e=XE(A,"string");return typeof e=="symbol"?e:e+""}function ts(A){"@babel/helpers - typeof";return ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ts(A)}function WE(A,e){if(!(A instanceof e))throw new TypeError("Cannot call a class as a function")}function go(A,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(A,Bo(r.key),r)}}function JE(A,e,t){return e&&go(A.prototype,e),t&&go(A,t),Object.defineProperty(A,"prototype",{writable:!1}),A}function qE(A,e,t){return e=Bo(e),e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Eo(A){return jE(A)||$E(A)||ZE(A)||zE()}function jE(A){if(Array.isArray(A))return rs(A)}function $E(A){if(typeof Symbol<"u"&&A[Symbol.iterator]!=null||A["@@iterator"]!=null)return Array.from(A)}function ZE(A,e){if(A){if(typeof A=="string")return rs(A,e);var t=Object.prototype.toString.call(A).slice(8,-1);if(t==="Object"&&A.constructor&&(t=A.constructor.name),t==="Map"||t==="Set")return Array.from(A);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rs(A,e)}}function rs(A,e){(e==null||e>A.length)&&(e=A.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=A[t];return r}function zE(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ln=typeof window<"u"&&typeof window.document<"u",me=ln?window:{},ns=ln&&me.document.documentElement?"ontouchstart"in me.document.documentElement:!1,as=ln?"PointerEvent"in me:!1,BA="cropper",ss="all",mo="crop",po="move",Co="zoom",at="e",st="w",Tt="s",Re="n",ar="ne",sr="nw",ir="se",ur="sw",is="".concat(BA,"-crop"),wo="".concat(BA,"-disabled"),qA="".concat(BA,"-hidden"),To="".concat(BA,"-hide"),Am="".concat(BA,"-invisible"),fn="".concat(BA,"-modal"),us="".concat(BA,"-move"),or="".concat(BA,"Action"),hn="".concat(BA,"Preview"),os="crop",bo="move",Uo="none",cs="crop",ls="cropend",fs="cropmove",hs="cropstart",Qo="dblclick",em=ns?"touchstart":"mousedown",tm=ns?"touchmove":"mousemove",rm=ns?"touchend touchcancel":"mouseup",Fo=as?"pointerdown":em,Io=as?"pointermove":tm,_o=as?"pointerup pointercancel":rm,yo="ready",No="resize",So="wheel",ds="zoom",vo="image/jpeg",nm=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,am=/^data:/,sm=/^data:image\/jpeg;base64,/,im=/^img|canvas$/i,Lo=200,xo=100,Ho={viewMode:0,dragMode:os,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Lo,minContainerHeight:xo,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},um='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',om=Number.isNaN||me.isNaN;function z(A){return typeof A=="number"&&!om(A)}var Do=function(e){return e>0&&e<1/0};function Bs(A){return typeof A>"u"}function it(A){return ts(A)==="object"&&A!==null}var cm=Object.prototype.hasOwnProperty;function bt(A){if(!it(A))return!1;try{var e=A.constructor,t=e.prototype;return e&&t&&cm.call(t,"isPrototypeOf")}catch{return!1}}function jA(A){return typeof A=="function"}var lm=Array.prototype.slice;function Oo(A){return Array.from?Array.from(A):lm.call(A)}function bA(A,e){return A&&jA(e)&&(Array.isArray(A)||z(A.length)?Oo(A).forEach(function(t,r){e.call(A,t,r,A)}):it(A)&&Object.keys(A).forEach(function(t){e.call(A,A[t],t,A)})),A}var gA=Object.assign||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return it(e)&&r.length>0&&r.forEach(function(a){it(a)&&Object.keys(a).forEach(function(s){e[s]=a[s]})}),e},fm=/\.\d*(?:0|9){12}\d*$/;function Ut(A){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return fm.test(A)?Math.round(A*e)/e:A}var hm=/^width|height|left|top|marginLeft|marginTop$/;function Me(A,e){var t=A.style;bA(e,function(r,n){hm.test(n)&&z(r)&&(r="".concat(r,"px")),t[n]=r})}function dm(A,e){return A.classList?A.classList.contains(e):A.className.indexOf(e)>-1}function vA(A,e){if(e){if(z(A.length)){bA(A,function(r){vA(r,e)});return}if(A.classList){A.classList.add(e);return}var t=A.className.trim();t?t.indexOf(e)<0&&(A.className="".concat(t," ").concat(e)):A.className=e}}function pe(A,e){if(e){if(z(A.length)){bA(A,function(t){pe(t,e)});return}if(A.classList){A.classList.remove(e);return}A.className.indexOf(e)>=0&&(A.className=A.className.replace(e,""))}}function Qt(A,e,t){if(e){if(z(A.length)){bA(A,function(r){Qt(r,e,t)});return}t?vA(A,e):pe(A,e)}}var Bm=/([a-z\d])([A-Z])/g;function gs(A){return A.replace(Bm,"$1-$2").toLowerCase()}function Es(A,e){return it(A[e])?A[e]:A.dataset?A.dataset[e]:A.getAttribute("data-".concat(gs(e)))}function cr(A,e,t){it(t)?A[e]=t:A.dataset?A.dataset[e]=t:A.setAttribute("data-".concat(gs(e)),t)}function gm(A,e){if(it(A[e]))try{delete A[e]}catch{A[e]=void 0}else if(A.dataset)try{delete A.dataset[e]}catch{A.dataset[e]=void 0}else A.removeAttribute("data-".concat(gs(e)))}var Ro=/\s\s*/,Mo=function(){var A=!1;if(ln){var e=!1,t=function(){},r=Object.defineProperty({},"once",{get:function(){return A=!0,e},set:function(a){e=a}});me.addEventListener("test",t,r),me.removeEventListener("test",t,r)}return A}();function fe(A,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;e.trim().split(Ro).forEach(function(a){if(!Mo){var s=A.listeners;s&&s[a]&&s[a][t]&&(n=s[a][t],delete s[a][t],Object.keys(s[a]).length===0&&delete s[a],Object.keys(s).length===0&&delete A.listeners)}A.removeEventListener(a,n,r)})}function ae(A,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;e.trim().split(Ro).forEach(function(a){if(r.once&&!Mo){var s=A.listeners,u=s===void 0?{}:s;n=function(){delete u[a][t],A.removeEventListener(a,n,r);for(var l=arguments.length,f=new Array(l),h=0;h<l;h++)f[h]=arguments[h];t.apply(A,f)},u[a]||(u[a]={}),u[a][t]&&A.removeEventListener(a,u[a][t],r),u[a][t]=n,A.listeners=u}A.addEventListener(a,n,r)})}function Ft(A,e,t){var r;return jA(Event)&&jA(CustomEvent)?r=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(e,!0,!0,t)),A.dispatchEvent(r)}function ko(A){var e=A.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var ms=me.location,Em=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Po(A){var e=A.match(Em);return e!==null&&(e[1]!==ms.protocol||e[2]!==ms.hostname||e[3]!==ms.port)}function Ko(A){var e="timestamp=".concat(new Date().getTime());return A+(A.indexOf("?")===-1?"?":"&")+e}function lr(A){var e=A.rotate,t=A.scaleX,r=A.scaleY,n=A.translateX,a=A.translateY,s=[];z(n)&&n!==0&&s.push("translateX(".concat(n,"px)")),z(a)&&a!==0&&s.push("translateY(".concat(a,"px)")),z(e)&&e!==0&&s.push("rotate(".concat(e,"deg)")),z(t)&&t!==1&&s.push("scaleX(".concat(t,")")),z(r)&&r!==1&&s.push("scaleY(".concat(r,")"));var u=s.length?s.join(" "):"none";return{WebkitTransform:u,msTransform:u,transform:u}}function mm(A){var e=ho({},A),t=0;return bA(A,function(r,n){delete e[n],bA(e,function(a){var s=Math.abs(r.startX-a.startX),u=Math.abs(r.startY-a.startY),o=Math.abs(r.endX-a.endX),l=Math.abs(r.endY-a.endY),f=Math.sqrt(s*s+u*u),h=Math.sqrt(o*o+l*l),d=(h-f)/f;Math.abs(d)>Math.abs(t)&&(t=d)})}),t}function dn(A,e){var t=A.pageX,r=A.pageY,n={endX:t,endY:r};return e?n:ho({startX:t,startY:r},n)}function pm(A){var e=0,t=0,r=0;return bA(A,function(n){var a=n.startX,s=n.startY;e+=a,t+=s,r+=1}),e/=r,t/=r,{pageX:e,pageY:t}}function ke(A){var e=A.aspectRatio,t=A.height,r=A.width,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=Do(r),s=Do(t);if(a&&s){var u=t*e;n==="contain"&&u>r||n==="cover"&&u<r?t=r/e:r=t*e}else a?t=r/e:s&&(r=t*e);return{width:r,height:t}}function Cm(A){var e=A.width,t=A.height,r=A.degree;if(r=Math.abs(r)%180,r===90)return{width:t,height:e};var n=r%90*Math.PI/180,a=Math.sin(n),s=Math.cos(n),u=e*s+t*a,o=e*a+t*s;return r>90?{width:o,height:u}:{width:u,height:o}}function wm(A,e,t,r){var n=e.aspectRatio,a=e.naturalWidth,s=e.naturalHeight,u=e.rotate,o=u===void 0?0:u,l=e.scaleX,f=l===void 0?1:l,h=e.scaleY,d=h===void 0?1:h,C=t.aspectRatio,p=t.naturalWidth,T=t.naturalHeight,U=r.fillColor,_=U===void 0?"transparent":U,I=r.imageSmoothingEnabled,D=I===void 0?!0:I,k=r.imageSmoothingQuality,x=k===void 0?"low":k,m=r.maxWidth,H=m===void 0?1/0:m,P=r.maxHeight,M=P===void 0?1/0:P,eA=r.minWidth,uA=eA===void 0?0:eA,fA=r.minHeight,J=fA===void 0?0:fA,rA=document.createElement("canvas"),oA=rA.getContext("2d"),hA=ke({aspectRatio:C,width:H,height:M}),pA=ke({aspectRatio:C,width:uA,height:J},"cover"),GA=Math.min(hA.width,Math.max(pA.width,p)),IA=Math.min(hA.height,Math.max(pA.height,T)),KA=ke({aspectRatio:n,width:H,height:M}),xA=ke({aspectRatio:n,width:uA,height:J},"cover"),ZA=Math.min(KA.width,Math.max(xA.width,a)),_A=Math.min(KA.height,Math.max(xA.height,s)),v=[-ZA/2,-_A/2,ZA,_A];return rA.width=Ut(GA),rA.height=Ut(IA),oA.fillStyle=_,oA.fillRect(0,0,GA,IA),oA.save(),oA.translate(GA/2,IA/2),oA.rotate(o*Math.PI/180),oA.scale(f,d),oA.imageSmoothingEnabled=D,oA.imageSmoothingQuality=x,oA.drawImage.apply(oA,[A].concat(Eo(v.map(function(S){return Math.floor(Ut(S))})))),oA.restore(),rA}var Vo=String.fromCharCode;function Tm(A,e,t){var r="";t+=e;for(var n=e;n<t;n+=1)r+=Vo(A.getUint8(n));return r}var bm=/^data:.*,/;function Um(A){var e=A.replace(bm,""),t=atob(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);return bA(n,function(a,s){n[s]=t.charCodeAt(s)}),r}function Qm(A,e){for(var t=[],r=8192,n=new Uint8Array(A);n.length>0;)t.push(Vo.apply(null,Oo(n.subarray(0,r)))),n=n.subarray(r);return"data:".concat(e,";base64,").concat(btoa(t.join("")))}function Fm(A){var e=new DataView(A),t;try{var r,n,a;if(e.getUint8(0)===255&&e.getUint8(1)===216)for(var s=e.byteLength,u=2;u+1<s;){if(e.getUint8(u)===255&&e.getUint8(u+1)===225){n=u;break}u+=1}if(n){var o=n+4,l=n+10;if(Tm(e,o,4)==="Exif"){var f=e.getUint16(l);if(r=f===18761,(r||f===19789)&&e.getUint16(l+2,r)===42){var h=e.getUint32(l+4,r);h>=8&&(a=l+h)}}}if(a){var d=e.getUint16(a,r),C,p;for(p=0;p<d;p+=1)if(C=a+p*12+2,e.getUint16(C,r)===274){C+=8,t=e.getUint16(C,r),e.setUint16(C,1,r);break}}}catch{t=1}return t}function Im(A){var e=0,t=1,r=1;switch(A){case 2:t=-1;break;case 3:e=-180;break;case 4:r=-1;break;case 5:e=90,r=-1;break;case 6:e=90;break;case 7:e=90,t=-1;break;case 8:e=-90;break}return{rotate:e,scaleX:t,scaleY:r}}var _m={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,r=this.container,n=this.cropper,a=Number(t.minContainerWidth),s=Number(t.minContainerHeight);vA(n,qA),pe(e,qA);var u={width:Math.max(r.offsetWidth,a>=0?a:Lo),height:Math.max(r.offsetHeight,s>=0?s:xo)};this.containerData=u,Me(n,{width:u.width,height:u.height}),vA(e,qA),pe(n,qA)},initCanvas:function(){var e=this.containerData,t=this.imageData,r=this.options.viewMode,n=Math.abs(t.rotate)%180===90,a=n?t.naturalHeight:t.naturalWidth,s=n?t.naturalWidth:t.naturalHeight,u=a/s,o=e.width,l=e.height;e.height*u>e.width?r===3?o=e.height*u:l=e.width/u:r===3?l=e.width/u:o=e.height*u;var f={aspectRatio:u,naturalWidth:a,naturalHeight:s,width:o,height:l};this.canvasData=f,this.limited=r===1||r===2,this.limitCanvas(!0,!0),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),f.left=(e.width-f.width)/2,f.top=(e.height-f.height)/2,f.oldLeft=f.left,f.oldTop=f.top,this.initialCanvasData=gA({},f)},limitCanvas:function(e,t){var r=this.options,n=this.containerData,a=this.canvasData,s=this.cropBoxData,u=r.viewMode,o=a.aspectRatio,l=this.cropped&&s;if(e){var f=Number(r.minCanvasWidth)||0,h=Number(r.minCanvasHeight)||0;u>1?(f=Math.max(f,n.width),h=Math.max(h,n.height),u===3&&(h*o>f?f=h*o:h=f/o)):u>0&&(f?f=Math.max(f,l?s.width:0):h?h=Math.max(h,l?s.height:0):l&&(f=s.width,h=s.height,h*o>f?f=h*o:h=f/o));var d=ke({aspectRatio:o,width:f,height:h});f=d.width,h=d.height,a.minWidth=f,a.minHeight=h,a.maxWidth=1/0,a.maxHeight=1/0}if(t)if(u>(l?0:1)){var C=n.width-a.width,p=n.height-a.height;a.minLeft=Math.min(0,C),a.minTop=Math.min(0,p),a.maxLeft=Math.max(0,C),a.maxTop=Math.max(0,p),l&&this.limited&&(a.minLeft=Math.min(s.left,s.left+(s.width-a.width)),a.minTop=Math.min(s.top,s.top+(s.height-a.height)),a.maxLeft=s.left,a.maxTop=s.top,u===2&&(a.width>=n.width&&(a.minLeft=Math.min(0,C),a.maxLeft=Math.max(0,C)),a.height>=n.height&&(a.minTop=Math.min(0,p),a.maxTop=Math.max(0,p))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=n.width,a.maxTop=n.height},renderCanvas:function(e,t){var r=this.canvasData,n=this.imageData;if(t){var a=Cm({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),s=a.width,u=a.height,o=r.width*(s/r.naturalWidth),l=r.height*(u/r.naturalHeight);r.left-=(o-r.width)/2,r.top-=(l-r.height)/2,r.width=o,r.height=l,r.aspectRatio=s/u,r.naturalWidth=s,r.naturalHeight=u,this.limitCanvas(!0,!1)}(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCanvas(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,Me(this.canvas,gA({width:r.width,height:r.height},lr({translateX:r.left,translateY:r.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,r=this.imageData,n=r.naturalWidth*(t.width/t.naturalWidth),a=r.naturalHeight*(t.height/t.naturalHeight);gA(r,{width:n,height:a,left:(t.width-n)/2,top:(t.height-a)/2}),Me(this.image,gA({width:r.width,height:r.height},lr(gA({translateX:r.left,translateY:r.top},r)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,r=e.aspectRatio||e.initialAspectRatio,n=Number(e.autoCropArea)||.8,a={width:t.width,height:t.height};r&&(t.height*r>t.width?a.height=a.width/r:a.width=a.height*r),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*n),a.height=Math.max(a.minHeight,a.height*n),a.left=t.left+(t.width-a.width)/2,a.top=t.top+(t.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=gA({},a)},limitCropBox:function(e,t){var r=this.options,n=this.containerData,a=this.canvasData,s=this.cropBoxData,u=this.limited,o=r.aspectRatio;if(e){var l=Number(r.minCropBoxWidth)||0,f=Number(r.minCropBoxHeight)||0,h=u?Math.min(n.width,a.width,a.width+a.left,n.width-a.left):n.width,d=u?Math.min(n.height,a.height,a.height+a.top,n.height-a.top):n.height;l=Math.min(l,n.width),f=Math.min(f,n.height),o&&(l&&f?f*o>l?f=l/o:l=f*o:l?f=l/o:f&&(l=f*o),d*o>h?d=h/o:h=d*o),s.minWidth=Math.min(l,h),s.minHeight=Math.min(f,d),s.maxWidth=h,s.maxHeight=d}t&&(u?(s.minLeft=Math.max(0,a.left),s.minTop=Math.max(0,a.top),s.maxLeft=Math.min(n.width,a.left+a.width)-s.width,s.maxTop=Math.min(n.height,a.top+a.height)-s.height):(s.minLeft=0,s.minTop=0,s.maxLeft=n.width-s.width,s.maxTop=n.height-s.height))},renderCropBox:function(){var e=this.options,t=this.containerData,r=this.cropBoxData;(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCropBox(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,e.movable&&e.cropBoxMovable&&cr(this.face,or,r.width>=t.width&&r.height>=t.height?po:ss),Me(this.cropBox,gA({width:r.width,height:r.height},lr({translateX:r.left,translateY:r.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ft(this.element,cs,this.getData())}},ym={initPreview:function(){var e=this.element,t=this.crossOrigin,r=this.options.preview,n=t?this.crossOriginUrl:this.url,a=e.alt||"The image to preview",s=document.createElement("img");if(t&&(s.crossOrigin=t),s.src=n,s.alt=a,this.viewBox.appendChild(s),this.viewBoxImage=s,!!r){var u=r;typeof r=="string"?u=e.ownerDocument.querySelectorAll(r):r.querySelector&&(u=[r]),this.previews=u,bA(u,function(o){var l=document.createElement("img");cr(o,hn,{width:o.offsetWidth,height:o.offsetHeight,html:o.innerHTML}),t&&(l.crossOrigin=t),l.src=n,l.alt=a,l.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',o.innerHTML="",o.appendChild(l)})}},resetPreview:function(){bA(this.previews,function(e){var t=Es(e,hn);Me(e,{width:t.width,height:t.height}),e.innerHTML=t.html,gm(e,hn)})},preview:function(){var e=this.imageData,t=this.canvasData,r=this.cropBoxData,n=r.width,a=r.height,s=e.width,u=e.height,o=r.left-t.left-e.left,l=r.top-t.top-e.top;!this.cropped||this.disabled||(Me(this.viewBoxImage,gA({width:s,height:u},lr(gA({translateX:-o,translateY:-l},e)))),bA(this.previews,function(f){var h=Es(f,hn),d=h.width,C=h.height,p=d,T=C,U=1;n&&(U=d/n,T=a*U),a&&T>C&&(U=C/a,p=n*U,T=C),Me(f,{width:p,height:T}),Me(f.getElementsByTagName("img")[0],gA({width:s*U,height:u*U},lr(gA({translateX:-o*U,translateY:-l*U},e))))}))}},Nm={bind:function(){var e=this.element,t=this.options,r=this.cropper;jA(t.cropstart)&&ae(e,hs,t.cropstart),jA(t.cropmove)&&ae(e,fs,t.cropmove),jA(t.cropend)&&ae(e,ls,t.cropend),jA(t.crop)&&ae(e,cs,t.crop),jA(t.zoom)&&ae(e,ds,t.zoom),ae(r,Fo,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ae(r,So,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ae(r,Qo,this.onDblclick=this.dblclick.bind(this)),ae(e.ownerDocument,Io,this.onCropMove=this.cropMove.bind(this)),ae(e.ownerDocument,_o,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ae(window,No,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,r=this.cropper;jA(t.cropstart)&&fe(e,hs,t.cropstart),jA(t.cropmove)&&fe(e,fs,t.cropmove),jA(t.cropend)&&fe(e,ls,t.cropend),jA(t.crop)&&fe(e,cs,t.crop),jA(t.zoom)&&fe(e,ds,t.zoom),fe(r,Fo,this.onCropStart),t.zoomable&&t.zoomOnWheel&&fe(r,So,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&fe(r,Qo,this.onDblclick),fe(e.ownerDocument,Io,this.onCropMove),fe(e.ownerDocument,_o,this.onCropEnd),t.responsive&&fe(window,No,this.onResize)}},Sm={resize:function(){if(!this.disabled){var e=this.options,t=this.container,r=this.containerData,n=t.offsetWidth/r.width,a=t.offsetHeight/r.height,s=Math.abs(n-1)>Math.abs(a-1)?n:a;if(s!==1){var u,o;e.restore&&(u=this.getCanvasData(),o=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(bA(u,function(l,f){u[f]=l*s})),this.setCropBoxData(bA(o,function(l,f){o[f]=l*s})))}}},dblclick:function(){this.disabled||this.options.dragMode===Uo||this.setDragMode(dm(this.dragBox,is)?bo:os)},wheel:function(e){var t=this,r=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*r,e)))},cropStart:function(e){var t=e.buttons,r=e.button;if(!(this.disabled||(e.type==="mousedown"||e.type==="pointerdown"&&e.pointerType==="mouse")&&(z(t)&&t!==1||z(r)&&r!==0||e.ctrlKey))){var n=this.options,a=this.pointers,s;e.changedTouches?bA(e.changedTouches,function(u){a[u.identifier]=dn(u)}):a[e.pointerId||0]=dn(e),Object.keys(a).length>1&&n.zoomable&&n.zoomOnTouch?s=Co:s=Es(e.target,or),nm.test(s)&&Ft(this.element,hs,{originalEvent:e,action:s})!==!1&&(e.preventDefault(),this.action=s,this.cropping=!1,s===mo&&(this.cropping=!0,vA(this.dragBox,fn)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var r=this.pointers;e.preventDefault(),Ft(this.element,fs,{originalEvent:e,action:t})!==!1&&(e.changedTouches?bA(e.changedTouches,function(n){gA(r[n.identifier]||{},dn(n,!0))}):gA(r[e.pointerId||0]||{},dn(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,r=this.pointers;e.changedTouches?bA(e.changedTouches,function(n){delete r[n.identifier]}):delete r[e.pointerId||0],t&&(e.preventDefault(),Object.keys(r).length||(this.action=""),this.cropping&&(this.cropping=!1,Qt(this.dragBox,fn,this.cropped&&this.options.modal)),Ft(this.element,ls,{originalEvent:e,action:t}))}}},vm={change:function(e){var t=this.options,r=this.canvasData,n=this.containerData,a=this.cropBoxData,s=this.pointers,u=this.action,o=t.aspectRatio,l=a.left,f=a.top,h=a.width,d=a.height,C=l+h,p=f+d,T=0,U=0,_=n.width,I=n.height,D=!0,k;!o&&e.shiftKey&&(o=h&&d?h/d:1),this.limited&&(T=a.minLeft,U=a.minTop,_=T+Math.min(n.width,r.width,r.left+r.width),I=U+Math.min(n.height,r.height,r.top+r.height));var x=s[Object.keys(s)[0]],m={x:x.endX-x.startX,y:x.endY-x.startY},H=function(M){switch(M){case at:C+m.x>_&&(m.x=_-C);break;case st:l+m.x<T&&(m.x=T-l);break;case Re:f+m.y<U&&(m.y=U-f);break;case Tt:p+m.y>I&&(m.y=I-p);break}};switch(u){case ss:l+=m.x,f+=m.y;break;case at:if(m.x>=0&&(C>=_||o&&(f<=U||p>=I))){D=!1;break}H(at),h+=m.x,h<0&&(u=st,h=-h,l-=h),o&&(d=h/o,f+=(a.height-d)/2);break;case Re:if(m.y<=0&&(f<=U||o&&(l<=T||C>=_))){D=!1;break}H(Re),d-=m.y,f+=m.y,d<0&&(u=Tt,d=-d,f-=d),o&&(h=d*o,l+=(a.width-h)/2);break;case st:if(m.x<=0&&(l<=T||o&&(f<=U||p>=I))){D=!1;break}H(st),h-=m.x,l+=m.x,h<0&&(u=at,h=-h,l-=h),o&&(d=h/o,f+=(a.height-d)/2);break;case Tt:if(m.y>=0&&(p>=I||o&&(l<=T||C>=_))){D=!1;break}H(Tt),d+=m.y,d<0&&(u=Re,d=-d,f-=d),o&&(h=d*o,l+=(a.width-h)/2);break;case ar:if(o){if(m.y<=0&&(f<=U||C>=_)){D=!1;break}H(Re),d-=m.y,f+=m.y,h=d*o}else H(Re),H(at),m.x>=0?C<_?h+=m.x:m.y<=0&&f<=U&&(D=!1):h+=m.x,m.y<=0?f>U&&(d-=m.y,f+=m.y):(d-=m.y,f+=m.y);h<0&&d<0?(u=ur,d=-d,h=-h,f-=d,l-=h):h<0?(u=sr,h=-h,l-=h):d<0&&(u=ir,d=-d,f-=d);break;case sr:if(o){if(m.y<=0&&(f<=U||l<=T)){D=!1;break}H(Re),d-=m.y,f+=m.y,h=d*o,l+=a.width-h}else H(Re),H(st),m.x<=0?l>T?(h-=m.x,l+=m.x):m.y<=0&&f<=U&&(D=!1):(h-=m.x,l+=m.x),m.y<=0?f>U&&(d-=m.y,f+=m.y):(d-=m.y,f+=m.y);h<0&&d<0?(u=ir,d=-d,h=-h,f-=d,l-=h):h<0?(u=ar,h=-h,l-=h):d<0&&(u=ur,d=-d,f-=d);break;case ur:if(o){if(m.x<=0&&(l<=T||p>=I)){D=!1;break}H(st),h-=m.x,l+=m.x,d=h/o}else H(Tt),H(st),m.x<=0?l>T?(h-=m.x,l+=m.x):m.y>=0&&p>=I&&(D=!1):(h-=m.x,l+=m.x),m.y>=0?p<I&&(d+=m.y):d+=m.y;h<0&&d<0?(u=ar,d=-d,h=-h,f-=d,l-=h):h<0?(u=ir,h=-h,l-=h):d<0&&(u=sr,d=-d,f-=d);break;case ir:if(o){if(m.x>=0&&(C>=_||p>=I)){D=!1;break}H(at),h+=m.x,d=h/o}else H(Tt),H(at),m.x>=0?C<_?h+=m.x:m.y>=0&&p>=I&&(D=!1):h+=m.x,m.y>=0?p<I&&(d+=m.y):d+=m.y;h<0&&d<0?(u=sr,d=-d,h=-h,f-=d,l-=h):h<0?(u=ur,h=-h,l-=h):d<0&&(u=ar,d=-d,f-=d);break;case po:this.move(m.x,m.y),D=!1;break;case Co:this.zoom(mm(s),e),D=!1;break;case mo:if(!m.x||!m.y){D=!1;break}k=ko(this.cropper),l=x.startX-k.left,f=x.startY-k.top,h=a.minWidth,d=a.minHeight,m.x>0?u=m.y>0?ir:ar:m.x<0&&(l-=h,u=m.y>0?ur:sr),m.y<0&&(f-=d),this.cropped||(pe(this.cropBox,qA),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}D&&(a.width=h,a.height=d,a.left=l,a.top=f,this.action=u,this.renderCropBox()),bA(s,function(P){P.startX=P.endX,P.startY=P.endY})}},Lm={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&vA(this.dragBox,fn),pe(this.cropBox,qA),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=gA({},this.initialImageData),this.canvasData=gA({},this.initialCanvasData),this.cropBoxData=gA({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(gA(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),pe(this.dragBox,fn),vA(this.cropBox,qA)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,bA(this.previews,function(r){r.getElementsByTagName("img")[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,pe(this.cropper,wo)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,vA(this.cropper,wo)),this},destroy:function(){var e=this.element;return e[BA]?(e[BA]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.canvasData,n=r.left,a=r.top;return this.moveTo(Bs(e)?e:n+Number(e),Bs(t)?t:a+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.canvasData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(z(e)&&(r.left=e,n=!0),z(t)&&(r.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(e,t){var r=this.canvasData;return e=Number(e),e<0?e=1/(1-e):e=1+e,this.zoomTo(r.width*e/r.naturalWidth,null,t)},zoomTo:function(e,t,r){var n=this.options,a=this.canvasData,s=a.width,u=a.height,o=a.naturalWidth,l=a.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&n.zoomable){var f=o*e,h=l*e;if(Ft(this.element,ds,{ratio:e,oldRatio:s/o,originalEvent:r})===!1)return this;if(r){var d=this.pointers,C=ko(this.cropper),p=d&&Object.keys(d).length?pm(d):{pageX:r.pageX,pageY:r.pageY};a.left-=(f-s)*((p.pageX-C.left-a.left)/s),a.top-=(h-u)*((p.pageY-C.top-a.top)/u)}else bt(t)&&z(t.x)&&z(t.y)?(a.left-=(f-s)*((t.x-a.left)/s),a.top-=(h-u)*((t.y-a.top)/u)):(a.left-=(f-s)/2,a.top-=(h-u)/2);a.width=f,a.height=h,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),z(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,z(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(z(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.imageData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(z(e)&&(r.scaleX=e,n=!0),z(t)&&(r.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,r=this.imageData,n=this.canvasData,a=this.cropBoxData,s;if(this.ready&&this.cropped){s={x:a.left-n.left,y:a.top-n.top,width:a.width,height:a.height};var u=r.width/r.naturalWidth;if(bA(s,function(f,h){s[h]=f/u}),e){var o=Math.round(s.y+s.height),l=Math.round(s.x+s.width);s.x=Math.round(s.x),s.y=Math.round(s.y),s.width=l-s.x,s.height=o-s.y}}else s={x:0,y:0,width:0,height:0};return t.rotatable&&(s.rotate=r.rotate||0),t.scalable&&(s.scaleX=r.scaleX||1,s.scaleY=r.scaleY||1),s},setData:function(e){var t=this.options,r=this.imageData,n=this.canvasData,a={};if(this.ready&&!this.disabled&&bt(e)){var s=!1;t.rotatable&&z(e.rotate)&&e.rotate!==r.rotate&&(r.rotate=e.rotate,s=!0),t.scalable&&(z(e.scaleX)&&e.scaleX!==r.scaleX&&(r.scaleX=e.scaleX,s=!0),z(e.scaleY)&&e.scaleY!==r.scaleY&&(r.scaleY=e.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var u=r.width/r.naturalWidth;z(e.x)&&(a.left=e.x*u+n.left),z(e.y)&&(a.top=e.y*u+n.top),z(e.width)&&(a.width=e.width*u),z(e.height)&&(a.height=e.height*u),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?gA({},this.containerData):{}},getImageData:function(){return this.sized?gA({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&bA(["left","top","width","height","naturalWidth","naturalHeight"],function(r){t[r]=e[r]}),t},setCanvasData:function(e){var t=this.canvasData,r=t.aspectRatio;return this.ready&&!this.disabled&&bt(e)&&(z(e.left)&&(t.left=e.left),z(e.top)&&(t.top=e.top),z(e.width)?(t.width=e.width,t.height=e.width/r):z(e.height)&&(t.height=e.height,t.width=e.height*r),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,r=this.options.aspectRatio,n,a;return this.ready&&this.cropped&&!this.disabled&&bt(e)&&(z(e.left)&&(t.left=e.left),z(e.top)&&(t.top=e.top),z(e.width)&&e.width!==t.width&&(n=!0,t.width=e.width),z(e.height)&&e.height!==t.height&&(a=!0,t.height=e.height),r&&(n?t.height=t.width/r:a&&(t.width=t.height*r)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,r=wm(this.image,this.imageData,t,e);if(!this.cropped)return r;var n=this.getData(e.rounded),a=n.x,s=n.y,u=n.width,o=n.height,l=r.width/Math.floor(t.naturalWidth);l!==1&&(a*=l,s*=l,u*=l,o*=l);var f=u/o,h=ke({aspectRatio:f,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),d=ke({aspectRatio:f,width:e.minWidth||0,height:e.minHeight||0},"cover"),C=ke({aspectRatio:f,width:e.width||(l!==1?r.width:u),height:e.height||(l!==1?r.height:o)}),p=C.width,T=C.height;p=Math.min(h.width,Math.max(d.width,p)),T=Math.min(h.height,Math.max(d.height,T));var U=document.createElement("canvas"),_=U.getContext("2d");U.width=Ut(p),U.height=Ut(T),_.fillStyle=e.fillColor||"transparent",_.fillRect(0,0,p,T);var I=e.imageSmoothingEnabled,D=I===void 0?!0:I,k=e.imageSmoothingQuality;_.imageSmoothingEnabled=D,k&&(_.imageSmoothingQuality=k);var x=r.width,m=r.height,H=a,P=s,M,eA,uA,fA,J,rA;H<=-u||H>x?(H=0,M=0,uA=0,J=0):H<=0?(uA=-H,H=0,M=Math.min(x,u+H),J=M):H<=x&&(uA=0,M=Math.min(u,x-H),J=M),M<=0||P<=-o||P>m?(P=0,eA=0,fA=0,rA=0):P<=0?(fA=-P,P=0,eA=Math.min(m,o+P),rA=eA):P<=m&&(fA=0,eA=Math.min(o,m-P),rA=eA);var oA=[H,P,M,eA];if(J>0&&rA>0){var hA=p/u;oA.push(uA*hA,fA*hA,J*hA,rA*hA)}return _.drawImage.apply(_,[r].concat(Eo(oA.map(function(pA){return Math.floor(Ut(pA))})))),U},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!Bs(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,r=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var a=e===os,s=t.movable&&e===bo;e=a||s?e:Uo,t.dragMode=e,cr(r,or,e),Qt(r,is,a),Qt(r,us,s),t.cropBoxMovable||(cr(n,or,e),Qt(n,is,a),Qt(n,us,s))}return this}},xm=me.Cropper,Go=function(){function A(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(WE(this,A),!e||!im.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=gA({},Ho,bt(t)&&t),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return JE(A,[{key:"init",value:function(){var t=this.element,r=t.tagName.toLowerCase(),n;if(!t[BA]){if(t[BA]=this,r==="img"){if(this.isImg=!0,n=t.getAttribute("src")||"",this.originalUrl=n,!n)return;n=t.src}else r==="canvas"&&window.HTMLCanvasElement&&(n=t.toDataURL());this.load(n)}}},{key:"load",value:function(t){var r=this;if(t){this.url=t,this.imageData={};var n=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(am.test(t)){sm.test(t)?this.read(Um(t)):this.clone();return}var s=new XMLHttpRequest,u=this.clone.bind(this);this.reloading=!0,this.xhr=s,s.onabort=u,s.onerror=u,s.ontimeout=u,s.onprogress=function(){s.getResponseHeader("content-type")!==vo&&s.abort()},s.onload=function(){r.read(s.response)},s.onloadend=function(){r.reloading=!1,r.xhr=null},a.checkCrossOrigin&&Po(t)&&n.crossOrigin&&(t=Ko(t)),s.open("GET",t,!0),s.responseType="arraybuffer",s.withCredentials=n.crossOrigin==="use-credentials",s.send()}}},{key:"read",value:function(t){var r=this.options,n=this.imageData,a=Fm(t),s=0,u=1,o=1;if(a>1){this.url=Qm(t,vo);var l=Im(a);s=l.rotate,u=l.scaleX,o=l.scaleY}r.rotatable&&(n.rotate=s),r.scalable&&(n.scaleX=u,n.scaleY=o),this.clone()}},{key:"clone",value:function(){var t=this.element,r=this.url,n=t.crossOrigin,a=r;this.options.checkCrossOrigin&&Po(r)&&(n||(n="anonymous"),a=Ko(r)),this.crossOrigin=n,this.crossOriginUrl=a;var s=document.createElement("img");n&&(s.crossOrigin=n),s.src=a||r,s.alt=t.alt||"The image to crop",this.image=s,s.onload=this.start.bind(this),s.onerror=this.stop.bind(this),vA(s,To),t.parentNode.insertBefore(s,t.nextSibling)}},{key:"start",value:function(){var t=this,r=this.image;r.onload=null,r.onerror=null,this.sizing=!0;var n=me.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(me.navigator.userAgent),a=function(l,f){gA(t.imageData,{naturalWidth:l,naturalHeight:f,aspectRatio:l/f}),t.initialImageData=gA({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(r.naturalWidth&&!n){a(r.naturalWidth,r.naturalHeight);return}var s=document.createElement("img"),u=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){a(s.width,s.height),n||u.removeChild(s)},s.src=r.src,n||(s.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",u.appendChild(s))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,r=this.options,n=this.image,a=t.parentNode,s=document.createElement("div");s.innerHTML=um;var u=s.querySelector(".".concat(BA,"-container")),o=u.querySelector(".".concat(BA,"-canvas")),l=u.querySelector(".".concat(BA,"-drag-box")),f=u.querySelector(".".concat(BA,"-crop-box")),h=f.querySelector(".".concat(BA,"-face"));this.container=a,this.cropper=u,this.canvas=o,this.dragBox=l,this.cropBox=f,this.viewBox=u.querySelector(".".concat(BA,"-view-box")),this.face=h,o.appendChild(n),vA(t,qA),a.insertBefore(u,t.nextSibling),pe(n,To),this.initPreview(),this.bind(),r.initialAspectRatio=Math.max(0,r.initialAspectRatio)||NaN,r.aspectRatio=Math.max(0,r.aspectRatio)||NaN,r.viewMode=Math.max(0,Math.min(3,Math.round(r.viewMode)))||0,vA(f,qA),r.guides||vA(f.getElementsByClassName("".concat(BA,"-dashed")),qA),r.center||vA(f.getElementsByClassName("".concat(BA,"-center")),qA),r.background&&vA(u,"".concat(BA,"-bg")),r.highlight||vA(h,Am),r.cropBoxMovable&&(vA(h,us),cr(h,or,ss)),r.cropBoxResizable||(vA(f.getElementsByClassName("".concat(BA,"-line")),qA),vA(f.getElementsByClassName("".concat(BA,"-point")),qA)),this.render(),this.ready=!0,this.setDragMode(r.dragMode),r.autoCrop&&this.crop(),this.setData(r.data),jA(r.ready)&&ae(t,yo,r.ready,{once:!0}),Ft(t,yo)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),pe(this.element,qA)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=xm,A}},{key:"setDefaults",value:function(t){gA(Ho,bt(t)&&t)}}])}();gA(Go.prototype,_m,ym,Nm,Sm,vm,Lm);function Hm(A,e){const t=A.split(",")||[],r=t[0].match(/:(.*?);/)[1],n=t[1]&&atob(t[1]);let a=n&&n.length;const s=new Uint8Array(a);for(;a--;)s[a]=n==null?void 0:n.charCodeAt(a);return new File([s],e,{type:r})}const Dm={key:0,contenteditable:"false",class:"z-10 w-[100vw] h-[100vh] bg-[rgba(0,0,0,0.7)] flex flex-col justify-center items-center fixed top-0 left-0 cursor-auto"},Om={class:"w-[700px] flex flex-col bg-white rounded pb-8"},Rm={class:"flex flex-row items-center justify-between px-6 py-4 bg-[#f4f8ff]"},Mm={class:"flex flex-col h-full"},km={class:"flex flex-row justify-center items-start flex-1"},Pm={class:"flex flex-col items-start flex-1"},Km={class:"flex flex-col w-full px-6 py-4"},Vm={class:"flex flex-col w-full"},Gm={class:"flex flex-row items-center"},Ym={class:"relative bg-[#474AFF] text-white rounded p-3"},Xm={class:"flex flex-row items-start justify-between mt-3"},Wm={class:"flex flex-col"},Jm={class:"flex flex-col justify-center items-center border w-[300px] h-[300px]"},qm={key:0,class:"w-full text-center"},jm=["src"],$m={class:"flex flex-col items-center",style:{width:"300px",height:"300px"}},Zm={class:"text-[#999] mt-05 flex justify-center mt-4"},zm={class:"w-full flex justify-end space-x-5 mt-5 px-6"},Ap=["loading"],ep=c.defineComponent({__name:"GpCropper",emits:["cancel","ok"],setup(A,{expose:e,emit:t}){const r=t,n=c.ref({coverUrl:"",inputValue:"",uploadType:2,videoHost:"",videoUrl:""}),a=c.ref(),s=c.ref({autoCrop:!0,autoCropArea:1,background:!0,center:!0,cropBoxResizable:!0,dragMode:"move",preview:".before",toggleDragModeOnDblclick:!0,viewMode:1,zoomOnWheel:!0}),u=c.ref(!1),o=c.ref("image/jpeg"),l=c.ref({afterImg:"",image:null,myCropper:null}),f=x=>{const m=x.target.files[0];m&&(m.name&&(n.value.inputValue=m.name),h(m))};async function h(x){if(!x)return;await k();const m=URL.createObjectURL(x);l.value.image=m,l.value.image&&d(),o.value=x.type}function d(){const x=document.querySelector("#imgId");x&&x.addEventListener("load",()=>{D(),l.value.myCropper=new Go(x,s.value)})}const C=c.ref(!1),p=c.ref();function T(x,m,H,P){p.value=P,a.value=x,x&&x.aspectRatio&&(s.value.aspectRatio=x.aspectRatio),H&&(n.value.inputValue=H),C.value=!0,m&&h(m)}function U(){C.value=!1}const _=()=>{var P,M;if(!l.value.myCropper)return;u.value=!0;var m=l.value.myCropper.getCroppedCanvas({height:(P=a.value)==null?void 0:P.height,imageSmoothingQuality:"high",width:(M=a.value)==null?void 0:M.width}).toDataURL(o.value);l.value.afterImg=m;const H=Hm(l.value.afterImg,n.value.inputValue);r("ok",{file:H,element:p.value}),u.value=!1,k(),D(),U()};function I(){k(),D(),U(),r("cancel")}function D(){l.value.myCropper&&l.value.myCropper.destroy()}function k(){l.value.image=""}return e({handleCloseCropper:U,handleOpenCropper:T}),(x,m)=>{var H,P,M;return C.value?(c.openBlock(),c.createElementBlock("div",Dm,[c.createElementVNode("div",Om,[c.createElementVNode("div",Rm,[m[1]||(m[1]=c.createElementVNode("span",{class:"text-base font-semibold text-[#333]"},"图片裁剪",-1)),c.createElementVNode("span",{class:"text-lg cursor-pointer text-[#999] iconfont icon-shanchu2",onClick:c.withModifiers(I,["stop"])})]),c.createElementVNode("div",Mm,[c.createElementVNode("div",km,[c.createElementVNode("div",Pm,[c.createElementVNode("div",Km,[c.createElementVNode("div",Vm,[c.createElementVNode("div",Gm,[c.createElementVNode("div",Ym,[c.createElementVNode("input",{type:"file",accept:"image/*",onClick:m[0]||(m[0]=c.withModifiers(()=>{},["stop"])),contenteditable:"false",ref:"fileInput",onChange:f,class:"absolute top-0 left-0 w-[110px] h-[40px] opacity-0 cursor-pointer"},null,544),m[2]||(m[2]=c.createElementVNode("span",{id:"uploadHandler",class:"cursor-pointer"}," 选择/更换图片 ",-1))]),m[3]||(m[3]=c.createElementVNode("span",{class:"text-sm text-[#999] ml-3"},"滚动鼠标放大或缩小图片",-1))]),c.createElementVNode("div",Xm,[c.createElementVNode("div",Wm,[c.createElementVNode("div",Jm,[l.value.image?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",qm," 请上传图片 ")),c.createElementVNode("img",{id:"imgId",src:l.value.image,style:{width:"300px"}},null,8,jm)])]),c.createElementVNode("div",$m,[m[4]||(m[4]=c.createElementVNode("div",{class:"before w-[270px] h-[200px] pr-[70px] border"},null,-1)),c.createElementVNode("div",Zm," 预览画像 "+c.toDisplayString(((H=a.value)==null?void 0:H.width)||"")+" "+c.toDisplayString((P=a.value)!=null&&P.width?"x":"")+" "+c.toDisplayString(((M=a.value)==null?void 0:M.height)||""),1)])])])])])]),c.createElementVNode("div",zm,[c.createElementVNode("span",{loading:u.value,class:"!w-22 bg-[#474AFF] text-white rounded py-2 px-6 cursor-pointer",type:"primary",onClick:_}," 确认 ",8,Ap),c.createElementVNode("span",{class:"!w-22 border border-[#DEDEDE] text-[#666] rounded py-2 px-6 cursor-pointer",onClick:I},"取消")])])])])):c.createCommentVNode("",!0)}}}),tp=c.defineComponent({name:"GpModal",props:{visible:{type:Boolean,required:!0},title:{type:String,default:""},okText:{type:String,default:"确定"},cancelText:{type:String,default:"取消"},showOkButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0}},emits:["update:visible","ok","cancel"],setup(A,{emit:e}){const{visible:t,okText:r,cancelText:n,showCloseButton:a}=c.toRefs(A);return{visible:t,okText:r,cancelText:n,showCloseButton:a,onClose:()=>{e("cancel"),e("update:visible",!1)},onOk:()=>{e("ok"),e("update:visible",!1)},onCancel:()=>{e("cancel"),e("update:visible",!1)}}}}),rp={class:"bg-white rounded-lg shadow-xl w-ful"},np={class:"p-4 border-b border-gray-200 relative flex items-center justify-between"},ap={key:0,class:"text-lg font-semibold"},sp={class:"p-4"},ip={key:0,class:"p-4 border-t border-gray-200 flex justify-end space-x-2"};function up(A,e,t,r,n,a){return A.visible?(c.openBlock(),c.createElementBlock("div",{key:0,class:"fixed inset-0 z-[99999] flex items-center justify-center bg-gray-900 bg-opacity-50",onClick:e[3]||(e[3]=c.withModifiers((...s)=>A.onClose&&A.onClose(...s),["self"]))},[c.createElementVNode("div",rp,[c.createElementVNode("div",np,[A.title?(c.openBlock(),c.createElementBlock("h3",ap,c.toDisplayString(A.title),1)):c.createCommentVNode("",!0),c.renderSlot(A.$slots,"header"),A.showCloseButton?(c.openBlock(),c.createElementBlock("button",{key:1,class:"text-gray-400 hover:text-gray-600",onClick:e[0]||(e[0]=(...s)=>A.onClose&&A.onClose(...s)),"aria-label":"Close"},e[4]||(e[4]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[c.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)]))):c.createCommentVNode("",!0)]),c.createElementVNode("div",sp,[c.renderSlot(A.$slots,"default")]),A.showCancelButton||A.showOkButton?(c.openBlock(),c.createElementBlock("div",ip,[c.renderSlot(A.$slots,"footer",{},()=>[A.showCancelButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded hover:bg-gray-200",onClick:e[1]||(e[1]=(...s)=>A.onCancel&&A.onCancel(...s))},c.toDisplayString(A.cancelText),1)):c.createCommentVNode("",!0),A.showOkButton?(c.openBlock(),c.createElementBlock("button",{key:1,class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700",onClick:e[2]||(e[2]=(...s)=>A.onOk&&A.onOk(...s))},c.toDisplayString(A.okText),1)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0)}const op=Oe(tp,[["render",up]]),cp={class:"p-4 flex flex-wrap max-h-[500px] overflow-y-auto w-[640px]"},lp=["onClick"],fp=c.defineComponent({__name:"GpIcon",props:{icons:{type:Array,default:()=>[]}},emits:["ok"],setup(A,{expose:e,emit:t}){const r=A,n=t,a=c.ref(r.icons||[]);c.watch(()=>r.icons,h=>{a.value=h||[]},{immediate:!0});const s=c.ref(!1),u=c.ref();function o(h){s.value=!0,u.value=h}function l(h){f(),n("ok",{icon:h,element:u.value})}function f(){s.value=!1}return e({openModal:o,closeModal:f}),(h,d)=>(c.openBlock(),c.createBlock(op,{visible:s.value,"onUpdate:visible":d[0]||(d[0]=C=>s.value=C),title:"选择图标",onOk:f,onCancel:f,showCancelButton:!1,showOkButton:!1},{default:c.withCtx(()=>[c.createElementVNode("div",cp,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,C=>(c.openBlock(),c.createElementBlock("span",{key:C,onClick:c.withModifiers(p=>l(C),["stop"]),style:{position:"unset",color:"unset",top:"unset",left:"unset",right:"unset",transform:"unset","font-size":"unset"},class:c.normalizeClass(["w-12 h-12 mx-1 mb-2 border cursor-pointer hover:border-gray-400 hover:bg-gray-200",`iconfont icon-${C} text-4xl overflow-hidden flex justify-center items-center`])},null,10,lp))),128))])]),_:1},8,["visible"]))}}),hp=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},show:{type:Boolean,default:!0}},setup(A,{emit:e}){const t=c.ref(null),r=c.ref([]),n=c.ref(),a=c.ref(A.show);c.watch(()=>A.show,f=>{a.value=f},{immediate:!0});const s=()=>{var f;(f=t.value)==null||f.click()},u=async f=>{var p;const d=f.target.files;if(!d)return;const C=[];for(let T=0;T<d.length;T++){const U=d[T];if(A.beforeUpload&&await A.beforeUpload(U)===!1)continue;const _=`${Date.now()}-${U.name}`,I=URL.createObjectURL(U),D=document.createElement("img");D.src=I,document.body.appendChild(D),await new Promise(m=>{D.onload=m});const k=D.width,x=D.height;document.body.removeChild(D),C.push({uid:_,name:U.name,status:"uploading",thumbUrl:I,file:U,width:k,height:x})}A.maxCount&&r.value.length+C.length>A.maxCount&&C.splice(A.maxCount-r.value.length),A.multiple?r.value=[...r.value,...C]:r.value=C.slice(0,1),(p=A.onChange)==null||p.call(A,r.value,n.value),e("update:fileList",r.value),t.value&&(t.value.value="")},o=f=>{var h;r.value=r.value.filter(d=>d.uid!==f),(h=A.onChange)==null||h.call(A,r.value,n.value)};function l(f){n.value=f,s()}return{isShow:a,openModal:l,inputRef:t,fileList:r,triggerInput:s,handleChange:u,removeFile:o}}}),dp={class:"upload-wrapper"},Bp=["accept","multiple"],gp={key:1,class:"file-list mt-4"},Ep={class:"flex items-center space-x-4"},mp=["src"],pp=["onClick"];function Cp(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",dp,[A.isShow?(c.openBlock(),c.createElementBlock("div",{key:0,class:"",onClick:e[0]||(e[0]=(...s)=>A.triggerInput&&A.triggerInput(...s))},[c.renderSlot(A.$slots,"upload-icon",{},()=>[e[2]||(e[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.createCommentVNode("",!0),c.createElementVNode("input",{type:"file",ref:"inputRef",class:"hidden",accept:A.accept,multiple:A.multiple,onChange:e[1]||(e[1]=(...s)=>A.handleChange&&A.handleChange(...s))},null,40,Bp),A.showList?(c.openBlock(),c.createElementBlock("div",gp,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(A.fileList,s=>(c.openBlock(),c.createElementBlock("div",{key:s.uid,class:"file-item flex items-center justify-between p-2 border rounded mb-2"},[c.createElementVNode("div",Ep,[s.thumbUrl?(c.openBlock(),c.createElementBlock("img",{key:0,src:s.thumbUrl,alt:"preview",class:"w-12 h-12 object-cover rounded"},null,8,mp)):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(s.name),1)]),c.createElementVNode("div",null,[c.createElementVNode("button",{onClick:u=>A.removeFile(s.uid),class:"text-red-500 hover:underline"}," 删除 ",8,pp)])]))),128))])):c.createCommentVNode("",!0)])}const wp=Oe(hp,[["render",Cp],["__scopeId","data-v-08babff9"]]);/*!
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ln=typeof window<"u"&&typeof window.document<"u",me=ln?window:{},ns=ln&&me.document.documentElement?"ontouchstart"in me.document.documentElement:!1,as=ln?"PointerEvent"in me:!1,BA="cropper",ss="all",mo="crop",po="move",Co="zoom",at="e",st="w",Tt="s",Re="n",ar="ne",sr="nw",ir="se",ur="sw",is="".concat(BA,"-crop"),wo="".concat(BA,"-disabled"),qA="".concat(BA,"-hidden"),To="".concat(BA,"-hide"),Am="".concat(BA,"-invisible"),fn="".concat(BA,"-modal"),us="".concat(BA,"-move"),or="".concat(BA,"Action"),hn="".concat(BA,"Preview"),os="crop",bo="move",Uo="none",cs="crop",ls="cropend",fs="cropmove",hs="cropstart",Qo="dblclick",em=ns?"touchstart":"mousedown",tm=ns?"touchmove":"mousemove",rm=ns?"touchend touchcancel":"mouseup",Fo=as?"pointerdown":em,Io=as?"pointermove":tm,_o=as?"pointerup pointercancel":rm,yo="ready",No="resize",So="wheel",ds="zoom",vo="image/jpeg",nm=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,am=/^data:/,sm=/^data:image\/jpeg;base64,/,im=/^img|canvas$/i,Lo=200,xo=100,Ho={viewMode:0,dragMode:os,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Lo,minContainerHeight:xo,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},um='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',om=Number.isNaN||me.isNaN;function z(A){return typeof A=="number"&&!om(A)}var Do=function(e){return e>0&&e<1/0};function Bs(A){return typeof A>"u"}function it(A){return ts(A)==="object"&&A!==null}var cm=Object.prototype.hasOwnProperty;function bt(A){if(!it(A))return!1;try{var e=A.constructor,t=e.prototype;return e&&t&&cm.call(t,"isPrototypeOf")}catch{return!1}}function jA(A){return typeof A=="function"}var lm=Array.prototype.slice;function Oo(A){return Array.from?Array.from(A):lm.call(A)}function bA(A,e){return A&&jA(e)&&(Array.isArray(A)||z(A.length)?Oo(A).forEach(function(t,r){e.call(A,t,r,A)}):it(A)&&Object.keys(A).forEach(function(t){e.call(A,A[t],t,A)})),A}var gA=Object.assign||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return it(e)&&r.length>0&&r.forEach(function(a){it(a)&&Object.keys(a).forEach(function(s){e[s]=a[s]})}),e},fm=/\.\d*(?:0|9){12}\d*$/;function Ut(A){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return fm.test(A)?Math.round(A*e)/e:A}var hm=/^width|height|left|top|marginLeft|marginTop$/;function Me(A,e){var t=A.style;bA(e,function(r,n){hm.test(n)&&z(r)&&(r="".concat(r,"px")),t[n]=r})}function dm(A,e){return A.classList?A.classList.contains(e):A.className.indexOf(e)>-1}function vA(A,e){if(e){if(z(A.length)){bA(A,function(r){vA(r,e)});return}if(A.classList){A.classList.add(e);return}var t=A.className.trim();t?t.indexOf(e)<0&&(A.className="".concat(t," ").concat(e)):A.className=e}}function pe(A,e){if(e){if(z(A.length)){bA(A,function(t){pe(t,e)});return}if(A.classList){A.classList.remove(e);return}A.className.indexOf(e)>=0&&(A.className=A.className.replace(e,""))}}function Qt(A,e,t){if(e){if(z(A.length)){bA(A,function(r){Qt(r,e,t)});return}t?vA(A,e):pe(A,e)}}var Bm=/([a-z\d])([A-Z])/g;function gs(A){return A.replace(Bm,"$1-$2").toLowerCase()}function Es(A,e){return it(A[e])?A[e]:A.dataset?A.dataset[e]:A.getAttribute("data-".concat(gs(e)))}function cr(A,e,t){it(t)?A[e]=t:A.dataset?A.dataset[e]=t:A.setAttribute("data-".concat(gs(e)),t)}function gm(A,e){if(it(A[e]))try{delete A[e]}catch{A[e]=void 0}else if(A.dataset)try{delete A.dataset[e]}catch{A.dataset[e]=void 0}else A.removeAttribute("data-".concat(gs(e)))}var Ro=/\s\s*/,Mo=function(){var A=!1;if(ln){var e=!1,t=function(){},r=Object.defineProperty({},"once",{get:function(){return A=!0,e},set:function(a){e=a}});me.addEventListener("test",t,r),me.removeEventListener("test",t,r)}return A}();function fe(A,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;e.trim().split(Ro).forEach(function(a){if(!Mo){var s=A.listeners;s&&s[a]&&s[a][t]&&(n=s[a][t],delete s[a][t],Object.keys(s[a]).length===0&&delete s[a],Object.keys(s).length===0&&delete A.listeners)}A.removeEventListener(a,n,r)})}function ae(A,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;e.trim().split(Ro).forEach(function(a){if(r.once&&!Mo){var s=A.listeners,u=s===void 0?{}:s;n=function(){delete u[a][t],A.removeEventListener(a,n,r);for(var l=arguments.length,f=new Array(l),h=0;h<l;h++)f[h]=arguments[h];t.apply(A,f)},u[a]||(u[a]={}),u[a][t]&&A.removeEventListener(a,u[a][t],r),u[a][t]=n,A.listeners=u}A.addEventListener(a,n,r)})}function Ft(A,e,t){var r;return jA(Event)&&jA(CustomEvent)?r=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(e,!0,!0,t)),A.dispatchEvent(r)}function ko(A){var e=A.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var ms=me.location,Em=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Po(A){var e=A.match(Em);return e!==null&&(e[1]!==ms.protocol||e[2]!==ms.hostname||e[3]!==ms.port)}function Ko(A){var e="timestamp=".concat(new Date().getTime());return A+(A.indexOf("?")===-1?"?":"&")+e}function lr(A){var e=A.rotate,t=A.scaleX,r=A.scaleY,n=A.translateX,a=A.translateY,s=[];z(n)&&n!==0&&s.push("translateX(".concat(n,"px)")),z(a)&&a!==0&&s.push("translateY(".concat(a,"px)")),z(e)&&e!==0&&s.push("rotate(".concat(e,"deg)")),z(t)&&t!==1&&s.push("scaleX(".concat(t,")")),z(r)&&r!==1&&s.push("scaleY(".concat(r,")"));var u=s.length?s.join(" "):"none";return{WebkitTransform:u,msTransform:u,transform:u}}function mm(A){var e=ho({},A),t=0;return bA(A,function(r,n){delete e[n],bA(e,function(a){var s=Math.abs(r.startX-a.startX),u=Math.abs(r.startY-a.startY),o=Math.abs(r.endX-a.endX),l=Math.abs(r.endY-a.endY),f=Math.sqrt(s*s+u*u),h=Math.sqrt(o*o+l*l),d=(h-f)/f;Math.abs(d)>Math.abs(t)&&(t=d)})}),t}function dn(A,e){var t=A.pageX,r=A.pageY,n={endX:t,endY:r};return e?n:ho({startX:t,startY:r},n)}function pm(A){var e=0,t=0,r=0;return bA(A,function(n){var a=n.startX,s=n.startY;e+=a,t+=s,r+=1}),e/=r,t/=r,{pageX:e,pageY:t}}function ke(A){var e=A.aspectRatio,t=A.height,r=A.width,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=Do(r),s=Do(t);if(a&&s){var u=t*e;n==="contain"&&u>r||n==="cover"&&u<r?t=r/e:r=t*e}else a?t=r/e:s&&(r=t*e);return{width:r,height:t}}function Cm(A){var e=A.width,t=A.height,r=A.degree;if(r=Math.abs(r)%180,r===90)return{width:t,height:e};var n=r%90*Math.PI/180,a=Math.sin(n),s=Math.cos(n),u=e*s+t*a,o=e*a+t*s;return r>90?{width:o,height:u}:{width:u,height:o}}function wm(A,e,t,r){var n=e.aspectRatio,a=e.naturalWidth,s=e.naturalHeight,u=e.rotate,o=u===void 0?0:u,l=e.scaleX,f=l===void 0?1:l,h=e.scaleY,d=h===void 0?1:h,C=t.aspectRatio,p=t.naturalWidth,T=t.naturalHeight,U=r.fillColor,_=U===void 0?"transparent":U,I=r.imageSmoothingEnabled,D=I===void 0?!0:I,k=r.imageSmoothingQuality,x=k===void 0?"low":k,m=r.maxWidth,H=m===void 0?1/0:m,P=r.maxHeight,M=P===void 0?1/0:P,eA=r.minWidth,uA=eA===void 0?0:eA,fA=r.minHeight,J=fA===void 0?0:fA,rA=document.createElement("canvas"),oA=rA.getContext("2d"),hA=ke({aspectRatio:C,width:H,height:M}),pA=ke({aspectRatio:C,width:uA,height:J},"cover"),GA=Math.min(hA.width,Math.max(pA.width,p)),IA=Math.min(hA.height,Math.max(pA.height,T)),KA=ke({aspectRatio:n,width:H,height:M}),xA=ke({aspectRatio:n,width:uA,height:J},"cover"),ZA=Math.min(KA.width,Math.max(xA.width,a)),_A=Math.min(KA.height,Math.max(xA.height,s)),S=[-ZA/2,-_A/2,ZA,_A];return rA.width=Ut(GA),rA.height=Ut(IA),oA.fillStyle=_,oA.fillRect(0,0,GA,IA),oA.save(),oA.translate(GA/2,IA/2),oA.rotate(o*Math.PI/180),oA.scale(f,d),oA.imageSmoothingEnabled=D,oA.imageSmoothingQuality=x,oA.drawImage.apply(oA,[A].concat(Eo(S.map(function(v){return Math.floor(Ut(v))})))),oA.restore(),rA}var Vo=String.fromCharCode;function Tm(A,e,t){var r="";t+=e;for(var n=e;n<t;n+=1)r+=Vo(A.getUint8(n));return r}var bm=/^data:.*,/;function Um(A){var e=A.replace(bm,""),t=atob(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);return bA(n,function(a,s){n[s]=t.charCodeAt(s)}),r}function Qm(A,e){for(var t=[],r=8192,n=new Uint8Array(A);n.length>0;)t.push(Vo.apply(null,Oo(n.subarray(0,r)))),n=n.subarray(r);return"data:".concat(e,";base64,").concat(btoa(t.join("")))}function Fm(A){var e=new DataView(A),t;try{var r,n,a;if(e.getUint8(0)===255&&e.getUint8(1)===216)for(var s=e.byteLength,u=2;u+1<s;){if(e.getUint8(u)===255&&e.getUint8(u+1)===225){n=u;break}u+=1}if(n){var o=n+4,l=n+10;if(Tm(e,o,4)==="Exif"){var f=e.getUint16(l);if(r=f===18761,(r||f===19789)&&e.getUint16(l+2,r)===42){var h=e.getUint32(l+4,r);h>=8&&(a=l+h)}}}if(a){var d=e.getUint16(a,r),C,p;for(p=0;p<d;p+=1)if(C=a+p*12+2,e.getUint16(C,r)===274){C+=8,t=e.getUint16(C,r),e.setUint16(C,1,r);break}}}catch{t=1}return t}function Im(A){var e=0,t=1,r=1;switch(A){case 2:t=-1;break;case 3:e=-180;break;case 4:r=-1;break;case 5:e=90,r=-1;break;case 6:e=90;break;case 7:e=90,t=-1;break;case 8:e=-90;break}return{rotate:e,scaleX:t,scaleY:r}}var _m={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,r=this.container,n=this.cropper,a=Number(t.minContainerWidth),s=Number(t.minContainerHeight);vA(n,qA),pe(e,qA);var u={width:Math.max(r.offsetWidth,a>=0?a:Lo),height:Math.max(r.offsetHeight,s>=0?s:xo)};this.containerData=u,Me(n,{width:u.width,height:u.height}),vA(e,qA),pe(n,qA)},initCanvas:function(){var e=this.containerData,t=this.imageData,r=this.options.viewMode,n=Math.abs(t.rotate)%180===90,a=n?t.naturalHeight:t.naturalWidth,s=n?t.naturalWidth:t.naturalHeight,u=a/s,o=e.width,l=e.height;e.height*u>e.width?r===3?o=e.height*u:l=e.width/u:r===3?l=e.width/u:o=e.height*u;var f={aspectRatio:u,naturalWidth:a,naturalHeight:s,width:o,height:l};this.canvasData=f,this.limited=r===1||r===2,this.limitCanvas(!0,!0),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),f.left=(e.width-f.width)/2,f.top=(e.height-f.height)/2,f.oldLeft=f.left,f.oldTop=f.top,this.initialCanvasData=gA({},f)},limitCanvas:function(e,t){var r=this.options,n=this.containerData,a=this.canvasData,s=this.cropBoxData,u=r.viewMode,o=a.aspectRatio,l=this.cropped&&s;if(e){var f=Number(r.minCanvasWidth)||0,h=Number(r.minCanvasHeight)||0;u>1?(f=Math.max(f,n.width),h=Math.max(h,n.height),u===3&&(h*o>f?f=h*o:h=f/o)):u>0&&(f?f=Math.max(f,l?s.width:0):h?h=Math.max(h,l?s.height:0):l&&(f=s.width,h=s.height,h*o>f?f=h*o:h=f/o));var d=ke({aspectRatio:o,width:f,height:h});f=d.width,h=d.height,a.minWidth=f,a.minHeight=h,a.maxWidth=1/0,a.maxHeight=1/0}if(t)if(u>(l?0:1)){var C=n.width-a.width,p=n.height-a.height;a.minLeft=Math.min(0,C),a.minTop=Math.min(0,p),a.maxLeft=Math.max(0,C),a.maxTop=Math.max(0,p),l&&this.limited&&(a.minLeft=Math.min(s.left,s.left+(s.width-a.width)),a.minTop=Math.min(s.top,s.top+(s.height-a.height)),a.maxLeft=s.left,a.maxTop=s.top,u===2&&(a.width>=n.width&&(a.minLeft=Math.min(0,C),a.maxLeft=Math.max(0,C)),a.height>=n.height&&(a.minTop=Math.min(0,p),a.maxTop=Math.max(0,p))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=n.width,a.maxTop=n.height},renderCanvas:function(e,t){var r=this.canvasData,n=this.imageData;if(t){var a=Cm({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),s=a.width,u=a.height,o=r.width*(s/r.naturalWidth),l=r.height*(u/r.naturalHeight);r.left-=(o-r.width)/2,r.top-=(l-r.height)/2,r.width=o,r.height=l,r.aspectRatio=s/u,r.naturalWidth=s,r.naturalHeight=u,this.limitCanvas(!0,!1)}(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCanvas(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,Me(this.canvas,gA({width:r.width,height:r.height},lr({translateX:r.left,translateY:r.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,r=this.imageData,n=r.naturalWidth*(t.width/t.naturalWidth),a=r.naturalHeight*(t.height/t.naturalHeight);gA(r,{width:n,height:a,left:(t.width-n)/2,top:(t.height-a)/2}),Me(this.image,gA({width:r.width,height:r.height},lr(gA({translateX:r.left,translateY:r.top},r)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,r=e.aspectRatio||e.initialAspectRatio,n=Number(e.autoCropArea)||.8,a={width:t.width,height:t.height};r&&(t.height*r>t.width?a.height=a.width/r:a.width=a.height*r),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*n),a.height=Math.max(a.minHeight,a.height*n),a.left=t.left+(t.width-a.width)/2,a.top=t.top+(t.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=gA({},a)},limitCropBox:function(e,t){var r=this.options,n=this.containerData,a=this.canvasData,s=this.cropBoxData,u=this.limited,o=r.aspectRatio;if(e){var l=Number(r.minCropBoxWidth)||0,f=Number(r.minCropBoxHeight)||0,h=u?Math.min(n.width,a.width,a.width+a.left,n.width-a.left):n.width,d=u?Math.min(n.height,a.height,a.height+a.top,n.height-a.top):n.height;l=Math.min(l,n.width),f=Math.min(f,n.height),o&&(l&&f?f*o>l?f=l/o:l=f*o:l?f=l/o:f&&(l=f*o),d*o>h?d=h/o:h=d*o),s.minWidth=Math.min(l,h),s.minHeight=Math.min(f,d),s.maxWidth=h,s.maxHeight=d}t&&(u?(s.minLeft=Math.max(0,a.left),s.minTop=Math.max(0,a.top),s.maxLeft=Math.min(n.width,a.left+a.width)-s.width,s.maxTop=Math.min(n.height,a.top+a.height)-s.height):(s.minLeft=0,s.minTop=0,s.maxLeft=n.width-s.width,s.maxTop=n.height-s.height))},renderCropBox:function(){var e=this.options,t=this.containerData,r=this.cropBoxData;(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCropBox(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,e.movable&&e.cropBoxMovable&&cr(this.face,or,r.width>=t.width&&r.height>=t.height?po:ss),Me(this.cropBox,gA({width:r.width,height:r.height},lr({translateX:r.left,translateY:r.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ft(this.element,cs,this.getData())}},ym={initPreview:function(){var e=this.element,t=this.crossOrigin,r=this.options.preview,n=t?this.crossOriginUrl:this.url,a=e.alt||"The image to preview",s=document.createElement("img");if(t&&(s.crossOrigin=t),s.src=n,s.alt=a,this.viewBox.appendChild(s),this.viewBoxImage=s,!!r){var u=r;typeof r=="string"?u=e.ownerDocument.querySelectorAll(r):r.querySelector&&(u=[r]),this.previews=u,bA(u,function(o){var l=document.createElement("img");cr(o,hn,{width:o.offsetWidth,height:o.offsetHeight,html:o.innerHTML}),t&&(l.crossOrigin=t),l.src=n,l.alt=a,l.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',o.innerHTML="",o.appendChild(l)})}},resetPreview:function(){bA(this.previews,function(e){var t=Es(e,hn);Me(e,{width:t.width,height:t.height}),e.innerHTML=t.html,gm(e,hn)})},preview:function(){var e=this.imageData,t=this.canvasData,r=this.cropBoxData,n=r.width,a=r.height,s=e.width,u=e.height,o=r.left-t.left-e.left,l=r.top-t.top-e.top;!this.cropped||this.disabled||(Me(this.viewBoxImage,gA({width:s,height:u},lr(gA({translateX:-o,translateY:-l},e)))),bA(this.previews,function(f){var h=Es(f,hn),d=h.width,C=h.height,p=d,T=C,U=1;n&&(U=d/n,T=a*U),a&&T>C&&(U=C/a,p=n*U,T=C),Me(f,{width:p,height:T}),Me(f.getElementsByTagName("img")[0],gA({width:s*U,height:u*U},lr(gA({translateX:-o*U,translateY:-l*U},e))))}))}},Nm={bind:function(){var e=this.element,t=this.options,r=this.cropper;jA(t.cropstart)&&ae(e,hs,t.cropstart),jA(t.cropmove)&&ae(e,fs,t.cropmove),jA(t.cropend)&&ae(e,ls,t.cropend),jA(t.crop)&&ae(e,cs,t.crop),jA(t.zoom)&&ae(e,ds,t.zoom),ae(r,Fo,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ae(r,So,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ae(r,Qo,this.onDblclick=this.dblclick.bind(this)),ae(e.ownerDocument,Io,this.onCropMove=this.cropMove.bind(this)),ae(e.ownerDocument,_o,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ae(window,No,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,r=this.cropper;jA(t.cropstart)&&fe(e,hs,t.cropstart),jA(t.cropmove)&&fe(e,fs,t.cropmove),jA(t.cropend)&&fe(e,ls,t.cropend),jA(t.crop)&&fe(e,cs,t.crop),jA(t.zoom)&&fe(e,ds,t.zoom),fe(r,Fo,this.onCropStart),t.zoomable&&t.zoomOnWheel&&fe(r,So,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&fe(r,Qo,this.onDblclick),fe(e.ownerDocument,Io,this.onCropMove),fe(e.ownerDocument,_o,this.onCropEnd),t.responsive&&fe(window,No,this.onResize)}},Sm={resize:function(){if(!this.disabled){var e=this.options,t=this.container,r=this.containerData,n=t.offsetWidth/r.width,a=t.offsetHeight/r.height,s=Math.abs(n-1)>Math.abs(a-1)?n:a;if(s!==1){var u,o;e.restore&&(u=this.getCanvasData(),o=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(bA(u,function(l,f){u[f]=l*s})),this.setCropBoxData(bA(o,function(l,f){o[f]=l*s})))}}},dblclick:function(){this.disabled||this.options.dragMode===Uo||this.setDragMode(dm(this.dragBox,is)?bo:os)},wheel:function(e){var t=this,r=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*r,e)))},cropStart:function(e){var t=e.buttons,r=e.button;if(!(this.disabled||(e.type==="mousedown"||e.type==="pointerdown"&&e.pointerType==="mouse")&&(z(t)&&t!==1||z(r)&&r!==0||e.ctrlKey))){var n=this.options,a=this.pointers,s;e.changedTouches?bA(e.changedTouches,function(u){a[u.identifier]=dn(u)}):a[e.pointerId||0]=dn(e),Object.keys(a).length>1&&n.zoomable&&n.zoomOnTouch?s=Co:s=Es(e.target,or),nm.test(s)&&Ft(this.element,hs,{originalEvent:e,action:s})!==!1&&(e.preventDefault(),this.action=s,this.cropping=!1,s===mo&&(this.cropping=!0,vA(this.dragBox,fn)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var r=this.pointers;e.preventDefault(),Ft(this.element,fs,{originalEvent:e,action:t})!==!1&&(e.changedTouches?bA(e.changedTouches,function(n){gA(r[n.identifier]||{},dn(n,!0))}):gA(r[e.pointerId||0]||{},dn(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,r=this.pointers;e.changedTouches?bA(e.changedTouches,function(n){delete r[n.identifier]}):delete r[e.pointerId||0],t&&(e.preventDefault(),Object.keys(r).length||(this.action=""),this.cropping&&(this.cropping=!1,Qt(this.dragBox,fn,this.cropped&&this.options.modal)),Ft(this.element,ls,{originalEvent:e,action:t}))}}},vm={change:function(e){var t=this.options,r=this.canvasData,n=this.containerData,a=this.cropBoxData,s=this.pointers,u=this.action,o=t.aspectRatio,l=a.left,f=a.top,h=a.width,d=a.height,C=l+h,p=f+d,T=0,U=0,_=n.width,I=n.height,D=!0,k;!o&&e.shiftKey&&(o=h&&d?h/d:1),this.limited&&(T=a.minLeft,U=a.minTop,_=T+Math.min(n.width,r.width,r.left+r.width),I=U+Math.min(n.height,r.height,r.top+r.height));var x=s[Object.keys(s)[0]],m={x:x.endX-x.startX,y:x.endY-x.startY},H=function(M){switch(M){case at:C+m.x>_&&(m.x=_-C);break;case st:l+m.x<T&&(m.x=T-l);break;case Re:f+m.y<U&&(m.y=U-f);break;case Tt:p+m.y>I&&(m.y=I-p);break}};switch(u){case ss:l+=m.x,f+=m.y;break;case at:if(m.x>=0&&(C>=_||o&&(f<=U||p>=I))){D=!1;break}H(at),h+=m.x,h<0&&(u=st,h=-h,l-=h),o&&(d=h/o,f+=(a.height-d)/2);break;case Re:if(m.y<=0&&(f<=U||o&&(l<=T||C>=_))){D=!1;break}H(Re),d-=m.y,f+=m.y,d<0&&(u=Tt,d=-d,f-=d),o&&(h=d*o,l+=(a.width-h)/2);break;case st:if(m.x<=0&&(l<=T||o&&(f<=U||p>=I))){D=!1;break}H(st),h-=m.x,l+=m.x,h<0&&(u=at,h=-h,l-=h),o&&(d=h/o,f+=(a.height-d)/2);break;case Tt:if(m.y>=0&&(p>=I||o&&(l<=T||C>=_))){D=!1;break}H(Tt),d+=m.y,d<0&&(u=Re,d=-d,f-=d),o&&(h=d*o,l+=(a.width-h)/2);break;case ar:if(o){if(m.y<=0&&(f<=U||C>=_)){D=!1;break}H(Re),d-=m.y,f+=m.y,h=d*o}else H(Re),H(at),m.x>=0?C<_?h+=m.x:m.y<=0&&f<=U&&(D=!1):h+=m.x,m.y<=0?f>U&&(d-=m.y,f+=m.y):(d-=m.y,f+=m.y);h<0&&d<0?(u=ur,d=-d,h=-h,f-=d,l-=h):h<0?(u=sr,h=-h,l-=h):d<0&&(u=ir,d=-d,f-=d);break;case sr:if(o){if(m.y<=0&&(f<=U||l<=T)){D=!1;break}H(Re),d-=m.y,f+=m.y,h=d*o,l+=a.width-h}else H(Re),H(st),m.x<=0?l>T?(h-=m.x,l+=m.x):m.y<=0&&f<=U&&(D=!1):(h-=m.x,l+=m.x),m.y<=0?f>U&&(d-=m.y,f+=m.y):(d-=m.y,f+=m.y);h<0&&d<0?(u=ir,d=-d,h=-h,f-=d,l-=h):h<0?(u=ar,h=-h,l-=h):d<0&&(u=ur,d=-d,f-=d);break;case ur:if(o){if(m.x<=0&&(l<=T||p>=I)){D=!1;break}H(st),h-=m.x,l+=m.x,d=h/o}else H(Tt),H(st),m.x<=0?l>T?(h-=m.x,l+=m.x):m.y>=0&&p>=I&&(D=!1):(h-=m.x,l+=m.x),m.y>=0?p<I&&(d+=m.y):d+=m.y;h<0&&d<0?(u=ar,d=-d,h=-h,f-=d,l-=h):h<0?(u=ir,h=-h,l-=h):d<0&&(u=sr,d=-d,f-=d);break;case ir:if(o){if(m.x>=0&&(C>=_||p>=I)){D=!1;break}H(at),h+=m.x,d=h/o}else H(Tt),H(at),m.x>=0?C<_?h+=m.x:m.y>=0&&p>=I&&(D=!1):h+=m.x,m.y>=0?p<I&&(d+=m.y):d+=m.y;h<0&&d<0?(u=sr,d=-d,h=-h,f-=d,l-=h):h<0?(u=ur,h=-h,l-=h):d<0&&(u=ar,d=-d,f-=d);break;case po:this.move(m.x,m.y),D=!1;break;case Co:this.zoom(mm(s),e),D=!1;break;case mo:if(!m.x||!m.y){D=!1;break}k=ko(this.cropper),l=x.startX-k.left,f=x.startY-k.top,h=a.minWidth,d=a.minHeight,m.x>0?u=m.y>0?ir:ar:m.x<0&&(l-=h,u=m.y>0?ur:sr),m.y<0&&(f-=d),this.cropped||(pe(this.cropBox,qA),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}D&&(a.width=h,a.height=d,a.left=l,a.top=f,this.action=u,this.renderCropBox()),bA(s,function(P){P.startX=P.endX,P.startY=P.endY})}},Lm={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&vA(this.dragBox,fn),pe(this.cropBox,qA),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=gA({},this.initialImageData),this.canvasData=gA({},this.initialCanvasData),this.cropBoxData=gA({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(gA(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),pe(this.dragBox,fn),vA(this.cropBox,qA)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,bA(this.previews,function(r){r.getElementsByTagName("img")[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,pe(this.cropper,wo)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,vA(this.cropper,wo)),this},destroy:function(){var e=this.element;return e[BA]?(e[BA]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.canvasData,n=r.left,a=r.top;return this.moveTo(Bs(e)?e:n+Number(e),Bs(t)?t:a+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.canvasData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(z(e)&&(r.left=e,n=!0),z(t)&&(r.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(e,t){var r=this.canvasData;return e=Number(e),e<0?e=1/(1-e):e=1+e,this.zoomTo(r.width*e/r.naturalWidth,null,t)},zoomTo:function(e,t,r){var n=this.options,a=this.canvasData,s=a.width,u=a.height,o=a.naturalWidth,l=a.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&n.zoomable){var f=o*e,h=l*e;if(Ft(this.element,ds,{ratio:e,oldRatio:s/o,originalEvent:r})===!1)return this;if(r){var d=this.pointers,C=ko(this.cropper),p=d&&Object.keys(d).length?pm(d):{pageX:r.pageX,pageY:r.pageY};a.left-=(f-s)*((p.pageX-C.left-a.left)/s),a.top-=(h-u)*((p.pageY-C.top-a.top)/u)}else bt(t)&&z(t.x)&&z(t.y)?(a.left-=(f-s)*((t.x-a.left)/s),a.top-=(h-u)*((t.y-a.top)/u)):(a.left-=(f-s)/2,a.top-=(h-u)/2);a.width=f,a.height=h,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),z(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,z(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(z(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=this.imageData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(z(e)&&(r.scaleX=e,n=!0),z(t)&&(r.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,r=this.imageData,n=this.canvasData,a=this.cropBoxData,s;if(this.ready&&this.cropped){s={x:a.left-n.left,y:a.top-n.top,width:a.width,height:a.height};var u=r.width/r.naturalWidth;if(bA(s,function(f,h){s[h]=f/u}),e){var o=Math.round(s.y+s.height),l=Math.round(s.x+s.width);s.x=Math.round(s.x),s.y=Math.round(s.y),s.width=l-s.x,s.height=o-s.y}}else s={x:0,y:0,width:0,height:0};return t.rotatable&&(s.rotate=r.rotate||0),t.scalable&&(s.scaleX=r.scaleX||1,s.scaleY=r.scaleY||1),s},setData:function(e){var t=this.options,r=this.imageData,n=this.canvasData,a={};if(this.ready&&!this.disabled&&bt(e)){var s=!1;t.rotatable&&z(e.rotate)&&e.rotate!==r.rotate&&(r.rotate=e.rotate,s=!0),t.scalable&&(z(e.scaleX)&&e.scaleX!==r.scaleX&&(r.scaleX=e.scaleX,s=!0),z(e.scaleY)&&e.scaleY!==r.scaleY&&(r.scaleY=e.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var u=r.width/r.naturalWidth;z(e.x)&&(a.left=e.x*u+n.left),z(e.y)&&(a.top=e.y*u+n.top),z(e.width)&&(a.width=e.width*u),z(e.height)&&(a.height=e.height*u),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?gA({},this.containerData):{}},getImageData:function(){return this.sized?gA({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&bA(["left","top","width","height","naturalWidth","naturalHeight"],function(r){t[r]=e[r]}),t},setCanvasData:function(e){var t=this.canvasData,r=t.aspectRatio;return this.ready&&!this.disabled&&bt(e)&&(z(e.left)&&(t.left=e.left),z(e.top)&&(t.top=e.top),z(e.width)?(t.width=e.width,t.height=e.width/r):z(e.height)&&(t.height=e.height,t.width=e.height*r),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,r=this.options.aspectRatio,n,a;return this.ready&&this.cropped&&!this.disabled&&bt(e)&&(z(e.left)&&(t.left=e.left),z(e.top)&&(t.top=e.top),z(e.width)&&e.width!==t.width&&(n=!0,t.width=e.width),z(e.height)&&e.height!==t.height&&(a=!0,t.height=e.height),r&&(n?t.height=t.width/r:a&&(t.width=t.height*r)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,r=wm(this.image,this.imageData,t,e);if(!this.cropped)return r;var n=this.getData(e.rounded),a=n.x,s=n.y,u=n.width,o=n.height,l=r.width/Math.floor(t.naturalWidth);l!==1&&(a*=l,s*=l,u*=l,o*=l);var f=u/o,h=ke({aspectRatio:f,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),d=ke({aspectRatio:f,width:e.minWidth||0,height:e.minHeight||0},"cover"),C=ke({aspectRatio:f,width:e.width||(l!==1?r.width:u),height:e.height||(l!==1?r.height:o)}),p=C.width,T=C.height;p=Math.min(h.width,Math.max(d.width,p)),T=Math.min(h.height,Math.max(d.height,T));var U=document.createElement("canvas"),_=U.getContext("2d");U.width=Ut(p),U.height=Ut(T),_.fillStyle=e.fillColor||"transparent",_.fillRect(0,0,p,T);var I=e.imageSmoothingEnabled,D=I===void 0?!0:I,k=e.imageSmoothingQuality;_.imageSmoothingEnabled=D,k&&(_.imageSmoothingQuality=k);var x=r.width,m=r.height,H=a,P=s,M,eA,uA,fA,J,rA;H<=-u||H>x?(H=0,M=0,uA=0,J=0):H<=0?(uA=-H,H=0,M=Math.min(x,u+H),J=M):H<=x&&(uA=0,M=Math.min(u,x-H),J=M),M<=0||P<=-o||P>m?(P=0,eA=0,fA=0,rA=0):P<=0?(fA=-P,P=0,eA=Math.min(m,o+P),rA=eA):P<=m&&(fA=0,eA=Math.min(o,m-P),rA=eA);var oA=[H,P,M,eA];if(J>0&&rA>0){var hA=p/u;oA.push(uA*hA,fA*hA,J*hA,rA*hA)}return _.drawImage.apply(_,[r].concat(Eo(oA.map(function(pA){return Math.floor(Ut(pA))})))),U},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!Bs(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,r=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var a=e===os,s=t.movable&&e===bo;e=a||s?e:Uo,t.dragMode=e,cr(r,or,e),Qt(r,is,a),Qt(r,us,s),t.cropBoxMovable||(cr(n,or,e),Qt(n,is,a),Qt(n,us,s))}return this}},xm=me.Cropper,Go=function(){function A(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(WE(this,A),!e||!im.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=gA({},Ho,bt(t)&&t),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return JE(A,[{key:"init",value:function(){var t=this.element,r=t.tagName.toLowerCase(),n;if(!t[BA]){if(t[BA]=this,r==="img"){if(this.isImg=!0,n=t.getAttribute("src")||"",this.originalUrl=n,!n)return;n=t.src}else r==="canvas"&&window.HTMLCanvasElement&&(n=t.toDataURL());this.load(n)}}},{key:"load",value:function(t){var r=this;if(t){this.url=t,this.imageData={};var n=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(am.test(t)){sm.test(t)?this.read(Um(t)):this.clone();return}var s=new XMLHttpRequest,u=this.clone.bind(this);this.reloading=!0,this.xhr=s,s.onabort=u,s.onerror=u,s.ontimeout=u,s.onprogress=function(){s.getResponseHeader("content-type")!==vo&&s.abort()},s.onload=function(){r.read(s.response)},s.onloadend=function(){r.reloading=!1,r.xhr=null},a.checkCrossOrigin&&Po(t)&&n.crossOrigin&&(t=Ko(t)),s.open("GET",t,!0),s.responseType="arraybuffer",s.withCredentials=n.crossOrigin==="use-credentials",s.send()}}},{key:"read",value:function(t){var r=this.options,n=this.imageData,a=Fm(t),s=0,u=1,o=1;if(a>1){this.url=Qm(t,vo);var l=Im(a);s=l.rotate,u=l.scaleX,o=l.scaleY}r.rotatable&&(n.rotate=s),r.scalable&&(n.scaleX=u,n.scaleY=o),this.clone()}},{key:"clone",value:function(){var t=this.element,r=this.url,n=t.crossOrigin,a=r;this.options.checkCrossOrigin&&Po(r)&&(n||(n="anonymous"),a=Ko(r)),this.crossOrigin=n,this.crossOriginUrl=a;var s=document.createElement("img");n&&(s.crossOrigin=n),s.src=a||r,s.alt=t.alt||"The image to crop",this.image=s,s.onload=this.start.bind(this),s.onerror=this.stop.bind(this),vA(s,To),t.parentNode.insertBefore(s,t.nextSibling)}},{key:"start",value:function(){var t=this,r=this.image;r.onload=null,r.onerror=null,this.sizing=!0;var n=me.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(me.navigator.userAgent),a=function(l,f){gA(t.imageData,{naturalWidth:l,naturalHeight:f,aspectRatio:l/f}),t.initialImageData=gA({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(r.naturalWidth&&!n){a(r.naturalWidth,r.naturalHeight);return}var s=document.createElement("img"),u=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){a(s.width,s.height),n||u.removeChild(s)},s.src=r.src,n||(s.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",u.appendChild(s))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,r=this.options,n=this.image,a=t.parentNode,s=document.createElement("div");s.innerHTML=um;var u=s.querySelector(".".concat(BA,"-container")),o=u.querySelector(".".concat(BA,"-canvas")),l=u.querySelector(".".concat(BA,"-drag-box")),f=u.querySelector(".".concat(BA,"-crop-box")),h=f.querySelector(".".concat(BA,"-face"));this.container=a,this.cropper=u,this.canvas=o,this.dragBox=l,this.cropBox=f,this.viewBox=u.querySelector(".".concat(BA,"-view-box")),this.face=h,o.appendChild(n),vA(t,qA),a.insertBefore(u,t.nextSibling),pe(n,To),this.initPreview(),this.bind(),r.initialAspectRatio=Math.max(0,r.initialAspectRatio)||NaN,r.aspectRatio=Math.max(0,r.aspectRatio)||NaN,r.viewMode=Math.max(0,Math.min(3,Math.round(r.viewMode)))||0,vA(f,qA),r.guides||vA(f.getElementsByClassName("".concat(BA,"-dashed")),qA),r.center||vA(f.getElementsByClassName("".concat(BA,"-center")),qA),r.background&&vA(u,"".concat(BA,"-bg")),r.highlight||vA(h,Am),r.cropBoxMovable&&(vA(h,us),cr(h,or,ss)),r.cropBoxResizable||(vA(f.getElementsByClassName("".concat(BA,"-line")),qA),vA(f.getElementsByClassName("".concat(BA,"-point")),qA)),this.render(),this.ready=!0,this.setDragMode(r.dragMode),r.autoCrop&&this.crop(),this.setData(r.data),jA(r.ready)&&ae(t,yo,r.ready,{once:!0}),Ft(t,yo)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),pe(this.element,qA)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=xm,A}},{key:"setDefaults",value:function(t){gA(Ho,bt(t)&&t)}}])}();gA(Go.prototype,_m,ym,Nm,Sm,vm,Lm);function Hm(A,e){const t=A.split(",")||[],r=t[0].match(/:(.*?);/)[1],n=t[1]&&atob(t[1]);let a=n&&n.length;const s=new Uint8Array(a);for(;a--;)s[a]=n==null?void 0:n.charCodeAt(a);return new File([s],e,{type:r})}const Dm={key:0,contenteditable:"false",class:"z-10 w-[100vw] h-[100vh] bg-[rgba(0,0,0,0.7)] flex flex-col justify-center items-center fixed top-0 left-0 cursor-auto"},Om={class:"w-[700px] flex flex-col bg-white rounded pb-8"},Rm={class:"flex flex-row items-center justify-between px-6 py-4 bg-[#f4f8ff]"},Mm={class:"flex flex-col h-full"},km={class:"flex flex-row justify-center items-start flex-1"},Pm={class:"flex flex-col items-start flex-1"},Km={class:"flex flex-col w-full px-6 py-4"},Vm={class:"flex flex-col w-full"},Gm={class:"flex flex-row items-center"},Ym={class:"relative bg-[#474AFF] text-white rounded p-3"},Xm={class:"flex flex-row items-start justify-between mt-3"},Wm={class:"flex flex-col"},Jm={class:"flex flex-col justify-center items-center border w-[300px] h-[300px]"},qm={key:0,class:"w-full text-center"},jm=["src"],$m={class:"flex flex-col items-center",style:{width:"300px",height:"300px"}},Zm={class:"text-[#999] mt-05 flex justify-center mt-4"},zm={class:"w-full flex justify-end space-x-5 mt-5 px-6"},Ap=["loading"],ep=c.defineComponent({__name:"GpCropper",emits:["cancel","ok"],setup(A,{expose:e,emit:t}){const r=t,n=c.ref({coverUrl:"",inputValue:"",uploadType:2,videoHost:"",videoUrl:""}),a=c.ref(),s=c.ref({autoCrop:!0,autoCropArea:1,background:!0,center:!0,cropBoxResizable:!0,dragMode:"move",preview:".before",toggleDragModeOnDblclick:!0,viewMode:1,zoomOnWheel:!0}),u=c.ref(!1),o=c.ref("image/jpeg"),l=c.ref({afterImg:"",image:null,myCropper:null}),f=x=>{const m=x.target.files[0];m&&(m.name&&(n.value.inputValue=m.name),h(m))};async function h(x){if(!x)return;await k();const m=URL.createObjectURL(x);l.value.image=m,l.value.image&&d(),o.value=x.type}function d(){const x=document.querySelector("#imgId");x&&x.addEventListener("load",()=>{D(),l.value.myCropper=new Go(x,s.value)})}const C=c.ref(!1),p=c.ref();function T(x,m,H,P){p.value=P,a.value=x,x&&x.aspectRatio&&(s.value.aspectRatio=x.aspectRatio),H&&(n.value.inputValue=H),C.value=!0,m&&h(m)}function U(){C.value=!1}const _=()=>{var P,M;if(!l.value.myCropper)return;u.value=!0;var m=l.value.myCropper.getCroppedCanvas({height:(P=a.value)==null?void 0:P.height,imageSmoothingQuality:"high",width:(M=a.value)==null?void 0:M.width}).toDataURL(o.value);l.value.afterImg=m;const H=Hm(l.value.afterImg,n.value.inputValue);r("ok",{file:H,element:p.value}),u.value=!1,k(),D(),U()};function I(){k(),D(),U(),r("cancel")}function D(){l.value.myCropper&&l.value.myCropper.destroy()}function k(){l.value.image=""}return e({handleCloseCropper:U,handleOpenCropper:T}),(x,m)=>{var H,P,M;return C.value?(c.openBlock(),c.createElementBlock("div",Dm,[c.createElementVNode("div",Om,[c.createElementVNode("div",Rm,[m[1]||(m[1]=c.createElementVNode("span",{class:"text-base font-semibold text-[#333]"},"图片裁剪",-1)),c.createElementVNode("span",{class:"text-lg cursor-pointer text-[#999] iconfont icon-shanchu2",onClick:c.withModifiers(I,["stop"])})]),c.createElementVNode("div",Mm,[c.createElementVNode("div",km,[c.createElementVNode("div",Pm,[c.createElementVNode("div",Km,[c.createElementVNode("div",Vm,[c.createElementVNode("div",Gm,[c.createElementVNode("div",Ym,[c.createElementVNode("input",{type:"file",accept:"image/*",onClick:m[0]||(m[0]=c.withModifiers(()=>{},["stop"])),contenteditable:"false",ref:"fileInput",onChange:f,class:"absolute top-0 left-0 w-[110px] h-[40px] opacity-0 cursor-pointer"},null,544),m[2]||(m[2]=c.createElementVNode("span",{id:"uploadHandler",class:"cursor-pointer"}," 选择/更换图片 ",-1))]),m[3]||(m[3]=c.createElementVNode("span",{class:"text-sm text-[#999] ml-3"},"滚动鼠标放大或缩小图片",-1))]),c.createElementVNode("div",Xm,[c.createElementVNode("div",Wm,[c.createElementVNode("div",Jm,[l.value.image?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",qm," 请上传图片 ")),c.createElementVNode("img",{id:"imgId",src:l.value.image,style:{width:"300px"}},null,8,jm)])]),c.createElementVNode("div",$m,[m[4]||(m[4]=c.createElementVNode("div",{class:"before w-[270px] h-[200px] pr-[70px] border"},null,-1)),c.createElementVNode("div",Zm," 预览画像 "+c.toDisplayString(((H=a.value)==null?void 0:H.width)||"")+" "+c.toDisplayString((P=a.value)!=null&&P.width?"x":"")+" "+c.toDisplayString(((M=a.value)==null?void 0:M.height)||""),1)])])])])])]),c.createElementVNode("div",zm,[c.createElementVNode("span",{loading:u.value,class:"!w-22 bg-[#474AFF] text-white rounded py-2 px-6 cursor-pointer",type:"primary",onClick:_}," 确认 ",8,Ap),c.createElementVNode("span",{class:"!w-22 border border-[#DEDEDE] text-[#666] rounded py-2 px-6 cursor-pointer",onClick:I},"取消")])])])])):c.createCommentVNode("",!0)}}}),tp=c.defineComponent({name:"GpModal",props:{visible:{type:Boolean,required:!0},title:{type:String,default:""},okText:{type:String,default:"确定"},cancelText:{type:String,default:"取消"},showOkButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0}},emits:["update:visible","ok","cancel"],setup(A,{emit:e}){const{visible:t,okText:r,cancelText:n,showCloseButton:a}=c.toRefs(A);return{visible:t,okText:r,cancelText:n,showCloseButton:a,onClose:()=>{e("cancel"),e("update:visible",!1)},onOk:()=>{e("ok"),e("update:visible",!1)},onCancel:()=>{e("cancel"),e("update:visible",!1)}}}}),rp={class:"bg-white rounded-lg shadow-xl w-ful"},np={class:"p-4 border-b border-gray-200 relative flex items-center justify-between"},ap={key:0,class:"text-lg font-semibold"},sp={class:"p-4"},ip={key:0,class:"p-4 border-t border-gray-200 flex justify-end space-x-2"};function up(A,e,t,r,n,a){return A.visible?(c.openBlock(),c.createElementBlock("div",{key:0,class:"fixed inset-0 z-[99999] flex items-center justify-center bg-gray-900 bg-opacity-50",onClick:e[3]||(e[3]=c.withModifiers((...s)=>A.onClose&&A.onClose(...s),["self"]))},[c.createElementVNode("div",rp,[c.createElementVNode("div",np,[A.title?(c.openBlock(),c.createElementBlock("h3",ap,c.toDisplayString(A.title),1)):c.createCommentVNode("",!0),c.renderSlot(A.$slots,"header"),A.showCloseButton?(c.openBlock(),c.createElementBlock("button",{key:1,class:"text-gray-400 hover:text-gray-600",onClick:e[0]||(e[0]=(...s)=>A.onClose&&A.onClose(...s)),"aria-label":"Close"},e[4]||(e[4]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[c.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)]))):c.createCommentVNode("",!0)]),c.createElementVNode("div",sp,[c.renderSlot(A.$slots,"default")]),A.showCancelButton||A.showOkButton?(c.openBlock(),c.createElementBlock("div",ip,[c.renderSlot(A.$slots,"footer",{},()=>[A.showCancelButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded hover:bg-gray-200",onClick:e[1]||(e[1]=(...s)=>A.onCancel&&A.onCancel(...s))},c.toDisplayString(A.cancelText),1)):c.createCommentVNode("",!0),A.showOkButton?(c.openBlock(),c.createElementBlock("button",{key:1,class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700",onClick:e[2]||(e[2]=(...s)=>A.onOk&&A.onOk(...s))},c.toDisplayString(A.okText),1)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0)}const op=Oe(tp,[["render",up]]),cp={class:"p-4 flex flex-wrap max-h-[500px] overflow-y-auto w-[640px]"},lp=["onClick"],fp=c.defineComponent({__name:"GpIcon",props:{icons:{type:Array,default:()=>[]}},emits:["ok"],setup(A,{expose:e,emit:t}){const r=A,n=t,a=c.ref(r.icons||[]);c.watch(()=>r.icons,h=>{a.value=h||[]},{immediate:!0});const s=c.ref(!1),u=c.ref();function o(h){s.value=!0,u.value=h}function l(h){f(),n("ok",{icon:h,element:u.value})}function f(){s.value=!1}return e({openModal:o,closeModal:f}),(h,d)=>(c.openBlock(),c.createBlock(op,{visible:s.value,"onUpdate:visible":d[0]||(d[0]=C=>s.value=C),title:"选择图标",onOk:f,onCancel:f,showCancelButton:!1,showOkButton:!1},{default:c.withCtx(()=>[c.createElementVNode("div",cp,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,C=>(c.openBlock(),c.createElementBlock("span",{key:C,onClick:c.withModifiers(p=>l(C),["stop"]),style:{position:"unset",color:"unset",top:"unset",left:"unset",right:"unset",transform:"unset","font-size":"unset"},class:c.normalizeClass(["w-12 h-12 mx-1 mb-2 border cursor-pointer hover:border-gray-400 hover:bg-gray-200",`iconfont icon-${C} text-4xl overflow-hidden flex justify-center items-center`])},null,10,lp))),128))])]),_:1},8,["visible"]))}}),hp=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},show:{type:Boolean,default:!0}},setup(A,{emit:e}){const t=c.ref(null),r=c.ref([]),n=c.ref(),a=c.ref(A.show);c.watch(()=>A.show,f=>{a.value=f},{immediate:!0});const s=()=>{var f;(f=t.value)==null||f.click()},u=async f=>{var p;const d=f.target.files;if(!d)return;const C=[];for(let T=0;T<d.length;T++){const U=d[T];if(A.beforeUpload&&await A.beforeUpload(U)===!1)continue;const _=`${Date.now()}-${U.name}`,I=URL.createObjectURL(U),D=document.createElement("img");D.src=I,document.body.appendChild(D),await new Promise(m=>{D.onload=m});const k=D.width,x=D.height;document.body.removeChild(D),C.push({uid:_,name:U.name,status:"uploading",thumbUrl:I,file:U,width:k,height:x})}A.maxCount&&r.value.length+C.length>A.maxCount&&C.splice(A.maxCount-r.value.length),A.multiple?r.value=[...r.value,...C]:r.value=C.slice(0,1),(p=A.onChange)==null||p.call(A,r.value,n.value),e("update:fileList",r.value),t.value&&(t.value.value="")},o=f=>{var h;r.value=r.value.filter(d=>d.uid!==f),(h=A.onChange)==null||h.call(A,r.value,n.value)};function l(f){n.value=f,s()}return{isShow:a,openModal:l,inputRef:t,fileList:r,triggerInput:s,handleChange:u,removeFile:o}}}),dp={class:"upload-wrapper"},Bp=["accept","multiple"],gp={key:1,class:"file-list mt-4"},Ep={class:"flex items-center space-x-4"},mp=["src"],pp=["onClick"];function Cp(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",dp,[A.isShow?(c.openBlock(),c.createElementBlock("div",{key:0,class:"",onClick:e[0]||(e[0]=(...s)=>A.triggerInput&&A.triggerInput(...s))},[c.renderSlot(A.$slots,"upload-icon",{},()=>[e[2]||(e[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.createCommentVNode("",!0),c.createElementVNode("input",{type:"file",ref:"inputRef",class:"hidden",accept:A.accept,multiple:A.multiple,onChange:e[1]||(e[1]=(...s)=>A.handleChange&&A.handleChange(...s))},null,40,Bp),A.showList?(c.openBlock(),c.createElementBlock("div",gp,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(A.fileList,s=>(c.openBlock(),c.createElementBlock("div",{key:s.uid,class:"file-item flex items-center justify-between p-2 border rounded mb-2"},[c.createElementVNode("div",Ep,[s.thumbUrl?(c.openBlock(),c.createElementBlock("img",{key:0,src:s.thumbUrl,alt:"preview",class:"w-12 h-12 object-cover rounded"},null,8,mp)):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(s.name),1)]),c.createElementVNode("div",null,[c.createElementVNode("button",{onClick:u=>A.removeFile(s.uid),class:"text-red-500 hover:underline"}," 删除 ",8,pp)])]))),128))])):c.createCommentVNode("",!0)])}const wp=Oe(hp,[["render",Cp],["__scopeId","data-v-08babff9"]]);/*!
|
19
19
|
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
20
20
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
21
21
|
* Released under MIT License
|
@@ -36,4 +36,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
36
36
|
content: "" !important;
|
37
37
|
display: none !important;
|
38
38
|
}`,ib=function(A){ub(A,"."+ci+ab+Dl+`
|
39
|
-
.`+li+sb+Dl)},ub=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}},Ol=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),ob=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(hi(e)||hb(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return VA(this,void 0,void 0,function(){var t,r,n,a,s=this;return kA(this,function(u){switch(u.label){case 0:return t=Ol.isSameOrigin(e),r=!fi(e)&&this._options.useCORS===!0&&RA.SUPPORT_CORS_IMAGES&&!t,n=!fi(e)&&!t&&!hi(e)&&typeof this._options.proxy=="string"&&RA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!fi(e)&&!hi(e)&&!n&&!r?[2]:(a=e,n?[4,this.proxy(a)]:[3,2]);case 1:a=u.sent(),u.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(o,l){var f=new Image;f.onload=function(){return o(f)},f.onerror=l,(db(a)||r)&&(f.crossOrigin="anonymous"),f.src=a,f.complete===!0&&setTimeout(function(){return o(f)},500),s._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,u.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(a,s){var u=RA.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(o.status===200)if(u==="text")a(o.response);else{var h=new FileReader;h.addEventListener("load",function(){return a(h.result)},!1),h.addEventListener("error",function(d){return s(d)},!1),h.readAsDataURL(o.response)}else s("Failed to proxy resource "+n+" with status code "+o.status)},o.onerror=s;var l=r.indexOf("?")>-1?"&":"?";if(o.open("GET",""+r+l+"url="+encodeURIComponent(e)+"&responseType="+u),u!=="text"&&o instanceof XMLHttpRequest&&(o.responseType=u),t._options.imageTimeout){var f=t._options.imageTimeout;o.timeout=f,o.ontimeout=function(){return s("Timed out ("+f+"ms) proxying "+n)}}o.send()})},A}(),cb=/^data:image\/svg\+xml/i,lb=/^data:image\/.*;base64,/i,fb=/^data:image\/.*/i,hb=function(A){return RA.SUPPORT_SVG_DRAWING||!Bb(A)},fi=function(A){return fb.test(A)},db=function(A){return lb.test(A)},hi=function(A){return A.substr(0,4)==="blob"},Bb=function(A){return A.substr(-3).toLowerCase()==="svg"||cb.test(A)},O=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Dt=function(A,e,t){return new O(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},ea=function(){function A(e,t,r,n){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=n}return A.prototype.subdivide=function(e,t){var r=Dt(this.start,this.startControl,e),n=Dt(this.startControl,this.endControl,e),a=Dt(this.endControl,this.end,e),s=Dt(r,n,e),u=Dt(n,a,e),o=Dt(s,u,e);return t?new A(this.start,r,s,o):new A(o,u,a,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),ue=function(A){return A.type===1},gb=function(){function A(e){var t=e.styles,r=e.bounds,n=Qr(t.borderTopLeftRadius,r.width,r.height),a=n[0],s=n[1],u=Qr(t.borderTopRightRadius,r.width,r.height),o=u[0],l=u[1],f=Qr(t.borderBottomRightRadius,r.width,r.height),h=f[0],d=f[1],C=Qr(t.borderBottomLeftRadius,r.width,r.height),p=C[0],T=C[1],U=[];U.push((a+o)/r.width),U.push((p+h)/r.width),U.push((s+T)/r.height),U.push((l+d)/r.height);var _=Math.max.apply(Math,U);_>1&&(a/=_,s/=_,o/=_,l/=_,h/=_,d/=_,p/=_,T/=_);var I=r.width-o,D=r.height-d,k=r.width-h,x=r.height-T,m=t.borderTopWidth,H=t.borderRightWidth,P=t.borderBottomWidth,M=t.borderLeftWidth,eA=lA(t.paddingTop,e.bounds.width),uA=lA(t.paddingRight,e.bounds.width),fA=lA(t.paddingBottom,e.bounds.width),J=lA(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||s>0?EA(r.left+M/3,r.top+m/3,a-M/3,s-m/3,aA.TOP_LEFT):new O(r.left+M/3,r.top+m/3),this.topRightBorderDoubleOuterBox=a>0||s>0?EA(r.left+I,r.top+m/3,o-H/3,l-m/3,aA.TOP_RIGHT):new O(r.left+r.width-H/3,r.top+m/3),this.bottomRightBorderDoubleOuterBox=h>0||d>0?EA(r.left+k,r.top+D,h-H/3,d-P/3,aA.BOTTOM_RIGHT):new O(r.left+r.width-H/3,r.top+r.height-P/3),this.bottomLeftBorderDoubleOuterBox=p>0||T>0?EA(r.left+M/3,r.top+x,p-M/3,T-P/3,aA.BOTTOM_LEFT):new O(r.left+M/3,r.top+r.height-P/3),this.topLeftBorderDoubleInnerBox=a>0||s>0?EA(r.left+M*2/3,r.top+m*2/3,a-M*2/3,s-m*2/3,aA.TOP_LEFT):new O(r.left+M*2/3,r.top+m*2/3),this.topRightBorderDoubleInnerBox=a>0||s>0?EA(r.left+I,r.top+m*2/3,o-H*2/3,l-m*2/3,aA.TOP_RIGHT):new O(r.left+r.width-H*2/3,r.top+m*2/3),this.bottomRightBorderDoubleInnerBox=h>0||d>0?EA(r.left+k,r.top+D,h-H*2/3,d-P*2/3,aA.BOTTOM_RIGHT):new O(r.left+r.width-H*2/3,r.top+r.height-P*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||T>0?EA(r.left+M*2/3,r.top+x,p-M*2/3,T-P*2/3,aA.BOTTOM_LEFT):new O(r.left+M*2/3,r.top+r.height-P*2/3),this.topLeftBorderStroke=a>0||s>0?EA(r.left+M/2,r.top+m/2,a-M/2,s-m/2,aA.TOP_LEFT):new O(r.left+M/2,r.top+m/2),this.topRightBorderStroke=a>0||s>0?EA(r.left+I,r.top+m/2,o-H/2,l-m/2,aA.TOP_RIGHT):new O(r.left+r.width-H/2,r.top+m/2),this.bottomRightBorderStroke=h>0||d>0?EA(r.left+k,r.top+D,h-H/2,d-P/2,aA.BOTTOM_RIGHT):new O(r.left+r.width-H/2,r.top+r.height-P/2),this.bottomLeftBorderStroke=p>0||T>0?EA(r.left+M/2,r.top+x,p-M/2,T-P/2,aA.BOTTOM_LEFT):new O(r.left+M/2,r.top+r.height-P/2),this.topLeftBorderBox=a>0||s>0?EA(r.left,r.top,a,s,aA.TOP_LEFT):new O(r.left,r.top),this.topRightBorderBox=o>0||l>0?EA(r.left+I,r.top,o,l,aA.TOP_RIGHT):new O(r.left+r.width,r.top),this.bottomRightBorderBox=h>0||d>0?EA(r.left+k,r.top+D,h,d,aA.BOTTOM_RIGHT):new O(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||T>0?EA(r.left,r.top+x,p,T,aA.BOTTOM_LEFT):new O(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||s>0?EA(r.left+M,r.top+m,Math.max(0,a-M),Math.max(0,s-m),aA.TOP_LEFT):new O(r.left+M,r.top+m),this.topRightPaddingBox=o>0||l>0?EA(r.left+Math.min(I,r.width-H),r.top+m,I>r.width+H?0:Math.max(0,o-H),Math.max(0,l-m),aA.TOP_RIGHT):new O(r.left+r.width-H,r.top+m),this.bottomRightPaddingBox=h>0||d>0?EA(r.left+Math.min(k,r.width-M),r.top+Math.min(D,r.height-P),Math.max(0,h-H),Math.max(0,d-P),aA.BOTTOM_RIGHT):new O(r.left+r.width-H,r.top+r.height-P),this.bottomLeftPaddingBox=p>0||T>0?EA(r.left+M,r.top+Math.min(x,r.height-P),Math.max(0,p-M),Math.max(0,T-P),aA.BOTTOM_LEFT):new O(r.left+M,r.top+r.height-P),this.topLeftContentBox=a>0||s>0?EA(r.left+M+J,r.top+m+eA,Math.max(0,a-(M+J)),Math.max(0,s-(m+eA)),aA.TOP_LEFT):new O(r.left+M+J,r.top+m+eA),this.topRightContentBox=o>0||l>0?EA(r.left+Math.min(I,r.width+M+J),r.top+m+eA,I>r.width+M+J?0:o-M+J,l-(m+eA),aA.TOP_RIGHT):new O(r.left+r.width-(H+uA),r.top+m+eA),this.bottomRightContentBox=h>0||d>0?EA(r.left+Math.min(k,r.width-(M+J)),r.top+Math.min(D,r.height+m+eA),Math.max(0,h-(H+uA)),d-(P+fA),aA.BOTTOM_RIGHT):new O(r.left+r.width-(H+uA),r.top+r.height-(P+fA)),this.bottomLeftContentBox=p>0||T>0?EA(r.left+M+J,r.top+x,Math.max(0,p-(M+J)),T-(P+fA),aA.BOTTOM_LEFT):new O(r.left+M+J,r.top+r.height-(P+fA))}return A}(),aA;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(aA||(aA={}));var EA=function(A,e,t,r,n){var a=4*((Math.sqrt(2)-1)/3),s=t*a,u=r*a,o=A+t,l=e+r;switch(n){case aA.TOP_LEFT:return new ea(new O(A,l),new O(A,l-u),new O(o-s,e),new O(o,e));case aA.TOP_RIGHT:return new ea(new O(A,e),new O(A+s,e),new O(o,l-u),new O(o,l));case aA.BOTTOM_RIGHT:return new ea(new O(o,e),new O(o,e+u),new O(A+s,l),new O(A,l));case aA.BOTTOM_LEFT:default:return new ea(new O(o,l),new O(o-s,l),new O(A,e+u),new O(A,e))}},ta=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Eb=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},ra=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},mb=function(){function A(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return A}(),na=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),pb=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),Cb=function(A){return A.type===0},Rl=function(A){return A.type===1},wb=function(A){return A.type===2},Ml=function(A,e){return A.length===e.length?A.some(function(t,r){return t===e[r]}):!1},Tb=function(A,e,t,r,n){return A.map(function(a,s){switch(s){case 0:return a.add(e,t);case 1:return a.add(e+r,t);case 2:return a.add(e+r,t+n);case 3:return a.add(e,t+n)}return a})},kl=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),Pl=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new gb(this.container),this.container.styles.opacity<1&&this.effects.push(new pb(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new mb(r,n,a))}if(this.container.styles.overflowX!==0){var s=ta(this.curves),u=ra(this.curves);Ml(s,u)?this.effects.push(new na(s,6)):(this.effects.push(new na(s,2)),this.effects.push(new na(u,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(o){return!Rl(o)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var s=ta(r.curves),u=ra(r.curves);Ml(s,u)||n.unshift(new na(u,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(o){return FA(o.target,e)})},A}(),di=function(A,e,t,r){A.container.elements.forEach(function(n){var a=FA(n.flags,4),s=FA(n.flags,2),u=new Pl(n,A);FA(n.styles.display,2048)&&r.push(u);var o=FA(n.flags,8)?[]:r;if(a||s){var l=a||n.styles.isPositioned()?t:e,f=new kl(u);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;l.negativeZIndex.some(function(p,T){return h>p.element.container.styles.zIndex.order?(d=T,!1):d>0}),l.negativeZIndex.splice(d,0,f)}else if(h>0){var C=0;l.positiveZIndex.some(function(p,T){return h>=p.element.container.styles.zIndex.order?(C=T+1,!1):C>0}),l.positiveZIndex.splice(C,0,f)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(f)}else n.styles.isFloating()?l.nonPositionedFloats.push(f):l.nonPositionedInlineLevel.push(f);di(u,f,a?f:t,o)}else n.styles.isInlineLevel()?e.inlineLevel.push(u):e.nonInlineLevel.push(u),di(u,e,t,o);FA(n.flags,8)&&Kl(n,o)})},Kl=function(A,e){for(var t=A instanceof ri?A.start:1,r=A instanceof ri?A.reversed:!1,n=0;n<e.length;n++){var a=e[n];a.container instanceof hl&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=Sr(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},bb=function(A){var e=new Pl(A,null),t=new kl(e),r=[];return di(e,t,t,r),Kl(e.container,r),t},Vl=function(A,e){switch(e){case 0:return oe(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return oe(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return oe(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return oe(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ub=function(A,e){switch(e){case 0:return oe(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return oe(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return oe(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return oe(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Qb=function(A,e){switch(e){case 0:return oe(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return oe(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return oe(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return oe(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Fb=function(A,e){switch(e){case 0:return aa(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return aa(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return aa(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return aa(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},aa=function(A,e){var t=[];return ue(A)?t.push(A.subdivide(.5,!1)):t.push(A),ue(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},oe=function(A,e,t,r){var n=[];return ue(A)?n.push(A.subdivide(.5,!1)):n.push(A),ue(t)?n.push(t.subdivide(.5,!0)):n.push(t),ue(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),ue(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Gl=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},sa=function(A){var e=A.styles,t=A.bounds,r=lA(e.paddingLeft,t.width),n=lA(e.paddingRight,t.width),a=lA(e.paddingTop,t.width),s=lA(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+a+s))},Ib=function(A,e){return A===0?e.bounds:A===2?sa(e):Gl(e)},_b=function(A,e){return A===0?e.bounds:A===2?sa(e):Gl(e)},Bi=function(A,e,t){var r=Ib(Rt(A.styles.backgroundOrigin,e),A),n=_b(Rt(A.styles.backgroundClip,e),A),a=yb(Rt(A.styles.backgroundSize,e),t,r),s=a[0],u=a[1],o=Qr(Rt(A.styles.backgroundPosition,e),r.width-s,r.height-u),l=Nb(Rt(A.styles.backgroundRepeat,e),o,a,r,n),f=Math.round(r.left+o[0]),h=Math.round(r.top+o[1]);return[l,f,h,s,u]},Ot=function(A){return iA(A)&&A.value===vt.AUTO},ia=function(A){return typeof A=="number"},yb=function(A,e,t){var r=e[0],n=e[1],a=e[2],s=A[0],u=A[1];if(!s)return[0,0];if(UA(s)&&u&&UA(u))return[lA(s,t.width),lA(u,t.height)];var o=ia(a);if(iA(s)&&(s.value===vt.CONTAIN||s.value===vt.COVER)){if(ia(a)){var l=t.width/t.height;return l<a!=(s.value===vt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var f=ia(r),h=ia(n),d=f||h;if(Ot(s)&&(!u||Ot(u))){if(f&&h)return[r,n];if(!o&&!d)return[t.width,t.height];if(d&&o){var C=f?r:n*a,p=h?n:r/a;return[C,p]}var T=f?r:t.width,U=h?n:t.height;return[T,U]}if(o){var _=0,I=0;return UA(s)?_=lA(s,t.width):UA(u)&&(I=lA(u,t.height)),Ot(s)?_=I*a:(!u||Ot(u))&&(I=_/a),[_,I]}var D=null,k=null;if(UA(s)?D=lA(s,t.width):u&&UA(u)&&(k=lA(u,t.height)),D!==null&&(!u||Ot(u))&&(k=f&&h?D/r*n:t.height),k!==null&&Ot(s)&&(D=f&&h?k/n*r:t.width),D!==null&&k!==null)return[D,k];throw new Error("Unable to calculate background-size for element")},Rt=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},Nb=function(A,e,t,r,n){var a=e[0],s=e[1],u=t[0],o=t[1];switch(A){case 2:return[new O(Math.round(r.left),Math.round(r.top+s)),new O(Math.round(r.left+r.width),Math.round(r.top+s)),new O(Math.round(r.left+r.width),Math.round(o+r.top+s)),new O(Math.round(r.left),Math.round(o+r.top+s))];case 3:return[new O(Math.round(r.left+a),Math.round(r.top)),new O(Math.round(r.left+a+u),Math.round(r.top)),new O(Math.round(r.left+a+u),Math.round(r.height+r.top)),new O(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new O(Math.round(r.left+a),Math.round(r.top+s)),new O(Math.round(r.left+a+u),Math.round(r.top+s)),new O(Math.round(r.left+a+u),Math.round(r.top+s+o)),new O(Math.round(r.left+a),Math.round(r.top+s+o))];default:return[new O(Math.round(n.left),Math.round(n.top)),new O(Math.round(n.left+n.width),Math.round(n.top)),new O(Math.round(n.left+n.width),Math.round(n.height+n.top)),new O(Math.round(n.left),Math.round(n.height+n.top))]}},Sb="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Yl="Hidden Text",vb=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),s=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",s.appendChild(r),n.src=Sb,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(Yl)),r.appendChild(a),r.appendChild(n);var u=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(Yl)),r.style.lineHeight="normal",n.style.verticalAlign="super";var o=n.offsetTop-r.offsetTop+2;return s.removeChild(r),{baseline:u,middle:o}},A.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},A}(),Xl=function(){function A(e,t){this.context=e,this.options=t}return A}(),Lb=1e4,xb=function(A){he(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new vb(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},e.prototype.applyEffect=function(t){this.ctx.save(),wb(t)&&(this.ctx.globalAlpha=t.opacity),Cb(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Rl(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return VA(this,void 0,void 0,function(){var r;return kA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return VA(this,void 0,void 0,function(){return kA(this,function(r){switch(r.label){case 0:if(FA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var s=ti(t.text);s.reduce(function(u,o){return a.ctx.fillText(o,u,t.bounds.top+n),u+a.ctx.measureText(o).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),n=Mb(t.fontFamily).join(", "),a=Ur(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},e.prototype.renderTextNode=function(t,r){return VA(this,void 0,void 0,function(){var n,a,s,u,o,l,f,h,d=this;return kA(this,function(C){return n=this.createFontStyle(r),a=n[0],s=n[1],u=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",o=this.fontMetrics.getMetrics(s,u),l=o.baseline,f=o.middle,h=r.paintOrder,t.textBounds.forEach(function(p){h.forEach(function(T){switch(T){case 0:d.ctx.fillStyle=LA(r.color),d.renderTextWithLetterSpacing(p,r.letterSpacing,l);var U=r.textShadow;U.length&&p.text.trim().length&&(U.slice(0).reverse().forEach(function(_){d.ctx.shadowColor=LA(_.color),d.ctx.shadowOffsetX=_.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=_.offsetY.number*d.options.scale,d.ctx.shadowBlur=_.blur.number,d.renderTextWithLetterSpacing(p,r.letterSpacing,l)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),r.textDecorationLine.length&&(d.ctx.fillStyle=LA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(_){switch(_){case 1:d.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+l),p.bounds.width,1);break;case 2:d.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:d.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+f),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(d.ctx.strokeStyle=LA(r.webkitTextStrokeColor),d.ctx.lineWidth=r.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+l)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=sa(t),s=ra(r);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o,I,I,l,f,h,d,k,C,p,x,T,U,_,I,D,k,x;return kA(this,function(m){switch(m.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,s=0,u=r.textNodes,m.label=1;case 1:return s<u.length?(o=u[s],[4,this.renderTextNode(o,a)]):[3,4];case 2:m.sent(),m.label=3;case 3:return s++,[3,1];case 4:if(!(r instanceof cl))return[3,8];m.label=5;case 5:return m.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return I=m.sent(),this.renderReplacedElement(r,n,I),[3,8];case 7:return m.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof ll&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof fl))return[3,12];m.label=9;case 9:return m.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return I=m.sent(),this.renderReplacedElement(r,n,I),[3,12];case 11:return m.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof El&&r.tree?(l=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,l.render(r.tree)]):[3,14];case 13:f=m.sent(),r.width&&r.height&&this.ctx.drawImage(f,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),m.label=14;case 14:if(r instanceof ni&&(h=Math.min(r.bounds.width,r.bounds.height),r.type===qn?r.checked&&(this.ctx.save(),this.path([new O(r.bounds.left+h*.39363,r.bounds.top+h*.79),new O(r.bounds.left+h*.16,r.bounds.top+h*.5549),new O(r.bounds.left+h*.27347,r.bounds.top+h*.44071),new O(r.bounds.left+h*.39694,r.bounds.top+h*.5649),new O(r.bounds.left+h*.72983,r.bounds.top+h*.23),new O(r.bounds.left+h*.84,r.bounds.top+h*.34085),new O(r.bounds.left+h*.39363,r.bounds.top+h*.79)]),this.ctx.fillStyle=LA(dl),this.ctx.fill(),this.ctx.restore()):r.type===jn&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+h/2,r.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=LA(dl),this.ctx.fill(),this.ctx.restore())),Hb(r)&&r.value.length){switch(d=this.createFontStyle(a),k=d[0],C=d[1],p=this.fontMetrics.getMetrics(k,C).baseline,this.ctx.font=k,this.ctx.fillStyle=LA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ob(r.styles.textAlign),x=sa(r),T=0,r.styles.textAlign){case 1:T+=x.width/2;break;case 2:T+=x.width;break}U=x.add(T,0,0,-x.height/2+1),this.ctx.save(),this.path([new O(x.left,x.top),new O(x.left+x.width,x.top),new O(x.left+x.width,x.top+x.height),new O(x.left,x.top+x.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new yr(r.value,U),a.letterSpacing,p),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!FA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(_=r.styles.listStyleImage,_.type!==0)return[3,18];I=void 0,D=_.url,m.label=15;case 15:return m.trys.push([15,17,,18]),[4,this.context.cache.match(D)];case 16:return I=m.sent(),this.ctx.drawImage(I,r.bounds.left-(I.width+10),r.bounds.top),[3,18];case 17:return m.sent(),this.context.logger.error("Error loading list-style-image "+D),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(k=this.createFontStyle(a)[0],this.ctx.font=k,this.ctx.fillStyle=LA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",x=new Fe(r.bounds.left,r.bounds.top+lA(r.styles.paddingTop,r.bounds.width),r.bounds.width,Yc(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new yr(t.listValue,x),a.letterSpacing,Yc(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),m.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return VA(this,void 0,void 0,function(){var r,n,_,a,s,_,u,o,_,l,f,_,h,d,_,C,p,_,T,U,_;return kA(this,function(I){switch(I.label){case 0:if(FA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:I.sent(),r=0,n=t.negativeZIndex,I.label=2;case 2:return r<n.length?(_=n[r],[4,this.renderStack(_)]):[3,5];case 3:I.sent(),I.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:I.sent(),a=0,s=t.nonInlineLevel,I.label=7;case 7:return a<s.length?(_=s[a],[4,this.renderNode(_)]):[3,10];case 8:I.sent(),I.label=9;case 9:return a++,[3,7];case 10:u=0,o=t.nonPositionedFloats,I.label=11;case 11:return u<o.length?(_=o[u],[4,this.renderStack(_)]):[3,14];case 12:I.sent(),I.label=13;case 13:return u++,[3,11];case 14:l=0,f=t.nonPositionedInlineLevel,I.label=15;case 15:return l<f.length?(_=f[l],[4,this.renderStack(_)]):[3,18];case 16:I.sent(),I.label=17;case 17:return l++,[3,15];case 18:h=0,d=t.inlineLevel,I.label=19;case 19:return h<d.length?(_=d[h],[4,this.renderNode(_)]):[3,22];case 20:I.sent(),I.label=21;case 21:return h++,[3,19];case 22:C=0,p=t.zeroOrAutoZIndexOrTransformedOrOpacity,I.label=23;case 23:return C<p.length?(_=p[C],[4,this.renderStack(_)]):[3,26];case 24:I.sent(),I.label=25;case 25:return C++,[3,23];case 26:T=0,U=t.positiveZIndex,I.label=27;case 27:return T<U.length?(_=U[T],[4,this.renderStack(_)]):[3,30];case 28:I.sent(),I.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var s=ue(n)?n.start:n;a===0?r.ctx.moveTo(s.x,s.y):r.ctx.lineTo(s.x,s.y),ue(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},e.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var s=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,u=s.createElement("canvas");u.width=Math.max(1,r),u.height=Math.max(1,n);var o=u.getContext("2d");return o.drawImage(t,0,0,t.width,t.height,0,0,r,n),u},e.prototype.renderBackgroundImage=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o;return kA(this,function(l){switch(l.label){case 0:r=t.styles.backgroundImage.length-1,n=function(f){var h,d,C,eA,hA,pA,J,rA,P,p,eA,hA,pA,J,rA,T,U,_,I,D,k,x,m,H,P,M,eA,uA,fA,J,rA,oA,hA,pA,GA,IA,KA,xA,ZA,_A,v,S;return kA(this,function(q){switch(q.label){case 0:if(f.type!==0)return[3,5];h=void 0,d=f.url,q.label=1;case 1:return q.trys.push([1,3,,4]),[4,a.context.cache.match(d)];case 2:return h=q.sent(),[3,4];case 3:return q.sent(),a.context.logger.error("Error loading background-image "+d),[3,4];case 4:return h&&(C=Bi(t,r,[h.width,h.height,h.width/h.height]),eA=C[0],hA=C[1],pA=C[2],J=C[3],rA=C[4],P=a.ctx.createPattern(a.resizeImage(h,J,rA),"repeat"),a.renderRepeat(eA,P,hA,pA)),[3,6];case 5:C1(f)?(p=Bi(t,r,[null,null,null]),eA=p[0],hA=p[1],pA=p[2],J=p[3],rA=p[4],T=B1(f.angle,J,rA),U=T[0],_=T[1],I=T[2],D=T[3],k=T[4],x=document.createElement("canvas"),x.width=J,x.height=rA,m=x.getContext("2d"),H=m.createLinearGradient(_,D,I,k),xc(f.stops,U).forEach(function($){return H.addColorStop($.stop,LA($.color))}),m.fillStyle=H,m.fillRect(0,0,J,rA),J>0&&rA>0&&(P=a.ctx.createPattern(x,"repeat"),a.renderRepeat(eA,P,hA,pA))):w1(f)&&(M=Bi(t,r,[null,null,null]),eA=M[0],uA=M[1],fA=M[2],J=M[3],rA=M[4],oA=f.position.length===0?[Ps]:f.position,hA=lA(oA[0],J),pA=lA(oA[oA.length-1],rA),GA=g1(f,hA,pA,J,rA),IA=GA[0],KA=GA[1],IA>0&&KA>0&&(xA=a.ctx.createRadialGradient(uA+hA,fA+pA,0,uA+hA,fA+pA,IA),xc(f.stops,IA*2).forEach(function($){return xA.addColorStop($.stop,LA($.color))}),a.path(eA),a.ctx.fillStyle=xA,IA!==KA?(ZA=t.bounds.left+.5*t.bounds.width,_A=t.bounds.top+.5*t.bounds.height,v=KA/IA,S=1/v,a.ctx.save(),a.ctx.translate(ZA,_A),a.ctx.transform(1,0,0,v,0,0),a.ctx.translate(-ZA,-_A),a.ctx.fillRect(uA,S*(fA-_A)+_A,J,rA*S),a.ctx.restore()):a.ctx.fill())),q.label=6;case 6:return r--,[2]}})},a=this,s=0,u=t.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return s<u.length?(o=u[s],[5,n(o)]):[3,4];case 2:l.sent(),l.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,n){return VA(this,void 0,void 0,function(){return kA(this,function(a){return this.path(Vl(n,r)),this.ctx.fillStyle=LA(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,n,a){return VA(this,void 0,void 0,function(){var s,u;return kA(this,function(o){switch(o.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return o.sent(),[2];case 2:return s=Ub(a,n),this.path(s),this.ctx.fillStyle=LA(t),this.ctx.fill(),u=Qb(a,n),this.path(u),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o,l,f,h=this;return kA(this,function(d){switch(d.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Xe(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],s=Db(Rt(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),Xe(r.backgroundColor)||(this.ctx.fillStyle=LA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(C){h.ctx.save();var p=ta(t.curves),T=C.inset?0:Lb,U=Tb(p,-T+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(h.path(p),h.ctx.clip(),h.mask(U)):(h.mask(p),h.ctx.clip(),h.path(U)),h.ctx.shadowOffsetX=C.offsetX.number+T,h.ctx.shadowOffsetY=C.offsetY.number,h.ctx.shadowColor=LA(C.color),h.ctx.shadowBlur=C.blur.number,h.ctx.fillStyle=C.inset?LA(C.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),d.label=2;case 2:u=0,o=0,l=a,d.label=3;case 3:return o<l.length?(f=l[o],f.style!==0&&!Xe(f.color)&&f.width>0?f.style!==2?[3,5]:[4,this.renderDashedDottedBorder(f.color,f.width,u,t.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return f.style!==3?[3,7]:[4,this.renderDashedDottedBorder(f.color,f.width,u,t.curves,3)];case 6:return d.sent(),[3,11];case 7:return f.style!==4?[3,9]:[4,this.renderDoubleBorder(f.color,f.width,u,t.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(f.color,u,t.curves)];case 10:d.sent(),d.label=11;case 11:u++,d.label=12;case 12:return o++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,n,a,s){return VA(this,void 0,void 0,function(){var u,o,l,f,h,d,C,p,T,U,_,I,D,k,x,m,x,m;return kA(this,function(H){return this.ctx.save(),u=Fb(a,n),o=Vl(a,n),s===2&&(this.path(o),this.ctx.clip()),ue(o[0])?(l=o[0].start.x,f=o[0].start.y):(l=o[0].x,f=o[0].y),ue(o[1])?(h=o[1].end.x,d=o[1].end.y):(h=o[1].x,d=o[1].y),n===0||n===2?C=Math.abs(l-h):C=Math.abs(f-d),this.ctx.beginPath(),s===3?this.formatPath(u):this.formatPath(o.slice(0,2)),p=r<3?r*3:r*2,T=r<3?r*2:r,s===3&&(p=r,T=r),U=!0,C<=p*2?U=!1:C<=p*2+T?(_=C/(2*p+T),p*=_,T*=_):(I=Math.floor((C+T)/(p+T)),D=(C-I*p)/(I-1),k=(C-(I+1)*p)/I,T=k<=0||Math.abs(T-D)<Math.abs(T-k)?D:k),U&&(s===3?this.ctx.setLineDash([0,p+T]):this.ctx.setLineDash([p,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=LA(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(ue(o[0])&&(x=o[3],m=o[0],this.ctx.beginPath(),this.formatPath([new O(x.end.x,x.end.y),new O(m.start.x,m.start.y)]),this.ctx.stroke()),ue(o[1])&&(x=o[1],m=o[2],this.ctx.beginPath(),this.formatPath([new O(x.end.x,x.end.y),new O(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return VA(this,void 0,void 0,function(){var r;return kA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=LA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=bb(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(Xl),Hb=function(A){return A instanceof gl||A instanceof Bl?!0:A instanceof ni&&A.type!==jn&&A.type!==qn},Db=function(A,e){switch(A){case 0:return ta(e);case 2:return Eb(e);case 1:default:return ra(e)}},Ob=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Rb=["-apple-system","system-ui"],Mb=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return Rb.indexOf(e)===-1}):A},kb=function(A){he(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return e.prototype.render=function(t){return VA(this,void 0,void 0,function(){var r,n;return kA(this,function(a){switch(a.label){case 0:return r=ei(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Pb(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=LA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(Xl),Pb=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Kb=function(){function A(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Bn([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A}(),Vb=function(){function A(e,t){var r;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new Kb({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new ob(this,e)}return A.instanceCount=1,A}(),Gb=function(A,e){return e===void 0&&(e={}),Yb(A,e)};typeof window<"u"&&Ol.setContext(window);var Yb=function(A,e){return VA(void 0,void 0,void 0,function(){var t,r,n,a,s,u,o,l,f,h,d,C,p,T,U,_,I,D,k,x,H,m,H,P,M,eA,uA,fA,J,rA,oA,hA,pA,GA,IA,KA,xA,ZA,_A,v;return kA(this,function(S){switch(S.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(P=e.allowTaint)!==null&&P!==void 0?P:!1,imageTimeout:(M=e.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:e.proxy,useCORS:(eA=e.useCORS)!==null&&eA!==void 0?eA:!1},a=Cs({logging:(uA=e.logging)!==null&&uA!==void 0?uA:!0,cache:e.cache},n),s={windowWidth:(fA=e.windowWidth)!==null&&fA!==void 0?fA:r.innerWidth,windowHeight:(J=e.windowHeight)!==null&&J!==void 0?J:r.innerHeight,scrollX:(rA=e.scrollX)!==null&&rA!==void 0?rA:r.pageXOffset,scrollY:(oA=e.scrollY)!==null&&oA!==void 0?oA:r.pageYOffset},u=new Fe(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),o=new Vb(a,u),l=(hA=e.foreignObjectRendering)!==null&&hA!==void 0?hA:!1,f={allowTaint:(pA=e.allowTaint)!==null&&pA!==void 0?pA:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:l,copyStyles:l},o.logger.debug("Starting document clone with size "+u.width+"x"+u.height+" scrolled to "+-u.left+","+-u.top),h=new Hl(o,A,f),d=h.clonedReferenceElement,d?[4,h.toIFrame(t,u)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=S.sent(),p=si(d)||XT(d)?Tp(d.ownerDocument):gn(o,d),T=p.width,U=p.height,_=p.left,I=p.top,D=Xb(o,d,e.backgroundColor),k={canvas:e.canvas,backgroundColor:D,scale:(IA=(GA=e.scale)!==null&&GA!==void 0?GA:r.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((KA=e.x)!==null&&KA!==void 0?KA:0)+_,y:((xA=e.y)!==null&&xA!==void 0?xA:0)+I,width:(ZA=e.width)!==null&&ZA!==void 0?ZA:Math.ceil(T),height:(_A=e.height)!==null&&_A!==void 0?_A:Math.ceil(U)},l?(o.logger.debug("Document cloned, using foreign object rendering"),H=new kb(o,k),[4,H.render(d)]):[3,3];case 2:return x=S.sent(),[3,5];case 3:return o.logger.debug("Document cloned, element located at "+_+","+I+" with size "+T+"x"+U+" using computed rendering"),o.logger.debug("Starting DOM parsing"),m=pl(o,d),D===m.styles.backgroundColor&&(m.styles.backgroundColor=_e.TRANSPARENT),o.logger.debug("Starting renderer for element at "+k.x+","+k.y+" with size "+k.width+"x"+k.height),H=new xb(o,k),[4,H.render(m)];case 4:x=S.sent(),S.label=5;case 5:return(!((v=e.removeContainer)!==null&&v!==void 0)||v)&&(Hl.destroy(C)||o.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),o.logger.debug("Finished rendering"),[2,x]}})})},Xb=function(A,e,t){var r=e.ownerDocument,n=r.documentElement?Fr(A,getComputedStyle(r.documentElement).backgroundColor):_e.TRANSPARENT,a=r.body?Fr(A,getComputedStyle(r.body).backgroundColor):_e.TRANSPARENT,s=typeof t=="string"?Fr(A,t):t===null?_e.TRANSPARENT:4294967295;return e===r.documentElement?Xe(n)?Xe(a)?s:a:n:s};const Wb=c.defineComponent({name:"GpIframe",props:{htmlContent:{type:String,required:!0},jsFiles:{type:Array,default:[]},cssFiles:{type:Array,default:[]},iframeStyle:{type:Object,default:()=>({width:"100%",height:"100%",border:"none"})}},setup(A){const e=c.ref(null),t=c.ref(),r=()=>{var C;const a=e.value;if(!a)return;const s=a.contentDocument||((C=a.contentWindow)==null?void 0:C.document);if(!s)return;s.open(),s.write("<!DOCTYPE html><html><head></head><body></body></html>"),s.close();const u=s.head;A.cssFiles.forEach(p=>{const T=s.createElement("link");T.rel="stylesheet",T.href=p,u.appendChild(T)});const o=s.createElement("link");o.rel="stylesheet",o.href="/spa/topic/css/style.css",u.appendChild(o);const l=s.createElement("script");l.src="/spa/topic/js/jquery-3.6.0.min.js",l.async=!1,u.appendChild(l);const f=s.createElement("script");f.src="/spa/topic/js/swiper-bundle.min.js",f.async=!1,u.appendChild(f);const h=s.createElement("script");h.src="/spa/topic/js/index.js",h.async=!1,u.appendChild(h);const d=s.body;d.innerHTML=A.htmlContent,A.jsFiles.forEach(p=>{const T=s.createElement("script");T.src=p,T.async=!1,d.appendChild(T)}),t.value=d,c.nextTick(()=>{})};c.watch(t,a=>{if(!a)return;new MutationObserver(()=>{const u=e.value;u&&(u.style.height=`${a.scrollHeight}px`)}).observe(a,{childList:!0,subtree:!0})});const n=async a=>{var l;const s=e.value;if(!s)return;const u=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);if(!u)return;const o=u.body;if(o)try{await c.nextTick();const f=await Gb(o,{x:0,y:0,scrollX:window.scrollX,scrollY:window.scrollY,useCORS:!0,allowTaint:!0,foreignObjectRendering:!1});a?a(f):f.toBlob(h=>{const d=URL.createObjectURL(h);window.open(d,"_blank")})}catch(f){console.error("截图生成失败:",f)}};return c.watch(()=>[A.htmlContent,A.jsFiles,A.cssFiles],r,{deep:!0}),c.onMounted(()=>{r()}),{iframeRef:e,generateCover:n}}});function Jb(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",null,[c.createElementVNode("iframe",{ref:"iframeRef",style:c.normalizeStyle(A.iframeStyle)},null,4)])}const Wl=Oe(Wb,[["render",Jb],["__scopeId","data-v-607ae90c"]]),qb={class:"flex gp-dsigner"},jb={key:0,class:"flex items-center justify-between border-b"},$b={class:"text-lg font-bold p-2"},Zb={class:"text-sm font-thin text-gray-500"},zb={class:"flex-1 overflow-auto"},AU={key:0,class:"flex justify-between items-center border-b p-2"},eU={class:"flex items-center"},tU={class:"p-2"},rU={class:"sticky top-0"},nU={key:0,class:"text-lg font-bold border-b p-2"},aU={class:"text-sm font-thin text-gray-500"},sU={class:"p-2"},Jl=Oe(c.defineComponent({__name:"Designer",props:{mode:{default:"design"},template:{},css:{},js:{},previewWidth:{default:360},uploadByFile:{},icons:{},rules:{},preview:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0}},emits:["update:modelValue","update:element"],setup(A,{expose:e,emit:t}){const r=A,n=t,a=c.ref(r.rules||[]),s=c.ref(r.template),u=c.ref();let o=co("",{},!1);const l=c.ref("");c.watch(()=>r.template,F=>{s.value=F},{immediate:!0}),c.watch(()=>s.value,F=>{F&&(u.value=fA(F))},{immediate:!0}),c.watch(()=>r.css,F=>{F.forEach(L=>{if(document.querySelector(`link[href="${L}"]`))return;const K=document.createElement("link");K.rel="stylesheet",K.href=L,document.head.appendChild(K)})},{immediate:!0}),c.watch(()=>r.js,F=>{!F||F.length===0||F.forEach(L=>{if(document.querySelector(`script[src="${L}"]`))return;const K=document.createElement("script");K.src=L,document.body.appendChild(K)})},{immediate:!0});const f=c.ref(r.mode);c.watch(()=>u.value,F=>{F&&n("update:element",F)},{immediate:!0});const h=c.ref("");c.watch(()=>l.value,F=>{n("update:modelValue",F)},{immediate:!0});const d=c.ref(),C=c.ref(),p=c.ref(),T=c.ref(),U=c.ref(),_=c.ref(),I=c.ref(""),D=c.ref(r.mode==="design");c.watch(()=>r.rules,F=>{a.value=F,s.value&&(u.value=fA(s.value))},{immediate:!0});function k(F=void 0){T.value&&T.value.generateCover(F)}function x(F){U.value=F}function m(F,L=""){if(L){const K=H(u.value,L);K?_.value=K:_.value=F}else _.value=F}function H(F,L){if(F.xpath===L)return F;if(F.children&&F.children.length)for(const K of F.children){const V=H(K,L);if(V)return V}}function P(F,L){var K,V;return F.tag===L.tag&&((K=F.children)==null?void 0:K.length)===((V=L.children)==null?void 0:V.length)}function M(F){if(U.value.xpath==F.xpath){if(U.value){if(F.type===W.Block){var L=!0;const K=H(u.value,U.value.parentxpath||"");if(K&&K.children&&K.children.forEach(V=>{if(V.tag!=U.value.tag||!P(V,U.value)){L=!1;return}}),!L){j.error("同级结构不一致,错误配置!");return}}if(U.value.rule=F.rule,U.value.type=F.type,U.value.type===W.Block){const K=H(u.value,U.value.parentxpath||"");K&&K.children&&(K.children.forEach(V=>{if(V.tag!=U.value.tag||!P(V,U.value)){j.error("同级结构不一致,无法配置为块类型");return}}),K.children.forEach(V=>{V.tag===U.value.tag&&(V.rule=F.rule,V.type=F.type)}))}}h.value=new Date().getTime().toString(),j.success("保存成功"),n("update:element",u.value)}}function eA(F){const L=H(u.value,F.xpath||"");L&&(L.rule=F.rule,L.type=F.type,L.children&&F.children&&L.children.forEach(K=>{const V=F.children.find(CA=>CA.xpath===K.xpath);V&&(K.rule=V.rule,K.type=V.type)})),j.success("操作成功"),h.value=new Date().getTime().toString(),n("update:element",u.value)}function uA(F){l.value=F}function fA(F){o=co(F);const L=o("body").children().toArray().map(K=>J(o(K)));return l.value=o("body").html()||"",L[0]}function J(F,L=""){var YA;function K(HA){if(!HA||!HA[0])return"";const $e=[];let cA=HA;for(;cA.length&&cA[0].tagName!=="html";){const ua=cA[0].tagName,uU=cA.parent().children(ua).index(cA)+1;$e.unshift(`${ua}[${uU}]`),cA=cA.parent()}return"/html/"+$e.join("/")}const V=K(F).replace("/html/body[1]",""),CA=F.children().toArray().map(HA=>J(o(HA),V)),te=(YA=a.value)==null?void 0:YA.find(HA=>HA.xpath===V);return{tag:F[0].tagName,text:F.contents().not(F.children()).text().trim(),attrs:F[0].attribs,children:CA,xpath:V,parentxpath:L,type:(te==null?void 0:te.type)||W.None,rule:(te==null?void 0:te.rule)||{}}}function rA(F){const L=H(u.value,F.element.xpath);if(L){const K=c.toRaw(L);K.editText=F.newText}}function oA(F,L=""){function K(V,CA){var HA;const YA=(CA?((HA=H(u.value,CA))==null?void 0:HA.children)||[]:[u.value]).filter($e=>$e.tag===V.tag).indexOf(V)+1;return`${CA}/${V.tag}[${YA}]`}F.xpath=K(F,L),F.parentxpath=L,(F.children||[]).forEach(V=>oA(V,F.xpath))}function hA({action:F,element:L,newBlock:K}){const V=H(u.value,L.parentxpath||"");if(!V||!V.children)return;const CA=V.children.findIndex(cA=>cA===L);if(CA===-1){j.error("未找到元素");return}const te=V.children.length,{minBlock:YA,maxBlock:HA}=L.rule;if((F==="add"||F==="copy")&&te>=(HA||1/0)){I.value=`无法添加更多块。最大块数量为 ${HA}`,j.error(I.value);return}function $e(cA){cA.xpath="",cA.parentxpath="",cA.text=cA.editText||cA.text,cA.editText="",cA.children.forEach(ua=>{$e(ua)})}switch(F){case"add":if(K){const cA={...K,children:JSON.parse(JSON.stringify(K.children))};$e(cA),V.children.splice(CA+1,0,cA),j.success("添加成功")}break;case"copy":if(K){const cA={...K,children:JSON.parse(JSON.stringify(K.children))};$e(cA),V.children.splice(CA+1,0,cA),j.success("复制成功")}break;case"moveUp":if(CA>0){const[cA]=V.children.splice(CA,1);V.children.splice(CA-1,0,cA),j.success("前移成功")}else j.error("已经是第一个块,无法前移");break;case"moveDown":if(CA<V.children.length-1){const[cA]=V.children.splice(CA,1);V.children.splice(CA+1,0,cA),j.success("后移成功")}else j.error("已经是最后一个块,无法后移");break;case"delete":if(te<=(YA||0)){I.value=`无法删除更多块。最小块数量为 ${YA}`,j.error(I.value);return}V.children.splice(CA,1),j.success("删除成功");break}I.value="",oA(u.value)}function pA(F,L){let K=L.attrs.class.replace(/icon-\S+/g,`icon-${F}`);L.attrs.class=K}function GA(F){const L=F.file,K=H(u.value,F.element.xpath);if(r.uploadByFile)r.uploadByFile(L).then(V=>{V.success&&(K.attrs.src=V.file.url,h.value=new Date().getTime().toString())});else{K.attrs.alt=L.name;const V=URL.createObjectURL(L);K.attrs.src=V,h.value=new Date().getTime().toString()}}function IA(F){const{icon:L}=F,K=H(u.value,F.element.xpath);let V=K.attrs.class.replace(/icon-\S+/g,`icon-${L}`);K.attrs.class=V,h.value=new Date().getTime().toString()}const KA=F=>F.type.startsWith("image/")?!0:(j.error("只能上传图片文件"),!1),xA=c.ref({});function ZA(F,L){if(!F||F.length===0)return;const K=F[0];if(L.rule&&(L.rule.minImageWidth||L.rule.maxImageHeight)){if(L.rule.minImageWidth&&K.width<L.rule.minImageWidth){j.error(`图片宽度不能小于 ${L.rule.minImageWidth}px`);return}if(L.rule.maxImageHeight&&K.height<L.rule.maxImageHeight){j.error(`图片高度不能小于 ${L.rule.maxImageHeight}px`);return}}L.rule.minImageWidth&&L.rule.maxImageHeight?(xA.value.width=L.rule.minImageWidth,xA.value.height=L.rule.maxImageHeight,xA.value.aspectRatio=L.rule.minImageWidth/L.rule.maxImageHeight):xA.value={},K&&(L.rule.crop?(K.thumbUrl,d.value.handleOpenCropper(xA.value,K.file,K.name,L)):r.uploadByFile?r.uploadByFile(K.file).then(V=>{V.success&&(L.attrs.src=V.file.url,h.value=new Date().getTime().toString())}):(L.attrs.src=K.thumbUrl,h.value=new Date().getTime().toString()))}const _A=c.ref(r.previewWidth),v=c.ref(360);let S=c.ref(!1),q=c.ref(""),$=0,zA=0;function je(F){q.value=F,S.value=!0,$=event.clientX,F==="preview"?zA=_A.value:F==="structure"&&(zA=v.value),window.addEventListener("mousemove",Lr),window.addEventListener("mouseup",xr)}function Lr(F){if(!S.value)return;const L=F.clientX-$;q.value==="preview"?_A.value=Math.max(200,zA+L):q.value==="structure"&&(v.value=Math.max(200,zA-L))}function xr(){S.value=!1,q.value="",window.removeEventListener("mousemove",Lr),window.removeEventListener("mouseup",xr)}return e({generateCover:k}),(F,L)=>(c.openBlock(),c.createElementBlock("div",qb,[F.preview?(c.openBlock(),c.createElementBlock("div",{key:0,class:"border-l overflow-auto resize-area",style:c.normalizeStyle({width:_A.value+"px"})},[F.showTitle?(c.openBlock(),c.createElementBlock("div",jb,[c.createElementVNode("h2",$b,[L[4]||(L[4]=c.createTextVNode(" 实时预览 ")),c.createElementVNode("span",Zb,c.toDisplayString(_A.value)+"px",1)]),c.createElementVNode("div",{onClick:L[0]||(L[0]=()=>k()),class:"p-2 cursor-pointer text-blue-500"}," 封面 ")])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[l.value?(c.openBlock(),c.createBlock(Wl,{key:0,"css-files":F.css,"js-files":F.js,"html-content":l.value,class:"gp-designer-preview",ref_key:"previewRef",ref:T},null,8,["css-files","js-files","html-content"])):(c.openBlock(),c.createBlock(Wl,{key:1,"css-files":F.css,"js-files":F.js,"html-content":c.unref(o)("body").html(),class:"gp-designer-preview",ref_key:"previewRef",ref:T},null,8,["css-files","js-files","html-content"]))])],4)):c.createCommentVNode("",!0),F.preview?(c.openBlock(),c.createElementBlock("div",{key:1,class:"resizer",onMousedown:L[1]||(L[1]=K=>je("preview"))},null,32)):c.createCommentVNode("",!0),c.createElementVNode("div",zb,[F.showTitle?(c.openBlock(),c.createElementBlock("div",AU,[L[6]||(L[6]=c.createElementVNode("h2",{class:"text-lg font-bold"},"结构渲染",-1)),c.createElementVNode("div",eU,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":L[2]||(L[2]=K=>D.value=K),type:"checkbox",id:"showMargin",class:"mr-2"},null,512),[[c.vModelCheckbox,D.value]]),L[5]||(L[5]=c.createElementVNode("label",{for:"showMargin"},"间距",-1))])])):c.createCommentVNode("",!0),c.createElementVNode("div",tU,[u.value?(c.openBlock(),c.createBlock(CE,{key:0,"upload-by-file":F.uploadByFile,cropper:d.value,icon:C.value,upload:p.value,mode:F.mode,icons:F.icons,r:h.value,"show-margin":D.value,element:u.value,selectedElement:U.value,hoveredElement:_.value,onSelectElement:x,onHoverElement:m,onContentUpdated:uA,onUpdateText:rA,onBlockAction:hA,onAddIcon:pA,onUpdateElementRule:eA},null,8,["upload-by-file","cropper","icon","upload","mode","icons","r","show-margin","element","selectedElement","hoveredElement"])):c.createCommentVNode("",!0)])]),f.value=="design"?(c.openBlock(),c.createElementBlock("div",{key:2,class:"resizer",onMousedown:L[3]||(L[3]=K=>je("structure"))},null,32)):c.createCommentVNode("",!0),f.value=="design"?(c.openBlock(),c.createElementBlock("div",{key:3,class:"resize-area",style:c.normalizeStyle({width:v.value+"px"})},[c.createElementVNode("div",rU,[F.showTitle?(c.openBlock(),c.createElementBlock("h2",nU,[L[7]||(L[7]=c.createTextVNode(" 节点属性 ")),c.createElementVNode("span",aU,c.toDisplayString(v.value)+"px",1)])):c.createCommentVNode("",!0),c.createElementVNode("div",sU,[U.value?(c.openBlock(),c.createBlock(YE,{key:0,element:U.value,onUpdateElement:M},null,8,["element"])):c.createCommentVNode("",!0)])])],4)):c.createCommentVNode("",!0),c.createVNode(ep,{ref_key:"cropperRef",ref:d,onOk:GA},null,512),c.createVNode(fp,{icons:F.icons,ref_key:"iconRef",ref:C,onOk:IA},null,8,["icons"]),c.createVNode(wp,{ref_key:"uploadRef",ref:p,multiple:!1,show:!1,beforeUpload:KA,onChange:ZA},{"upload-icon":c.withCtx(()=>L[8]||(L[8]=[c.createElementVNode("div",{class:"p-2"},"上传",-1)])),_:1},512)]))}}),[["__scopeId","data-v-0670a162"]]),iU={install(A){A.component("Designer",Jl)}};Ne.Designer=Jl,Ne.default=iU,Object.defineProperties(Ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
39
|
+
.`+li+sb+Dl)},ub=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}},Ol=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),ob=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(hi(e)||hb(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return VA(this,void 0,void 0,function(){var t,r,n,a,s=this;return kA(this,function(u){switch(u.label){case 0:return t=Ol.isSameOrigin(e),r=!fi(e)&&this._options.useCORS===!0&&RA.SUPPORT_CORS_IMAGES&&!t,n=!fi(e)&&!t&&!hi(e)&&typeof this._options.proxy=="string"&&RA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!fi(e)&&!hi(e)&&!n&&!r?[2]:(a=e,n?[4,this.proxy(a)]:[3,2]);case 1:a=u.sent(),u.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(o,l){var f=new Image;f.onload=function(){return o(f)},f.onerror=l,(db(a)||r)&&(f.crossOrigin="anonymous"),f.src=a,f.complete===!0&&setTimeout(function(){return o(f)},500),s._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,u.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(a,s){var u=RA.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(o.status===200)if(u==="text")a(o.response);else{var h=new FileReader;h.addEventListener("load",function(){return a(h.result)},!1),h.addEventListener("error",function(d){return s(d)},!1),h.readAsDataURL(o.response)}else s("Failed to proxy resource "+n+" with status code "+o.status)},o.onerror=s;var l=r.indexOf("?")>-1?"&":"?";if(o.open("GET",""+r+l+"url="+encodeURIComponent(e)+"&responseType="+u),u!=="text"&&o instanceof XMLHttpRequest&&(o.responseType=u),t._options.imageTimeout){var f=t._options.imageTimeout;o.timeout=f,o.ontimeout=function(){return s("Timed out ("+f+"ms) proxying "+n)}}o.send()})},A}(),cb=/^data:image\/svg\+xml/i,lb=/^data:image\/.*;base64,/i,fb=/^data:image\/.*/i,hb=function(A){return RA.SUPPORT_SVG_DRAWING||!Bb(A)},fi=function(A){return fb.test(A)},db=function(A){return lb.test(A)},hi=function(A){return A.substr(0,4)==="blob"},Bb=function(A){return A.substr(-3).toLowerCase()==="svg"||cb.test(A)},O=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Dt=function(A,e,t){return new O(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},ea=function(){function A(e,t,r,n){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=n}return A.prototype.subdivide=function(e,t){var r=Dt(this.start,this.startControl,e),n=Dt(this.startControl,this.endControl,e),a=Dt(this.endControl,this.end,e),s=Dt(r,n,e),u=Dt(n,a,e),o=Dt(s,u,e);return t?new A(this.start,r,s,o):new A(o,u,a,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),ue=function(A){return A.type===1},gb=function(){function A(e){var t=e.styles,r=e.bounds,n=Qr(t.borderTopLeftRadius,r.width,r.height),a=n[0],s=n[1],u=Qr(t.borderTopRightRadius,r.width,r.height),o=u[0],l=u[1],f=Qr(t.borderBottomRightRadius,r.width,r.height),h=f[0],d=f[1],C=Qr(t.borderBottomLeftRadius,r.width,r.height),p=C[0],T=C[1],U=[];U.push((a+o)/r.width),U.push((p+h)/r.width),U.push((s+T)/r.height),U.push((l+d)/r.height);var _=Math.max.apply(Math,U);_>1&&(a/=_,s/=_,o/=_,l/=_,h/=_,d/=_,p/=_,T/=_);var I=r.width-o,D=r.height-d,k=r.width-h,x=r.height-T,m=t.borderTopWidth,H=t.borderRightWidth,P=t.borderBottomWidth,M=t.borderLeftWidth,eA=lA(t.paddingTop,e.bounds.width),uA=lA(t.paddingRight,e.bounds.width),fA=lA(t.paddingBottom,e.bounds.width),J=lA(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||s>0?EA(r.left+M/3,r.top+m/3,a-M/3,s-m/3,aA.TOP_LEFT):new O(r.left+M/3,r.top+m/3),this.topRightBorderDoubleOuterBox=a>0||s>0?EA(r.left+I,r.top+m/3,o-H/3,l-m/3,aA.TOP_RIGHT):new O(r.left+r.width-H/3,r.top+m/3),this.bottomRightBorderDoubleOuterBox=h>0||d>0?EA(r.left+k,r.top+D,h-H/3,d-P/3,aA.BOTTOM_RIGHT):new O(r.left+r.width-H/3,r.top+r.height-P/3),this.bottomLeftBorderDoubleOuterBox=p>0||T>0?EA(r.left+M/3,r.top+x,p-M/3,T-P/3,aA.BOTTOM_LEFT):new O(r.left+M/3,r.top+r.height-P/3),this.topLeftBorderDoubleInnerBox=a>0||s>0?EA(r.left+M*2/3,r.top+m*2/3,a-M*2/3,s-m*2/3,aA.TOP_LEFT):new O(r.left+M*2/3,r.top+m*2/3),this.topRightBorderDoubleInnerBox=a>0||s>0?EA(r.left+I,r.top+m*2/3,o-H*2/3,l-m*2/3,aA.TOP_RIGHT):new O(r.left+r.width-H*2/3,r.top+m*2/3),this.bottomRightBorderDoubleInnerBox=h>0||d>0?EA(r.left+k,r.top+D,h-H*2/3,d-P*2/3,aA.BOTTOM_RIGHT):new O(r.left+r.width-H*2/3,r.top+r.height-P*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||T>0?EA(r.left+M*2/3,r.top+x,p-M*2/3,T-P*2/3,aA.BOTTOM_LEFT):new O(r.left+M*2/3,r.top+r.height-P*2/3),this.topLeftBorderStroke=a>0||s>0?EA(r.left+M/2,r.top+m/2,a-M/2,s-m/2,aA.TOP_LEFT):new O(r.left+M/2,r.top+m/2),this.topRightBorderStroke=a>0||s>0?EA(r.left+I,r.top+m/2,o-H/2,l-m/2,aA.TOP_RIGHT):new O(r.left+r.width-H/2,r.top+m/2),this.bottomRightBorderStroke=h>0||d>0?EA(r.left+k,r.top+D,h-H/2,d-P/2,aA.BOTTOM_RIGHT):new O(r.left+r.width-H/2,r.top+r.height-P/2),this.bottomLeftBorderStroke=p>0||T>0?EA(r.left+M/2,r.top+x,p-M/2,T-P/2,aA.BOTTOM_LEFT):new O(r.left+M/2,r.top+r.height-P/2),this.topLeftBorderBox=a>0||s>0?EA(r.left,r.top,a,s,aA.TOP_LEFT):new O(r.left,r.top),this.topRightBorderBox=o>0||l>0?EA(r.left+I,r.top,o,l,aA.TOP_RIGHT):new O(r.left+r.width,r.top),this.bottomRightBorderBox=h>0||d>0?EA(r.left+k,r.top+D,h,d,aA.BOTTOM_RIGHT):new O(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||T>0?EA(r.left,r.top+x,p,T,aA.BOTTOM_LEFT):new O(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||s>0?EA(r.left+M,r.top+m,Math.max(0,a-M),Math.max(0,s-m),aA.TOP_LEFT):new O(r.left+M,r.top+m),this.topRightPaddingBox=o>0||l>0?EA(r.left+Math.min(I,r.width-H),r.top+m,I>r.width+H?0:Math.max(0,o-H),Math.max(0,l-m),aA.TOP_RIGHT):new O(r.left+r.width-H,r.top+m),this.bottomRightPaddingBox=h>0||d>0?EA(r.left+Math.min(k,r.width-M),r.top+Math.min(D,r.height-P),Math.max(0,h-H),Math.max(0,d-P),aA.BOTTOM_RIGHT):new O(r.left+r.width-H,r.top+r.height-P),this.bottomLeftPaddingBox=p>0||T>0?EA(r.left+M,r.top+Math.min(x,r.height-P),Math.max(0,p-M),Math.max(0,T-P),aA.BOTTOM_LEFT):new O(r.left+M,r.top+r.height-P),this.topLeftContentBox=a>0||s>0?EA(r.left+M+J,r.top+m+eA,Math.max(0,a-(M+J)),Math.max(0,s-(m+eA)),aA.TOP_LEFT):new O(r.left+M+J,r.top+m+eA),this.topRightContentBox=o>0||l>0?EA(r.left+Math.min(I,r.width+M+J),r.top+m+eA,I>r.width+M+J?0:o-M+J,l-(m+eA),aA.TOP_RIGHT):new O(r.left+r.width-(H+uA),r.top+m+eA),this.bottomRightContentBox=h>0||d>0?EA(r.left+Math.min(k,r.width-(M+J)),r.top+Math.min(D,r.height+m+eA),Math.max(0,h-(H+uA)),d-(P+fA),aA.BOTTOM_RIGHT):new O(r.left+r.width-(H+uA),r.top+r.height-(P+fA)),this.bottomLeftContentBox=p>0||T>0?EA(r.left+M+J,r.top+x,Math.max(0,p-(M+J)),T-(P+fA),aA.BOTTOM_LEFT):new O(r.left+M+J,r.top+r.height-(P+fA))}return A}(),aA;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(aA||(aA={}));var EA=function(A,e,t,r,n){var a=4*((Math.sqrt(2)-1)/3),s=t*a,u=r*a,o=A+t,l=e+r;switch(n){case aA.TOP_LEFT:return new ea(new O(A,l),new O(A,l-u),new O(o-s,e),new O(o,e));case aA.TOP_RIGHT:return new ea(new O(A,e),new O(A+s,e),new O(o,l-u),new O(o,l));case aA.BOTTOM_RIGHT:return new ea(new O(o,e),new O(o,e+u),new O(A+s,l),new O(A,l));case aA.BOTTOM_LEFT:default:return new ea(new O(o,l),new O(o-s,l),new O(A,e+u),new O(A,e))}},ta=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Eb=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},ra=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},mb=function(){function A(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return A}(),na=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),pb=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),Cb=function(A){return A.type===0},Rl=function(A){return A.type===1},wb=function(A){return A.type===2},Ml=function(A,e){return A.length===e.length?A.some(function(t,r){return t===e[r]}):!1},Tb=function(A,e,t,r,n){return A.map(function(a,s){switch(s){case 0:return a.add(e,t);case 1:return a.add(e+r,t);case 2:return a.add(e+r,t+n);case 3:return a.add(e,t+n)}return a})},kl=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),Pl=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new gb(this.container),this.container.styles.opacity<1&&this.effects.push(new pb(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new mb(r,n,a))}if(this.container.styles.overflowX!==0){var s=ta(this.curves),u=ra(this.curves);Ml(s,u)?this.effects.push(new na(s,6)):(this.effects.push(new na(s,2)),this.effects.push(new na(u,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(o){return!Rl(o)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var s=ta(r.curves),u=ra(r.curves);Ml(s,u)||n.unshift(new na(u,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(o){return FA(o.target,e)})},A}(),di=function(A,e,t,r){A.container.elements.forEach(function(n){var a=FA(n.flags,4),s=FA(n.flags,2),u=new Pl(n,A);FA(n.styles.display,2048)&&r.push(u);var o=FA(n.flags,8)?[]:r;if(a||s){var l=a||n.styles.isPositioned()?t:e,f=new kl(u);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;l.negativeZIndex.some(function(p,T){return h>p.element.container.styles.zIndex.order?(d=T,!1):d>0}),l.negativeZIndex.splice(d,0,f)}else if(h>0){var C=0;l.positiveZIndex.some(function(p,T){return h>=p.element.container.styles.zIndex.order?(C=T+1,!1):C>0}),l.positiveZIndex.splice(C,0,f)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(f)}else n.styles.isFloating()?l.nonPositionedFloats.push(f):l.nonPositionedInlineLevel.push(f);di(u,f,a?f:t,o)}else n.styles.isInlineLevel()?e.inlineLevel.push(u):e.nonInlineLevel.push(u),di(u,e,t,o);FA(n.flags,8)&&Kl(n,o)})},Kl=function(A,e){for(var t=A instanceof ri?A.start:1,r=A instanceof ri?A.reversed:!1,n=0;n<e.length;n++){var a=e[n];a.container instanceof hl&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=Sr(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},bb=function(A){var e=new Pl(A,null),t=new kl(e),r=[];return di(e,t,t,r),Kl(e.container,r),t},Vl=function(A,e){switch(e){case 0:return oe(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return oe(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return oe(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return oe(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ub=function(A,e){switch(e){case 0:return oe(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return oe(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return oe(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return oe(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Qb=function(A,e){switch(e){case 0:return oe(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return oe(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return oe(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return oe(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Fb=function(A,e){switch(e){case 0:return aa(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return aa(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return aa(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return aa(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},aa=function(A,e){var t=[];return ue(A)?t.push(A.subdivide(.5,!1)):t.push(A),ue(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},oe=function(A,e,t,r){var n=[];return ue(A)?n.push(A.subdivide(.5,!1)):n.push(A),ue(t)?n.push(t.subdivide(.5,!0)):n.push(t),ue(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),ue(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Gl=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},sa=function(A){var e=A.styles,t=A.bounds,r=lA(e.paddingLeft,t.width),n=lA(e.paddingRight,t.width),a=lA(e.paddingTop,t.width),s=lA(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+a+s))},Ib=function(A,e){return A===0?e.bounds:A===2?sa(e):Gl(e)},_b=function(A,e){return A===0?e.bounds:A===2?sa(e):Gl(e)},Bi=function(A,e,t){var r=Ib(Rt(A.styles.backgroundOrigin,e),A),n=_b(Rt(A.styles.backgroundClip,e),A),a=yb(Rt(A.styles.backgroundSize,e),t,r),s=a[0],u=a[1],o=Qr(Rt(A.styles.backgroundPosition,e),r.width-s,r.height-u),l=Nb(Rt(A.styles.backgroundRepeat,e),o,a,r,n),f=Math.round(r.left+o[0]),h=Math.round(r.top+o[1]);return[l,f,h,s,u]},Ot=function(A){return iA(A)&&A.value===vt.AUTO},ia=function(A){return typeof A=="number"},yb=function(A,e,t){var r=e[0],n=e[1],a=e[2],s=A[0],u=A[1];if(!s)return[0,0];if(UA(s)&&u&&UA(u))return[lA(s,t.width),lA(u,t.height)];var o=ia(a);if(iA(s)&&(s.value===vt.CONTAIN||s.value===vt.COVER)){if(ia(a)){var l=t.width/t.height;return l<a!=(s.value===vt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var f=ia(r),h=ia(n),d=f||h;if(Ot(s)&&(!u||Ot(u))){if(f&&h)return[r,n];if(!o&&!d)return[t.width,t.height];if(d&&o){var C=f?r:n*a,p=h?n:r/a;return[C,p]}var T=f?r:t.width,U=h?n:t.height;return[T,U]}if(o){var _=0,I=0;return UA(s)?_=lA(s,t.width):UA(u)&&(I=lA(u,t.height)),Ot(s)?_=I*a:(!u||Ot(u))&&(I=_/a),[_,I]}var D=null,k=null;if(UA(s)?D=lA(s,t.width):u&&UA(u)&&(k=lA(u,t.height)),D!==null&&(!u||Ot(u))&&(k=f&&h?D/r*n:t.height),k!==null&&Ot(s)&&(D=f&&h?k/n*r:t.width),D!==null&&k!==null)return[D,k];throw new Error("Unable to calculate background-size for element")},Rt=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},Nb=function(A,e,t,r,n){var a=e[0],s=e[1],u=t[0],o=t[1];switch(A){case 2:return[new O(Math.round(r.left),Math.round(r.top+s)),new O(Math.round(r.left+r.width),Math.round(r.top+s)),new O(Math.round(r.left+r.width),Math.round(o+r.top+s)),new O(Math.round(r.left),Math.round(o+r.top+s))];case 3:return[new O(Math.round(r.left+a),Math.round(r.top)),new O(Math.round(r.left+a+u),Math.round(r.top)),new O(Math.round(r.left+a+u),Math.round(r.height+r.top)),new O(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new O(Math.round(r.left+a),Math.round(r.top+s)),new O(Math.round(r.left+a+u),Math.round(r.top+s)),new O(Math.round(r.left+a+u),Math.round(r.top+s+o)),new O(Math.round(r.left+a),Math.round(r.top+s+o))];default:return[new O(Math.round(n.left),Math.round(n.top)),new O(Math.round(n.left+n.width),Math.round(n.top)),new O(Math.round(n.left+n.width),Math.round(n.height+n.top)),new O(Math.round(n.left),Math.round(n.height+n.top))]}},Sb="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Yl="Hidden Text",vb=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),s=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",s.appendChild(r),n.src=Sb,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(Yl)),r.appendChild(a),r.appendChild(n);var u=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(Yl)),r.style.lineHeight="normal",n.style.verticalAlign="super";var o=n.offsetTop-r.offsetTop+2;return s.removeChild(r),{baseline:u,middle:o}},A.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},A}(),Xl=function(){function A(e,t){this.context=e,this.options=t}return A}(),Lb=1e4,xb=function(A){he(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new vb(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},e.prototype.applyEffect=function(t){this.ctx.save(),wb(t)&&(this.ctx.globalAlpha=t.opacity),Cb(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Rl(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return VA(this,void 0,void 0,function(){var r;return kA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return VA(this,void 0,void 0,function(){return kA(this,function(r){switch(r.label){case 0:if(FA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var s=ti(t.text);s.reduce(function(u,o){return a.ctx.fillText(o,u,t.bounds.top+n),u+a.ctx.measureText(o).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),n=Mb(t.fontFamily).join(", "),a=Ur(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},e.prototype.renderTextNode=function(t,r){return VA(this,void 0,void 0,function(){var n,a,s,u,o,l,f,h,d=this;return kA(this,function(C){return n=this.createFontStyle(r),a=n[0],s=n[1],u=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",o=this.fontMetrics.getMetrics(s,u),l=o.baseline,f=o.middle,h=r.paintOrder,t.textBounds.forEach(function(p){h.forEach(function(T){switch(T){case 0:d.ctx.fillStyle=LA(r.color),d.renderTextWithLetterSpacing(p,r.letterSpacing,l);var U=r.textShadow;U.length&&p.text.trim().length&&(U.slice(0).reverse().forEach(function(_){d.ctx.shadowColor=LA(_.color),d.ctx.shadowOffsetX=_.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=_.offsetY.number*d.options.scale,d.ctx.shadowBlur=_.blur.number,d.renderTextWithLetterSpacing(p,r.letterSpacing,l)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),r.textDecorationLine.length&&(d.ctx.fillStyle=LA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(_){switch(_){case 1:d.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+l),p.bounds.width,1);break;case 2:d.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:d.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+f),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(d.ctx.strokeStyle=LA(r.webkitTextStrokeColor),d.ctx.lineWidth=r.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+l)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=sa(t),s=ra(r);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o,I,I,l,f,h,d,k,C,p,x,T,U,_,I,D,k,x;return kA(this,function(m){switch(m.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,s=0,u=r.textNodes,m.label=1;case 1:return s<u.length?(o=u[s],[4,this.renderTextNode(o,a)]):[3,4];case 2:m.sent(),m.label=3;case 3:return s++,[3,1];case 4:if(!(r instanceof cl))return[3,8];m.label=5;case 5:return m.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return I=m.sent(),this.renderReplacedElement(r,n,I),[3,8];case 7:return m.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof ll&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof fl))return[3,12];m.label=9;case 9:return m.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return I=m.sent(),this.renderReplacedElement(r,n,I),[3,12];case 11:return m.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof El&&r.tree?(l=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,l.render(r.tree)]):[3,14];case 13:f=m.sent(),r.width&&r.height&&this.ctx.drawImage(f,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),m.label=14;case 14:if(r instanceof ni&&(h=Math.min(r.bounds.width,r.bounds.height),r.type===qn?r.checked&&(this.ctx.save(),this.path([new O(r.bounds.left+h*.39363,r.bounds.top+h*.79),new O(r.bounds.left+h*.16,r.bounds.top+h*.5549),new O(r.bounds.left+h*.27347,r.bounds.top+h*.44071),new O(r.bounds.left+h*.39694,r.bounds.top+h*.5649),new O(r.bounds.left+h*.72983,r.bounds.top+h*.23),new O(r.bounds.left+h*.84,r.bounds.top+h*.34085),new O(r.bounds.left+h*.39363,r.bounds.top+h*.79)]),this.ctx.fillStyle=LA(dl),this.ctx.fill(),this.ctx.restore()):r.type===jn&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+h/2,r.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=LA(dl),this.ctx.fill(),this.ctx.restore())),Hb(r)&&r.value.length){switch(d=this.createFontStyle(a),k=d[0],C=d[1],p=this.fontMetrics.getMetrics(k,C).baseline,this.ctx.font=k,this.ctx.fillStyle=LA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Ob(r.styles.textAlign),x=sa(r),T=0,r.styles.textAlign){case 1:T+=x.width/2;break;case 2:T+=x.width;break}U=x.add(T,0,0,-x.height/2+1),this.ctx.save(),this.path([new O(x.left,x.top),new O(x.left+x.width,x.top),new O(x.left+x.width,x.top+x.height),new O(x.left,x.top+x.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new yr(r.value,U),a.letterSpacing,p),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!FA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(_=r.styles.listStyleImage,_.type!==0)return[3,18];I=void 0,D=_.url,m.label=15;case 15:return m.trys.push([15,17,,18]),[4,this.context.cache.match(D)];case 16:return I=m.sent(),this.ctx.drawImage(I,r.bounds.left-(I.width+10),r.bounds.top),[3,18];case 17:return m.sent(),this.context.logger.error("Error loading list-style-image "+D),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(k=this.createFontStyle(a)[0],this.ctx.font=k,this.ctx.fillStyle=LA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",x=new Fe(r.bounds.left,r.bounds.top+lA(r.styles.paddingTop,r.bounds.width),r.bounds.width,Yc(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new yr(t.listValue,x),a.letterSpacing,Yc(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),m.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return VA(this,void 0,void 0,function(){var r,n,_,a,s,_,u,o,_,l,f,_,h,d,_,C,p,_,T,U,_;return kA(this,function(I){switch(I.label){case 0:if(FA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:I.sent(),r=0,n=t.negativeZIndex,I.label=2;case 2:return r<n.length?(_=n[r],[4,this.renderStack(_)]):[3,5];case 3:I.sent(),I.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:I.sent(),a=0,s=t.nonInlineLevel,I.label=7;case 7:return a<s.length?(_=s[a],[4,this.renderNode(_)]):[3,10];case 8:I.sent(),I.label=9;case 9:return a++,[3,7];case 10:u=0,o=t.nonPositionedFloats,I.label=11;case 11:return u<o.length?(_=o[u],[4,this.renderStack(_)]):[3,14];case 12:I.sent(),I.label=13;case 13:return u++,[3,11];case 14:l=0,f=t.nonPositionedInlineLevel,I.label=15;case 15:return l<f.length?(_=f[l],[4,this.renderStack(_)]):[3,18];case 16:I.sent(),I.label=17;case 17:return l++,[3,15];case 18:h=0,d=t.inlineLevel,I.label=19;case 19:return h<d.length?(_=d[h],[4,this.renderNode(_)]):[3,22];case 20:I.sent(),I.label=21;case 21:return h++,[3,19];case 22:C=0,p=t.zeroOrAutoZIndexOrTransformedOrOpacity,I.label=23;case 23:return C<p.length?(_=p[C],[4,this.renderStack(_)]):[3,26];case 24:I.sent(),I.label=25;case 25:return C++,[3,23];case 26:T=0,U=t.positiveZIndex,I.label=27;case 27:return T<U.length?(_=U[T],[4,this.renderStack(_)]):[3,30];case 28:I.sent(),I.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var s=ue(n)?n.start:n;a===0?r.ctx.moveTo(s.x,s.y):r.ctx.lineTo(s.x,s.y),ue(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},e.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var s=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,u=s.createElement("canvas");u.width=Math.max(1,r),u.height=Math.max(1,n);var o=u.getContext("2d");return o.drawImage(t,0,0,t.width,t.height,0,0,r,n),u},e.prototype.renderBackgroundImage=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o;return kA(this,function(l){switch(l.label){case 0:r=t.styles.backgroundImage.length-1,n=function(f){var h,d,C,eA,hA,pA,J,rA,P,p,eA,hA,pA,J,rA,T,U,_,I,D,k,x,m,H,P,M,eA,uA,fA,J,rA,oA,hA,pA,GA,IA,KA,xA,ZA,_A,S,v;return kA(this,function(q){switch(q.label){case 0:if(f.type!==0)return[3,5];h=void 0,d=f.url,q.label=1;case 1:return q.trys.push([1,3,,4]),[4,a.context.cache.match(d)];case 2:return h=q.sent(),[3,4];case 3:return q.sent(),a.context.logger.error("Error loading background-image "+d),[3,4];case 4:return h&&(C=Bi(t,r,[h.width,h.height,h.width/h.height]),eA=C[0],hA=C[1],pA=C[2],J=C[3],rA=C[4],P=a.ctx.createPattern(a.resizeImage(h,J,rA),"repeat"),a.renderRepeat(eA,P,hA,pA)),[3,6];case 5:C1(f)?(p=Bi(t,r,[null,null,null]),eA=p[0],hA=p[1],pA=p[2],J=p[3],rA=p[4],T=B1(f.angle,J,rA),U=T[0],_=T[1],I=T[2],D=T[3],k=T[4],x=document.createElement("canvas"),x.width=J,x.height=rA,m=x.getContext("2d"),H=m.createLinearGradient(_,D,I,k),xc(f.stops,U).forEach(function($){return H.addColorStop($.stop,LA($.color))}),m.fillStyle=H,m.fillRect(0,0,J,rA),J>0&&rA>0&&(P=a.ctx.createPattern(x,"repeat"),a.renderRepeat(eA,P,hA,pA))):w1(f)&&(M=Bi(t,r,[null,null,null]),eA=M[0],uA=M[1],fA=M[2],J=M[3],rA=M[4],oA=f.position.length===0?[Ps]:f.position,hA=lA(oA[0],J),pA=lA(oA[oA.length-1],rA),GA=g1(f,hA,pA,J,rA),IA=GA[0],KA=GA[1],IA>0&&KA>0&&(xA=a.ctx.createRadialGradient(uA+hA,fA+pA,0,uA+hA,fA+pA,IA),xc(f.stops,IA*2).forEach(function($){return xA.addColorStop($.stop,LA($.color))}),a.path(eA),a.ctx.fillStyle=xA,IA!==KA?(ZA=t.bounds.left+.5*t.bounds.width,_A=t.bounds.top+.5*t.bounds.height,S=KA/IA,v=1/S,a.ctx.save(),a.ctx.translate(ZA,_A),a.ctx.transform(1,0,0,S,0,0),a.ctx.translate(-ZA,-_A),a.ctx.fillRect(uA,v*(fA-_A)+_A,J,rA*v),a.ctx.restore()):a.ctx.fill())),q.label=6;case 6:return r--,[2]}})},a=this,s=0,u=t.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return s<u.length?(o=u[s],[5,n(o)]):[3,4];case 2:l.sent(),l.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,n){return VA(this,void 0,void 0,function(){return kA(this,function(a){return this.path(Vl(n,r)),this.ctx.fillStyle=LA(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,n,a){return VA(this,void 0,void 0,function(){var s,u;return kA(this,function(o){switch(o.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return o.sent(),[2];case 2:return s=Ub(a,n),this.path(s),this.ctx.fillStyle=LA(t),this.ctx.fill(),u=Qb(a,n),this.path(u),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return VA(this,void 0,void 0,function(){var r,n,a,s,u,o,l,f,h=this;return kA(this,function(d){switch(d.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Xe(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],s=Db(Rt(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),Xe(r.backgroundColor)||(this.ctx.fillStyle=LA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(C){h.ctx.save();var p=ta(t.curves),T=C.inset?0:Lb,U=Tb(p,-T+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(h.path(p),h.ctx.clip(),h.mask(U)):(h.mask(p),h.ctx.clip(),h.path(U)),h.ctx.shadowOffsetX=C.offsetX.number+T,h.ctx.shadowOffsetY=C.offsetY.number,h.ctx.shadowColor=LA(C.color),h.ctx.shadowBlur=C.blur.number,h.ctx.fillStyle=C.inset?LA(C.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),d.label=2;case 2:u=0,o=0,l=a,d.label=3;case 3:return o<l.length?(f=l[o],f.style!==0&&!Xe(f.color)&&f.width>0?f.style!==2?[3,5]:[4,this.renderDashedDottedBorder(f.color,f.width,u,t.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return f.style!==3?[3,7]:[4,this.renderDashedDottedBorder(f.color,f.width,u,t.curves,3)];case 6:return d.sent(),[3,11];case 7:return f.style!==4?[3,9]:[4,this.renderDoubleBorder(f.color,f.width,u,t.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(f.color,u,t.curves)];case 10:d.sent(),d.label=11;case 11:u++,d.label=12;case 12:return o++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,n,a,s){return VA(this,void 0,void 0,function(){var u,o,l,f,h,d,C,p,T,U,_,I,D,k,x,m,x,m;return kA(this,function(H){return this.ctx.save(),u=Fb(a,n),o=Vl(a,n),s===2&&(this.path(o),this.ctx.clip()),ue(o[0])?(l=o[0].start.x,f=o[0].start.y):(l=o[0].x,f=o[0].y),ue(o[1])?(h=o[1].end.x,d=o[1].end.y):(h=o[1].x,d=o[1].y),n===0||n===2?C=Math.abs(l-h):C=Math.abs(f-d),this.ctx.beginPath(),s===3?this.formatPath(u):this.formatPath(o.slice(0,2)),p=r<3?r*3:r*2,T=r<3?r*2:r,s===3&&(p=r,T=r),U=!0,C<=p*2?U=!1:C<=p*2+T?(_=C/(2*p+T),p*=_,T*=_):(I=Math.floor((C+T)/(p+T)),D=(C-I*p)/(I-1),k=(C-(I+1)*p)/I,T=k<=0||Math.abs(T-D)<Math.abs(T-k)?D:k),U&&(s===3?this.ctx.setLineDash([0,p+T]):this.ctx.setLineDash([p,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=LA(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(ue(o[0])&&(x=o[3],m=o[0],this.ctx.beginPath(),this.formatPath([new O(x.end.x,x.end.y),new O(m.start.x,m.start.y)]),this.ctx.stroke()),ue(o[1])&&(x=o[1],m=o[2],this.ctx.beginPath(),this.formatPath([new O(x.end.x,x.end.y),new O(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return VA(this,void 0,void 0,function(){var r;return kA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=LA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=bb(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(Xl),Hb=function(A){return A instanceof gl||A instanceof Bl?!0:A instanceof ni&&A.type!==jn&&A.type!==qn},Db=function(A,e){switch(A){case 0:return ta(e);case 2:return Eb(e);case 1:default:return ra(e)}},Ob=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Rb=["-apple-system","system-ui"],Mb=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return Rb.indexOf(e)===-1}):A},kb=function(A){he(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return e.prototype.render=function(t){return VA(this,void 0,void 0,function(){var r,n;return kA(this,function(a){switch(a.label){case 0:return r=ei(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Pb(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=LA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(Xl),Pb=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Kb=function(){function A(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Bn([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A}(),Vb=function(){function A(e,t){var r;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new Kb({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new ob(this,e)}return A.instanceCount=1,A}(),Gb=function(A,e){return e===void 0&&(e={}),Yb(A,e)};typeof window<"u"&&Ol.setContext(window);var Yb=function(A,e){return VA(void 0,void 0,void 0,function(){var t,r,n,a,s,u,o,l,f,h,d,C,p,T,U,_,I,D,k,x,H,m,H,P,M,eA,uA,fA,J,rA,oA,hA,pA,GA,IA,KA,xA,ZA,_A,S;return kA(this,function(v){switch(v.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(P=e.allowTaint)!==null&&P!==void 0?P:!1,imageTimeout:(M=e.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:e.proxy,useCORS:(eA=e.useCORS)!==null&&eA!==void 0?eA:!1},a=Cs({logging:(uA=e.logging)!==null&&uA!==void 0?uA:!0,cache:e.cache},n),s={windowWidth:(fA=e.windowWidth)!==null&&fA!==void 0?fA:r.innerWidth,windowHeight:(J=e.windowHeight)!==null&&J!==void 0?J:r.innerHeight,scrollX:(rA=e.scrollX)!==null&&rA!==void 0?rA:r.pageXOffset,scrollY:(oA=e.scrollY)!==null&&oA!==void 0?oA:r.pageYOffset},u=new Fe(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),o=new Vb(a,u),l=(hA=e.foreignObjectRendering)!==null&&hA!==void 0?hA:!1,f={allowTaint:(pA=e.allowTaint)!==null&&pA!==void 0?pA:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:l,copyStyles:l},o.logger.debug("Starting document clone with size "+u.width+"x"+u.height+" scrolled to "+-u.left+","+-u.top),h=new Hl(o,A,f),d=h.clonedReferenceElement,d?[4,h.toIFrame(t,u)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=v.sent(),p=si(d)||XT(d)?Tp(d.ownerDocument):gn(o,d),T=p.width,U=p.height,_=p.left,I=p.top,D=Xb(o,d,e.backgroundColor),k={canvas:e.canvas,backgroundColor:D,scale:(IA=(GA=e.scale)!==null&&GA!==void 0?GA:r.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((KA=e.x)!==null&&KA!==void 0?KA:0)+_,y:((xA=e.y)!==null&&xA!==void 0?xA:0)+I,width:(ZA=e.width)!==null&&ZA!==void 0?ZA:Math.ceil(T),height:(_A=e.height)!==null&&_A!==void 0?_A:Math.ceil(U)},l?(o.logger.debug("Document cloned, using foreign object rendering"),H=new kb(o,k),[4,H.render(d)]):[3,3];case 2:return x=v.sent(),[3,5];case 3:return o.logger.debug("Document cloned, element located at "+_+","+I+" with size "+T+"x"+U+" using computed rendering"),o.logger.debug("Starting DOM parsing"),m=pl(o,d),D===m.styles.backgroundColor&&(m.styles.backgroundColor=_e.TRANSPARENT),o.logger.debug("Starting renderer for element at "+k.x+","+k.y+" with size "+k.width+"x"+k.height),H=new xb(o,k),[4,H.render(m)];case 4:x=v.sent(),v.label=5;case 5:return(!((S=e.removeContainer)!==null&&S!==void 0)||S)&&(Hl.destroy(C)||o.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),o.logger.debug("Finished rendering"),[2,x]}})})},Xb=function(A,e,t){var r=e.ownerDocument,n=r.documentElement?Fr(A,getComputedStyle(r.documentElement).backgroundColor):_e.TRANSPARENT,a=r.body?Fr(A,getComputedStyle(r.body).backgroundColor):_e.TRANSPARENT,s=typeof t=="string"?Fr(A,t):t===null?_e.TRANSPARENT:4294967295;return e===r.documentElement?Xe(n)?Xe(a)?s:a:n:s};const Wb=c.defineComponent({name:"GpIframe",props:{htmlContent:{type:String,required:!0},jsFiles:{type:Array,default:[]},cssFiles:{type:Array,default:[]},iframeStyle:{type:Object,default:()=>({width:"100%",height:"100%",border:"none"})}},setup(A){const e=c.ref(null),t=c.ref(),r=()=>{var C;const a=e.value;if(!a)return;const s=a.contentDocument||((C=a.contentWindow)==null?void 0:C.document);if(!s)return;s.open(),s.write("<!DOCTYPE html><html><head></head><body></body></html>"),s.close();const u=s.head;A.cssFiles.forEach(p=>{const T=s.createElement("link");T.rel="stylesheet",T.href=p,u.appendChild(T)});const o=s.createElement("link");o.rel="stylesheet",o.href="/spa/topic/css/style.css",u.appendChild(o);const l=s.createElement("script");l.src="/spa/topic/js/jquery-3.6.0.min.js",l.async=!1,u.appendChild(l);const f=s.createElement("script");f.src="/spa/topic/js/swiper-bundle.min.js",f.async=!1,u.appendChild(f);const h=s.createElement("script");h.src="/spa/topic/js/index.js",h.async=!1,u.appendChild(h);const d=s.body;d.innerHTML=A.htmlContent,A.jsFiles.forEach(p=>{const T=s.createElement("script");T.src=p,T.async=!1,d.appendChild(T)}),t.value=d,c.nextTick(()=>{})};c.watch(t,a=>{if(!a)return;new MutationObserver(()=>{const u=e.value;u&&(u.style.height=`${a.scrollHeight}px`)}).observe(a,{childList:!0,subtree:!0})});const n=async a=>{var l;const s=e.value;if(!s)return;const u=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);if(!u)return;const o=u.body;if(o)try{await c.nextTick();const f=await Gb(o,{x:0,y:0,scrollX:window.scrollX,scrollY:window.scrollY,useCORS:!0,allowTaint:!0,foreignObjectRendering:!1});a?a(f):f.toBlob(h=>{const d=URL.createObjectURL(h);window.open(d,"_blank")})}catch(f){console.error("截图生成失败:",f)}};return c.watch(()=>[A.htmlContent,A.jsFiles,A.cssFiles],r,{deep:!0}),c.onMounted(()=>{r()}),{iframeRef:e,generateCover:n}}});function Jb(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",null,[c.createElementVNode("iframe",{ref:"iframeRef",style:c.normalizeStyle([{"min-height":"600px"},A.iframeStyle])},null,4)])}const Wl=Oe(Wb,[["render",Jb],["__scopeId","data-v-e4f74412"]]),qb={class:"flex gp-dsigner"},jb={key:0,class:"flex items-center justify-between border-b"},$b={class:"text-lg font-bold p-2"},Zb={class:"text-sm font-thin text-gray-500"},zb={class:"flex-1 overflow-auto"},AU={key:0,class:"flex justify-between items-center border-b p-2"},eU={class:"flex items-center"},tU={class:"p-2"},rU={class:"sticky top-0"},nU={key:0,class:"text-lg font-bold border-b p-2"},aU={class:"text-sm font-thin text-gray-500"},sU={class:"p-2"},Jl=Oe(c.defineComponent({__name:"Designer",props:{mode:{default:"design"},template:{},css:{},js:{},previewWidth:{default:360},uploadByFile:{},icons:{},rules:{},preview:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0}},emits:["update:modelValue","update:element"],setup(A,{expose:e,emit:t}){const r=A,n=t,a=c.ref(r.rules||[]),s=c.ref(r.template),u=c.ref();let o=co("",{},!1);const l=c.ref("");c.watch(()=>r.template,F=>{s.value=F},{immediate:!0}),c.watch(()=>s.value,F=>{F&&(u.value=fA(F))},{immediate:!0}),c.watch(()=>r.css,F=>{F.forEach(L=>{if(document.querySelector(`link[href="${L}"]`))return;const K=document.createElement("link");K.rel="stylesheet",K.href=L,document.head.appendChild(K)})},{immediate:!0}),c.watch(()=>r.js,F=>{!F||F.length===0||F.forEach(L=>{if(document.querySelector(`script[src="${L}"]`))return;const K=document.createElement("script");K.src=L,document.body.appendChild(K)})},{immediate:!0});const f=c.ref(r.mode);c.watch(()=>u.value,F=>{F&&n("update:element",F)},{immediate:!0});const h=c.ref("");c.watch(()=>l.value,F=>{n("update:modelValue",F)},{immediate:!0});const d=c.ref(),C=c.ref(),p=c.ref(),T=c.ref(),U=c.ref(),_=c.ref(),I=c.ref(""),D=c.ref(r.mode==="design");c.watch(()=>r.rules,F=>{a.value=F,s.value&&(u.value=fA(s.value))},{immediate:!0});function k(F=void 0){T.value&&T.value.generateCover(F)}function x(F){U.value=F}function m(F,L=""){if(L){const K=H(u.value,L);K?_.value=K:_.value=F}else _.value=F}function H(F,L){if(F.xpath===L)return F;if(F.children&&F.children.length)for(const K of F.children){const V=H(K,L);if(V)return V}}function P(F,L){var K,V;return F.tag===L.tag&&((K=F.children)==null?void 0:K.length)===((V=L.children)==null?void 0:V.length)}function M(F){if(U.value.xpath==F.xpath){if(U.value){if(F.type===W.Block){var L=!0;const K=H(u.value,U.value.parentxpath||"");if(K&&K.children&&K.children.forEach(V=>{if(V.tag!=U.value.tag||!P(V,U.value)){L=!1;return}}),!L){j.error("同级结构不一致,错误配置!");return}}if(U.value.rule=F.rule,U.value.type=F.type,U.value.type===W.Block){const K=H(u.value,U.value.parentxpath||"");K&&K.children&&(K.children.forEach(V=>{if(V.tag!=U.value.tag||!P(V,U.value)){j.error("同级结构不一致,无法配置为块类型");return}}),K.children.forEach(V=>{V.tag===U.value.tag&&(V.rule=F.rule,V.type=F.type)}))}}h.value=new Date().getTime().toString(),j.success("保存成功"),n("update:element",u.value)}}function eA(F){const L=H(u.value,F.xpath||"");L&&(L.rule=F.rule,L.type=F.type,L.children&&F.children&&L.children.forEach(K=>{const V=F.children.find(CA=>CA.xpath===K.xpath);V&&(K.rule=V.rule,K.type=V.type)})),j.success("操作成功"),h.value=new Date().getTime().toString(),n("update:element",u.value)}function uA(F){l.value=F}function fA(F){o=co(F);const L=o("body").children().toArray().map(K=>J(o(K)));return l.value=o("body").html()||"",L[0]}function J(F,L=""){var YA;function K(HA){if(!HA||!HA[0])return"";const $e=[];let cA=HA;for(;cA.length&&cA[0].tagName!=="html";){const ua=cA[0].tagName,uU=cA.parent().children(ua).index(cA)+1;$e.unshift(`${ua}[${uU}]`),cA=cA.parent()}return"/html/"+$e.join("/")}const V=K(F).replace("/html/body[1]",""),CA=F.children().toArray().map(HA=>J(o(HA),V)),te=(YA=a.value)==null?void 0:YA.find(HA=>HA.xpath===V);return{tag:F[0].tagName,text:F.contents().not(F.children()).text().trim(),attrs:F[0].attribs,children:CA,xpath:V,parentxpath:L,type:(te==null?void 0:te.type)||W.None,rule:(te==null?void 0:te.rule)||{}}}function rA(F){const L=H(u.value,F.element.xpath);if(L){const K=c.toRaw(L);K.editText=F.newText}}function oA(F,L=""){function K(V,CA){var HA;const YA=(CA?((HA=H(u.value,CA))==null?void 0:HA.children)||[]:[u.value]).filter($e=>$e.tag===V.tag).indexOf(V)+1;return`${CA}/${V.tag}[${YA}]`}F.xpath=K(F,L),F.parentxpath=L,(F.children||[]).forEach(V=>oA(V,F.xpath))}function hA({action:F,element:L,newBlock:K}){const V=H(u.value,L.parentxpath||"");if(!V||!V.children)return;const CA=V.children.findIndex(cA=>cA===L);if(CA===-1){j.error("未找到元素");return}const te=V.children.length,{minBlock:YA,maxBlock:HA}=L.rule;if((F==="add"||F==="copy")&&te>=(HA||1/0)){I.value=`无法添加更多块。最大块数量为 ${HA}`,j.error(I.value);return}function $e(cA){cA.xpath="",cA.parentxpath="",cA.text=cA.editText||cA.text,cA.editText="",cA.children.forEach(ua=>{$e(ua)})}switch(F){case"add":if(K){const cA={...K,children:JSON.parse(JSON.stringify(K.children))};$e(cA),V.children.splice(CA+1,0,cA),j.success("添加成功")}break;case"copy":if(K){const cA={...K,children:JSON.parse(JSON.stringify(K.children))};$e(cA),V.children.splice(CA+1,0,cA),j.success("复制成功")}break;case"moveUp":if(CA>0){const[cA]=V.children.splice(CA,1);V.children.splice(CA-1,0,cA),j.success("前移成功")}else j.error("已经是第一个块,无法前移");break;case"moveDown":if(CA<V.children.length-1){const[cA]=V.children.splice(CA,1);V.children.splice(CA+1,0,cA),j.success("后移成功")}else j.error("已经是最后一个块,无法后移");break;case"delete":if(te<=(YA||0)){I.value=`无法删除更多块。最小块数量为 ${YA}`,j.error(I.value);return}V.children.splice(CA,1),j.success("删除成功");break}I.value="",oA(u.value)}function pA(F,L){let K=L.attrs.class.replace(/icon-\S+/g,`icon-${F}`);L.attrs.class=K}function GA(F){const L=F.file,K=H(u.value,F.element.xpath);if(r.uploadByFile)r.uploadByFile(L).then(V=>{V.success&&(K.attrs.src=V.file.url,h.value=new Date().getTime().toString())});else{K.attrs.alt=L.name;const V=URL.createObjectURL(L);K.attrs.src=V,h.value=new Date().getTime().toString()}}function IA(F){const{icon:L}=F,K=H(u.value,F.element.xpath);let V=K.attrs.class.replace(/icon-\S+/g,`icon-${L}`);K.attrs.class=V,h.value=new Date().getTime().toString()}const KA=F=>F.type.startsWith("image/")?!0:(j.error("只能上传图片文件"),!1),xA=c.ref({});function ZA(F,L){if(!F||F.length===0)return;const K=F[0];if(L.rule&&(L.rule.minImageWidth||L.rule.maxImageHeight)){if(L.rule.minImageWidth&&K.width<L.rule.minImageWidth){j.error(`图片宽度不能小于 ${L.rule.minImageWidth}px`);return}if(L.rule.maxImageHeight&&K.height<L.rule.maxImageHeight){j.error(`图片高度不能小于 ${L.rule.maxImageHeight}px`);return}}L.rule.minImageWidth&&L.rule.maxImageHeight?(xA.value.width=L.rule.minImageWidth,xA.value.height=L.rule.maxImageHeight,xA.value.aspectRatio=L.rule.minImageWidth/L.rule.maxImageHeight):xA.value={},K&&(L.rule.crop?(K.thumbUrl,d.value.handleOpenCropper(xA.value,K.file,K.name,L)):r.uploadByFile?r.uploadByFile(K.file).then(V=>{V.success&&(L.attrs.src=V.file.url,h.value=new Date().getTime().toString())}):(L.attrs.src=K.thumbUrl,h.value=new Date().getTime().toString()))}const _A=c.ref(r.previewWidth),S=c.ref(360);let v=c.ref(!1),q=c.ref(""),$=0,zA=0;function je(F){q.value=F,v.value=!0,$=event.clientX,F==="preview"?zA=_A.value:F==="structure"&&(zA=S.value),window.addEventListener("mousemove",Lr),window.addEventListener("mouseup",xr)}function Lr(F){if(!v.value)return;const L=F.clientX-$;q.value==="preview"?_A.value=Math.max(200,zA+L):q.value==="structure"&&(S.value=Math.max(200,zA-L))}function xr(){v.value=!1,q.value="",window.removeEventListener("mousemove",Lr),window.removeEventListener("mouseup",xr)}return e({generateCover:k}),(F,L)=>(c.openBlock(),c.createElementBlock("div",qb,[F.preview?(c.openBlock(),c.createElementBlock("div",{key:0,class:"border-l overflow-auto resize-area",style:c.normalizeStyle({width:_A.value+"px"})},[F.showTitle?(c.openBlock(),c.createElementBlock("div",jb,[c.createElementVNode("h2",$b,[L[4]||(L[4]=c.createTextVNode(" 实时预览 ")),c.createElementVNode("span",Zb,c.toDisplayString(_A.value)+"px",1)]),c.createElementVNode("div",{onClick:L[0]||(L[0]=()=>k()),class:"p-2 cursor-pointer text-blue-500"}," 封面 ")])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[l.value?(c.openBlock(),c.createBlock(Wl,{key:0,"css-files":F.css,"js-files":F.js,"html-content":l.value,class:"gp-designer-preview",ref_key:"previewRef",ref:T},null,8,["css-files","js-files","html-content"])):(c.openBlock(),c.createBlock(Wl,{key:1,"css-files":F.css,"js-files":F.js,"html-content":c.unref(o)("body").html(),class:"gp-designer-preview",ref_key:"previewRef",ref:T},null,8,["css-files","js-files","html-content"]))])],4)):c.createCommentVNode("",!0),F.preview?(c.openBlock(),c.createElementBlock("div",{key:1,class:"resizer",onMousedown:L[1]||(L[1]=K=>je("preview"))},null,32)):c.createCommentVNode("",!0),c.createElementVNode("div",zb,[F.showTitle?(c.openBlock(),c.createElementBlock("div",AU,[L[6]||(L[6]=c.createElementVNode("h2",{class:"text-lg font-bold"},"结构渲染",-1)),c.createElementVNode("div",eU,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":L[2]||(L[2]=K=>D.value=K),type:"checkbox",id:"showMargin",class:"mr-2"},null,512),[[c.vModelCheckbox,D.value]]),L[5]||(L[5]=c.createElementVNode("label",{for:"showMargin"},"间距",-1))])])):c.createCommentVNode("",!0),c.createElementVNode("div",tU,[u.value?(c.openBlock(),c.createBlock(CE,{key:0,"upload-by-file":F.uploadByFile,cropper:d.value,icon:C.value,upload:p.value,mode:F.mode,icons:F.icons,r:h.value,"show-margin":D.value,element:u.value,selectedElement:U.value,hoveredElement:_.value,onSelectElement:x,onHoverElement:m,onContentUpdated:uA,onUpdateText:rA,onBlockAction:hA,onAddIcon:pA,onUpdateElementRule:eA},null,8,["upload-by-file","cropper","icon","upload","mode","icons","r","show-margin","element","selectedElement","hoveredElement"])):c.createCommentVNode("",!0)])]),f.value=="design"?(c.openBlock(),c.createElementBlock("div",{key:2,class:"resizer",onMousedown:L[3]||(L[3]=K=>je("structure"))},null,32)):c.createCommentVNode("",!0),f.value=="design"?(c.openBlock(),c.createElementBlock("div",{key:3,class:"resize-area",style:c.normalizeStyle({width:S.value+"px"})},[c.createElementVNode("div",rU,[F.showTitle?(c.openBlock(),c.createElementBlock("h2",nU,[L[7]||(L[7]=c.createTextVNode(" 节点属性 ")),c.createElementVNode("span",aU,c.toDisplayString(S.value)+"px",1)])):c.createCommentVNode("",!0),c.createElementVNode("div",sU,[U.value?(c.openBlock(),c.createBlock(YE,{key:0,element:U.value,onUpdateElement:M},null,8,["element"])):c.createCommentVNode("",!0)])])],4)):c.createCommentVNode("",!0),c.createVNode(ep,{ref_key:"cropperRef",ref:d,onOk:GA},null,512),c.createVNode(fp,{icons:F.icons,ref_key:"iconRef",ref:C,onOk:IA},null,8,["icons"]),c.createVNode(wp,{ref_key:"uploadRef",ref:p,multiple:!1,show:!1,beforeUpload:KA,onChange:ZA},{"upload-icon":c.withCtx(()=>L[8]||(L[8]=[c.createElementVNode("div",{class:"p-2"},"上传",-1)])),_:1},512)]))}}),[["__scopeId","data-v-0670a162"]]),iU={install(A){A.component("Designer",Jl)}};Ne.Designer=Jl,Ne.default=iU,Object.defineProperties(Ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|