@php-wasm/cli 3.1.18 → 3.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/main.js +44 -40
  2. package/main.js.map +1 -1
  3. package/package.json +6 -6
package/main.js CHANGED
@@ -1,54 +1,58 @@
1
- import{LatestSupportedPHPVersion as hi,SupportedPHPVersionsList as pi,PHP as di,FileLockManagerInMemory as gi}from"@php-wasm/universal";import{spawn as mi}from"child_process";import Z,{readFileSync as Zt,writeFile as yi,statSync as bi,readdirSync as wi,lstatSync as Ei,existsSync as Ni,writeFileSync as xr,mkdtempSync as Nn,chmodSync as Ti}from"fs";import Tn from"os";import{rootCertificates as Oi}from"tls";import oe,{resolve as en,normalize as Ii}from"path";import{loadNodeRuntime as vi,useHostFilesystem as xi}from"@php-wasm/node";import{WebSocketServer as Ai}from"ws";import Pi from"net";import"assert";import{format as Ar}from"util";import{fileURLToPath as Li}from"url";import{createHash as _i}from"crypto";import Si from"timers";function Pr(e){let t=e.replaceAll("\\","/");const n=t.match(/^([A-Za-z]):\//);return n&&(t="/"+n[1]+t.slice(2)),t}const Lr=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Di=Lr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Mi="["+Lr+"]["+Di+"]*",Ci=new RegExp("^"+Mi+"$");function _r(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const ze=function(e){const t=Ci.exec(e);return!(t===null||typeof t>"u")};function Fi(e){return typeof e<"u"}const tn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Sr=["__proto__","constructor","prototype"],ji={allowBooleanAttributes:!1,unpairedTags:[]};function ki(e,t){t=Object.assign({},ji,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=In(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=vn(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
2
- `&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!Wi(u)){let g;return u.trim().length===0?g="Invalid space after '<'.":g="Tag '"+u+"' is an invalid name.",K("InvalidTag",g,ie(e,i))}const f=Xi(e,i);if(f===!1)return K("InvalidAttr","Attributes for '"+u+"' have open quote.",ie(e,i));let c=f.value;if(i=f.index,c[c.length-1]==="/"){const g=i-c.length;c=c.substring(0,c.length-1);const p=xn(c,t);if(p===!0)r=!0;else return K(p.err.code,p.err.msg,ie(e,g+p.err.line))}else if(a)if(f.tagClosed){if(c.trim().length>0)return K("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ie(e,s));if(n.length===0)return K("InvalidTag","Closing tag '"+u+"' has not been opened.",ie(e,s));{const g=n.pop();if(u!==g.tagName){let p=ie(e,g.tagStartPos);return K("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+u+"'.",ie(e,s))}n.length==0&&(o=!0)}}else return K("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ie(e,i));else{const g=xn(c,t);if(g!==!0)return K(g.err.code,g.err.msg,ie(e,i-c.length+g.err.line));if(o===!0)return K("InvalidXml","Multiple possible root nodes found.",ie(e,i));t.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=vn(e,i);continue}else if(e[i+1]==="?"){if(i=In(e,++i),i.err)return i}else break;else if(e[i]==="&"){const g=Vi(e,i);if(g==-1)return K("InvalidChar","char '&' is not expected.",ie(e,i));i=g}else if(o===!0&&!On(e[i]))return K("InvalidXml","Extra text at the end",ie(e,i));e[i]==="<"&&i--}}else{if(On(e[i]))continue;return K("InvalidChar","char '"+e[i]+"' is not expected.",ie(e,i))}if(r){if(n.length==1)return K("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ie(e,n[0].tagStartPos));if(n.length>0)return K("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return K("InvalidXml","Start tag expected.",1);return!0}function On(e){return e===" "||e===" "||e===`
3
- `||e==="\r"}function In(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return K("InvalidXml","XML declaration allowed only at the start of the document.",ie(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function vn(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const Ri='"',Bi="'";function Xi(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Ri||e[t]===Bi)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const $i=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function xn(e,t){const n=_r(e,$i),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return K("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",ke(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return K("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",ke(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return K("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",ke(n[o]));const i=n[o][2];if(!qi(i))return K("InvalidAttr","Attribute '"+i+"' is an invalid name.",ke(n[o]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return K("InvalidAttr","Attribute '"+i+"' is repeated.",ke(n[o]))}return!0}function Ui(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Vi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Ui(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function K(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function qi(e){return ze(e)}function Wi(e){return ze(e)}function ie(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ke(e){return e.startIndex+e[1].length}const Dr=e=>tn.includes(e)?"__"+e:e,Gi={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:Dr};function Hi(e,t){if(typeof e!="string")return;const n=e.toLowerCase();if(tn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Sr.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Mr(e){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??10),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1e3),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??100),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:Mr(!0)}const Yi=function(e){const t=Object.assign({},Gi,e),n=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(const{value:r,name:o}of n)r&&Hi(r,o);return t.onDangerousProperty===null&&(t.onDangerousProperty=Dr),t.processEntities=Mr(t.processEntities),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),t};let qe;typeof Symbol!="function"?qe="@@xmlMetadata":qe=Symbol("XML Node Metadata");class Ne{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][qe]={startIndex:n})}static getMetaDataSymbol(){return qe}}class zi{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const r=Object.create(null);let o=0;if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let i=1,s=!1,a=!1,u="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Oe(t,"!ENTITY",n)){n+=7;let f,c;if([f,c,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),c.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&o>=this.options.maxEntityCount)throw new Error(`Entity count (${o+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const g=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r[f]={regx:RegExp(`&${g};`,"g"),val:c},o++}}else if(s&&Oe(t,"!ELEMENT",n)){n+=8;const{index:f}=this.readElementExp(t,n+1);n=f}else if(s&&Oe(t,"!ATTLIST",n))n+=8;else if(s&&Oe(t,"!NOTATION",n)){n+=9;const{index:f}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=f}else if(Oe(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");i++,u=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,i--):i--,i===0)break}else t[n]==="["?s=!0:u+=t[n];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ae(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)n++;let o=t.substring(r,n);if(Re(o),n=ae(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(t,n,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${o}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[o,i,n]}readNotationExp(t,n){n=ae(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);!this.suppressValidationErr&&Re(o),n=ae(t,n);const i=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n+=i.length,n=ae(t,n);let s=null,a=null;if(i==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ae(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(i==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:o,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);n++;const s=n;for(;n<t.length&&t[n]!==i;)n++;if(o=t.substring(s,n),t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=ae(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);if(!this.suppressValidationErr&&!ze(o))throw new Error(`Invalid element name: "${o}"`);n=ae(t,n);let i="";if(t[n]==="E"&&Oe(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Oe(t,"NY",n))n+=2;else if(t[n]==="("){n++;const s=n;for(;n<t.length&&t[n]!==")";)n++;if(i=t.substring(s,n),t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:o,contentModel:i.trim(),index:n}}readAttlistExp(t,n){n=ae(t,n);let r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);for(Re(o),n=ae(t,n),r=n;n<t.length&&!/\s/.test(t[n]);)n++;let i=t.substring(r,n);if(!Re(i))throw new Error(`Invalid attribute name: "${i}"`);n=ae(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=ae(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let u=[];for(;n<t.length&&t[n]!==")";){const f=n;for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)n++;let c=t.substring(f,n);if(c=c.trim(),!Re(c))throw new Error(`Invalid notation name: "${c}"`);u.push(c),t[n]==="|"&&(n++,n=ae(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+u.join("|")+")"}else{const u=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;s+=t.substring(u,n);const f=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!f.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=ae(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:o,attributeName:i,attributeType:s,defaultValue:a,index:n}}}const ae=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Oe(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Re(e){if(ze(e))return e;throw new Error(`Invalid entity name ${e}`)}const Qi=/^[-+]?0x[a-fA-F0-9]+$/,Ji=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Ki={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function Zi(e,t={}){if(t=Object.assign({},Ki,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Qi.test(n))return rs(n,16);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return ts(e,n,t);{const r=Ji.exec(n);if(r){const o=r[1]||"",i=r[2];let s=ns(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const u=Number(n),f=String(u);if(u===0)return u;if(f.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return f==="0"||f===s||f===`${o}${s}`?u:e;let c=i?s:n;return i?c===f||o+c===f?u:e:c===f||c===o+f?u:e}}else return e}}else return is(e,Number(n),t)}const es=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ts(e,t,n){if(!n.eNotation)return e;const r=t.match(es);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function ns(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function rs(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function is(e,t,n){const r=t===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return r?"Infinity":"-Infinity";case"original":default:return e}}function ss(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Fe{constructor(t,n={}){this.pattern=t,this.separator=n.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(r=>r.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(r=>r.attrName!==void 0),this._hasPositionSelector=this.segments.some(r=>r.position!==void 0)}_parse(t){const n=[];let r=0,o="";for(;r<t.length;)t[r]===this.separator?r+1<t.length&&t[r+1]===this.separator?(o.trim()&&(n.push(this._parseSegment(o.trim())),o=""),n.push({type:"deep-wildcard"}),r+=2):(o.trim()&&n.push(this._parseSegment(o.trim())),o="",r++):(o+=t[r],r++);return o.trim()&&n.push(this._parseSegment(o.trim())),n}_parseSegment(t){const n={type:"tag"};let r=null,o=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(o=i[1]+i[3],i[2])){const c=i[2].slice(1,-1);c&&(r=c)}let s,a=o;if(o.includes("::")){const c=o.indexOf("::");if(s=o.substring(0,c).trim(),a=o.substring(c+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let u,f=null;if(a.includes(":")){const c=a.lastIndexOf(":"),g=a.substring(0,c).trim(),p=a.substring(c+1).trim();["first","last","odd","even"].includes(p)||/^nth\(\d+\)$/.test(p)?(u=g,f=p):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${t}`);if(n.tag=u,s&&(n.namespace=s),r)if(r.includes("=")){const c=r.indexOf("=");n.attrName=r.substring(0,c).trim(),n.attrValue=r.substring(c+1).trim()}else n.attrName=r.trim();if(f){const c=f.match(/^nth\((\d+)\)$/);c?(n.position="nth",n.positionValue=parseInt(c[1],10)):n.position=f}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}const os=new Set(["push","pop","reset","updateCurrent","restore"]);class nn{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,n=null,r=null){if(this.path.length>0){const c=this.path[this.path.length-1];c.values=void 0}const o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);const i=this.siblingStacks[o],s=r?`${r}:${t}`:t,a=i.get(s)||0;let u=0;for(const c of i.values())u+=c;i.set(s,a+1);const f={tag:t,position:u,counter:a};r!=null&&(f.namespace=r),n!=null&&(f.values=n),this.path.push(f)}pop(){if(this.path.length===0)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const n=this.path[this.path.length-1];t!=null&&(n.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){return this.path.length===0?void 0:this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&t in n.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,n=!0){const r=t||this.separator;return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const n=t.segments;return n.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let n=0;n<t.length;n++){const r=t[n],o=this.path[n],i=n===this.path.length-1;if(!this._matchSegment(r,o,i))return!1}return!0}_matchWithDeepWildcard(t){let n=this.path.length-1,r=t.length-1;for(;r>=0&&n>=0;){const o=t[r];if(o.type==="deep-wildcard"){if(r--,r<0)return!0;const i=t[r];let s=!1;for(let a=n;a>=0;a--){const u=a===this.path.length-1;if(this._matchSegment(i,this.path[a],u)){n=a-1,r--,s=!0;break}}if(!s)return!1}else{const i=n===this.path.length-1;if(!this._matchSegment(o,this.path[n],i))return!1;n--,r--}}return r<0}_matchSegment(t,n,r){if(t.tag!=="*"&&t.tag!==n.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==n.namespace)return!1;if(t.attrName!==void 0){if(!r||!n.values||!(t.attrName in n.values))return!1;if(t.attrValue!==void 0){const o=n.values[t.attrName];if(String(o)!==String(t.attrValue))return!1}}if(t.position!==void 0){if(!r)return!1;const o=n.counter??0;if(t.position==="first"&&o!==0)return!1;if(t.position==="odd"&&o%2!==1)return!1;if(t.position==="even"&&o%2!==0)return!1;if(t.position==="nth"&&o!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(n=>({...n})),this.siblingStacks=t.siblingStacks.map(n=>new Map(n))}readOnly(){const t=this;return new Proxy(t,{get(n,r,o){if(os.has(r))return()=>{throw new TypeError(`Cannot call '${r}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const i=Reflect.get(n,r,o);return r==="path"||r==="siblingStacks"?Object.freeze(Array.isArray(i)?i.map(s=>s instanceof Map?Object.freeze(new Map(s)):Object.freeze({...s})):i):typeof i=="function"?i.bind(n):i},set(n,r){throw new TypeError(`Cannot set property '${String(r)}' on a read-only Matcher.`)},deleteProperty(n,r){throw new TypeError(`Cannot delete property '${String(r)}' from a read-only Matcher.`)}})}}function as(e,t){if(!e)return{};const n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};const r={};for(const o in n)if(o.startsWith(t.attributeNamePrefix)){const i=o.substring(t.attributeNamePrefix.length);r[i]=n[o]}else r[o]=n[o];return r}function us(e){if(!e||typeof e!="string")return;const t=e.indexOf(":");if(t!==-1&&t>0){const n=e.substring(0,t);if(n!=="xmlns")return n}}class cs{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>An(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>An(r,16,"&#x")}},this.addExternalEntities=ls,this.parseXml=gs,this.parseTextData=fs,this.resolveNameSpace=hs,this.buildAttributesMap=ds,this.isItStopNode=ws,this.replaceEntitiesValue=ys,this.readStopNodeData=Ns,this.saveTextToParentTag=bs,this.addChild=ms,this.ignoreAttributesFn=ss(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new nn,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"?this.stopNodeExpressions.push(new Fe(r)):r instanceof Fe&&this.stopNodeExpressions.push(r)}}}}function ls(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n],o=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+o+";","g"),val:e[r]}}}function fs(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e,t,n));const a=this.options.jPath?n.toString():n,u=this.options.tagValueProcessor(t,e,a,o,i);return u==null?e:typeof u!=typeof e||u!==e?u:this.options.trimValues?Gt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Gt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function hs(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const ps=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ds(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=_r(e,ps),o=r.length,i={},s={};for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),f=r[a][4];if(u.length&&f!==void 0){let c=f;this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,this.readonlyMatcher),s[u]=c}}Object.keys(s).length>0&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(s);for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),f=this.options.jPath?t.toString():this.readonlyMatcher;if(this.ignoreAttributesFn(u,f))continue;let c=r[a][4],g=this.options.attributeNamePrefix+u;if(u.length)if(this.options.transformAttributeName&&(g=this.options.transformAttributeName(g)),g=Cr(g,this.options),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,this.readonlyMatcher);const p=this.options.jPath?t.toString():this.readonlyMatcher,b=this.options.attributeValueProcessor(u,c,p);b==null?i[g]=c:typeof b!=typeof c||b!==c?i[g]=b:i[g]=Gt(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[g]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=i,a}return i}}const gs=function(e){e=e.replace(/\r\n?/g,`
4
- `);const t=new Ne("!xml");let n=t,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const o=new zi(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const a=xe(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){const c=u.indexOf(":");c!==-1&&(u=u.substr(c+1))}u=nt(this.options.transformTagName,u,"",this.options).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));const f=this.matcher.getCurrentTag();if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);f&&this.options.unpairedTags.indexOf(f)!==-1&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=Wt(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,this.readonlyMatcher),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const u=new Ne(a.tagName);u.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(u[":@"]=this.buildAttributesMap(a.tagExp,this.matcher,a.tagName)),this.addChild(n,u,this.readonlyMatcher,i)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const a=xe(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=a}else if(e.substr(i+1,2)==="!D"){const a=o.readDocType(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){const a=xe(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,a);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let f=this.parseTextData(u,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,f),i=a+2}else{let a=Wt(e,i,this.options.removeNSPrefix);if(!a){const E=e.substring(Math.max(0,i-50),Math.min(e.length,i+50));throw new Error(`readTagExp returned undefined at position ${i}. Context: "${E}"`)}let u=a.tagName;const f=a.rawTagName;let c=a.tagExp,g=a.attrExpPresent,p=a.closeIndex;if({tagName:u,tagExp:c}=nt(this.options.transformTagName,u,c,this.options),this.options.strictReservedNames&&(u===this.options.commentPropName||u===this.options.cdataPropName||u===this.options.textNodeName||u===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${u}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));const b=n;b&&this.options.unpairedTags.indexOf(b.tagname)!==-1&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let N=!1;c.length>0&&c.lastIndexOf("/")===c.length-1&&(N=!0,u[u.length-1]==="/"?(u=u.substr(0,u.length-1),c=u):c=c.substr(0,c.length-1),g=u!==c);let I=null,y;y=us(f),u!==t.tagname&&this.matcher.push(u,{},y),u!==c&&g&&(I=this.buildAttributesMap(c,this.matcher,u),I&&as(I,this.options)),u!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const S=i;if(this.isCurrentNodeStopNode){let E="";if(N)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=a.closeIndex;else{const w=this.readStopNodeData(e,f,p+1);if(!w)throw new Error(`Unexpected end of ${f}`);i=w.i,E=w.tagContent}const h=new Ne(u);I&&(h[":@"]=I),h.add(this.options.textNodeName,E),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,h,this.readonlyMatcher,S)}else{if(N){({tagName:u,tagExp:c}=nt(this.options.transformTagName,u,c,this.options));const E=new Ne(u);I&&(E[":@"]=I),this.addChild(n,E,this.readonlyMatcher,S),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(this.options.unpairedTags.indexOf(u)!==-1){const E=new Ne(u);I&&(E[":@"]=I),this.addChild(n,E,this.readonlyMatcher,S),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=a.closeIndex;continue}else{const E=new Ne(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),I&&(E[":@"]=I),this.addChild(n,E,this.readonlyMatcher,S),n=E}r="",i=p}}else r+=e[i];return t.child};function ms(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.jPath?n.toString():n,i=this.options.updateTag(t.tagname,o,t[":@"]);i===!1||(typeof i=="string"&&(t.tagname=i),e.addChild(t,r))}function ys(e,t,n){const r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){const o=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,o)))return e}if(r.tagFilter){const o=this.options.jPath?n.toString():n;if(!r.tagFilter(t,o))return e}for(const o of Object.keys(this.docTypeEntities)){const i=this.docTypeEntities[o],s=e.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=e.length;if(e=e.replace(i.regx,i.val),r.maxExpandedLength&&(this.currentExpandedLength+=e.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}for(const o of Object.keys(this.lastEntities)){const i=this.lastEntities[o],s=e.match(i.regex);if(s&&(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(i.regex,i.val)}if(e.indexOf("&")===-1)return e;if(this.options.htmlEntities)for(const o of Object.keys(this.htmlEntities)){const i=this.htmlEntities[o],s=e.match(i.regex);if(s&&(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(i.regex,i.val)}return e=e.replace(this.ampEntity.regex,this.ampEntity.val),e}function bs(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function ws(e,t){if(!e||e.length===0)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function Es(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function xe(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Wt(e,t,n,r=">"){const o=Es(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,f=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const c=u;if(n){const g=u.indexOf(":");g!==-1&&(u=u.substr(g+1),f=u!==o.data.substr(g+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:f,rawTagName:c}}function Ns(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=xe(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=xe(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=xe(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=xe(e,"]]>",n,"StopNode is not closed.")-2;else{const i=Wt(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function Gt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:Zi(e,n)}else return Fi(e)?e:""}function An(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}function nt(e,t,n,r){if(e){const o=e(t);n===t&&(n=o),t=o}return t=Cr(t,r),{tagName:t,tagExp:n}}function Cr(e,t){if(Sr.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return tn.includes(e)?t.onDangerousProperty(e):e}const rt=Ne.getMetaDataSymbol();function Ts(e,t){if(!e||typeof e!="object")return{};if(!t)return e;const n={};for(const r in e)if(r.startsWith(t)){const o=r.substring(t.length);n[o]=e[r]}else n[r]=e[r];return n}function Os(e,t,n,r){return Fr(e,t,n,r)}function Fr(e,t,n,r){let o;const i={};for(let s=0;s<e.length;s++){const a=e[s],u=Is(a);if(u!==void 0&&u!==t.textNodeName){const f=Ts(a[":@"]||{},t.attributeNamePrefix);n.push(u,f)}if(u===t.textNodeName)o===void 0?o=a[u]:o+=""+a[u];else{if(u===void 0)continue;if(a[u]){let f=Fr(a[u],t,n,r);const c=xs(f,t);if(a[":@"]?vs(f,a[":@"],r,t):Object.keys(f).length===1&&f[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?f=f[t.textNodeName]:Object.keys(f).length===0&&(t.alwaysCreateTextNode?f[t.textNodeName]="":f=""),a[rt]!==void 0&&typeof f=="object"&&f!==null&&(f[rt]=a[rt]),i[u]!==void 0&&Object.prototype.hasOwnProperty.call(i,u))Array.isArray(i[u])||(i[u]=[i[u]]),i[u].push(f);else{const g=t.jPath?r.toString():r;t.isArray(u,g,c)?i[u]=[f]:i[u]=f}u!==void 0&&u!==t.textNodeName&&n.pop()}}}return typeof o=="string"?o.length>0&&(i[t.textNodeName]=o):o!==void 0&&(i[t.textNodeName]=o),i}function Is(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function vs(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s],u=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,f=r.jPath?n.toString()+"."+u:n;r.isArray(a,f,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function xs(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class jr{constructor(t){this.externalEntities={},this.options=Yi(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=ki(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new cs(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:Os(o,this.options,r.matcher,r.readonlyMatcher)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Ne.getMetaDataSymbol()}}const As=`
5
- `;function Ps(e,t){let n="";t.format&&t.indentBy.length>0&&(n=As);const r=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let i=0;i<t.stopNodes.length;i++){const s=t.stopNodes[i];typeof s=="string"?r.push(new Fe(s)):s instanceof Fe&&r.push(s)}const o=new nn;return kr(e,t,n,o,r)}function kr(e,t,n,r,o){let i="",s=!1;if(t.maxNestedTags&&r.getDepth()>t.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(e)){if(e!=null){let a=e.toString();return a=Ht(a,t),a}return""}for(let a=0;a<e.length;a++){const u=e[a],f=Br(u);if(f===void 0)continue;const c=Ls(u[":@"],t);r.push(f,c);const g=Ss(r,o);if(f===t.textNodeName){let y=u[f];g||(y=t.tagValueProcessor(f,y),y=Ht(y,t)),s&&(i+=n),i+=y,s=!1,r.pop();continue}else if(f===t.cdataPropName){s&&(i+=n),i+=`<![CDATA[${u[f][0][t.textNodeName]}]]>`,s=!1,r.pop();continue}else if(f===t.commentPropName){i+=n+`<!--${u[f][0][t.textNodeName]}-->`,s=!0,r.pop();continue}else if(f[0]==="?"){const y=Pn(u[":@"],t,g),S=f==="?xml"?"":n;let E=u[f][0][t.textNodeName];E=E.length!==0?" "+E:"",i+=S+`<${f}${E}${y}?>`,s=!0,r.pop();continue}let p=n;p!==""&&(p+=t.indentBy);const b=Pn(u[":@"],t,g),N=n+`<${f}${b}`;let I;g?I=Rr(u[f],t):I=kr(u[f],t,p,r,o),t.unpairedTags.indexOf(f)!==-1?t.suppressUnpairedNode?i+=N+">":i+=N+"/>":(!I||I.length===0)&&t.suppressEmptyNode?i+=N+"/>":I&&I.endsWith(">")?i+=N+`>${I}${n}</${f}>`:(i+=N+">",I&&n!==""&&(I.includes("/>")||I.includes("</"))?i+=n+t.indentBy+I+n:i+=I,i+=`</${f}>`),s=!0,r.pop()}return i}function Ls(e,t){if(!e||t.ignoreAttributes)return null;const n={};let r=!1;for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const i=o.startsWith(t.attributeNamePrefix)?o.substr(t.attributeNamePrefix.length):o;n[i]=e[o],r=!0}return r?n:null}function Rr(e,t){if(!Array.isArray(e))return e!=null?e.toString():"";let n="";for(let r=0;r<e.length;r++){const o=e[r],i=Br(o);if(i===t.textNodeName)n+=o[i];else if(i===t.cdataPropName)n+=o[i][0][t.textNodeName];else if(i===t.commentPropName)n+=o[i][0][t.textNodeName];else{if(i&&i[0]==="?")continue;if(i){const s=_s(o[":@"],t),a=Rr(o[i],t);!a||a.length===0?n+=`<${i}${s}/>`:n+=`<${i}${s}>${a}</${i}>`}}}return n}function _s(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let o=e[r];o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function Br(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==":@")return r}}function Pn(e,t,n){let r="";if(e&&!t.ignoreAttributes)for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i;n?i=e[o]:(i=t.attributeValueProcessor(o,e[o]),i=Ht(i,t)),i===!0&&t.suppressBooleanAttributes?r+=` ${o.substr(t.attributeNamePrefix.length)}`:r+=` ${o.substr(t.attributeNamePrefix.length)}="${i}"`}return r}function Ss(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function Ht(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}function Ds(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}const Ms={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function ce(e){if(this.options=Object.assign({},Ms,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>typeof t=="string"&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];typeof n=="string"?this.stopNodeExpressions.push(new Fe(n)):n instanceof Fe&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ds(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=js),this.processTextOrObjNode=Cs,this.options.format?(this.indentate=Fs,this.tagEndChar=`>
1
+ import{LatestSupportedPHPVersion as hi,SupportedPHPVersionsList as di,PHP as gi,FileLockManagerInMemory as mi}from"@php-wasm/universal";import{spawn as yi}from"child_process";import z,{readFileSync as tn,writeFile as bi,statSync as wi,readdirSync as Ei,lstatSync as Ni,existsSync as Ti,writeFileSync as Lr,mkdtempSync as In,chmodSync as Ii}from"fs";import vn from"os";import{rootCertificates as vi}from"tls";import ne,{resolve as nn,normalize as Oi}from"path";import{loadNodeRuntime as xi,useHostFilesystem as Pi}from"@php-wasm/node";import{WebSocketServer as Ai}from"ws";import Li from"net";import"assert";import{format as _r}from"util";import{fileURLToPath as _i}from"url";import{createHash as Si}from"crypto";import Di from"timers";function Sr(e){let t=e.replaceAll("\\","/");const n=t.match(/^([A-Za-z]):\//);return n&&(t="/"+n[1]+t.slice(2)),t}const Dr=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Mi=Dr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ci="["+Dr+"]["+Mi+"]*",Fi=new RegExp("^"+Ci+"$");function Mr(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const Je=function(e){const t=Fi.exec(e);return!(t===null||typeof t>"u")};function ji(e){return typeof e<"u"}const rn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Cr=["__proto__","constructor","prototype"],ki={allowBooleanAttributes:!1,unpairedTags:[]};function Ri(e,t){t=Object.assign({},ki,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=xn(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=Pn(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
2
+ `&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!Gi(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Z("InvalidTag",d,se(e,i))}const p=$i(e,i);if(p===!1)return Z("InvalidAttr","Attributes for '"+u+"' have open quote.",se(e,i));let c=p.value;if(i=p.index,c[c.length-1]==="/"){const d=i-c.length;c=c.substring(0,c.length-1);const f=An(c,t);if(f===!0)r=!0;else return Z(f.err.code,f.err.msg,se(e,d+f.err.line))}else if(a)if(p.tagClosed){if(c.trim().length>0)return Z("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",se(e,s));if(n.length===0)return Z("InvalidTag","Closing tag '"+u+"' has not been opened.",se(e,s));{const d=n.pop();if(u!==d.tagName){let f=se(e,d.tagStartPos);return Z("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",se(e,s))}n.length==0&&(o=!0)}}else return Z("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",se(e,i));else{const d=An(c,t);if(d!==!0)return Z(d.err.code,d.err.msg,se(e,i-c.length+d.err.line));if(o===!0)return Z("InvalidXml","Multiple possible root nodes found.",se(e,i));t.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Pn(e,i);continue}else if(e[i+1]==="?"){if(i=xn(e,++i),i.err)return i}else break;else if(e[i]==="&"){const d=qi(e,i);if(d==-1)return Z("InvalidChar","char '&' is not expected.",se(e,i));i=d}else if(o===!0&&!On(e[i]))return Z("InvalidXml","Extra text at the end",se(e,i));e[i]==="<"&&i--}}else{if(On(e[i]))continue;return Z("InvalidChar","char '"+e[i]+"' is not expected.",se(e,i))}if(r){if(n.length==1)return Z("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",se(e,n[0].tagStartPos));if(n.length>0)return Z("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Z("InvalidXml","Start tag expected.",1);return!0}function On(e){return e===" "||e===" "||e===`
3
+ `||e==="\r"}function xn(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Z("InvalidXml","XML declaration allowed only at the start of the document.",se(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Pn(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const Bi='"',Xi="'";function $i(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Bi||e[t]===Xi)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const Ui=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function An(e,t){const n=Mr(e,Ui),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",ke(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",ke(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Z("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",ke(n[o]));const i=n[o][2];if(!Wi(i))return Z("InvalidAttr","Attribute '"+i+"' is an invalid name.",ke(n[o]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return Z("InvalidAttr","Attribute '"+i+"' is repeated.",ke(n[o]))}return!0}function Vi(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function qi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Vi(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Z(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Wi(e){return Je(e)}function Gi(e){return Je(e)}function se(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ke(e){return e.startIndex+e[1].length}const Fr=e=>rn.includes(e)?"__"+e:e,Hi={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:Fr};function Yi(e,t){if(typeof e!="string")return;const n=e.toLowerCase();if(rn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Cr.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function jr(e){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??10),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1e3),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??100),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:jr(!0)}const zi=function(e){const t=Object.assign({},Hi,e),n=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(const{value:r,name:o}of n)r&&Yi(r,o);return t.onDangerousProperty===null&&(t.onDangerousProperty=Fr),t.processEntities=jr(t.processEntities),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),t};let qe;typeof Symbol!="function"?qe="@@xmlMetadata":qe=Symbol("XML Node Metadata");class Te{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][qe]={startIndex:n})}static getMetaDataSymbol(){return qe}}class Qi{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const r=Object.create(null);let o=0;if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let i=1,s=!1,a=!1,u="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Ie(t,"!ENTITY",n)){n+=7;let p,c;if([p,c,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),c.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&o>=this.options.maxEntityCount)throw new Error(`Entity count (${o+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const d=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r[p]={regx:RegExp(`&${d};`,"g"),val:c},o++}}else if(s&&Ie(t,"!ELEMENT",n)){n+=8;const{index:p}=this.readElementExp(t,n+1);n=p}else if(s&&Ie(t,"!ATTLIST",n))n+=8;else if(s&&Ie(t,"!NOTATION",n)){n+=9;const{index:p}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=p}else if(Ie(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");i++,u=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,i--):i--,i===0)break}else t[n]==="["?s=!0:u+=t[n];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ue(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)n++;let o=t.substring(r,n);if(Re(o),n=ue(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(t,n,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${o}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[o,i,n]}readNotationExp(t,n){n=ue(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);!this.suppressValidationErr&&Re(o),n=ue(t,n);const i=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&i!=="SYSTEM"&&i!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n+=i.length,n=ue(t,n);let s=null,a=null;if(i==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ue(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(i==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:o,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);n++;const s=n;for(;n<t.length&&t[n]!==i;)n++;if(o=t.substring(s,n),t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=ue(t,n);const r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);if(!this.suppressValidationErr&&!Je(o))throw new Error(`Invalid element name: "${o}"`);n=ue(t,n);let i="";if(t[n]==="E"&&Ie(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ie(t,"NY",n))n+=2;else if(t[n]==="("){n++;const s=n;for(;n<t.length&&t[n]!==")";)n++;if(i=t.substring(s,n),t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:o,contentModel:i.trim(),index:n}}readAttlistExp(t,n){n=ue(t,n);let r=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;let o=t.substring(r,n);for(Re(o),n=ue(t,n),r=n;n<t.length&&!/\s/.test(t[n]);)n++;let i=t.substring(r,n);if(!Re(i))throw new Error(`Invalid attribute name: "${i}"`);n=ue(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=ue(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let u=[];for(;n<t.length&&t[n]!==")";){const p=n;for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)n++;let c=t.substring(p,n);if(c=c.trim(),!Re(c))throw new Error(`Invalid notation name: "${c}"`);u.push(c),t[n]==="|"&&(n++,n=ue(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+u.join("|")+")"}else{const u=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;s+=t.substring(u,n);const p=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!p.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=ue(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:o,attributeName:i,attributeType:s,defaultValue:a,index:n}}}const ue=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Ie(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Re(e){if(Je(e))return e;throw new Error(`Invalid entity name ${e}`)}const Ji=/^[-+]?0x[a-fA-F0-9]+$/,Ki=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Zi={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function es(e,t={}){if(t=Object.assign({},Zi,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Ji.test(n))return is(n,16);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return ns(e,n,t);{const r=Ki.exec(n);if(r){const o=r[1]||"",i=r[2];let s=rs(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const u=Number(n),p=String(u);if(u===0)return u;if(p.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return p==="0"||p===s||p===`${o}${s}`?u:e;let c=i?s:n;return i?c===p||o+c===p?u:e:c===p||c===o+p?u:e}}else return e}}else return ss(e,Number(n),t)}const ts=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ns(e,t,n){if(!n.eNotation)return e;const r=t.match(ts);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function rs(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function is(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function ss(e,t,n){const r=t===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return r?"Infinity":"-Infinity";case"original":default:return e}}function os(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Fe{constructor(t,n={}){this.pattern=t,this.separator=n.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(r=>r.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(r=>r.attrName!==void 0),this._hasPositionSelector=this.segments.some(r=>r.position!==void 0)}_parse(t){const n=[];let r=0,o="";for(;r<t.length;)t[r]===this.separator?r+1<t.length&&t[r+1]===this.separator?(o.trim()&&(n.push(this._parseSegment(o.trim())),o=""),n.push({type:"deep-wildcard"}),r+=2):(o.trim()&&n.push(this._parseSegment(o.trim())),o="",r++):(o+=t[r],r++);return o.trim()&&n.push(this._parseSegment(o.trim())),n}_parseSegment(t){const n={type:"tag"};let r=null,o=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(o=i[1]+i[3],i[2])){const c=i[2].slice(1,-1);c&&(r=c)}let s,a=o;if(o.includes("::")){const c=o.indexOf("::");if(s=o.substring(0,c).trim(),a=o.substring(c+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let u,p=null;if(a.includes(":")){const c=a.lastIndexOf(":"),d=a.substring(0,c).trim(),f=a.substring(c+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(u=d,p=f):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${t}`);if(n.tag=u,s&&(n.namespace=s),r)if(r.includes("=")){const c=r.indexOf("=");n.attrName=r.substring(0,c).trim(),n.attrValue=r.substring(c+1).trim()}else n.attrName=r.trim();if(p){const c=p.match(/^nth\((\d+)\)$/);c?(n.position="nth",n.positionValue=parseInt(c[1],10)):n.position=p}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}const as=new Set(["push","pop","reset","updateCurrent","restore"]);class sn{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,n=null,r=null){if(this.path.length>0){const c=this.path[this.path.length-1];c.values=void 0}const o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);const i=this.siblingStacks[o],s=r?`${r}:${t}`:t,a=i.get(s)||0;let u=0;for(const c of i.values())u+=c;i.set(s,a+1);const p={tag:t,position:u,counter:a};r!=null&&(p.namespace=r),n!=null&&(p.values=n),this.path.push(p)}pop(){if(this.path.length===0)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const n=this.path[this.path.length-1];t!=null&&(n.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){return this.path.length===0?void 0:this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&t in n.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,n=!0){const r=t||this.separator;return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const n=t.segments;return n.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let n=0;n<t.length;n++){const r=t[n],o=this.path[n],i=n===this.path.length-1;if(!this._matchSegment(r,o,i))return!1}return!0}_matchWithDeepWildcard(t){let n=this.path.length-1,r=t.length-1;for(;r>=0&&n>=0;){const o=t[r];if(o.type==="deep-wildcard"){if(r--,r<0)return!0;const i=t[r];let s=!1;for(let a=n;a>=0;a--){const u=a===this.path.length-1;if(this._matchSegment(i,this.path[a],u)){n=a-1,r--,s=!0;break}}if(!s)return!1}else{const i=n===this.path.length-1;if(!this._matchSegment(o,this.path[n],i))return!1;n--,r--}}return r<0}_matchSegment(t,n,r){if(t.tag!=="*"&&t.tag!==n.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==n.namespace)return!1;if(t.attrName!==void 0){if(!r||!n.values||!(t.attrName in n.values))return!1;if(t.attrValue!==void 0){const o=n.values[t.attrName];if(String(o)!==String(t.attrValue))return!1}}if(t.position!==void 0){if(!r)return!1;const o=n.counter??0;if(t.position==="first"&&o!==0)return!1;if(t.position==="odd"&&o%2!==1)return!1;if(t.position==="even"&&o%2!==0)return!1;if(t.position==="nth"&&o!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(n=>({...n})),this.siblingStacks=t.siblingStacks.map(n=>new Map(n))}readOnly(){const t=this;return new Proxy(t,{get(n,r,o){if(as.has(r))return()=>{throw new TypeError(`Cannot call '${r}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const i=Reflect.get(n,r,o);return r==="path"||r==="siblingStacks"?Object.freeze(Array.isArray(i)?i.map(s=>s instanceof Map?Object.freeze(new Map(s)):Object.freeze({...s})):i):typeof i=="function"?i.bind(n):i},set(n,r){throw new TypeError(`Cannot set property '${String(r)}' on a read-only Matcher.`)},deleteProperty(n,r){throw new TypeError(`Cannot delete property '${String(r)}' from a read-only Matcher.`)}})}}function us(e,t){if(!e)return{};const n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};const r={};for(const o in n)if(o.startsWith(t.attributeNamePrefix)){const i=o.substring(t.attributeNamePrefix.length);r[i]=n[o]}else r[o]=n[o];return r}function cs(e){if(!e||typeof e!="string")return;const t=e.indexOf(":");if(t!==-1&&t>0){const n=e.substring(0,t);if(n!=="xmlns")return n}}class ls{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>Ln(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>Ln(r,16,"&#x")}},this.addExternalEntities=fs,this.parseXml=ms,this.parseTextData=ps,this.resolveNameSpace=hs,this.buildAttributesMap=gs,this.isItStopNode=Es,this.replaceEntitiesValue=bs,this.readStopNodeData=Ts,this.saveTextToParentTag=ws,this.addChild=ys,this.ignoreAttributesFn=os(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new sn,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"?this.stopNodeExpressions.push(new Fe(r)):r instanceof Fe&&this.stopNodeExpressions.push(r)}}}}function fs(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n],o=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+o+";","g"),val:e[r]}}}function ps(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e,t,n));const a=this.options.jPath?n.toString():n,u=this.options.tagValueProcessor(t,e,a,o,i);return u==null?e:typeof u!=typeof e||u!==e?u:this.options.trimValues?Yt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Yt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function hs(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const ds=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function gs(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Mr(e,ds),o=r.length,i={},s={};for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),p=r[a][4];if(u.length&&p!==void 0){let c=p;this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,this.readonlyMatcher),s[u]=c}}Object.keys(s).length>0&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(s);for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),p=this.options.jPath?t.toString():this.readonlyMatcher;if(this.ignoreAttributesFn(u,p))continue;let c=r[a][4],d=this.options.attributeNamePrefix+u;if(u.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d=kr(d,this.options),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,this.readonlyMatcher);const f=this.options.jPath?t.toString():this.readonlyMatcher,y=this.options.attributeValueProcessor(u,c,f);y==null?i[d]=c:typeof y!=typeof c||y!==c?i[d]=y:i[d]=Yt(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[d]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=i,a}return i}}const ms=function(e){e=e.replace(/\r\n?/g,`
4
+ `);const t=new Te("!xml");let n=t,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const o=new Qi(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const a=xe(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){const c=u.indexOf(":");c!==-1&&(u=u.substr(c+1))}u=it(this.options.transformTagName,u,"",this.options).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));const p=this.matcher.getCurrentTag();if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);p&&this.options.unpairedTags.indexOf(p)!==-1&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=Ht(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,this.readonlyMatcher),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const u=new Te(a.tagName);u.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(u[":@"]=this.buildAttributesMap(a.tagExp,this.matcher,a.tagName)),this.addChild(n,u,this.readonlyMatcher,i)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const a=xe(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=a}else if(e.substr(i+1,2)==="!D"){const a=o.readDocType(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){const a=xe(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,a);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let p=this.parseTextData(u,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);p==null&&(p=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,p),i=a+2}else{let a=Ht(e,i,this.options.removeNSPrefix);if(!a){const N=e.substring(Math.max(0,i-50),Math.min(e.length,i+50));throw new Error(`readTagExp returned undefined at position ${i}. Context: "${N}"`)}let u=a.tagName;const p=a.rawTagName;let c=a.tagExp,d=a.attrExpPresent,f=a.closeIndex;if({tagName:u,tagExp:c}=it(this.options.transformTagName,u,c,this.options),this.options.strictReservedNames&&(u===this.options.commentPropName||u===this.options.cdataPropName||u===this.options.textNodeName||u===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${u}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));const y=n;y&&this.options.unpairedTags.indexOf(y.tagname)!==-1&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let w=!1;c.length>0&&c.lastIndexOf("/")===c.length-1&&(w=!0,u[u.length-1]==="/"?(u=u.substr(0,u.length-1),c=u):c=c.substr(0,c.length-1),d=u!==c);let v=null,b;b=cs(p),u!==t.tagname&&this.matcher.push(u,{},b),u!==c&&d&&(v=this.buildAttributesMap(c,this.matcher,u),v&&us(v,this.options)),u!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const S=i;if(this.isCurrentNodeStopNode){let N="";if(w)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=a.closeIndex;else{const E=this.readStopNodeData(e,p,f+1);if(!E)throw new Error(`Unexpected end of ${p}`);i=E.i,N=E.tagContent}const h=new Te(u);v&&(h[":@"]=v),h.add(this.options.textNodeName,N),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,h,this.readonlyMatcher,S)}else{if(w){({tagName:u,tagExp:c}=it(this.options.transformTagName,u,c,this.options));const N=new Te(u);v&&(N[":@"]=v),this.addChild(n,N,this.readonlyMatcher,S),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(this.options.unpairedTags.indexOf(u)!==-1){const N=new Te(u);v&&(N[":@"]=v),this.addChild(n,N,this.readonlyMatcher,S),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=a.closeIndex;continue}else{const N=new Te(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),v&&(N[":@"]=v),this.addChild(n,N,this.readonlyMatcher,S),n=N}r="",i=f}}else r+=e[i];return t.child};function ys(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.jPath?n.toString():n,i=this.options.updateTag(t.tagname,o,t[":@"]);i===!1||(typeof i=="string"&&(t.tagname=i),e.addChild(t,r))}function bs(e,t,n){const r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){const o=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,o)))return e}if(r.tagFilter){const o=this.options.jPath?n.toString():n;if(!r.tagFilter(t,o))return e}for(const o of Object.keys(this.docTypeEntities)){const i=this.docTypeEntities[o],s=e.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=e.length;if(e=e.replace(i.regx,i.val),r.maxExpandedLength&&(this.currentExpandedLength+=e.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}for(const o of Object.keys(this.lastEntities)){const i=this.lastEntities[o],s=e.match(i.regex);if(s&&(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(i.regex,i.val)}if(e.indexOf("&")===-1)return e;if(this.options.htmlEntities)for(const o of Object.keys(this.htmlEntities)){const i=this.htmlEntities[o],s=e.match(i.regex);if(s&&(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(i.regex,i.val)}return e=e.replace(this.ampEntity.regex,this.ampEntity.val),e}function ws(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Es(e,t){if(!e||e.length===0)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function Ns(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function xe(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Ht(e,t,n,r=">"){const o=Ns(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,p=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const c=u;if(n){const d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),p=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:p,rawTagName:c}}function Ts(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=xe(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=xe(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=xe(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=xe(e,"]]>",n,"StopNode is not closed.")-2;else{const i=Ht(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function Yt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:es(e,n)}else return ji(e)?e:""}function Ln(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}function it(e,t,n,r){if(e){const o=e(t);n===t&&(n=o),t=o}return t=kr(t,r),{tagName:t,tagExp:n}}function kr(e,t){if(Cr.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return rn.includes(e)?t.onDangerousProperty(e):e}const st=Te.getMetaDataSymbol();function Is(e,t){if(!e||typeof e!="object")return{};if(!t)return e;const n={};for(const r in e)if(r.startsWith(t)){const o=r.substring(t.length);n[o]=e[r]}else n[r]=e[r];return n}function vs(e,t,n,r){return Rr(e,t,n,r)}function Rr(e,t,n,r){let o;const i={};for(let s=0;s<e.length;s++){const a=e[s],u=Os(a);if(u!==void 0&&u!==t.textNodeName){const p=Is(a[":@"]||{},t.attributeNamePrefix);n.push(u,p)}if(u===t.textNodeName)o===void 0?o=a[u]:o+=""+a[u];else{if(u===void 0)continue;if(a[u]){let p=Rr(a[u],t,n,r);const c=Ps(p,t);if(a[":@"]?xs(p,a[":@"],r,t):Object.keys(p).length===1&&p[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?p=p[t.textNodeName]:Object.keys(p).length===0&&(t.alwaysCreateTextNode?p[t.textNodeName]="":p=""),a[st]!==void 0&&typeof p=="object"&&p!==null&&(p[st]=a[st]),i[u]!==void 0&&Object.prototype.hasOwnProperty.call(i,u))Array.isArray(i[u])||(i[u]=[i[u]]),i[u].push(p);else{const d=t.jPath?r.toString():r;t.isArray(u,d,c)?i[u]=[p]:i[u]=p}u!==void 0&&u!==t.textNodeName&&n.pop()}}}return typeof o=="string"?o.length>0&&(i[t.textNodeName]=o):o!==void 0&&(i[t.textNodeName]=o),i}function Os(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function xs(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s],u=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,p=r.jPath?n.toString()+"."+u:n;r.isArray(a,p,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function Ps(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class We{constructor(t){this.externalEntities={},this.options=zi(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=Ri(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new ls(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:vs(o,this.options,r.matcher,r.readonlyMatcher)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Te.getMetaDataSymbol()}}const As=`
5
+ `;function Ls(e,t){let n="";t.format&&t.indentBy.length>0&&(n=As);const r=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let i=0;i<t.stopNodes.length;i++){const s=t.stopNodes[i];typeof s=="string"?r.push(new Fe(s)):s instanceof Fe&&r.push(s)}const o=new sn;return Br(e,t,n,o,r)}function Br(e,t,n,r,o){let i="",s=!1;if(t.maxNestedTags&&r.getDepth()>t.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(e)){if(e!=null){let a=e.toString();return a=zt(a,t),a}return""}for(let a=0;a<e.length;a++){const u=e[a],p=$r(u);if(p===void 0)continue;const c=_s(u[":@"],t);r.push(p,c);const d=Ds(r,o);if(p===t.textNodeName){let b=u[p];d||(b=t.tagValueProcessor(p,b),b=zt(b,t)),s&&(i+=n),i+=b,s=!1,r.pop();continue}else if(p===t.cdataPropName){s&&(i+=n),i+=`<![CDATA[${u[p][0][t.textNodeName]}]]>`,s=!1,r.pop();continue}else if(p===t.commentPropName){i+=n+`<!--${u[p][0][t.textNodeName]}-->`,s=!0,r.pop();continue}else if(p[0]==="?"){const b=_n(u[":@"],t,d),S=p==="?xml"?"":n;let N=u[p][0][t.textNodeName];N=N.length!==0?" "+N:"",i+=S+`<${p}${N}${b}?>`,s=!0,r.pop();continue}let f=n;f!==""&&(f+=t.indentBy);const y=_n(u[":@"],t,d),w=n+`<${p}${y}`;let v;d?v=Xr(u[p],t):v=Br(u[p],t,f,r,o),t.unpairedTags.indexOf(p)!==-1?t.suppressUnpairedNode?i+=w+">":i+=w+"/>":(!v||v.length===0)&&t.suppressEmptyNode?i+=w+"/>":v&&v.endsWith(">")?i+=w+`>${v}${n}</${p}>`:(i+=w+">",v&&n!==""&&(v.includes("/>")||v.includes("</"))?i+=n+t.indentBy+v+n:i+=v,i+=`</${p}>`),s=!0,r.pop()}return i}function _s(e,t){if(!e||t.ignoreAttributes)return null;const n={};let r=!1;for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const i=o.startsWith(t.attributeNamePrefix)?o.substr(t.attributeNamePrefix.length):o;n[i]=e[o],r=!0}return r?n:null}function Xr(e,t){if(!Array.isArray(e))return e!=null?e.toString():"";let n="";for(let r=0;r<e.length;r++){const o=e[r],i=$r(o);if(i===t.textNodeName)n+=o[i];else if(i===t.cdataPropName)n+=o[i][0][t.textNodeName];else if(i===t.commentPropName)n+=o[i][0][t.textNodeName];else{if(i&&i[0]==="?")continue;if(i){const s=Ss(o[":@"],t),a=Xr(o[i],t);!a||a.length===0?n+=`<${i}${s}/>`:n+=`<${i}${s}>${a}</${i}>`}}}return n}function Ss(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let o=e[r];o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function $r(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==":@")return r}}function _n(e,t,n){let r="";if(e&&!t.ignoreAttributes)for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i;n?i=e[o]:(i=t.attributeValueProcessor(o,e[o]),i=zt(i,t)),i===!0&&t.suppressBooleanAttributes?r+=` ${o.substr(t.attributeNamePrefix.length)}`:r+=` ${o.substr(t.attributeNamePrefix.length)}="${i}"`}return r}function Ds(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function zt(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}function Ms(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}const Cs={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function ae(e){if(this.options=Object.assign({},Cs,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>typeof t=="string"&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];typeof n=="string"?this.stopNodeExpressions.push(new Fe(n)):n instanceof Fe&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ms(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ks),this.processTextOrObjNode=Fs,this.options.format?(this.indentate=js,this.tagEndChar=`>
6
6
  `,this.newLine=`
7
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ce.prototype.build=function(e){if(this.options.preserveOrder)return Ps(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});const t=new nn;return this.j2x(e,0,t).val}};ce.prototype.j2x=function(e,t,n){let r="",o="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const i=this.options.jPath?n.toString():n,s=this.checkStopNode(n);for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t,n);else if(typeof e[a]!="object"){const u=this.isAttribute(a);if(u&&!this.ignoreAttributesFn(u,i))r+=this.buildAttrPairStr(u,""+e[a],s);else if(!u)if(a===this.options.textNodeName){let f=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(f)}else{n.push(a);const f=this.checkStopNode(n);if(n.pop(),f){const c=""+e[a];c===""?o+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:o+=this.indentate(t)+"<"+a+">"+c+"</"+a+this.tagEndChar}else o+=this.buildTextValNode(e[a],a,"",t,n)}}else if(Array.isArray(e[a])){const u=e[a].length;let f="",c="";for(let g=0;g<u;g++){const p=e[a][g];if(!(typeof p>"u"))if(p===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){n.push(a);const b=this.j2x(p,t+1,n);n.pop(),f+=b.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(c+=b.attrStr)}else f+=this.processTextOrObjNode(p,a,t,n);else if(this.options.oneListGroup){let b=this.options.tagValueProcessor(a,p);b=this.replaceEntitiesValue(b),f+=b}else{n.push(a);const b=this.checkStopNode(n);if(n.pop(),b){const N=""+p;N===""?f+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:f+=this.indentate(t)+"<"+a+">"+N+"</"+a+this.tagEndChar}else f+=this.buildTextValNode(p,a,"",t,n)}}this.options.oneListGroup&&(f=this.buildObjectNode(f,a,c,t)),o+=f}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const u=Object.keys(e[a]),f=u.length;for(let c=0;c<f;c++)r+=this.buildAttrPairStr(u[c],""+e[a][u[c]],s)}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}};ce.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function Cs(e,t,n,r){const o=this.extractAttributes(e);if(r.push(t,o),this.checkStopNode(r)){const a=this.buildRawContent(e),u=this.buildAttributesForStopNode(e);return r.pop(),this.buildObjectNode(a,t,u,n)}const s=this.j2x(e,n+1,r);return r.pop(),e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,n,r):this.buildObjectNode(s.val,t,s.attrStr,n)}ce.prototype.extractAttributes=function(e){if(!e||typeof e!="object")return null;const t={};let n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const r=e[this.options.attributesGroupName];for(let o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const i=o.startsWith(this.options.attributeNamePrefix)?o.substring(this.options.attributeNamePrefix.length):o;t[i]=r[o],n=!0}}else for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const o=this.isAttribute(r);o&&(t[o]=e[r],n=!0)}return n?t:null};ce.prototype.buildRawContent=function(e){if(typeof e=="string")return e;if(typeof e!="object"||e===null)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t="";for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=e[n];if(n===this.options.textNodeName)t+=r;else if(Array.isArray(r)){for(let o of r)if(typeof o=="string"||typeof o=="number")t+=`<${n}>${o}</${n}>`;else if(typeof o=="object"&&o!==null){const i=this.buildRawContent(o),s=this.buildAttributesForStopNode(o);i===""?t+=`<${n}${s}/>`:t+=`<${n}${s}>${i}</${n}>`}}else if(typeof r=="object"&&r!==null){const o=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);o===""?t+=`<${n}${i}/>`:t+=`<${n}${i}>${o}</${n}>`}else t+=`<${n}>${r}</${n}>`}return t};ce.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!="object")return"";let t="";if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const n=e[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const o=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,i=n[r];i===!0&&this.options.suppressBooleanAttributes?t+=" "+o:t+=" "+o+'="'+i+'"'}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=this.isAttribute(n);if(r){const o=e[n];o===!0&&this.options.suppressBooleanAttributes?t+=" "+r:t+=" "+r+'="'+o+'"'}}return t};ce.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+o}};ce.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};ce.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1};ce.prototype.buildTextValNode=function(e,t,n,r,o){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}};ce.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function Fs(e){return this.options.indentBy.repeat(e)}function js(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Xr(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,f=0,c=0,g=0;function p(h,w){let O=0,L=0;for(;O<h;){let P=e.charCodeAt(r);if(P>=48&&P<=57)L=L*16+P-48;else if(P>=65&&P<=70)L=L*16+P-65+10;else if(P>=97&&P<=102)L=L*16+P-97+10;else break;r++,O++}return O<h&&(L=-1),L}function b(h){r=h,o="",i=0,s=16,g=0}function N(){let h=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Le(e.charCodeAt(r)))for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;else return g=3,e.substring(h,r);let w=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Le(e.charCodeAt(r))){for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;w=r}else g=3;return e.substring(h,w)}function I(){let h="",w=r;for(;;){if(r>=n){h+=e.substring(w,r),g=2;break}const O=e.charCodeAt(r);if(O===34){h+=e.substring(w,r),r++;break}if(O===92){if(h+=e.substring(w,r),r++,r>=n){g=2;break}switch(e.charCodeAt(r++)){case 34:h+='"';break;case 92:h+="\\";break;case 47:h+="/";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+=`
8
- `;break;case 114:h+="\r";break;case 116:h+=" ";break;case 117:const P=p(4);P>=0?h+=String.fromCharCode(P):g=4;break;default:g=5}w=r;continue}if(O>=0&&O<=31)if(Be(O)){h+=e.substring(w,r),g=2;break}else g=6;r++}return h}function y(){if(o="",g=0,i=r,u=a,c=f,r>=n)return i=n,s=17;let h=e.charCodeAt(r);if(it(h)){do r++,o+=String.fromCharCode(h),h=e.charCodeAt(r);while(it(h));return s=15}if(Be(h))return r++,o+=String.fromCharCode(h),h===13&&e.charCodeAt(r)===10&&(r++,o+=`
9
- `),a++,f=r,s=14;switch(h){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=I(),s=10;case 47:const w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Be(e.charCodeAt(r));)r++;return o=e.substring(w,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const O=n-1;let L=!1;for(;r<O;){const P=e.charCodeAt(r);if(P===42&&e.charCodeAt(r+1)===47){r+=2,L=!0;break}r++,Be(P)&&(P===13&&e.charCodeAt(r)===10&&r++,a++,f=r)}return L||(r++,g=1),o=e.substring(w,r),s=13}return o+=String.fromCharCode(h),r++,s=16;case 45:if(o+=String.fromCharCode(h),r++,r===n||!Le(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=N(),s=11;default:for(;r<n&&S(h);)r++,h=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(h),r++,s=16}}function S(h){if(it(h)||Be(h))return!1;switch(h){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function E(){let h;do h=y();while(h>=12&&h<=15);return h}return{setPosition:b,getPosition:()=>r,scan:t?E:y,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-c,getTokenError:()=>g}}function it(e){return e===32||e===9}function Be(e){return e===10||e===13}function Le(e){return e>=48&&e<=57}var Ln;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Ln||(Ln={}));const le=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,_n={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
7
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ae.prototype.build=function(e){if(this.options.preserveOrder)return Ls(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});const t=new sn;return this.j2x(e,0,t).val}};ae.prototype.j2x=function(e,t,n){let r="",o="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const i=this.options.jPath?n.toString():n,s=this.checkStopNode(n);for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t,n);else if(typeof e[a]!="object"){const u=this.isAttribute(a);if(u&&!this.ignoreAttributesFn(u,i))r+=this.buildAttrPairStr(u,""+e[a],s);else if(!u)if(a===this.options.textNodeName){let p=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(p)}else{n.push(a);const p=this.checkStopNode(n);if(n.pop(),p){const c=""+e[a];c===""?o+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:o+=this.indentate(t)+"<"+a+">"+c+"</"+a+this.tagEndChar}else o+=this.buildTextValNode(e[a],a,"",t,n)}}else if(Array.isArray(e[a])){const u=e[a].length;let p="",c="";for(let d=0;d<u;d++){const f=e[a][d];if(!(typeof f>"u"))if(f===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){n.push(a);const y=this.j2x(f,t+1,n);n.pop(),p+=y.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(c+=y.attrStr)}else p+=this.processTextOrObjNode(f,a,t,n);else if(this.options.oneListGroup){let y=this.options.tagValueProcessor(a,f);y=this.replaceEntitiesValue(y),p+=y}else{n.push(a);const y=this.checkStopNode(n);if(n.pop(),y){const w=""+f;w===""?p+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:p+=this.indentate(t)+"<"+a+">"+w+"</"+a+this.tagEndChar}else p+=this.buildTextValNode(f,a,"",t,n)}}this.options.oneListGroup&&(p=this.buildObjectNode(p,a,c,t)),o+=p}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const u=Object.keys(e[a]),p=u.length;for(let c=0;c<p;c++)r+=this.buildAttrPairStr(u[c],""+e[a][u[c]],s)}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}};ae.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function Fs(e,t,n,r){const o=this.extractAttributes(e);if(r.push(t,o),this.checkStopNode(r)){const a=this.buildRawContent(e),u=this.buildAttributesForStopNode(e);return r.pop(),this.buildObjectNode(a,t,u,n)}const s=this.j2x(e,n+1,r);return r.pop(),e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,n,r):this.buildObjectNode(s.val,t,s.attrStr,n)}ae.prototype.extractAttributes=function(e){if(!e||typeof e!="object")return null;const t={};let n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const r=e[this.options.attributesGroupName];for(let o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const i=o.startsWith(this.options.attributeNamePrefix)?o.substring(this.options.attributeNamePrefix.length):o;t[i]=r[o],n=!0}}else for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const o=this.isAttribute(r);o&&(t[o]=e[r],n=!0)}return n?t:null};ae.prototype.buildRawContent=function(e){if(typeof e=="string")return e;if(typeof e!="object"||e===null)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t="";for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=e[n];if(n===this.options.textNodeName)t+=r;else if(Array.isArray(r)){for(let o of r)if(typeof o=="string"||typeof o=="number")t+=`<${n}>${o}</${n}>`;else if(typeof o=="object"&&o!==null){const i=this.buildRawContent(o),s=this.buildAttributesForStopNode(o);i===""?t+=`<${n}${s}/>`:t+=`<${n}${s}>${i}</${n}>`}}else if(typeof r=="object"&&r!==null){const o=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);o===""?t+=`<${n}${i}/>`:t+=`<${n}${i}>${o}</${n}>`}else t+=`<${n}>${r}</${n}>`}return t};ae.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!="object")return"";let t="";if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const n=e[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const o=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,i=n[r];i===!0&&this.options.suppressBooleanAttributes?t+=" "+o:t+=" "+o+'="'+i+'"'}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=this.isAttribute(n);if(r){const o=e[n];o===!0&&this.options.suppressBooleanAttributes?t+=" "+r:t+=" "+r+'="'+o+'"'}}return t};ae.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+o}};ae.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};ae.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1};ae.prototype.buildTextValNode=function(e,t,n,r,o){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}};ae.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function js(e){return this.options.indentBy.repeat(e)}function ks(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Ur(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,p=0,c=0,d=0;function f(h,E){let I=0,L=0;for(;I<h;){let A=e.charCodeAt(r);if(A>=48&&A<=57)L=L*16+A-48;else if(A>=65&&A<=70)L=L*16+A-65+10;else if(A>=97&&A<=102)L=L*16+A-97+10;else break;r++,I++}return I<h&&(L=-1),L}function y(h){r=h,o="",i=0,s=16,d=0}function w(){let h=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Le(e.charCodeAt(r)))for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;else return d=3,e.substring(h,r);let E=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Le(e.charCodeAt(r))){for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;E=r}else d=3;return e.substring(h,E)}function v(){let h="",E=r;for(;;){if(r>=n){h+=e.substring(E,r),d=2;break}const I=e.charCodeAt(r);if(I===34){h+=e.substring(E,r),r++;break}if(I===92){if(h+=e.substring(E,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:h+='"';break;case 92:h+="\\";break;case 47:h+="/";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+=`
8
+ `;break;case 114:h+="\r";break;case 116:h+=" ";break;case 117:const A=f(4);A>=0?h+=String.fromCharCode(A):d=4;break;default:d=5}E=r;continue}if(I>=0&&I<=31)if(Be(I)){h+=e.substring(E,r),d=2;break}else d=6;r++}return h}function b(){if(o="",d=0,i=r,u=a,c=p,r>=n)return i=n,s=17;let h=e.charCodeAt(r);if(ot(h)){do r++,o+=String.fromCharCode(h),h=e.charCodeAt(r);while(ot(h));return s=15}if(Be(h))return r++,o+=String.fromCharCode(h),h===13&&e.charCodeAt(r)===10&&(r++,o+=`
9
+ `),a++,p=r,s=14;switch(h){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=v(),s=10;case 47:const E=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Be(e.charCodeAt(r));)r++;return o=e.substring(E,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const I=n-1;let L=!1;for(;r<I;){const A=e.charCodeAt(r);if(A===42&&e.charCodeAt(r+1)===47){r+=2,L=!0;break}r++,Be(A)&&(A===13&&e.charCodeAt(r)===10&&r++,a++,p=r)}return L||(r++,d=1),o=e.substring(E,r),s=13}return o+=String.fromCharCode(h),r++,s=16;case 45:if(o+=String.fromCharCode(h),r++,r===n||!Le(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=w(),s=11;default:for(;r<n&&S(h);)r++,h=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(h),r++,s=16}}function S(h){if(ot(h)||Be(h))return!1;switch(h){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function N(){let h;do h=b();while(h>=12&&h<=15);return h}return{setPosition:y,getPosition:()=>r,scan:t?N:b,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-c,getTokenError:()=>d}}function ot(e){return e===32||e===9}function Be(e){return e===10||e===13}function Le(e){return e>=48&&e<=57}var Sn;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Sn||(Sn={}));const le=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,Dn={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
10
10
  `+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
11
11
  `+" ".repeat(t))}," ":{"\n":new Array(_e).fill(0).map((e,t)=>`
12
12
  `+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
13
- `+" ".repeat(t))}},ks=[`
13
+ `+" ".repeat(t))}},Rs=[`
14
14
  `,"\r",`\r
15
- `];function Rs(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!We(e,i-1);)i--;let O=a;for(;O<e.length&&!We(e,O);)O++;o=e.substring(i,O),r=Bs(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Xs(n,e),f=ks.includes(u);let c=0,g=0,p;n.insertSpaces?p=le[n.tabSize||4]??Se(le[1],n.tabSize||4):p=" ";const b=p===" "?" ":" ";let N=Xr(o,!1),I=!1;function y(){if(c>1)return Se(u,c)+Se(p,r+g);const O=p.length*(r+g);return!f||O>_n[b][u].length?u+Se(p,r+g):O<=0?u:_n[b][u][O]}function S(){let O=N.scan();for(c=0;O===15||O===14;)O===14&&n.keepLines?c+=1:O===14&&(c=1),O=N.scan();return I=O===16||N.getTokenError()!==0,O}const E=[];function h(O,L,P){!I&&(!t||L<a&&P>s)&&e.substring(L,P)!==O&&E.push({offset:L,length:P-L,content:O})}let w=S();if(n.keepLines&&c>0&&h(Se(u,c),0,0),w!==17){let O=N.getTokenOffset()+i,L=p.length*r<20&&n.insertSpaces?le[p.length*r]:Se(p,r);h(L,i,O)}for(;w!==17;){let O=N.getTokenOffset()+N.getTokenLength()+i,L=S(),P="",C=!1;for(;c===0&&(L===12||L===13);){let _=N.getTokenOffset()+i;h(le[1],O,_),O=N.getTokenOffset()+N.getTokenLength()+i,C=L===12,P=C?y():"",L=S()}if(L===2)w!==1&&g--,n.keepLines&&c>0||!n.keepLines&&w!==1?P=y():n.keepLines&&(P=le[1]);else if(L===4)w!==3&&g--,n.keepLines&&c>0||!n.keepLines&&w!==3?P=y():n.keepLines&&(P=le[1]);else{switch(w){case 3:case 1:g++,n.keepLines&&c>0||!n.keepLines?P=y():P=le[1];break;case 5:n.keepLines&&c>0||!n.keepLines?P=y():P=le[1];break;case 12:P=y();break;case 13:c>0?P=y():C||(P=le[1]);break;case 6:n.keepLines&&c>0?P=y():C||(P=le[1]);break;case 10:n.keepLines&&c>0?P=y():L===6&&!C&&(P="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&c>0?P=y():(L===12||L===13)&&!C?P=le[1]:L!==5&&L!==17&&(I=!0);break;case 16:I=!0;break}c>0&&(L===12||L===13)&&(P=y())}L===17&&(n.keepLines&&c>0?P=y():P=n.insertFinalNewline?u:"");const l=N.getTokenOffset()+i;h(P,O,l),w=L}return E}function Se(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Bs(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===le[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function Xs(e,t){for(let n=0;n<t.length;n++){const r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
15
+ `];function Bs(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!Ge(e,i-1);)i--;let I=a;for(;I<e.length&&!Ge(e,I);)I++;o=e.substring(i,I),r=Xs(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=$s(n,e),p=Rs.includes(u);let c=0,d=0,f;n.insertSpaces?f=le[n.tabSize||4]??Se(le[1],n.tabSize||4):f=" ";const y=f===" "?" ":" ";let w=Ur(o,!1),v=!1;function b(){if(c>1)return Se(u,c)+Se(f,r+d);const I=f.length*(r+d);return!p||I>Dn[y][u].length?u+Se(f,r+d):I<=0?u:Dn[y][u][I]}function S(){let I=w.scan();for(c=0;I===15||I===14;)I===14&&n.keepLines?c+=1:I===14&&(c=1),I=w.scan();return v=I===16||w.getTokenError()!==0,I}const N=[];function h(I,L,A){!v&&(!t||L<a&&A>s)&&e.substring(L,A)!==I&&N.push({offset:L,length:A-L,content:I})}let E=S();if(n.keepLines&&c>0&&h(Se(u,c),0,0),E!==17){let I=w.getTokenOffset()+i,L=f.length*r<20&&n.insertSpaces?le[f.length*r]:Se(f,r);h(L,i,I)}for(;E!==17;){let I=w.getTokenOffset()+w.getTokenLength()+i,L=S(),A="",C=!1;for(;c===0&&(L===12||L===13);){let _=w.getTokenOffset()+i;h(le[1],I,_),I=w.getTokenOffset()+w.getTokenLength()+i,C=L===12,A=C?b():"",L=S()}if(L===2)E!==1&&d--,n.keepLines&&c>0||!n.keepLines&&E!==1?A=b():n.keepLines&&(A=le[1]);else if(L===4)E!==3&&d--,n.keepLines&&c>0||!n.keepLines&&E!==3?A=b():n.keepLines&&(A=le[1]);else{switch(E){case 3:case 1:d++,n.keepLines&&c>0||!n.keepLines?A=b():A=le[1];break;case 5:n.keepLines&&c>0||!n.keepLines?A=b():A=le[1];break;case 12:A=b();break;case 13:c>0?A=b():C||(A=le[1]);break;case 6:n.keepLines&&c>0?A=b():C||(A=le[1]);break;case 10:n.keepLines&&c>0?A=b():L===6&&!C&&(A="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&c>0?A=b():(L===12||L===13)&&!C?A=le[1]:L!==5&&L!==17&&(v=!0);break;case 16:v=!0;break}c>0&&(L===12||L===13)&&(A=b())}L===17&&(n.keepLines&&c>0?A=b():A=n.insertFinalNewline?u:"");const l=w.getTokenOffset()+i;h(A,I,l),E=L}return N}function Se(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Xs(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===le[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function $s(e,t){for(let n=0;n<t.length;n++){const r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
16
16
  `?`\r
17
17
  `:"\r";if(r===`
18
18
  `)return`
19
19
  `}return e&&e.eol||`
20
- `}function We(e,t){return`\r
21
- `.indexOf(e.charAt(t))!==-1}var Ge;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Ge||(Ge={}));function $r(e,t=[],n=Ge.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(u){r.type==="property"&&(r.length=u-r.offset,r=r.parent)}function i(u){return r.children.push(u),u}$s(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,f,c)=>{r=i({type:"property",offset:f,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:f,length:c,parent:r})},onObjectEnd:(u,f)=>{o(u+f),r.length=u+f-r.offset,r=r.parent,o(u+f)},onArrayBegin:(u,f)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,f)=>{r.length=u+f-r.offset,r=r.parent,o(u+f)},onLiteralValue:(u,f,c)=>{i({type:Us(u),offset:f,length:c,parent:r,value:u}),o(f+c)},onSeparator:(u,f,c)=>{r.type==="property"&&(u===":"?r.colonOffset=f:u===","&&o(f))},onError:(u,f,c)=>{t.push({error:u,offset:f,length:c})}},n);const a=r.children[0];return a&&delete a.parent,a}function Yt(e,t){if(!e)return;let n=e;for(let r of t)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let o=!1;for(const i of n.children)if(Array.isArray(i.children)&&i.children[0].value===r&&i.children.length===2){n=i.children[1],o=!0;break}if(!o)return}else{const o=r;if(n.type!=="array"||o<0||!Array.isArray(n.children)||o>=n.children.length)return;n=n.children[o]}return n}function $s(e,t,n=Ge.DEFAULT){const r=Xr(e,!1),o=[];let i=0;function s(B){return B?()=>i===0&&B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(B){return B?U=>i===0&&B(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(B){return B?U=>i===0&&B(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function f(B){return B?()=>{i>0?i++:B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function c(B){return B?()=>{i>0&&i--,i===0&&B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const g=f(t.onObjectBegin),p=u(t.onObjectProperty),b=c(t.onObjectEnd),N=f(t.onArrayBegin),I=c(t.onArrayEnd),y=u(t.onLiteralValue),S=a(t.onSeparator),E=s(t.onComment),h=a(t.onError),w=n&&n.disallowComments,O=n&&n.allowTrailingComma;function L(){for(;;){const B=r.scan();switch(r.getTokenError()){case 4:P(14);break;case 5:P(15);break;case 3:P(13);break;case 1:w||P(11);break;case 2:P(12);break;case 6:P(16);break}switch(B){case 12:case 13:w?P(10):E();break;case 16:P(1);break;case 15:case 14:break;default:return B}}}function P(B,U=[],H=[]){if(h(B),U.length+H.length>0){let W=r.getToken();for(;W!==17;){if(U.indexOf(W)!==-1){L();break}else if(H.indexOf(W)!==-1)break;W=L()}}}function C(B){const U=r.getTokenValue();return B?y(U):(p(U),o.push(U)),L(),!0}function l(){switch(r.getToken()){case 11:const B=r.getTokenValue();let U=Number(B);isNaN(U)&&(P(2),U=0),y(U);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return L(),!0}function _(){return r.getToken()!==10?(P(3,[],[2,5]),!1):(C(!1),r.getToken()===6?(S(":"),L(),q()||P(4,[],[2,5])):P(5,[],[2,5]),o.pop(),!0)}function F(){g(),L();let B=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(B||P(4,[],[]),S(","),L(),r.getToken()===2&&O)break}else B&&P(6,[],[]);_()||P(4,[],[2,5]),B=!0}return b(),r.getToken()!==2?P(7,[2],[]):L(),!0}function k(){N(),L();let B=!0,U=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(U||P(4,[],[]),S(","),L(),r.getToken()===4&&O)break}else U&&P(6,[],[]);B?(o.push(0),B=!1):o[o.length-1]++,q()||P(4,[],[4,5]),U=!0}return I(),B||o.pop(),r.getToken()!==4?P(8,[4],[]):L(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return F();case 10:return C(!0);default:return l()}}return L(),r.getToken()===17?n.allowEmptyContent?!0:(P(4,[],[]),!1):q()?(r.getToken()!==17&&P(9,[],[]),!0):(P(4,[],[]),!1)}function Us(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function Vs(e,t,n,r){const o=t.slice(),s=$r(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Yt(s,o),a===void 0&&n!==void 0);)typeof u=="string"?n={[u]:n}:n=[n];if(a)if(a.type==="object"&&typeof u=="string"&&Array.isArray(a.children)){const f=Yt(a,[u]);if(f!==void 0)if(n===void 0){if(!f.parent)throw new Error("Malformed AST");const c=a.children.indexOf(f.parent);let g,p=f.parent.offset+f.parent.length;if(c>0){let b=a.children[c-1];g=b.offset+b.length}else g=a.offset+1,a.children.length>1&&(p=a.children[1].offset);return Ie(e,{offset:g,length:p-g,content:""},r)}else return Ie(e,{offset:f.offset,length:f.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const c=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,g=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let p;if(g>0){let b=a.children[g-1];p={offset:b.offset+b.length,length:0,content:","+c}}else a.children.length===0?p={offset:a.offset+1,length:0,content:c}:p={offset:a.offset+1,length:0,content:c+","};return Ie(e,p,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const f=u;if(f===-1){const c=`${JSON.stringify(n)}`;let g;if(a.children.length===0)g={offset:a.offset+1,length:0,content:c};else{const p=a.children[a.children.length-1];g={offset:p.offset+p.length,length:0,content:","+c}}return Ie(e,g,r)}else if(n===void 0&&a.children.length>=0){const c=u,g=a.children[c];let p;if(a.children.length===1)p={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===c){let b=a.children[c-1],N=b.offset+b.length,I=a.offset+a.length;p={offset:N,length:I-2-N,content:""}}else p={offset:g.offset,length:a.children[c+1].offset-g.offset,content:""};return Ie(e,p,r)}else if(n!==void 0){let c;const g=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const p=a.children[u];c={offset:p.offset,length:p.length,content:g}}else if(a.children.length===0||u===0)c={offset:a.offset+1,length:0,content:a.children.length===0?g:g+","};else{const p=u>a.children.length?a.children.length:u,b=a.children[p-1];c={offset:b.offset+b.length,length:0,content:","+g}}return Ie(e,c,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${f} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return Ie(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Ie(e,t,n){if(!n.formattingOptions)return[t];let r=zt(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!We(r,o-1);)o--;for(;i<r.length&&!We(r,i);)i++}const s=Rs(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const f=s[u];r=zt(r,f),o=Math.min(o,f.offset),i=Math.max(i,f.offset+f.length),i+=f.content.length-f.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function zt(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Sn;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Sn||(Sn={}));var Dn;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Dn||(Dn={}));const He=$r,Xe=Yt;var Mn;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Mn||(Mn={}));function qs(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function Qt(e,t,n,r){return Vs(e,t,n,r)}function Ur(e,t){let n=t.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=e.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)e=zt(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}const Ws="PHPWASMCLI";function Vr(e,t){return t.filter(n=>{const r=oe.resolve(n.hostPath),o=oe.join(e,oe.sep);return r===e||r.startsWith(o)})}const Te={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},qr={ignoreAttributes:Te.ignoreAttributes,attributeNamePrefix:Te.attributeNamePrefix,preserveOrder:Te.preserveOrder,cdataPropName:Te.cdataPropName,commentPropName:Te.commentPropName,suppressBooleanAttributes:!Te.allowBooleanAttributes,format:!0,indentBy:" "},Ye={allowEmptyContent:!0,allowTrailingComma:!0};function Gs(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new jr(Te),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),f={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(f.server[0].path_mappings=i.map(E=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Pr(oe.relative(t.projectDir,E.hostPath))}`,"remote-root":E.vfsPath}})));let c=u?.find(E=>!!E?.project);if(c){const E=c[":@"]?.version;if(E===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but the <project> configuration has no version number.');if(E!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${E}".`)}c===void 0&&(c={project:[],":@":{version:"4"}},u.push(c));let g=c.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="PhpServers");g===void 0&&(g={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(g));let p=g.component?.find(E=>!!E?.servers);p===void 0&&(p={servers:[]},g.component===void 0&&(g.component=[]),g.component.push(p));const b=p.servers?.findIndex(E=>!!E?.server&&E?.[":@"]?.name===n);(b===void 0||b<0)&&(p.servers===void 0&&(p.servers=[]),p.servers.push(f));let N=c.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="RunManager");if(N===void 0&&(N={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(N)),(N.component?.findIndex(E=>!!E?.configuration&&E?.[":@"]?.name===n)??-1)<0){const E={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};N.component===void 0&&(N.component=[]),N.component.push(E)}const S=new ce(qr).build(u);try{a.parse(S,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return S}function Hs(e,t){const{name:n,mappings:r}=t,o=[];let i=e,s=He(i,o,Ye);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");let a=Xe(s,["configurations"]);if(a===void 0||a.children===void 0){const f=Qt(i,["configurations"],[],{});i=Ur(i,f),s=He(i,[],Ye),a=Xe(s,["configurations"])}const u=a?.children?.findIndex(f=>Xe(f,["name"])?.value===n);if(u===void 0||u<0){const f={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(f.pathMappings=r.reduce((p,b)=>(p[b.vfsPath]=`\${workspaceFolder}/${Pr(oe.relative(t.workspaceDir,b.hostPath))}`,p),{}));const c=a?.children?.length||0,g=Qt(i,["configurations",c],f,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
- `}});i=Wr(i,g)}return i}async function Ys({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s=Ws}){const a=i?Vr(o,i):[],u={};if(t.includes("phpstorm")){const f=".idea/workspace.xml",c=oe.join(o,f);if(!Z.existsSync(c)){if(Z.existsSync(oe.dirname(c)))Z.writeFileSync(c,`<?xml version="1.0" encoding="UTF-8"?>
20
+ `}function Ge(e,t){return`\r
21
+ `.indexOf(e.charAt(t))!==-1}var He;(function(e){e.DEFAULT={allowTrailingComma:!1}})(He||(He={}));function Vr(e,t=[],n=He.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(u){r.type==="property"&&(r.length=u-r.offset,r=r.parent)}function i(u){return r.children.push(u),u}Us(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,p,c)=>{r=i({type:"property",offset:p,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:p,length:c,parent:r})},onObjectEnd:(u,p)=>{o(u+p),r.length=u+p-r.offset,r=r.parent,o(u+p)},onArrayBegin:(u,p)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,p)=>{r.length=u+p-r.offset,r=r.parent,o(u+p)},onLiteralValue:(u,p,c)=>{i({type:Vs(u),offset:p,length:c,parent:r,value:u}),o(p+c)},onSeparator:(u,p,c)=>{r.type==="property"&&(u===":"?r.colonOffset=p:u===","&&o(p))},onError:(u,p,c)=>{t.push({error:u,offset:p,length:c})}},n);const a=r.children[0];return a&&delete a.parent,a}function Qt(e,t){if(!e)return;let n=e;for(let r of t)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let o=!1;for(const i of n.children)if(Array.isArray(i.children)&&i.children[0].value===r&&i.children.length===2){n=i.children[1],o=!0;break}if(!o)return}else{const o=r;if(n.type!=="array"||o<0||!Array.isArray(n.children)||o>=n.children.length)return;n=n.children[o]}return n}function Us(e,t,n=He.DEFAULT){const r=Ur(e,!1),o=[];let i=0;function s(B){return B?()=>i===0&&B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(B){return B?U=>i===0&&B(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(B){return B?U=>i===0&&B(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function p(B){return B?()=>{i>0?i++:B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function c(B){return B?()=>{i>0&&i--,i===0&&B(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const d=p(t.onObjectBegin),f=u(t.onObjectProperty),y=c(t.onObjectEnd),w=p(t.onArrayBegin),v=c(t.onArrayEnd),b=u(t.onLiteralValue),S=a(t.onSeparator),N=s(t.onComment),h=a(t.onError),E=n&&n.disallowComments,I=n&&n.allowTrailingComma;function L(){for(;;){const B=r.scan();switch(r.getTokenError()){case 4:A(14);break;case 5:A(15);break;case 3:A(13);break;case 1:E||A(11);break;case 2:A(12);break;case 6:A(16);break}switch(B){case 12:case 13:E?A(10):N();break;case 16:A(1);break;case 15:case 14:break;default:return B}}}function A(B,U=[],H=[]){if(h(B),U.length+H.length>0){let W=r.getToken();for(;W!==17;){if(U.indexOf(W)!==-1){L();break}else if(H.indexOf(W)!==-1)break;W=L()}}}function C(B){const U=r.getTokenValue();return B?b(U):(f(U),o.push(U)),L(),!0}function l(){switch(r.getToken()){case 11:const B=r.getTokenValue();let U=Number(B);isNaN(U)&&(A(2),U=0),b(U);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return L(),!0}function _(){return r.getToken()!==10?(A(3,[],[2,5]),!1):(C(!1),r.getToken()===6?(S(":"),L(),q()||A(4,[],[2,5])):A(5,[],[2,5]),o.pop(),!0)}function F(){d(),L();let B=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(B||A(4,[],[]),S(","),L(),r.getToken()===2&&I)break}else B&&A(6,[],[]);_()||A(4,[],[2,5]),B=!0}return y(),r.getToken()!==2?A(7,[2],[]):L(),!0}function k(){w(),L();let B=!0,U=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(U||A(4,[],[]),S(","),L(),r.getToken()===4&&I)break}else U&&A(6,[],[]);B?(o.push(0),B=!1):o[o.length-1]++,q()||A(4,[],[4,5]),U=!0}return v(),B||o.pop(),r.getToken()!==4?A(8,[4],[]):L(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return F();case 10:return C(!0);default:return l()}}return L(),r.getToken()===17?n.allowEmptyContent?!0:(A(4,[],[]),!1):q()?(r.getToken()!==17&&A(9,[],[]),!0):(A(4,[],[]),!1)}function Vs(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function qs(e,t,n,r){const o=t.slice(),s=Vr(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Qt(s,o),a===void 0&&n!==void 0);)typeof u=="string"?n={[u]:n}:n=[n];if(a)if(a.type==="object"&&typeof u=="string"&&Array.isArray(a.children)){const p=Qt(a,[u]);if(p!==void 0)if(n===void 0){if(!p.parent)throw new Error("Malformed AST");const c=a.children.indexOf(p.parent);let d,f=p.parent.offset+p.parent.length;if(c>0){let y=a.children[c-1];d=y.offset+y.length}else d=a.offset+1,a.children.length>1&&(f=a.children[1].offset);return ve(e,{offset:d,length:f-d,content:""},r)}else return ve(e,{offset:p.offset,length:p.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const c=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,d=r.getInsertionIndex?r.getInsertionIndex(a.children.map(y=>y.children[0].value)):a.children.length;let f;if(d>0){let y=a.children[d-1];f={offset:y.offset+y.length,length:0,content:","+c}}else a.children.length===0?f={offset:a.offset+1,length:0,content:c}:f={offset:a.offset+1,length:0,content:c+","};return ve(e,f,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const p=u;if(p===-1){const c=`${JSON.stringify(n)}`;let d;if(a.children.length===0)d={offset:a.offset+1,length:0,content:c};else{const f=a.children[a.children.length-1];d={offset:f.offset+f.length,length:0,content:","+c}}return ve(e,d,r)}else if(n===void 0&&a.children.length>=0){const c=u,d=a.children[c];let f;if(a.children.length===1)f={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===c){let y=a.children[c-1],w=y.offset+y.length,v=a.offset+a.length;f={offset:w,length:v-2-w,content:""}}else f={offset:d.offset,length:a.children[c+1].offset-d.offset,content:""};return ve(e,f,r)}else if(n!==void 0){let c;const d=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const f=a.children[u];c={offset:f.offset,length:f.length,content:d}}else if(a.children.length===0||u===0)c={offset:a.offset+1,length:0,content:a.children.length===0?d:d+","};else{const f=u>a.children.length?a.children.length:u,y=a.children[f-1];c={offset:y.offset+y.length,length:0,content:","+d}}return ve(e,c,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${p} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return ve(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function ve(e,t,n){if(!n.formattingOptions)return[t];let r=Jt(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!Ge(r,o-1);)o--;for(;i<r.length&&!Ge(r,i);)i++}const s=Bs(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const p=s[u];r=Jt(r,p),o=Math.min(o,p.offset),i=Math.max(i,p.offset+p.length),i+=p.content.length-p.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Jt(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Mn;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Mn||(Mn={}));var Cn;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Cn||(Cn={}));const Ye=Vr,Xe=Qt;var Fn;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Fn||(Fn={}));function Ws(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function Kt(e,t,n,r){return qs(e,t,n,r)}function qr(e,t){let n=t.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=e.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)e=Jt(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}const Gs="PHPWASMCLI",jn=["/dev/","/home/","/internal/","/request/","/proc/"];function Wr(e,t){return t.filter(n=>{const r=ne.resolve(n.hostPath),o=ne.join(e,ne.sep);return r===e||r.startsWith(o)})}const me={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},ze={ignoreAttributes:me.ignoreAttributes,attributeNamePrefix:me.attributeNamePrefix,preserveOrder:me.preserveOrder,cdataPropName:me.cdataPropName,commentPropName:me.commentPropName,suppressBooleanAttributes:!me.allowBooleanAttributes,format:!0,indentBy:" "},Qe={allowEmptyContent:!0,allowTrailingComma:!0};function Hs(e,t){const{name:n,host:r,port:o,pathMappings:i,ideKey:s}=t,a=new We(me),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),p={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(p.server[0].path_mappings=i.map(N=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Sr(ne.relative(t.projectDir,N.hostPath))}`,"remote-root":N.vfsPath}})));let c=u?.find(N=>!!N?.project);if(c){const N=c[":@"]?.version;if(N===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but the <project> configuration has no version number.');if(N!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${N}".`)}c===void 0&&(c={project:[],":@":{version:"4"}},u.push(c));let d=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="PhpServers");d===void 0&&(d={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(d));let f=d.component?.find(N=>!!N?.servers);f===void 0&&(f={servers:[]},d.component===void 0&&(d.component=[]),d.component.push(f));const y=f.servers?.findIndex(N=>!!N?.server&&N?.[":@"]?.name===n);(y===void 0||y<0)&&(f.servers===void 0&&(f.servers=[]),f.servers.push(p));let w=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="RunManager");if(w===void 0&&(w={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(w)),(w.component?.findIndex(N=>!!N?.configuration&&N?.[":@"]?.name===n)??-1)<0){const N={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};w.component===void 0&&(w.component=[]),w.component.push(N)}const S=new ae(ze).build(u);try{a.parse(S,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return S}function Ys(e,t){const{pathSkippings:n}=t,r=new We(me),o=(()=>{try{return r.parse(e,!0)}catch{throw new Error("PhpStorm PHP configuration file is not valid XML.")}})();let i=o?.find(c=>!!c?.project);if(i){const c=i[":@"]?.version;if(c===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in php.xml, but the <project> configuration has no version number.');if(c!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in php.xml, but we found a <project> configuration with version "${c}".`)}i===void 0&&(i={project:[],":@":{version:"4"}},o.push(i));let s=i.project?.find(c=>!!c?.component&&c?.[":@"]?.name==="PhpStepFilterConfiguration");s===void 0&&(s={component:[],":@":{name:"PhpStepFilterConfiguration"}},i.project===void 0&&(i.project=[]),i.project.push(s));let a=s.component?.find(c=>!!c?.skipped_files);if(a===void 0&&(a={skipped_files:[]},s.component===void 0&&(s.component=[]),s.component.push(a)),n&&n.length)for(const c of n){const f=`$PROJECT_DIR$${c.endsWith("/")?c.slice(0,-1):c}`;a.skipped_files?.some(w=>!!w?.skipped_file&&w?.[":@"]?.file===f)||(a.skipped_files===void 0&&(a.skipped_files=[]),a.skipped_files.push({skipped_file:[],":@":{file:f}}))}const p=new ae(ze).build(o);try{r.parse(p,!0)}catch{throw new Error("The resulting PhpStorm PHP configuration file is not valid XML.")}return p}function zs(e,t){const{name:n,pathMappings:r,pathSkippings:o}=t,i=[];let s=e,a=Ye(s,i,Qe);if(a===void 0||i.length)throw new Error("VS Code configuration file is not valid JSON.");let u=Xe(a,["configurations"]);if(u===void 0||u.children===void 0){const c=Kt(s,["configurations"],[],{});s=qr(s,c),a=Ye(s,[],Qe),u=Xe(a,["configurations"])}const p=u?.children?.findIndex(c=>Xe(c,["name"])?.value===n);if(p===void 0||p<0){const c={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(c.pathMappings=r.reduce((y,w)=>(y[w.vfsPath]=`\${workspaceFolder}/${Sr(ne.relative(t.workspaceDir,w.hostPath))}`,y),{})),o&&o.length&&(c.skipFiles=o.map(y=>y.endsWith("/")?`${y}**`:y));const d=u?.children?.length||0,f=Kt(s,["configurations",d],c,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
+ `}});s=Gr(s,f)}return s}async function Qs({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,pathSkippings:s,ideKey:a=Gs}){const u=i?Wr(o,i):[],p={};if(t.includes("phpstorm")){const c=".idea/workspace.xml",d=ne.join(o,c);if(!z.existsSync(d)){if(z.existsSync(ne.dirname(d)))z.writeFileSync(d,`<?xml version="1.0" encoding="UTF-8"?>
23
23
  <project version="4">
24
- </project>`);else if(t.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(Z.existsSync(c)){const g=Z.readFileSync(c,"utf8"),p=Gs(g,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});Z.writeFileSync(c,p),u.phpstorm=f}}if(t.includes("vscode")){const f=".vscode/launch.json",c=oe.join(o,f);if(!Z.existsSync(c)){if(Z.existsSync(oe.dirname(c)))Z.writeFileSync(c,`{
24
+ </project>`);else if(t.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(z.existsSync(d)){const f=z.readFileSync(d,"utf8"),y=Hs(f,{name:e,host:n,port:r,projectDir:o,pathMappings:u,ideKey:a});z.writeFileSync(d,y),p.phpstorm=c}if(s&&s.length){const f=".idea/php.xml",y=ne.join(o,f);if(z.existsSync(y)||z.existsSync(ne.dirname(y))&&z.writeFileSync(y,`<?xml version="1.0" encoding="UTF-8"?>
25
+ <project version="4">
26
+ </project>`),z.existsSync(y)){const w=z.readFileSync(y,"utf8"),v=Ys(w,{pathSkippings:s});z.writeFileSync(y,v),p["phpstorm-php"]=f}}}if(t.includes("vscode")){const c=".vscode/launch.json",d=ne.join(o,c);if(!z.existsSync(d)){if(z.existsSync(ne.dirname(d)))z.writeFileSync(d,`{
25
27
  "configurations": []
26
- }`);else if(t.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(Z.existsSync(c)){const g=Z.readFileSync(c,"utf-8"),p=Hs(g,{name:e,workspaceDir:o,mappings:a});p!==g&&(Z.writeFileSync(c,p),u.vscode=f)}}return u}async function zs(e,t){const n=oe.join(t,".idea/workspace.xml");if(Z.existsSync(n)){const o=Z.readFileSync(n,"utf8"),i=new jr(Te),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),f=s.find(g=>!!g?.project)?.project?.find(g=>!!g?.component&&g?.[":@"]?.name==="PhpServers")?.component?.find(g=>!!g?.servers),c=f?.servers?.findIndex(g=>!!g?.server&&g?.[":@"]?.name===e);if(c!==void 0&&c>=0){f.servers.splice(c,1);const p=new ce(qr).build(s);try{i.parse(p,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}p===`<?xml version="1.0" encoding="UTF-8"?>
28
+ }`);else if(t.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(z.existsSync(d)){const f=z.readFileSync(d,"utf-8"),y=zs(f,{name:e,workspaceDir:o,pathMappings:u,pathSkippings:s});y!==f&&(z.writeFileSync(d,y),p.vscode=c)}}return p}async function Js(e,t){const n=ne.join(t,".idea/workspace.xml");if(z.existsSync(n)){const i=z.readFileSync(n,"utf8"),s=new We(me),a=(()=>{try{return s.parse(i,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),c=a.find(f=>!!f?.project)?.project?.find(f=>!!f?.component&&f?.[":@"]?.name==="PhpServers")?.component?.find(f=>!!f?.servers),d=c?.servers?.findIndex(f=>!!f?.server&&f?.[":@"]?.name===e);if(d!==void 0&&d>=0){c.servers.splice(d,1);const y=new ae(ze).build(a);try{s.parse(y,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}y===`<?xml version="1.0" encoding="UTF-8"?>
27
29
  <project version="4">
28
30
  <component name="PhpServers">
29
31
  <servers></servers>
30
32
  </component>
31
- </project>`?Z.unlinkSync(n):Z.writeFileSync(n,p)}}const r=oe.join(t,".vscode/launch.json");if(Z.existsSync(r)){const o=[],i=Z.readFileSync(r,"utf-8"),s=He(i,o,Ye);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");const u=Xe(s,["configurations"])?.children?.findIndex(f=>Xe(f,["name"])?.value===e);if(u!==void 0&&u>=0){const f=Qt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
- `}}),c=Wr(i,f);c===`{
33
+ </project>`?z.unlinkSync(n):z.writeFileSync(n,y)}}const r=ne.join(t,".idea/php.xml");if(z.existsSync(r)){const i=z.readFileSync(r,"utf8"),s=new We(me),a=(()=>{try{return s.parse(i,!0)}catch{throw new Error("PhpStorm PHP configuration file is not valid XML.")}})(),u=a.find(c=>!!c?.project),p=u?.project?.findIndex(c=>!!c?.component&&c?.[":@"]?.name==="PhpStepFilterConfiguration");if(p!==void 0&&p>=0){u.project.splice(p,1);const d=new ae(ze).build(a);try{s.parse(d,!0)}catch{throw new Error("The resulting PhpStorm PHP configuration file is not valid XML.")}d===`<?xml version="1.0" encoding="UTF-8"?>
34
+ <project version="4">
35
+ </project>`?z.unlinkSync(r):z.writeFileSync(r,d)}}const o=ne.join(t,".vscode/launch.json");if(z.existsSync(o)){const i=[],s=z.readFileSync(o,"utf-8"),a=Ye(s,i,Qe);if(a===void 0||i.length)throw new Error("VS Code configuration file is not valid JSON.");const p=Xe(a,["configurations"])?.children?.findIndex(c=>Xe(c,["name"])?.value===e);if(p!==void 0&&p>=0){const c=Kt(s,["configurations",p],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
36
+ `}}),d=Gr(s,c);d===`{
33
37
  "configurations": []
34
- }`?Z.unlinkSync(r):Z.writeFileSync(r,c)}}}function Qs({cwd:e,mounts:t,pathSkippings:n}){return{pathMappings:e&&t?Vr(e,t):void 0,pathSkippings:n}}function Wr(e,t){const n=[],r=Ur(e,t);if(n.length=0,He(r,n,Ye),n.length){const o=n.map(s=>({message:qs(s.error),offset:s.offset,length:s.length,fragment:r.slice(Math.max(0,s.offset-20),Math.min(r.length,s.offset+s.length+10))})).map(s=>`${s.message} at ${s.offset}:${s.length} (${s.fragment})`),i=t.map(s=>`At ${s.offset}:${s.length} - (${s.content})`);throw new Error(`VS Code configuration file (.vscode/launch.json) is not valid a JSONC after CLI modifications. This is likely a CLI bug. Please report it at https://github.com/WordPress/wordpress-playground/issues and include the contents of your ".vscode/launch.json" file.
38
+ }`?z.unlinkSync(o):z.writeFileSync(o,d)}}}function Ks({cwd:e,mounts:t,pathSkippings:n}){return{pathMappings:e&&t?Wr(e,t):void 0,pathSkippings:n}}function Gr(e,t){const n=[],r=qr(e,t);if(n.length=0,Ye(r,n,Qe),n.length){const o=n.map(s=>({message:Ws(s.error),offset:s.offset,length:s.length,fragment:r.slice(Math.max(0,s.offset-20),Math.min(r.length,s.offset+s.length+10))})).map(s=>`${s.message} at ${s.offset}:${s.length} (${s.fragment})`),i=t.map(s=>`At ${s.offset}:${s.length} - (${s.content})`);throw new Error(`VS Code configuration file (.vscode/launch.json) is not valid a JSONC after CLI modifications. This is likely a CLI bug. Please report it at https://github.com/WordPress/wordpress-playground/issues and include the contents of your ".vscode/launch.json" file.
35
39
 
36
40
  Applied edits: ${i.join(`
37
41
  `)}
38
42
 
39
43
  The errors are: ${o.join(`
40
- `)}`)}return r}const Gr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Gr==="NODE"){let e=function(n){return new Promise(function(r,o){n.onload=n.onerror=function(i){n.onload=n.onerror=null,i.type==="load"?r(n.result):o(new Error("Failed to read the blob/file"))}})},t=function(){const n=new Uint8Array([1,2,3,4]),o=new File([n],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class n extends Blob{constructor(o,i,s){super(o);let a;s?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=n}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const r=new FileReader;return r.readAsArrayBuffer(this),e(r)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const r=new FileReader;return r.readAsText(this),e(r)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let n=0;const r=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const i=o.byobRequest.view,a=await r.slice(n,n+i.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(i.buffer).set(u);const f=u.byteLength;o.byobRequest.respond(f),n+=f,n>=r.size&&o.close()}})})}if(Gr==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Js="playground-log",Ks=(e,...t)=>{ge.dispatchEvent(new CustomEvent(Js,{detail:{log:e,args:t}}))},Zs=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Jt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Jt(e.message.message)),e.severity){case fe.Debug:console.debug(e.message,...t);break;case fe.Info:console.info(e.message,...t);break;case fe.Warn:console.warn(e.message,...t);break;case fe.Error:console.error(e.message,...t);break;case fe.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},eo=e=>e instanceof Error?[e.message,e.stack].join(`
41
- `):JSON.stringify(e,null,2),Hr=[],Cn=e=>{Hr.push(e)},Yr=e=>{if(e.raw===!0)Cn(e.message);else{const t=ro(typeof e.message=="object"?eo(e.message):e.message,e.severity,e.prefix??Me.JS);Cn(t)}},fe={Fatal:{},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},Me={JS:"JavaScript"};class to extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=fe.Info,this.handlers=t}getLogs(){return this.handlers.includes(Yr)?[...Hr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
44
+ `)}`)}return r}const Hr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Hr==="NODE"){let e=function(n){return new Promise(function(r,o){n.onload=n.onerror=function(i){n.onload=n.onerror=null,i.type==="load"?r(n.result):o(new Error("Failed to read the blob/file"))}})},t=function(){const n=new Uint8Array([1,2,3,4]),o=new File([n],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class n extends Blob{constructor(o,i,s){super(o);let a;s?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=n}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const r=new FileReader;return r.readAsArrayBuffer(this),e(r)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const r=new FileReader;return r.readAsText(this),e(r)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let n=0;const r=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const i=o.byobRequest.view,a=await r.slice(n,n+i.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(i.buffer).set(u);const p=u.byteLength;o.byobRequest.respond(p),n+=p,n>=r.size&&o.close()}})})}if(Hr==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Zs="playground-log",eo=(e,...t)=>{ge.dispatchEvent(new CustomEvent(Zs,{detail:{log:e,args:t}}))},to=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Zt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Zt(e.message.message)),e.severity){case fe.Debug:console.debug(e.message,...t);break;case fe.Info:console.info(e.message,...t);break;case fe.Warn:console.warn(e.message,...t);break;case fe.Error:console.error(e.message,...t);break;case fe.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},no=e=>e instanceof Error?[e.message,e.stack].join(`
45
+ `):JSON.stringify(e,null,2),Yr=[],kn=e=>{Yr.push(e)},zr=e=>{if(e.raw===!0)kn(e.message);else{const t=so(typeof e.message=="object"?no(e.message):e.message,e.severity,e.prefix??Me.JS);kn(t)}},fe={Fatal:{},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},Me={JS:"JavaScript"};class ro extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=fe.Info,this.handlers=t}getLogs(){return this.handlers.includes(zr)?[...Yr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
42
46
  If you're using a custom logger instance, make sure to register logToMemory handler.
43
- `),[])}logMessage(t,...n){const r={...t,severity:t.severity??fe.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(t){this.severity=t}log(t,...n){this.logMessage({message:t,severity:fe.Log,prefix:Me.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:fe.Debug,prefix:Me.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:fe.Info,prefix:Me.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:fe.Warn,prefix:Me.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:fe.Error,prefix:Me.JS,raw:!1},...n)}}const no=()=>{try{}catch{}return[Yr,Zs,Ks]},ge=new to(no()),Jt=e=>e.replace(/\t/g,""),ro=(e,t,n)=>{const r=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(r).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(r),s=o+" "+i;return e=Jt(e),`[${s}] ${n} ${t.name}: ${e}`};var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},rn={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,Fn=Ce&&typeof Ce.apply=="function"?Ce.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Ve;Ce&&typeof Ce.ownKeys=="function"?Ve=Ce.ownKeys:Object.getOwnPropertySymbols?Ve=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ve=function(t){return Object.getOwnPropertyNames(t)};function io(e){console&&console.warn&&console.warn(e)}var zr=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}rn.exports=Q;rn.exports.once=uo;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var jn=10;function Qe(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Q,"defaultMaxListeners",{enumerable:!0,get:function(){return jn},set:function(e){if(typeof e!="number"||e<0||zr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");jn=e}});Q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Q.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||zr(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Qr(e){return e._maxListeners===void 0?Q.defaultMaxListeners:e._maxListeners}Q.prototype.getMaxListeners=function(){return Qr(this)};Q.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")Fn(u,this,n);else for(var f=u.length,c=ti(u,f),r=0;r<f;++r)Fn(c[r],this,n);return!0};function Jr(e,t,n,r){var o,i,s;if(Qe(n),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),s===void 0)s=i[t]=n,++e._eventsCount;else if(typeof s=="function"?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=Qr(e),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,io(a)}return e}Q.prototype.addListener=function(t,n){return Jr(this,t,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(t,n){return Jr(this,t,n,!0)};function so(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Kr(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=so.bind(r);return o.listener=n,r.wrapFn=o,o}Q.prototype.once=function(t,n){return Qe(n),this.on(t,Kr(this,t,n)),this};Q.prototype.prependOnceListener=function(t,n){return Qe(n),this.prependListener(t,Kr(this,t,n)),this};Q.prototype.removeListener=function(t,n){var r,o,i,s,a;if(Qe(n),o=this._events,o===void 0)return this;if(r=o[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():oo(r,i),r.length===1&&(o[t]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners=function(t){var n,r,o;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var i=Object.keys(r),s;for(o=0;o<i.length;++o)s=i[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this};function Zr(e,t,n){var r=e._events;if(r===void 0)return[];var o=r[t];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?ao(o):ti(o,o.length)}Q.prototype.listeners=function(t){return Zr(this,t,!0)};Q.prototype.rawListeners=function(t){return Zr(this,t,!1)};Q.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ei.call(e,t)};Q.prototype.listenerCount=ei;function ei(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Q.prototype.eventNames=function(){return this._eventsCount>0?Ve(this._events):[]};function ti(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function oo(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function ao(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function uo(e,t){return new Promise(function(n,r){function o(s){e.removeListener(t,i),r(s)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),n([].slice.call(arguments))}ni(e,t,i,{once:!0}),t!=="error"&&co(e,o,{once:!0})})}function co(e,t,n){typeof e.on=="function"&&ni(e,"error",t,n)}function ni(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var sn=rn.exports;class lo extends sn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Ai({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{ge.debug("\x1B[1;32m[CDP][received]\x1B[0m",r.toString());let o;try{o=JSON.parse(r.toString())}catch{return}this.connected?this.emit("message",o):this.buffer.push(o)}),n.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.on("newListener",n=>{n==="message"&&process.nextTick(()=>{for(const r of this.buffer)this.emit("message",r);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(t);ge.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class fo extends sn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=Pi.createServer(),this.server.on("connection",n=>{if(this.socket){n.destroy();return}this.socket=n,n.setEncoding("utf8"),this.emit("connected"),n.on("data",r=>this.onData(r.toString())),n.on("close",()=>{this.socket=null,this.emit("disconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.server.listen(t)}onData(t){for(ge.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const n=this.buffer.indexOf("\0");if(n===-1)break;const r=this.buffer.substring(0,n),o=parseInt(r,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,this.buffer=this.buffer.slice(n+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const n=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const r=n.trim();this.expectedLength=null,this.emit("message",r);continue}break}}sendCommand(t){this.socket&&(ge.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
47
+ `),[])}logMessage(t,...n){const r={...t,severity:t.severity??fe.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(t){this.severity=t}log(t,...n){this.logMessage({message:t,severity:fe.Log,prefix:Me.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:fe.Debug,prefix:Me.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:fe.Info,prefix:Me.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:fe.Warn,prefix:Me.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:fe.Error,prefix:Me.JS,raw:!1},...n)}}const io=()=>{try{}catch{}return[zr,to,eo]},ge=new ro(io()),Zt=e=>e.replace(/\t/g,""),so=(e,t,n)=>{const r=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(r).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(r),s=o+" "+i;return e=Zt(e),`[${s}] ${n} ${t.name}: ${e}`};var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},on={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,Rn=Ce&&typeof Ce.apply=="function"?Ce.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Ve;Ce&&typeof Ce.ownKeys=="function"?Ve=Ce.ownKeys:Object.getOwnPropertySymbols?Ve=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ve=function(t){return Object.getOwnPropertyNames(t)};function oo(e){console&&console.warn&&console.warn(e)}var Qr=Number.isNaN||function(t){return t!==t};function J(){J.init.call(this)}on.exports=J;on.exports.once=lo;J.EventEmitter=J;J.prototype._events=void 0;J.prototype._eventsCount=0;J.prototype._maxListeners=void 0;var Bn=10;function Ke(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return Bn},set:function(e){if(typeof e!="number"||e<0||Qr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Bn=e}});J.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};J.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Qr(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Jr(e){return e._maxListeners===void 0?J.defaultMaxListeners:e._maxListeners}J.prototype.getMaxListeners=function(){return Jr(this)};J.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")Rn(u,this,n);else for(var p=u.length,c=ni(u,p),r=0;r<p;++r)Rn(c[r],this,n);return!0};function Kr(e,t,n,r){var o,i,s;if(Ke(n),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),s===void 0)s=i[t]=n,++e._eventsCount;else if(typeof s=="function"?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=Jr(e),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,oo(a)}return e}J.prototype.addListener=function(t,n){return Kr(this,t,n,!1)};J.prototype.on=J.prototype.addListener;J.prototype.prependListener=function(t,n){return Kr(this,t,n,!0)};function ao(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Zr(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=ao.bind(r);return o.listener=n,r.wrapFn=o,o}J.prototype.once=function(t,n){return Ke(n),this.on(t,Zr(this,t,n)),this};J.prototype.prependOnceListener=function(t,n){return Ke(n),this.prependListener(t,Zr(this,t,n)),this};J.prototype.removeListener=function(t,n){var r,o,i,s,a;if(Ke(n),o=this._events,o===void 0)return this;if(r=o[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():uo(r,i),r.length===1&&(o[t]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};J.prototype.off=J.prototype.removeListener;J.prototype.removeAllListeners=function(t){var n,r,o;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var i=Object.keys(r),s;for(o=0;o<i.length;++o)s=i[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this};function ei(e,t,n){var r=e._events;if(r===void 0)return[];var o=r[t];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?co(o):ni(o,o.length)}J.prototype.listeners=function(t){return ei(this,t,!0)};J.prototype.rawListeners=function(t){return ei(this,t,!1)};J.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ti.call(e,t)};J.prototype.listenerCount=ti;function ti(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Ve(this._events):[]};function ni(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function uo(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function co(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function lo(e,t){return new Promise(function(n,r){function o(s){e.removeListener(t,i),r(s)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),n([].slice.call(arguments))}ri(e,t,i,{once:!0}),t!=="error"&&fo(e,o,{once:!0})})}function fo(e,t,n){typeof e.on=="function"&&ri(e,"error",t,n)}function ri(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var an=on.exports;class po extends an.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Ai({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{ge.debug("\x1B[1;32m[CDP][received]\x1B[0m",r.toString());let o;try{o=JSON.parse(r.toString())}catch{return}this.connected?this.emit("message",o):this.buffer.push(o)}),n.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.on("newListener",n=>{n==="message"&&process.nextTick(()=>{for(const r of this.buffer)this.emit("message",r);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(t);ge.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class ho extends an.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=Li.createServer(),this.server.on("connection",n=>{if(this.socket){n.destroy();return}this.socket=n,n.setEncoding("utf8"),this.emit("connected"),n.on("data",r=>this.onData(r.toString())),n.on("close",()=>{this.socket=null,this.emit("disconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.server.listen(t)}onData(t){for(ge.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const n=this.buffer.indexOf("\0");if(n===-1)break;const r=this.buffer.substring(0,n),o=parseInt(r,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,this.buffer=this.buffer.slice(n+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const n=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const r=n.trim();this.expectedLength=null,this.emit("message",r);continue}break}}sendCommand(t){this.socket&&(ge.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
44
48
  * @license
45
49
  * Copyright (c) 2016, Contributors
46
50
  * SPDX-License-Identifier: ISC
47
- */function Ue(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",r=!1;const o=e.match(/^-+/);for(let i=o?o[0].length:0;i<e.length;i++){let s=e.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function ho(e,t){const n=e.toLowerCase();t=t||"-";let r="";for(let o=0;o<e.length;o++){const i=n.charAt(o),s=e.charAt(o);i!==s&&o>0?r+=`${t}${n.charAt(o)}`:r+=s}return r}function po(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
51
+ */function Ue(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",r=!1;const o=e.match(/^-+/);for(let i=o?o[0].length:0;i<e.length;i++){let s=e.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function go(e,t){const n=e.toLowerCase();t=t||"-";let r="";for(let o=0;o<e.length;o++){const i=n.charAt(o),s=e.charAt(o);i!==s&&o>0?r+=`${t}${n.charAt(o)}`:r+=s}return r}function mo(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
48
52
  * @license
49
53
  * Copyright (c) 2016, Contributors
50
54
  * SPDX-License-Identifier: ISC
51
- */function go(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,r=null,o=null;const i=[];for(let s=0;s<e.length;s++){if(n=r,r=e.charAt(s),r===" "&&!o){n!==" "&&t++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[t]||(i[t]=""),i[t]+=r}return i}/**
55
+ */function yo(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,r=null,o=null;const i=[];for(let s=0;s<e.length;s++){if(n=r,r=e.charAt(s),r===" "&&!o){n!==" "&&t++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[t]||(i[t]=""),i[t]+=r}return i}/**
52
56
  * @license
53
57
  * Copyright (c) 2016, Contributors
54
58
  * SPDX-License-Identifier: ISC
@@ -56,25 +60,25 @@ import{LatestSupportedPHPVersion as hi,SupportedPHPVersionsList as pi,PHP as di,
56
60
  * @license
57
61
  * Copyright (c) 2016, Contributors
58
62
  * SPDX-License-Identifier: ISC
59
- */let ye;class mo{constructor(t){ye=t}parse(t,n){const r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},n),o=go(t),i=typeof t=="string",s=yo(Object.assign(Object.create(null),r.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),u=Object.assign(Object.create(null),r.default),f=r.configObjects||[],c=r.envPrefix,g=a["populate--"],p=g?"--":"_",b=Object.create(null),N=Object.create(null),I=r.__||ye.format,y={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,E=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(T){const A=typeof T=="object"?T.key:T,j=Object.keys(T).map(function(D){return{boolean:"bools",string:"strings",number:"numbers"}[D]}).filter(Boolean).pop();j&&(y[j][A]=!0),y.arrays[A]=!0,y.keys.push(A)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(T){y.bools[T]=!0,y.keys.push(T)}),[].concat(r.string||[]).filter(Boolean).forEach(function(T){y.strings[T]=!0,y.keys.push(T)}),[].concat(r.number||[]).filter(Boolean).forEach(function(T){y.numbers[T]=!0,y.keys.push(T)}),[].concat(r.count||[]).filter(Boolean).forEach(function(T){y.counts[T]=!0,y.keys.push(T)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(T){y.normalize[T]=!0,y.keys.push(T)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([T,A])=>{typeof A=="number"&&(y.nargs[T]=A,y.keys.push(T))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([T,A])=>{typeof A=="function"&&(y.coercions[T]=A,y.keys.push(T))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(T){y.configs[T]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([T,A])=>{(typeof A=="boolean"||typeof A=="function")&&(y.configs[T]=A)})),et(r.key,s,r.default,y.arrays),Object.keys(u).forEach(function(T){(y.aliases[T]||[]).forEach(function(A){u[A]=u[T]})});let h=null;ne();let w=[];const O=Object.assign(Object.create(null),{_:[]}),L={};for(let T=0;T<o.length;T++){const A=o[T],j=A.replace(/^-{3,}/,"---");let D,x,X,R,$,te;if(A!=="--"&&/^-/.test(A)&&d(A))P(A);else if(j.match(/^---+(=|$)/)){P(A);continue}else if(A.match(/^--.+=/)||!a["short-option-groups"]&&A.match(/^-.+=/))R=A.match(/^--?([^=]+)=([\s\S]*)$/),R!==null&&Array.isArray(R)&&R.length>=3&&(V(R[1],y.arrays)?T=l(T,R[1],o,R[2]):V(R[1],y.nargs)!==!1?T=C(T,R[1],o,R[2]):_(R[1],R[2],!0));else if(A.match(E)&&a["boolean-negation"])R=A.match(E),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],_(x,V(x,y.arrays)?[!1]:!1));else if(A.match(/^--.+/)||!a["short-option-groups"]&&A.match(/^-[^-]+/))R=A.match(/^--?(.+)/),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],V(x,y.arrays)?T=l(T,x,o):V(x,y.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!$.match(/^-/)||$.match(S))&&!V(x,y.bools)&&!V(x,y.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,v(x))));else if(A.match(/^-.\..+=/))R=A.match(/^-([^=]+)=([\s\S]*)$/),R!==null&&Array.isArray(R)&&R.length>=3&&_(R[1],R[2]);else if(A.match(/^-.\..+/)&&!A.match(S))$=o[T+1],R=A.match(/^-(.\..+)/),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],$!==void 0&&!$.match(/^-/)&&!V(x,y.bools)&&!V(x,y.counts)?(_(x,$),T++):_(x,v(x)));else if(A.match(/^-[^-]+/)&&!A.match(S)){X=A.slice(1,-1).split(""),D=!1;for(let re=0;re<X.length;re++){if($=A.slice(re+2),X[re+1]&&X[re+1]==="="){te=A.slice(re+3),x=X[re],V(x,y.arrays)?T=l(T,x,o,te):V(x,y.nargs)!==!1?T=C(T,x,o,te):_(x,te),D=!0;break}if($==="-"){_(X[re],$);continue}if(/[A-Za-z]/.test(X[re])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&V($,y.bools)===!1){_(X[re],$),D=!0;break}if(X[re+1]&&X[re+1].match(/\W/)){_(X[re],$),D=!0;break}else _(X[re],v(X[re]))}x=A.slice(-1)[0],!D&&x!=="-"&&(V(x,y.arrays)?T=l(T,x,o):V(x,y.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(S))&&!V(x,y.bools)&&!V(x,y.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,v(x))))}else if(A.match(/^-[0-9]$/)&&A.match(S)&&V(A.slice(1),y.bools))x=A.slice(1),_(x,v(x));else if(A==="--"){w=o.slice(T+1);break}else if(a["halt-at-non-option"]){w=o.slice(T);break}else P(A)}W(O,!0),W(O,!1),B(O),H(),Ae(O,y.aliases,u,!0),Ze(O),a["set-placeholder-key"]&&je(O),Object.keys(y.counts).forEach(function(T){ue(O,T.split("."))||_(T,0)}),g&&w.length&&(O[p]=[]),w.forEach(function(T){O[p].push(T)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(O).filter(T=>T!=="--"&&T.includes("-")).forEach(T=>{delete O[T]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(T=>s[T])).forEach(T=>{a["camel-case-expansion"]&&T.includes("-")&&delete O[T.split(".").map(A=>Ue(A)).join(".")],delete O[T]});function P(T){const A=q("_",T);(typeof A=="string"||typeof A=="number")&&O._.push(A)}function C(T,A,j,D){let x,X=V(A,y.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return z(D)||(h=Error(I("Argument unexpected for: %s",A))),_(A,v(A)),T;let R=z(D)?0:1;if(a["nargs-eats-options"])j.length-(T+1)+R<X&&(h=Error(I("Not enough arguments following: %s",A))),R=X;else{for(x=T+1;x<j.length&&(!j[x].match(/^-[^0-9]/)||j[x].match(S)||d(j[x]));x++)R++;R<X&&(h=Error(I("Not enough arguments following: %s",A)))}let $=Math.min(R,X);for(!z(D)&&$>0&&(_(A,D),$--),x=T+1;x<$+T+1;x++)_(A,j[x]);return T+$}function l(T,A,j,D){let x=[],X=D||j[T+1];const R=V(A,y.nargs);if(V(A,y.bools)&&!/^(true|false)$/.test(X))x.push(!0);else if(z(X)||z(D)&&/^-/.test(X)&&!S.test(X)&&!d(X)){if(u[A]!==void 0){const $=u[A];x=Array.isArray($)?$:[$]}}else{z(D)||x.push(k(A,D,!0));for(let $=T+1;$<j.length&&!(!a["greedy-arrays"]&&x.length>0||R&&typeof R=="number"&&x.length>=R||(X=j[$],/^-/.test(X)&&!S.test(X)&&!d(X)));$++)T=$,x.push(k(A,X,i))}return typeof R=="number"&&(R&&x.length<R||isNaN(R)&&x.length===0)&&(h=Error(I("Not enough arguments following: %s",A))),_(A,x),T}function _(T,A,j=i){if(/-/.test(T)&&a["camel-case-expansion"]){const X=T.split(".").map(function(R){return Ue(R)}).join(".");F(T,X)}const D=k(T,A,j),x=T.split(".");me(O,x,D),y.aliases[T]&&y.aliases[T].forEach(function(X){const R=X.split(".");me(O,R,D)}),x.length>1&&a["dot-notation"]&&(y.aliases[x[0]]||[]).forEach(function(X){let R=X.split(".");const $=[].concat(x);$.shift(),R=R.concat($),(y.aliases[T]||[]).includes(R.join("."))||me(O,R,D)}),V(T,y.normalize)&&!V(T,y.arrays)&&[T].concat(y.aliases[T]||[]).forEach(function(R){Object.defineProperty(L,R,{enumerable:!0,get(){return A},set($){A=typeof $=="string"?ye.normalize($):$}})})}function F(T,A){y.aliases[T]&&y.aliases[T].length||(y.aliases[T]=[A],b[A]=!0),y.aliases[A]&&y.aliases[A].length||F(A,T)}function k(T,A,j){j&&(A=bo(A)),(V(T,y.bools)||V(T,y.counts))&&typeof A=="string"&&(A=A==="true");let D=Array.isArray(A)?A.map(function(x){return q(T,x)}):q(T,A);return V(T,y.counts)&&(z(D)||typeof D=="boolean")&&(D=st()),V(T,y.normalize)&&V(T,y.arrays)&&(Array.isArray(A)?D=A.map(x=>ye.normalize(x)):D=ye.normalize(A)),D}function q(T,A){return!a["parse-positional-numbers"]&&T==="_"||!V(T,y.strings)&&!V(T,y.bools)&&!Array.isArray(A)&&(po(A)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${A}`)))||!z(A)&&V(T,y.numbers))&&(A=Number(A)),A}function B(T){const A=Object.create(null);Ae(A,y.aliases,u),Object.keys(y.configs).forEach(function(j){const D=T[j]||A[j];if(D)try{let x=null;const X=ye.resolve(ye.cwd(),D),R=y.configs[j];if(typeof R=="function"){try{x=R(X)}catch($){x=$}if(x instanceof Error){h=x;return}}else x=ye.require(X);U(x)}catch(x){x.name==="PermissionDenied"?h=x:T[j]&&(h=Error(I("Invalid JSON config file: %s",D)))}})}function U(T,A){Object.keys(T).forEach(function(j){const D=T[j],x=A?A+"."+j:j;typeof D=="object"&&D!==null&&!Array.isArray(D)&&a["dot-notation"]?U(D,x):(!ue(O,x.split("."))||V(x,y.arrays)&&a["combine-arrays"])&&_(x,D)})}function H(){typeof f<"u"&&f.forEach(function(T){U(T)})}function W(T,A){if(typeof c>"u")return;const j=typeof c=="string"?c:"",D=ye.env();Object.keys(D).forEach(function(x){if(j===""||x.lastIndexOf(j,0)===0){const X=x.split("__").map(function(R,$){return $===0&&(R=R.substring(j.length)),Ue(R)});(A&&y.configs[X.join(".")]||!A)&&!ue(T,X)&&_(X.join("."),D[x])}})}function Ze(T){let A;const j=new Set;Object.keys(T).forEach(function(D){if(!j.has(D)&&(A=V(D,y.coercions),typeof A=="function"))try{const x=q(D,A(T[D]));[].concat(y.aliases[D]||[],D).forEach(X=>{j.add(X),T[X]=x})}catch(x){h=x}})}function je(T){return y.keys.forEach(A=>{~A.indexOf(".")||typeof T[A]>"u"&&(T[A]=void 0)}),T}function Ae(T,A,j,D=!1){Object.keys(j).forEach(function(x){ue(T,x.split("."))||(me(T,x.split("."),j[x]),D&&(N[x]=!0),(A[x]||[]).forEach(function(X){ue(T,X.split("."))||me(T,X.split("."),j[x])}))})}function ue(T,A){let j=T;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(x){j=j[x]||{}});const D=A[A.length-1];return typeof j!="object"?!1:D in j}function me(T,A,j){let D=T;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(te){te=kn(te),typeof D=="object"&&D[te]===void 0&&(D[te]={}),typeof D[te]!="object"||Array.isArray(D[te])?(Array.isArray(D[te])?D[te].push({}):D[te]=[D[te],{}],D=D[te][D[te].length-1]):D=D[te]});const x=kn(A[A.length-1]),X=V(A.join("."),y.arrays),R=Array.isArray(j);let $=a["duplicate-arguments-array"];!$&&V(x,y.nargs)&&($=!0,(!z(D[x])&&y.nargs[x]===1||Array.isArray(D[x])&&D[x].length===y.nargs[x])&&(D[x]=void 0)),j===st()?D[x]=st(D[x]):Array.isArray(D[x])?$&&X&&R?D[x]=a["flatten-duplicate-arrays"]?D[x].concat(j):(Array.isArray(D[x][0])?D[x]:[D[x]]).concat([j]):!$&&!!X==!!R?D[x]=j:D[x]=D[x].concat([j]):D[x]===void 0&&X?D[x]=R?j:[j]:$&&!(D[x]===void 0||V(x,y.counts)||V(x,y.bools))?D[x]=[D[x],j]:D[x]=j}function et(...T){T.forEach(function(A){Object.keys(A||{}).forEach(function(j){y.aliases[j]||(y.aliases[j]=[].concat(s[j]||[]),y.aliases[j].concat(j).forEach(function(D){if(/-/.test(D)&&a["camel-case-expansion"]){const x=Ue(D);x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].concat(j).forEach(function(D){if(D.length>1&&/[A-Z]/.test(D)&&a["camel-case-expansion"]){const x=ho(D,"-");x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].forEach(function(D){y.aliases[D]=[j].concat(y.aliases[j].filter(function(x){return D!==x}))}))})})}function V(T,A){const j=[].concat(y.aliases[T]||[],T),D=Object.keys(A),x=j.find(X=>D.includes(X));return x?A[x]:!1}function Pe(T){const A=Object.keys(y);return[].concat(A.map(D=>y[D])).some(function(D){return Array.isArray(D)?D.includes(T):D[T]})}function tt(T,...A){return[].concat(...A).some(function(D){const x=T.match(D);return x&&Pe(x[1])})}function m(T){if(T.match(S)||!T.match(/^-[^-]+/))return!1;let A=!0,j;const D=T.slice(1).split("");for(let x=0;x<D.length;x++){if(j=T.slice(x+2),!Pe(D[x])){A=!1;break}if(D[x+1]&&D[x+1]==="="||j==="-"||/[A-Za-z]/.test(D[x])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||D[x+1]&&D[x+1].match(/\W/))break}return A}function d(T){return a["unknown-options-as-args"]&&M(T)}function M(T){return T=T.replace(/^-{3,}/,"--"),T.match(S)||m(T)?!1:!tt(T,/^-+([^=]+?)=[\s\S]*$/,E,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function v(T){return!V(T,y.bools)&&!V(T,y.counts)&&`${T}`in u?u[T]:Y(J(T))}function Y(T){return{[de.BOOLEAN]:!0,[de.STRING]:"",[de.NUMBER]:void 0,[de.ARRAY]:[]}[T]}function J(T){let A=de.BOOLEAN;return V(T,y.strings)?A=de.STRING:V(T,y.numbers)?A=de.NUMBER:V(T,y.bools)?A=de.BOOLEAN:V(T,y.arrays)&&(A=de.ARRAY),A}function z(T){return T===void 0}function ne(){Object.keys(y.counts).find(T=>V(T,y.arrays)?(h=Error(I("Invalid configuration: %s, opts.count excludes opts.array.",T)),!0):V(T,y.nargs)?(h=Error(I("Invalid configuration: %s, opts.count excludes opts.narg.",T)),!0):!1)}return{aliases:Object.assign({},y.aliases),argv:Object.assign(L,O),configuration:a,defaulted:Object.assign({},N),error:h,newAliases:Object.assign({},b)}}}function yo(e){const t=[],n=Object.create(null);let r=!0;for(Object.keys(e).forEach(function(o){t.push([].concat(e[o],o))});r;){r=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),r=!0;break}}return t.forEach(function(o){o=o.filter(function(s,a,u){return u.indexOf(s)===a});const i=o.pop();i!==void 0&&typeof i=="string"&&(n[i]=o)}),n}function st(e){return e!==void 0?e+1:1}function kn(e){return e==="__proto__"?"___proto___":e}function bo(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
63
+ */let be;class bo{constructor(t){be=t}parse(t,n){const r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},n),o=yo(t),i=typeof t=="string",s=wo(Object.assign(Object.create(null),r.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),u=Object.assign(Object.create(null),r.default),p=r.configObjects||[],c=r.envPrefix,d=a["populate--"],f=d?"--":"_",y=Object.create(null),w=Object.create(null),v=r.__||be.format,b={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,N=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(T){const P=typeof T=="object"?T.key:T,j=Object.keys(T).map(function(D){return{boolean:"bools",string:"strings",number:"numbers"}[D]}).filter(Boolean).pop();j&&(b[j][P]=!0),b.arrays[P]=!0,b.keys.push(P)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(T){b.bools[T]=!0,b.keys.push(T)}),[].concat(r.string||[]).filter(Boolean).forEach(function(T){b.strings[T]=!0,b.keys.push(T)}),[].concat(r.number||[]).filter(Boolean).forEach(function(T){b.numbers[T]=!0,b.keys.push(T)}),[].concat(r.count||[]).filter(Boolean).forEach(function(T){b.counts[T]=!0,b.keys.push(T)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(T){b.normalize[T]=!0,b.keys.push(T)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([T,P])=>{typeof P=="number"&&(b.nargs[T]=P,b.keys.push(T))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([T,P])=>{typeof P=="function"&&(b.coercions[T]=P,b.keys.push(T))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(T){b.configs[T]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([T,P])=>{(typeof P=="boolean"||typeof P=="function")&&(b.configs[T]=P)})),nt(r.key,s,r.default,b.arrays),Object.keys(u).forEach(function(T){(b.aliases[T]||[]).forEach(function(P){u[P]=u[T]})});let h=null;re();let E=[];const I=Object.assign(Object.create(null),{_:[]}),L={};for(let T=0;T<o.length;T++){const P=o[T],j=P.replace(/^-{3,}/,"---");let D,x,X,R,$,te;if(P!=="--"&&/^-/.test(P)&&g(P))A(P);else if(j.match(/^---+(=|$)/)){A(P);continue}else if(P.match(/^--.+=/)||!a["short-option-groups"]&&P.match(/^-.+=/))R=P.match(/^--?([^=]+)=([\s\S]*)$/),R!==null&&Array.isArray(R)&&R.length>=3&&(V(R[1],b.arrays)?T=l(T,R[1],o,R[2]):V(R[1],b.nargs)!==!1?T=C(T,R[1],o,R[2]):_(R[1],R[2],!0));else if(P.match(N)&&a["boolean-negation"])R=P.match(N),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],_(x,V(x,b.arrays)?[!1]:!1));else if(P.match(/^--.+/)||!a["short-option-groups"]&&P.match(/^-[^-]+/))R=P.match(/^--?(.+)/),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],V(x,b.arrays)?T=l(T,x,o):V(x,b.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!$.match(/^-/)||$.match(S))&&!V(x,b.bools)&&!V(x,b.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,O(x))));else if(P.match(/^-.\..+=/))R=P.match(/^-([^=]+)=([\s\S]*)$/),R!==null&&Array.isArray(R)&&R.length>=3&&_(R[1],R[2]);else if(P.match(/^-.\..+/)&&!P.match(S))$=o[T+1],R=P.match(/^-(.\..+)/),R!==null&&Array.isArray(R)&&R.length>=2&&(x=R[1],$!==void 0&&!$.match(/^-/)&&!V(x,b.bools)&&!V(x,b.counts)?(_(x,$),T++):_(x,O(x)));else if(P.match(/^-[^-]+/)&&!P.match(S)){X=P.slice(1,-1).split(""),D=!1;for(let ie=0;ie<X.length;ie++){if($=P.slice(ie+2),X[ie+1]&&X[ie+1]==="="){te=P.slice(ie+3),x=X[ie],V(x,b.arrays)?T=l(T,x,o,te):V(x,b.nargs)!==!1?T=C(T,x,o,te):_(x,te),D=!0;break}if($==="-"){_(X[ie],$);continue}if(/[A-Za-z]/.test(X[ie])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&V($,b.bools)===!1){_(X[ie],$),D=!0;break}if(X[ie+1]&&X[ie+1].match(/\W/)){_(X[ie],$),D=!0;break}else _(X[ie],O(X[ie]))}x=P.slice(-1)[0],!D&&x!=="-"&&(V(x,b.arrays)?T=l(T,x,o):V(x,b.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(S))&&!V(x,b.bools)&&!V(x,b.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,O(x))))}else if(P.match(/^-[0-9]$/)&&P.match(S)&&V(P.slice(1),b.bools))x=P.slice(1),_(x,O(x));else if(P==="--"){E=o.slice(T+1);break}else if(a["halt-at-non-option"]){E=o.slice(T);break}else A(P)}W(I,!0),W(I,!1),B(I),H(),Pe(I,b.aliases,u,!0),tt(I),a["set-placeholder-key"]&&je(I),Object.keys(b.counts).forEach(function(T){ce(I,T.split("."))||_(T,0)}),d&&E.length&&(I[f]=[]),E.forEach(function(T){I[f].push(T)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(T=>T!=="--"&&T.includes("-")).forEach(T=>{delete I[T]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(T=>s[T])).forEach(T=>{a["camel-case-expansion"]&&T.includes("-")&&delete I[T.split(".").map(P=>Ue(P)).join(".")],delete I[T]});function A(T){const P=q("_",T);(typeof P=="string"||typeof P=="number")&&I._.push(P)}function C(T,P,j,D){let x,X=V(P,b.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return Q(D)||(h=Error(v("Argument unexpected for: %s",P))),_(P,O(P)),T;let R=Q(D)?0:1;if(a["nargs-eats-options"])j.length-(T+1)+R<X&&(h=Error(v("Not enough arguments following: %s",P))),R=X;else{for(x=T+1;x<j.length&&(!j[x].match(/^-[^0-9]/)||j[x].match(S)||g(j[x]));x++)R++;R<X&&(h=Error(v("Not enough arguments following: %s",P)))}let $=Math.min(R,X);for(!Q(D)&&$>0&&(_(P,D),$--),x=T+1;x<$+T+1;x++)_(P,j[x]);return T+$}function l(T,P,j,D){let x=[],X=D||j[T+1];const R=V(P,b.nargs);if(V(P,b.bools)&&!/^(true|false)$/.test(X))x.push(!0);else if(Q(X)||Q(D)&&/^-/.test(X)&&!S.test(X)&&!g(X)){if(u[P]!==void 0){const $=u[P];x=Array.isArray($)?$:[$]}}else{Q(D)||x.push(k(P,D,!0));for(let $=T+1;$<j.length&&!(!a["greedy-arrays"]&&x.length>0||R&&typeof R=="number"&&x.length>=R||(X=j[$],/^-/.test(X)&&!S.test(X)&&!g(X)));$++)T=$,x.push(k(P,X,i))}return typeof R=="number"&&(R&&x.length<R||isNaN(R)&&x.length===0)&&(h=Error(v("Not enough arguments following: %s",P))),_(P,x),T}function _(T,P,j=i){if(/-/.test(T)&&a["camel-case-expansion"]){const X=T.split(".").map(function(R){return Ue(R)}).join(".");F(T,X)}const D=k(T,P,j),x=T.split(".");ye(I,x,D),b.aliases[T]&&b.aliases[T].forEach(function(X){const R=X.split(".");ye(I,R,D)}),x.length>1&&a["dot-notation"]&&(b.aliases[x[0]]||[]).forEach(function(X){let R=X.split(".");const $=[].concat(x);$.shift(),R=R.concat($),(b.aliases[T]||[]).includes(R.join("."))||ye(I,R,D)}),V(T,b.normalize)&&!V(T,b.arrays)&&[T].concat(b.aliases[T]||[]).forEach(function(R){Object.defineProperty(L,R,{enumerable:!0,get(){return P},set($){P=typeof $=="string"?be.normalize($):$}})})}function F(T,P){b.aliases[T]&&b.aliases[T].length||(b.aliases[T]=[P],y[P]=!0),b.aliases[P]&&b.aliases[P].length||F(P,T)}function k(T,P,j){j&&(P=Eo(P)),(V(T,b.bools)||V(T,b.counts))&&typeof P=="string"&&(P=P==="true");let D=Array.isArray(P)?P.map(function(x){return q(T,x)}):q(T,P);return V(T,b.counts)&&(Q(D)||typeof D=="boolean")&&(D=at()),V(T,b.normalize)&&V(T,b.arrays)&&(Array.isArray(P)?D=P.map(x=>be.normalize(x)):D=be.normalize(P)),D}function q(T,P){return!a["parse-positional-numbers"]&&T==="_"||!V(T,b.strings)&&!V(T,b.bools)&&!Array.isArray(P)&&(mo(P)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${P}`)))||!Q(P)&&V(T,b.numbers))&&(P=Number(P)),P}function B(T){const P=Object.create(null);Pe(P,b.aliases,u),Object.keys(b.configs).forEach(function(j){const D=T[j]||P[j];if(D)try{let x=null;const X=be.resolve(be.cwd(),D),R=b.configs[j];if(typeof R=="function"){try{x=R(X)}catch($){x=$}if(x instanceof Error){h=x;return}}else x=be.require(X);U(x)}catch(x){x.name==="PermissionDenied"?h=x:T[j]&&(h=Error(v("Invalid JSON config file: %s",D)))}})}function U(T,P){Object.keys(T).forEach(function(j){const D=T[j],x=P?P+"."+j:j;typeof D=="object"&&D!==null&&!Array.isArray(D)&&a["dot-notation"]?U(D,x):(!ce(I,x.split("."))||V(x,b.arrays)&&a["combine-arrays"])&&_(x,D)})}function H(){typeof p<"u"&&p.forEach(function(T){U(T)})}function W(T,P){if(typeof c>"u")return;const j=typeof c=="string"?c:"",D=be.env();Object.keys(D).forEach(function(x){if(j===""||x.lastIndexOf(j,0)===0){const X=x.split("__").map(function(R,$){return $===0&&(R=R.substring(j.length)),Ue(R)});(P&&b.configs[X.join(".")]||!P)&&!ce(T,X)&&_(X.join("."),D[x])}})}function tt(T){let P;const j=new Set;Object.keys(T).forEach(function(D){if(!j.has(D)&&(P=V(D,b.coercions),typeof P=="function"))try{const x=q(D,P(T[D]));[].concat(b.aliases[D]||[],D).forEach(X=>{j.add(X),T[X]=x})}catch(x){h=x}})}function je(T){return b.keys.forEach(P=>{~P.indexOf(".")||typeof T[P]>"u"&&(T[P]=void 0)}),T}function Pe(T,P,j,D=!1){Object.keys(j).forEach(function(x){ce(T,x.split("."))||(ye(T,x.split("."),j[x]),D&&(w[x]=!0),(P[x]||[]).forEach(function(X){ce(T,X.split("."))||ye(T,X.split("."),j[x])}))})}function ce(T,P){let j=T;a["dot-notation"]||(P=[P.join(".")]),P.slice(0,-1).forEach(function(x){j=j[x]||{}});const D=P[P.length-1];return typeof j!="object"?!1:D in j}function ye(T,P,j){let D=T;a["dot-notation"]||(P=[P.join(".")]),P.slice(0,-1).forEach(function(te){te=Xn(te),typeof D=="object"&&D[te]===void 0&&(D[te]={}),typeof D[te]!="object"||Array.isArray(D[te])?(Array.isArray(D[te])?D[te].push({}):D[te]=[D[te],{}],D=D[te][D[te].length-1]):D=D[te]});const x=Xn(P[P.length-1]),X=V(P.join("."),b.arrays),R=Array.isArray(j);let $=a["duplicate-arguments-array"];!$&&V(x,b.nargs)&&($=!0,(!Q(D[x])&&b.nargs[x]===1||Array.isArray(D[x])&&D[x].length===b.nargs[x])&&(D[x]=void 0)),j===at()?D[x]=at(D[x]):Array.isArray(D[x])?$&&X&&R?D[x]=a["flatten-duplicate-arrays"]?D[x].concat(j):(Array.isArray(D[x][0])?D[x]:[D[x]]).concat([j]):!$&&!!X==!!R?D[x]=j:D[x]=D[x].concat([j]):D[x]===void 0&&X?D[x]=R?j:[j]:$&&!(D[x]===void 0||V(x,b.counts)||V(x,b.bools))?D[x]=[D[x],j]:D[x]=j}function nt(...T){T.forEach(function(P){Object.keys(P||{}).forEach(function(j){b.aliases[j]||(b.aliases[j]=[].concat(s[j]||[]),b.aliases[j].concat(j).forEach(function(D){if(/-/.test(D)&&a["camel-case-expansion"]){const x=Ue(D);x!==j&&b.aliases[j].indexOf(x)===-1&&(b.aliases[j].push(x),y[x]=!0)}}),b.aliases[j].concat(j).forEach(function(D){if(D.length>1&&/[A-Z]/.test(D)&&a["camel-case-expansion"]){const x=go(D,"-");x!==j&&b.aliases[j].indexOf(x)===-1&&(b.aliases[j].push(x),y[x]=!0)}}),b.aliases[j].forEach(function(D){b.aliases[D]=[j].concat(b.aliases[j].filter(function(x){return D!==x}))}))})})}function V(T,P){const j=[].concat(b.aliases[T]||[],T),D=Object.keys(P),x=j.find(X=>D.includes(X));return x?P[x]:!1}function Ae(T){const P=Object.keys(b);return[].concat(P.map(D=>b[D])).some(function(D){return Array.isArray(D)?D.includes(T):D[T]})}function rt(T,...P){return[].concat(...P).some(function(D){const x=T.match(D);return x&&Ae(x[1])})}function m(T){if(T.match(S)||!T.match(/^-[^-]+/))return!1;let P=!0,j;const D=T.slice(1).split("");for(let x=0;x<D.length;x++){if(j=T.slice(x+2),!Ae(D[x])){P=!1;break}if(D[x+1]&&D[x+1]==="="||j==="-"||/[A-Za-z]/.test(D[x])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||D[x+1]&&D[x+1].match(/\W/))break}return P}function g(T){return a["unknown-options-as-args"]&&M(T)}function M(T){return T=T.replace(/^-{3,}/,"--"),T.match(S)||m(T)?!1:!rt(T,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function O(T){return!V(T,b.bools)&&!V(T,b.counts)&&`${T}`in u?u[T]:Y(K(T))}function Y(T){return{[de.BOOLEAN]:!0,[de.STRING]:"",[de.NUMBER]:void 0,[de.ARRAY]:[]}[T]}function K(T){let P=de.BOOLEAN;return V(T,b.strings)?P=de.STRING:V(T,b.numbers)?P=de.NUMBER:V(T,b.bools)?P=de.BOOLEAN:V(T,b.arrays)&&(P=de.ARRAY),P}function Q(T){return T===void 0}function re(){Object.keys(b.counts).find(T=>V(T,b.arrays)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.array.",T)),!0):V(T,b.nargs)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.narg.",T)),!0):!1)}return{aliases:Object.assign({},b.aliases),argv:Object.assign(L,I),configuration:a,defaulted:Object.assign({},w),error:h,newAliases:Object.assign({},y)}}}function wo(e){const t=[],n=Object.create(null);let r=!0;for(Object.keys(e).forEach(function(o){t.push([].concat(e[o],o))});r;){r=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),r=!0;break}}return t.forEach(function(o){o=o.filter(function(s,a,u){return u.indexOf(s)===a});const i=o.pop();i!==void 0&&typeof i=="string"&&(n[i]=o)}),n}function at(e){return e!==void 0?e+1:1}function Xn(e){return e==="__proto__"?"___proto___":e}function Eo(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
60
64
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
61
65
  * CJS and ESM environments.
62
66
  *
63
67
  * @license
64
68
  * Copyright (c) 2016, Contributors
65
69
  * SPDX-License-Identifier: ISC
66
- */var ot,at,ut;const Rn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Bn=(at=(ot=process==null?void 0:process.versions)===null||ot===void 0?void 0:ot.node)!==null&&at!==void 0?at:(ut=process==null?void 0:process.version)===null||ut===void 0?void 0:ut.slice(1);if(Bn&&Number(Bn.match(/^([^.]+)/)[1])<Rn)throw Error(`yargs parser supports a minimum Node.js version of ${Rn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const wo=process?process.env:{};new mo({cwd:process.cwd,env:()=>wo,format:Ar,normalize:Ii,resolve:en,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Zt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const Eo={fs:{readFileSync:Zt,writeFile:yi},format:Ar,resolve:en,exists:e=>{try{return bi(e).isFile()}catch{return!1}}};let pe;class No{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const n=t.shift();let r=function(){};return typeof t[t.length-1]=="function"&&(r=t.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),pe.format.apply(pe.format,[this.cache[this.locale][n]||n].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),n=t.shift(),r=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?n:r;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[s];return~s.indexOf("%d")&&a.push(o),pe.format.apply(pe.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let r="";return t.forEach(function(o,i){const s=n[i+1];r+=o,typeof s<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,n=this.writeQueue[0],r=n.directory,o=n.locale,i=n.cb,s=this._resolveLocaleFile(r,o),a=JSON.stringify(this.cache[o],null,2);pe.fs.writeFile(s,a,"utf-8",function(u){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(u)})}_readLocaleFile(){let t={};const n=this._resolveLocaleFile(this.directory,this.locale);try{pe.fs.readFileSync&&(t=JSON.parse(pe.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")t={};else throw r}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let r=pe.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=pe.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(t){return pe.exists(t)}}function To(e,t){pe=t;const n=new No(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const Oo=e=>To(e,Eo);let $e;try{$e=Li(import.meta.url)}catch{$e=process.cwd()}const Io=$e.substring(0,$e.lastIndexOf("node_modules"));Io||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,Oo({directory:en($e,"../../../locales"),updateFiles:!1});var ct={},Xn;function on(){return Xn||(Xn=1,function(){ct.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
67
- `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(G)),ct}var lt={},be={},we={},$n;function Ee(){return $n||($n=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var f,c,g,p,b,N;if(N=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(f=0,g=b.length;f<g;f++)if(p=b[f],p!=null)for(c in p)u.call(p,c)&&(N[c]=p[c]);return N},o=function(f){return!!f&&Object.prototype.toString.call(f)==="[object Function]"},i=function(f){var c;return!!f&&((c=typeof f)=="function"||c==="object")},n=function(f){return o(Array.isArray)?Array.isArray(f):Object.prototype.toString.call(f)==="[object Array]"},r=function(f){var c;if(n(f))return!f.length;for(c in f)if(u.call(f,c))return!1;return!0},s=function(f){var c,g;return i(f)&&(g=Object.getPrototypeOf(f))&&(c=g.constructor)&&typeof c=="function"&&c instanceof c&&Function.prototype.toString.call(c)===Function.prototype.toString.call(Object)},t=function(f){return o(f.valueOf)?f.valueOf():f},we.assign=e,we.isFunction=o,we.isObject=i,we.isArray=n,we.isEmpty=r,we.isPlainObject=s,we.getValue=t}.call(G)),we}var ft={exports:{}},Un;function ri(){return Un||(Un=1,function(){ft.exports=function(){function e(){}return e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(G)),ft.exports}var ht={exports:{}},pt={exports:{}},dt={exports:{}},Vn;function vo(){return Vn||(Vn=1,function(){dt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(G)),dt.exports}var gt={exports:{}},qn;function xo(){return qn||(qn=1,function(){gt.exports=function(){function e(t){this.arr=t||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e}()}.call(G)),gt.exports}var Wn;function Ao(){return Wn||(Wn=1,function(){var e,t;e=vo(),t=xo(),pt.exports=function(){function n(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(r){return this.params.hasOwnProperty(r)?this.params[r]:null},n.prototype.canSetParameter=function(r,o){return!0},n.prototype.setParameter=function(r,o){return o!=null?this.params[r]=o:delete this.params[r]},n}()}.call(G)),pt.exports}var mt={exports:{}},yt={exports:{}},bt={exports:{}},Gn;function ee(){return Gn||(Gn=1,function(){bt.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(G)),bt.exports}var wt={exports:{}},Hn;function ii(){return Hn||(Hn=1,function(){var e;e=ee(),he(),wt.exports=function(){function t(n,r,o){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),r==null)throw new Error("Missing attribute name. "+this.debugInfo(r));this.name=this.stringify.name(r),this.value=this.stringify.attValue(o),this.type=e.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},t.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},t}()}.call(G)),wt.exports}var Et={exports:{}},Yn;function an(){return Yn||(Yn=1,function(){Et.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(G)),Et.exports}var zn;function un(){return zn||(zn=1,function(){var e,t,n,r,o,i,s,a,u=function(c,g){for(var p in g)f.call(g,p)&&(c[p]=g[p]);function b(){this.constructor=c}return b.prototype=g.prototype,c.prototype=new b,c.__super__=g.prototype,c},f={}.hasOwnProperty;a=Ee(),s=a.isObject,i=a.isFunction,o=a.getValue,r=he(),e=ee(),t=ii(),n=an(),yt.exports=function(c){u(g,c);function g(p,b,N){var I,y,S,E;if(g.__super__.constructor.call(this,p),b==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(b),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,N!=null&&this.attribute(N),p.type===e.Document&&(this.isRoot=!0,this.documentObject=p,p.rootObject=this,p.children)){for(E=p.children,y=0,S=E.length;y<S;y++)if(I=E[y],I.type===e.DocType){I.name=this.name;break}}}return Object.defineProperty(g.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(g.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(g.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),g.prototype.clone=function(){var p,b,N,I;N=Object.create(this),N.isRoot&&(N.documentObject=null),N.attribs={},I=this.attribs;for(b in I)f.call(I,b)&&(p=I[b],N.attribs[b]=p.clone());return N.children=[],this.children.forEach(function(y){var S;return S=y.clone(),S.parent=N,N.children.push(S)}),N},g.prototype.attribute=function(p,b){var N,I;if(p!=null&&(p=o(p)),s(p))for(N in p)f.call(p,N)&&(I=p[N],this.attribute(N,I));else i(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.attribs[p]=new t(this,p,""):b!=null&&(this.attribs[p]=new t(this,p,b));return this},g.prototype.removeAttribute=function(p){var b,N,I;if(p==null)throw new Error("Missing attribute name. "+this.debugInfo());if(p=o(p),Array.isArray(p))for(N=0,I=p.length;N<I;N++)b=p[N],delete this.attribs[b];else delete this.attribs[p];return this},g.prototype.toString=function(p){return this.options.writer.element(this,this.options.writer.filterOptions(p))},g.prototype.att=function(p,b){return this.attribute(p,b)},g.prototype.a=function(p,b){return this.attribute(p,b)},g.prototype.getAttribute=function(p){return this.attribs.hasOwnProperty(p)?this.attribs[p].value:null},g.prototype.setAttribute=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNode=function(p){return this.attribs.hasOwnProperty(p)?this.attribs[p]:null},g.prototype.setAttributeNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNS=function(p,b,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNodeNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNodeNS=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.hasAttribute=function(p){return this.attribs.hasOwnProperty(p)},g.prototype.hasAttributeNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttribute=function(p,b){return this.attribs.hasOwnProperty(p)?this.attribs[p].isId:b},g.prototype.setIdAttributeNS=function(p,b,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttributeNode=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.isEqualNode=function(p){var b,N,I;if(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)||p.namespaceURI!==this.namespaceURI||p.prefix!==this.prefix||p.localName!==this.localName||p.attribs.length!==this.attribs.length)return!1;for(b=N=0,I=this.attribs.length-1;0<=I?N<=I:N>=I;b=0<=I?++N:--N)if(!this.attribs[b].isEqualNode(p.attribs[b]))return!1;return!0},g}(r)}.call(G)),yt.exports}var Nt={exports:{}},Tt={exports:{}},Qn;function Je(){return Qn||(Qn=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=he(),Tt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,s,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(e)}.call(G)),Tt.exports}var Jn;function cn(){return Jn||(Jn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Je(),Nt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.cdata(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Nt.exports}var Ot={exports:{}},Kn;function ln(){return Kn||(Kn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Je(),Ot.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.comment(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Ot.exports}var It={exports:{}},Zn;function fn(){return Zn||(Zn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ee().isObject,t=he(),e=ee(),It.exports=function(i){r(s,i);function s(a,u,f,c){var g;s.__super__.constructor.call(this,a),n(u)&&(g=u,u=g.version,f=g.encoding,c=g.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),f!=null&&(this.encoding=this.stringify.xmlEncoding(f)),c!=null&&(this.standalone=this.stringify.xmlStandalone(c))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(G)),It.exports}var vt={exports:{}},xt={exports:{}},er;function hn(){return er||(er=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=he(),e=ee(),xt.exports=function(o){n(i,o);function i(s,a,u,f,c,g){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(u==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!f)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!c)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(c.indexOf("#")!==0&&(c="#"+c),!c.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(g&&!c.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(f),g&&(this.defaultValue=this.stringify.dtdAttDefault(g)),this.defaultValueType=c}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),xt.exports}var At={exports:{}},tr;function pn(){return tr||(tr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ee().isObject,t=he(),e=ee(),At.exports=function(i){r(s,i);function s(a,u,f,c){if(s.__super__.constructor.call(this,a),f==null)throw new Error("Missing DTD entity name. "+this.debugInfo(f));if(c==null)throw new Error("Missing DTD entity value. "+this.debugInfo(f));if(this.pe=!!u,this.name=this.stringify.name(f),this.type=e.EntityDeclaration,!n(c))this.value=this.stringify.dtdEntityValue(c),this.internal=!0;else{if(!c.pubID&&!c.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(f));if(c.pubID&&!c.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(f));if(this.internal=!1,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID)),c.nData!=null&&(this.nData=this.stringify.dtdNData(c.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(f))}}return Object.defineProperty(s.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(s.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(s.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(s.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlVersion",{get:function(){return null}}),s.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},s}(t)}.call(G)),At.exports}var Pt={exports:{}},nr;function dn(){return nr||(nr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=he(),e=ee(),Pt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(u)}return i.prototype.toString=function(s){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Pt.exports}var Lt={exports:{}},rr;function gn(){return rr||(rr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=he(),e=ee(),Lt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=e.NotationDeclaration,u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(s){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Lt.exports}var ir;function mn(){return ir||(ir=1,function(){var e,t,n,r,o,i,s,a,u=function(c,g){for(var p in g)f.call(g,p)&&(c[p]=g[p]);function b(){this.constructor=c}return b.prototype=g.prototype,c.prototype=new b,c.__super__=g.prototype,c},f={}.hasOwnProperty;a=Ee().isObject,s=he(),e=ee(),t=hn(),r=pn(),n=dn(),o=gn(),i=an(),vt.exports=function(c){u(g,c);function g(p,b,N){var I,y,S,E,h,w;if(g.__super__.constructor.call(this,p),this.type=e.DocType,p.children){for(E=p.children,y=0,S=E.length;y<S;y++)if(I=E[y],I.type===e.Element){this.name=I.name;break}}this.documentObject=p,a(b)&&(h=b,b=h.pubID,N=h.sysID),N==null&&(w=[b,N],N=w[0],b=w[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),N!=null&&(this.sysID=this.stringify.dtdSysID(N))}return Object.defineProperty(g.prototype,"entities",{get:function(){var p,b,N,I,y;for(I={},y=this.children,b=0,N=y.length;b<N;b++)p=y[b],p.type===e.EntityDeclaration&&!p.pe&&(I[p.name]=p);return new i(I)}}),Object.defineProperty(g.prototype,"notations",{get:function(){var p,b,N,I,y;for(I={},y=this.children,b=0,N=y.length;b<N;b++)p=y[b],p.type===e.NotationDeclaration&&(I[p.name]=p);return new i(I)}}),Object.defineProperty(g.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(g.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(g.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),g.prototype.element=function(p,b){var N;return N=new n(this,p,b),this.children.push(N),this},g.prototype.attList=function(p,b,N,I,y){var S;return S=new t(this,p,b,N,I,y),this.children.push(S),this},g.prototype.entity=function(p,b){var N;return N=new r(this,!1,p,b),this.children.push(N),this},g.prototype.pEntity=function(p,b){var N;return N=new r(this,!0,p,b),this.children.push(N),this},g.prototype.notation=function(p,b){var N;return N=new o(this,p,b),this.children.push(N),this},g.prototype.toString=function(p){return this.options.writer.docType(this,this.options.writer.filterOptions(p))},g.prototype.ele=function(p,b){return this.element(p,b)},g.prototype.att=function(p,b,N,I,y){return this.attList(p,b,N,I,y)},g.prototype.ent=function(p,b){return this.entity(p,b)},g.prototype.pent=function(p,b){return this.pEntity(p,b)},g.prototype.not=function(p,b){return this.notation(p,b)},g.prototype.up=function(){return this.root()||this.documentObject},g.prototype.isEqualNode=function(p){return!(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)||p.name!==this.name||p.publicId!==this.publicId||p.systemId!==this.systemId)},g}(s)}.call(G)),vt.exports}var _t={exports:{}},sr;function yn(){return sr||(sr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=he(),_t.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.raw(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),_t.exports}var St={exports:{}},or;function bn(){return or||(or=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Je(),St.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(a)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var s,a,u;for(u="",a=this.previousSibling;a;)u=a.data+u,a=a.previousSibling;for(u+=this.data,s=this.nextSibling;s;)u=u+s.data,s=s.nextSibling;return u}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.text(this,this.options.writer.filterOptions(s))},i.prototype.splitText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(G)),St.exports}var Dt={exports:{}},ar;function wn(){return ar||(ar=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Je(),Dt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,u&&(this.value=this.stringify.insValue(u))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(s))},i.prototype.isEqualNode=function(s){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(s)||s.target!==this.target)},i}(t)}.call(G)),Dt.exports}var Mt={exports:{}},ur;function si(){return ur||(ur=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=he(),e=ee(),Mt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=e.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(t)}.call(G)),Mt.exports}var Ct={exports:{}},cr;function Po(){return cr||(cr=1,function(){Ct.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e}()}.call(G)),Ct.exports}var Ft={exports:{}},lr;function Lo(){return lr||(lr=1,function(){Ft.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(G)),Ft.exports}var fr;function he(){return fr||(fr=1,function(){var e,t,n,r,o,i,s,a,u,f,c,g,p,b,N,I,y,S={}.hasOwnProperty;y=Ee(),I=y.isObject,N=y.isFunction,b=y.isEmpty,p=y.getValue,a=null,n=null,r=null,o=null,i=null,c=null,g=null,f=null,s=null,t=null,u=null,e=null,mt.exports=function(){function E(h){this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=un(),n=cn(),r=ln(),o=fn(),i=mn(),c=yn(),g=bn(),f=wn(),s=si(),t=ee(),u=Po(),an(),e=Lo())}return Object.defineProperty(E.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(E.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(E.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(E.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(E.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(E.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(E.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(E.prototype,"previousSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h-1]||null}}),Object.defineProperty(E.prototype,"nextSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h+1]||null}}),Object.defineProperty(E.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(E.prototype,"textContent",{get:function(){var h,w,O,L,P;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(P="",L=this.children,w=0,O=L.length;w<O;w++)h=L[w],h.textContent&&(P+=h.textContent);return P}else return null},set:function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),E.prototype.setParent=function(h){var w,O,L,P,C;for(this.parent=h,h&&(this.options=h.options,this.stringify=h.stringify),P=this.children,C=[],O=0,L=P.length;O<L;O++)w=P[O],C.push(w.setParent(this));return C},E.prototype.element=function(h,w,O){var L,P,C,l,_,F,k,q,B,U,H;if(F=null,w===null&&O==null&&(B=[{},null],w=B[0],O=B[1]),w==null&&(w={}),w=p(w),I(w)||(U=[w,O],O=U[0],w=U[1]),h!=null&&(h=p(h)),Array.isArray(h))for(C=0,k=h.length;C<k;C++)P=h[C],F=this.element(P);else if(N(h))F=this.element(h.apply());else if(I(h)){for(_ in h)if(S.call(h,_))if(H=h[_],N(H)&&(H=H.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(_.substr(this.stringify.convertAttKey.length),H);else if(!this.options.separateArrayItems&&Array.isArray(H)&&b(H))F=this.dummy();else if(I(H)&&b(H))F=this.element(_);else if(!this.options.keepNullNodes&&H==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(H))for(l=0,q=H.length;l<q;l++)P=H[l],L={},L[_]=P,F=this.element(L);else I(H)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?F=this.element(H):(F=this.element(_),F.element(H)):F=this.element(_,H)}else!this.options.keepNullNodes&&O===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&h.indexOf(this.stringify.convertTextKey)===0?F=this.text(O):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&h.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(O):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&h.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(O):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&h.indexOf(this.stringify.convertRawKey)===0?F=this.raw(O):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&h.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(h.substr(this.stringify.convertPIKey.length),O):F=this.node(h,w,O);if(F==null)throw new Error("Could not create any elements with: "+h+". "+this.debugInfo());return F},E.prototype.insertBefore=function(h,w,O){var L,P,C,l,_;if(h?.type)return C=h,l=w,C.setParent(this),l?(P=children.indexOf(l),_=children.splice(P),children.push(C),Array.prototype.push.apply(children,_)):children.push(C),C;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return P=this.parent.children.indexOf(this),_=this.parent.children.splice(P),L=this.parent.element(h,w,O),Array.prototype.push.apply(this.parent.children,_),L},E.prototype.insertAfter=function(h,w,O){var L,P,C;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return P=this.parent.children.indexOf(this),C=this.parent.children.splice(P+1),L=this.parent.element(h,w,O),Array.prototype.push.apply(this.parent.children,C),L},E.prototype.remove=function(){var h;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return h=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[h,h-h+1].concat([])),this.parent},E.prototype.node=function(h,w,O){var L,P;return h!=null&&(h=p(h)),w||(w={}),w=p(w),I(w)||(P=[w,O],O=P[0],w=P[1]),L=new a(this,h,w),O!=null&&L.text(O),this.children.push(L),L},E.prototype.text=function(h){var w;return I(h)&&this.element(h),w=new g(this,h),this.children.push(w),this},E.prototype.cdata=function(h){var w;return w=new n(this,h),this.children.push(w),this},E.prototype.comment=function(h){var w;return w=new r(this,h),this.children.push(w),this},E.prototype.commentBefore=function(h){var w,O;return w=this.parent.children.indexOf(this),O=this.parent.children.splice(w),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,O),this},E.prototype.commentAfter=function(h){var w,O;return w=this.parent.children.indexOf(this),O=this.parent.children.splice(w+1),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,O),this},E.prototype.raw=function(h){var w;return w=new c(this,h),this.children.push(w),this},E.prototype.dummy=function(){var h;return h=new s(this),h},E.prototype.instruction=function(h,w){var O,L,P,C,l;if(h!=null&&(h=p(h)),w!=null&&(w=p(w)),Array.isArray(h))for(C=0,l=h.length;C<l;C++)O=h[C],this.instruction(O);else if(I(h))for(O in h)S.call(h,O)&&(L=h[O],this.instruction(O,L));else N(w)&&(w=w.apply()),P=new f(this,h,w),this.children.push(P);return this},E.prototype.instructionBefore=function(h,w){var O,L;return O=this.parent.children.indexOf(this),L=this.parent.children.splice(O),this.parent.instruction(h,w),Array.prototype.push.apply(this.parent.children,L),this},E.prototype.instructionAfter=function(h,w){var O,L;return O=this.parent.children.indexOf(this),L=this.parent.children.splice(O+1),this.parent.instruction(h,w),Array.prototype.push.apply(this.parent.children,L),this},E.prototype.declaration=function(h,w,O){var L,P;return L=this.document(),P=new o(L,h,w,O),L.children.length===0?L.children.unshift(P):L.children[0].type===t.Declaration?L.children[0]=P:L.children.unshift(P),L.root()||L},E.prototype.dtd=function(h,w){var O,L,P,C,l,_,F,k,q,B;for(L=this.document(),P=new i(L,h,w),q=L.children,C=l=0,F=q.length;l<F;C=++l)if(O=q[C],O.type===t.DocType)return L.children[C]=P,P;for(B=L.children,C=_=0,k=B.length;_<k;C=++_)if(O=B[C],O.isRoot)return L.children.splice(C,0,P),P;return L.children.push(P),P},E.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},E.prototype.root=function(){var h;for(h=this;h;){if(h.type===t.Document)return h.rootObject;if(h.isRoot)return h;h=h.parent}},E.prototype.document=function(){var h;for(h=this;h;){if(h.type===t.Document)return h;h=h.parent}},E.prototype.end=function(h){return this.document().end(h)},E.prototype.prev=function(){var h;if(h=this.parent.children.indexOf(this),h<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[h-1]},E.prototype.next=function(){var h;if(h=this.parent.children.indexOf(this),h===-1||h===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[h+1]},E.prototype.importDocument=function(h){var w;return w=h.root().clone(),w.parent=this,w.isRoot=!1,this.children.push(w),this},E.prototype.debugInfo=function(h){var w,O;return h=h||this.name,h==null&&!((w=this.parent)!=null&&w.name)?"":h==null?"parent: <"+this.parent.name+">":(O=this.parent)!=null&&O.name?"node: <"+h+">, parent: <"+this.parent.name+">":"node: <"+h+">"},E.prototype.ele=function(h,w,O){return this.element(h,w,O)},E.prototype.nod=function(h,w,O){return this.node(h,w,O)},E.prototype.txt=function(h){return this.text(h)},E.prototype.dat=function(h){return this.cdata(h)},E.prototype.com=function(h){return this.comment(h)},E.prototype.ins=function(h,w){return this.instruction(h,w)},E.prototype.doc=function(){return this.document()},E.prototype.dec=function(h,w,O){return this.declaration(h,w,O)},E.prototype.e=function(h,w,O){return this.element(h,w,O)},E.prototype.n=function(h,w,O){return this.node(h,w,O)},E.prototype.t=function(h){return this.text(h)},E.prototype.d=function(h){return this.cdata(h)},E.prototype.c=function(h){return this.comment(h)},E.prototype.r=function(h){return this.raw(h)},E.prototype.i=function(h,w){return this.instruction(h,w)},E.prototype.u=function(){return this.up()},E.prototype.importXMLBuilder=function(h){return this.importDocument(h)},E.prototype.replaceChild=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.removeChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.appendChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.hasChildNodes=function(){return this.children.length!==0},E.prototype.cloneNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isSupported=function(h,w){return!0},E.prototype.hasAttributes=function(){return this.attribs.length!==0},E.prototype.compareDocumentPosition=function(h){var w,O;return w=this,w===h?0:this.document()!==h.document()?(O=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?O|=e.Preceding:O|=e.Following,O):w.isAncestor(h)?e.Contains|e.Preceding:w.isDescendant(h)?e.Contains|e.Following:w.isPreceding(h)?e.Preceding:e.Following},E.prototype.isSameNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupPrefix=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isDefaultNamespace=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupNamespaceURI=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isEqualNode=function(h){var w,O,L;if(h.nodeType!==this.nodeType||h.children.length!==this.children.length)return!1;for(w=O=0,L=this.children.length-1;0<=L?O<=L:O>=L;w=0<=L?++O:--O)if(!this.children[w].isEqualNode(h.children[w]))return!1;return!0},E.prototype.getFeature=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.setUserData=function(h,w,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.getUserData=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.contains=function(h){return h?h===this||this.isDescendant(h):!1},E.prototype.isDescendant=function(h){var w,O,L,P,C;for(C=this.children,L=0,P=C.length;L<P;L++)if(w=C[L],h===w||(O=w.isDescendant(h),O))return!0;return!1},E.prototype.isAncestor=function(h){return h.isDescendant(this)},E.prototype.isPreceding=function(h){var w,O;return w=this.treePosition(h),O=this.treePosition(this),w===-1||O===-1?!1:w<O},E.prototype.isFollowing=function(h){var w,O;return w=this.treePosition(h),O=this.treePosition(this),w===-1||O===-1?!1:w>O},E.prototype.treePosition=function(h){var w,O;return O=0,w=!1,this.foreachTreeNode(this.document(),function(L){if(O++,!w&&L===h)return w=!0}),w?O:-1},E.prototype.foreachTreeNode=function(h,w){var O,L,P,C,l;for(h||(h=this.document()),C=h.children,L=0,P=C.length;L<P;L++){if(O=C[L],l=w(O))return l;if(l=this.foreachTreeNode(O,w),l)return l}},E}()}.call(G)),mt.exports}var jt={exports:{}},hr;function oi(){return hr||(hr=1,function(){var e=function(n,r){return function(){return n.apply(r,arguments)}},t={}.hasOwnProperty;jt.exports=function(){function n(r){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var o,i,s;r||(r={}),this.options=r,this.options.version||(this.options.version="1.0"),i=r.stringify||{};for(o in i)t.call(i,o)&&(s=i[o],this[o]=s)}return n.prototype.name=function(r){return this.options.noValidation?r:this.assertLegalName(""+r||"")},n.prototype.text=function(r){return this.options.noValidation?r:this.assertLegalChar(this.textEscape(""+r||""))},n.prototype.cdata=function(r){return this.options.noValidation?r:(r=""+r||"",r=r.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(r))},n.prototype.comment=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+r);return this.assertLegalChar(r)},n.prototype.raw=function(r){return this.options.noValidation?r:""+r||""},n.prototype.attValue=function(r){return this.options.noValidation?r:this.assertLegalChar(this.attEscape(r=""+r||""))},n.prototype.insTarget=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.insValue=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/\?>/))throw new Error("Invalid processing instruction value: "+r);return this.assertLegalChar(r)},n.prototype.xmlVersion=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+r);return r},n.prototype.xmlEncoding=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+r);return this.assertLegalChar(r)},n.prototype.xmlStandalone=function(r){return this.options.noValidation?r:r?"yes":"no"},n.prototype.dtdPubID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdSysID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdElementValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttType=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttDefault=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdEntityValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdNData=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(r){var o,i;if(this.options.noValidation)return r;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o))throw new Error("Invalid character in string: "+r+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o)))throw new Error("Invalid character in string: "+r+" at index "+i.index);return r},n.prototype.assertLegalName=function(r){var o;if(this.options.noValidation)return r;if(this.assertLegalChar(r),o=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!r.match(o))throw new Error("Invalid character in name");return r},n.prototype.textEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n}()}.call(G)),jt.exports}var kt={exports:{}},Rt={exports:{}},Bt={exports:{}},pr;function Ke(){return pr||(pr=1,function(){Bt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(G)),Bt.exports}var dr;function ai(){return dr||(dr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Ee().assign,e=ee(),fn(),mn(),cn(),ln(),un(),yn(),bn(),wn(),si(),hn(),dn(),pn(),gn(),t=Ke(),Rt.exports=function(){function o(i){var s,a,u;i||(i={}),this.options=i,a=i.writer||{};for(s in a)r.call(a,s)&&(u=a[s],this["_"+s]=this[s],this[s]=u)}return o.prototype.filterOptions=function(i){var s,a,u,f,c,g,p,b;return i||(i={}),i=n({},this.options,i),s={writer:this},s.pretty=i.pretty||!1,s.allowEmpty=i.allowEmpty||!1,s.indent=(a=i.indent)!=null?a:" ",s.newline=(u=i.newline)!=null?u:`
68
- `,s.offset=(f=i.offset)!=null?f:0,s.dontPrettyTextNodes=(c=(g=i.dontPrettyTextNodes)!=null?g:i.dontprettytextnodes)!=null?c:0,s.spaceBeforeSlash=(p=(b=i.spaceBeforeSlash)!=null?b:i.spacebeforeslash)!=null?p:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=t.None,s},o.prototype.indent=function(i,s,a){var u;return!s.pretty||s.suppressPrettyCount?"":s.pretty&&(u=(a||0)+s.offset+1,u>0)?new Array(u).join(s.indent):""},o.prototype.endline=function(i,s,a){return!s.pretty||s.suppressPrettyCount?"":s.newline},o.prototype.attribute=function(i,s,a){var u;return this.openAttribute(i,s,a),u=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,s,a),u},o.prototype.cdata=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=t.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,f,c,g,p;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,g=this.indent(i,s,a),g+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?g+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(g+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(g+=" [",g+=this.endline(i,s,a),s.state=t.InsideTag,p=i.children,f=0,c=p.length;f<c;f++)u=p[f],g+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,g+="]"}return s.state=t.CloseTag,g+=s.spaceBeforeSlash+">",g+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),g},o.prototype.element=function(i,s,a){var u,f,c,g,p,b,N,I,y,S,E,h,w,O;a||(a=0),S=!1,E="",this.openNode(i,s,a),s.state=t.OpenTag,E+=this.indent(i,s,a)+"<"+i.name,h=i.attribs;for(y in h)r.call(h,y)&&(u=h[y],E+=this.attribute(u,s,a));if(c=i.children.length,g=c===0?null:i.children[0],c===0||i.children.every(function(L){return(L.type===e.Text||L.type===e.Raw)&&L.value===""}))s.allowEmpty?(E+=">",s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,E+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&c===1&&(g.type===e.Text||g.type===e.Raw)&&g.value!=null)E+=">",s.state=t.InsideTag,s.suppressPrettyCount++,S=!0,E+=this.writeChildNode(g,s,a+1),s.suppressPrettyCount--,S=!1,s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(w=i.children,p=0,N=w.length;p<N;p++)if(f=w[p],(f.type===e.Text||f.type===e.Raw)&&f.value!=null){s.suppressPrettyCount++,S=!0;break}}for(E+=">"+this.endline(i,s,a),s.state=t.InsideTag,O=i.children,b=0,I=O.length;b<I;b++)f=O[b],E+=this.writeChildNode(f,s,a+1);s.state=t.CloseTag,E+=this.indent(i,s,a)+"</"+i.name+">",S&&s.suppressPrettyCount--,E+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),E},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case e.CData:return this.cdata(i,s,a);case e.Comment:return this.comment(i,s,a);case e.Element:return this.element(i,s,a);case e.Raw:return this.raw(i,s,a);case e.Text:return this.text(i,s,a);case e.ProcessingInstruction:return this.processingInstruction(i,s,a);case e.Dummy:return"";case e.Declaration:return this.declaration(i,s,a);case e.DocType:return this.docType(i,s,a);case e.AttributeDeclaration:return this.dtdAttList(i,s,a);case e.ElementDeclaration:return this.dtdElement(i,s,a);case e.EntityDeclaration:return this.dtdEntity(i,s,a);case e.NotationDeclaration:return this.dtdNotation(i,s,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?",s.state=t.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=t.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=t.InsideTag,u+=" "+i.name+" "+i.value,s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=t.InsideTag,i.pe&&(u+=" %"),u+=" "+i.name,i.value?u+=' "'+i.value+'"':(i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),i.nData&&(u+=" NDATA "+i.nData)),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=t.InsideTag,u+=" "+i.name,i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?u+=' PUBLIC "'+i.pubID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.openNode=function(i,s,a){},o.prototype.closeNode=function(i,s,a){},o.prototype.openAttribute=function(i,s,a){},o.prototype.closeAttribute=function(i,s,a){},o}()}.call(G)),Rt.exports}var gr;function En(){return gr||(gr=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=ai(),kt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,f,c,g;for(s=this.filterOptions(s),c="",g=i.children,u=0,f=g.length;u<f;u++)a=g[u],c+=this.writeChildNode(a,s,0);return s.pretty&&c.slice(-s.newline.length)===s.newline&&(c=c.slice(0,-s.newline.length)),c},o}(e)}.call(G)),kt.exports}var mr;function ui(){return mr||(mr=1,function(){var e,t,n,r,o,i,s,a=function(f,c){for(var g in c)u.call(c,g)&&(f[g]=c[g]);function p(){this.constructor=f}return p.prototype=c.prototype,f.prototype=new p,f.__super__=c.prototype,f},u={}.hasOwnProperty;s=Ee().isPlainObject,n=ri(),t=Ao(),r=he(),e=ee(),i=oi(),o=En(),ht.exports=function(f){a(c,f);function c(g){c.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,g||(g={}),g.writer||(g.writer=new o),this.options=g,this.stringify=new i(g)}return Object.defineProperty(c.prototype,"implementation",{value:new n}),Object.defineProperty(c.prototype,"doctype",{get:function(){var g,p,b,N;for(N=this.children,p=0,b=N.length;p<b;p++)if(g=N[p],g.type===e.DocType)return g;return null}}),Object.defineProperty(c.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(c.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(c.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(c.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(c.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(c.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(c.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(c.prototype,"origin",{get:function(){return null}}),Object.defineProperty(c.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(c.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(c.prototype,"contentType",{get:function(){return null}}),c.prototype.end=function(g){var p;return p={},g?s(g)&&(p=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(p))},c.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},c.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createProcessingInstruction=function(g,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.importNode=function(g,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createElementNS=function(g,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttributeNS=function(g,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagNameNS=function(g,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.renameNode=function(g,p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createNodeIterator=function(g,p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTreeWalker=function(g,p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(r)}.call(G)),ht.exports}var Xt={exports:{}},yr;function _o(){return yr||(yr=1,function(){var e,t,n,r,o,i,s,a,u,f,c,g,p,b,N,I,y,S,E,h,w,O,L,P={}.hasOwnProperty;L=Ee(),w=L.isObject,h=L.isFunction,O=L.isPlainObject,E=L.getValue,e=ee(),g=ui(),p=un(),r=cn(),o=ln(),N=yn(),S=bn(),b=wn(),f=fn(),c=mn(),i=hn(),a=pn(),s=dn(),u=gn(),n=ii(),y=oi(),I=En(),t=Ke(),Xt.exports=function(){function C(l,_,F){var k;this.name="?xml",this.type=e.Document,l||(l={}),k={},l.writer?O(l.writer)&&(k=l.writer,l.writer=new I):l.writer=new I,this.options=l,this.writer=l.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new y(l),this.onDataCallback=_||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return C.prototype.createChildNode=function(l){var _,F,k,q,B,U,H,W;switch(l.type){case e.CData:this.cdata(l.value);break;case e.Comment:this.comment(l.value);break;case e.Element:k={},H=l.attribs;for(F in H)P.call(H,F)&&(_=H[F],k[F]=_.value);this.node(l.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(l.value);break;case e.Text:this.text(l.value);break;case e.ProcessingInstruction:this.instruction(l.target,l.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+l.constructor.name)}for(W=l.children,B=0,U=W.length;B<U;B++)q=W[B],this.createChildNode(q),q.type===e.Element&&this.up();return this},C.prototype.dummy=function(){return this},C.prototype.node=function(l,_,F){var k;if(l==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(l));return this.openCurrent(),l=E(l),_==null&&(_={}),_=E(_),w(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new p(this,l,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},C.prototype.element=function(l,_,F){var k,q,B,U,H,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(l)||w(l)||h(l))for(U=this.options.noValidation,this.options.noValidation=!0,W=new g(this.options).element("TEMP_ROOT"),W.element(l),this.options.noValidation=U,H=W.children,q=0,B=H.length;q<B;q++)k=H[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(l,_,F);return this},C.prototype.attribute=function(l,_){var F,k;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(l));if(l!=null&&(l=E(l)),w(l))for(F in l)P.call(l,F)&&(k=l[F],this.attribute(F,k));else h(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[l]=new n(this,l,""):_!=null&&(this.currentNode.attribs[l]=new n(this,l,_));return this},C.prototype.text=function(l){var _;return this.openCurrent(),_=new S(this,l),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.cdata=function(l){var _;return this.openCurrent(),_=new r(this,l),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.comment=function(l){var _;return this.openCurrent(),_=new o(this,l),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.raw=function(l){var _;return this.openCurrent(),_=new N(this,l),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.instruction=function(l,_){var F,k,q,B,U;if(this.openCurrent(),l!=null&&(l=E(l)),_!=null&&(_=E(_)),Array.isArray(l))for(F=0,B=l.length;F<B;F++)k=l[F],this.instruction(k);else if(w(l))for(k in l)P.call(l,k)&&(q=l[k],this.instruction(k,q));else h(_)&&(_=_.apply()),U=new b(this,l,_),this.onData(this.writer.processingInstruction(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},C.prototype.declaration=function(l,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new f(this,l,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.doctype=function(l,_,F){if(this.openCurrent(),l==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new c(this,_,F),this.currentNode.rootNodeName=l,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},C.prototype.dtdElement=function(l,_){var F;return this.openCurrent(),F=new s(this,l,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.attList=function(l,_,F,k,q){var B;return this.openCurrent(),B=new i(this,l,_,F,k,q),this.onData(this.writer.dtdAttList(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.entity=function(l,_){var F;return this.openCurrent(),F=new a(this,!1,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.pEntity=function(l,_){var F;return this.openCurrent(),F=new a(this,!0,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.notation=function(l,_){var F;return this.openCurrent(),F=new u(this,l,_),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},C.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},C.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},C.prototype.openNode=function(l){var _,F,k,q;if(!l.isOpen){if(!this.root&&this.currentLevel===0&&l.type===e.Element&&(this.root=l),F="",l.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<"+l.name,q=l.attribs;for(k in q)P.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(l.children?">":"/>")+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+l.rootNodeName,l.pubID&&l.sysID?F+=' PUBLIC "'+l.pubID+'" "'+l.sysID+'"':l.sysID&&(F+=' SYSTEM "'+l.sysID+'"'),l.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(l,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),l.isOpen=!0}},C.prototype.closeNode=function(l){var _;if(!l.isClosed)return _="",this.writerOptions.state=t.CloseTag,l.type===e.Element?_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"</"+l.name+">"+this.writer.endline(l,this.writerOptions,this.currentLevel):_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),l.isClosed=!0},C.prototype.onData=function(l,_){return this.documentStarted=!0,this.onDataCallback(l,_+1)},C.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},C.prototype.debugInfo=function(l){return l==null?"":"node: <"+l+">"},C.prototype.ele=function(){return this.element.apply(this,arguments)},C.prototype.nod=function(l,_,F){return this.node(l,_,F)},C.prototype.txt=function(l){return this.text(l)},C.prototype.dat=function(l){return this.cdata(l)},C.prototype.com=function(l){return this.comment(l)},C.prototype.ins=function(l,_){return this.instruction(l,_)},C.prototype.dec=function(l,_,F){return this.declaration(l,_,F)},C.prototype.dtd=function(l,_,F){return this.doctype(l,_,F)},C.prototype.e=function(l,_,F){return this.element(l,_,F)},C.prototype.n=function(l,_,F){return this.node(l,_,F)},C.prototype.t=function(l){return this.text(l)},C.prototype.d=function(l){return this.cdata(l)},C.prototype.c=function(l){return this.comment(l)},C.prototype.r=function(l){return this.raw(l)},C.prototype.i=function(l,_){return this.instruction(l,_)},C.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.ent=function(l,_){return this.entity(l,_)},C.prototype.pent=function(l,_){return this.pEntity(l,_)},C.prototype.not=function(l,_){return this.notation(l,_)},C}()}.call(G)),Xt.exports}var $t={exports:{}},br;function So(){return br||(br=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;e=ee(),n=ai(),t=Ke(),$t.exports=function(i){r(s,i);function s(a,u){this.stream=a,s.__super__.constructor.call(this,u)}return s.prototype.endline=function(a,u,f){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,f)},s.prototype.document=function(a,u){var f,c,g,p,b,N,I,y,S;for(I=a.children,c=g=0,b=I.length;g<b;c=++g)f=I[c],f.isLastRootNode=c===a.children.length-1;for(u=this.filterOptions(u),y=a.children,S=[],p=0,N=y.length;p<N;p++)f=y[p],S.push(this.writeChildNode(f,u,0));return S},s.prototype.attribute=function(a,u,f){return this.stream.write(s.__super__.attribute.call(this,a,u,f))},s.prototype.cdata=function(a,u,f){return this.stream.write(s.__super__.cdata.call(this,a,u,f))},s.prototype.comment=function(a,u,f){return this.stream.write(s.__super__.comment.call(this,a,u,f))},s.prototype.declaration=function(a,u,f){return this.stream.write(s.__super__.declaration.call(this,a,u,f))},s.prototype.docType=function(a,u,f){var c,g,p,b;if(f||(f=0),this.openNode(a,u,f),u.state=t.OpenTag,this.stream.write(this.indent(a,u,f)),this.stream.write("<!DOCTYPE "+a.root().name),a.pubID&&a.sysID?this.stream.write(' PUBLIC "'+a.pubID+'" "'+a.sysID+'"'):a.sysID&&this.stream.write(' SYSTEM "'+a.sysID+'"'),a.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(a,u,f)),u.state=t.InsideTag,b=a.children,g=0,p=b.length;g<p;g++)c=b[g],this.writeChildNode(c,u,f+1);u.state=t.CloseTag,this.stream.write("]")}return u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,f)),u.state=t.None,this.closeNode(a,u,f)},s.prototype.element=function(a,u,f){var c,g,p,b,N,I,y,S,E;f||(f=0),this.openNode(a,u,f),u.state=t.OpenTag,this.stream.write(this.indent(a,u,f)+"<"+a.name),S=a.attribs;for(y in S)o.call(S,y)&&(c=S[y],this.attribute(c,u,f));if(p=a.children.length,b=p===0?null:a.children[0],p===0||a.children.every(function(h){return(h.type===e.Text||h.type===e.Raw)&&h.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=t.CloseTag,this.stream.write("</"+a.name+">")):(u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&p===1&&(b.type===e.Text||b.type===e.Raw)&&b.value!=null)this.stream.write(">"),u.state=t.InsideTag,u.suppressPrettyCount++,this.writeChildNode(b,u,f+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,f)),u.state=t.InsideTag,E=a.children,N=0,I=E.length;N<I;N++)g=E[N],this.writeChildNode(g,u,f+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,f)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,f)),u.state=t.None,this.closeNode(a,u,f)},s.prototype.processingInstruction=function(a,u,f){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,f))},s.prototype.raw=function(a,u,f){return this.stream.write(s.__super__.raw.call(this,a,u,f))},s.prototype.text=function(a,u,f){return this.stream.write(s.__super__.text.call(this,a,u,f))},s.prototype.dtdAttList=function(a,u,f){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,f))},s.prototype.dtdElement=function(a,u,f){return this.stream.write(s.__super__.dtdElement.call(this,a,u,f))},s.prototype.dtdEntity=function(a,u,f){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,f))},s.prototype.dtdNotation=function(a,u,f){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,f))},s}(n)}.call(G)),$t.exports}var wr;function Do(){return wr||(wr=1,function(){var e,t,n,r,o,i,s,a,u,f;f=Ee(),a=f.assign,u=f.isFunction,n=ri(),r=ui(),o=_o(),s=En(),i=So(),e=ee(),t=Ke(),be.create=function(c,g,p,b){var N,I;if(c==null)throw new Error("Root element needs a name.");return b=a({},g,p,b),N=new r(b),I=N.element(c),b.headless||(N.declaration(b),(b.pubID!=null||b.sysID!=null)&&N.dtd(b)),I},be.begin=function(c,g,p){var b;return u(c)&&(b=[c,g],g=b[0],p=b[1],c={}),g?new o(c,g,p):new r(c)},be.stringWriter=function(c){return new s(c)},be.streamWriter=function(c,g){return new i(c,g)},be.implementation=new n,be.nodeType=e,be.writerState=t}.call(G)),be}var Er;function Mo(){return Er||(Er=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=Do(),t=on().defaults,r=function(s){return typeof s=="string"&&(s.indexOf("&")>=0||s.indexOf(">")>=0||s.indexOf("<")>=0)},o=function(s){return"<![CDATA["+n(s)+"]]>"},n=function(s){return s.replace("]]>","]]]]><![CDATA[>")},lt.Builder=function(){function s(a){var u,f,c;this.options={},f=t["0.2"];for(u in f)i.call(f,u)&&(c=f[u],this.options[u]=c);for(u in a)i.call(a,u)&&(c=a[u],this.options[u]=c)}return s.prototype.buildObject=function(a){var u,f,c,g,p;return u=this.options.attrkey,f=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(p=Object.keys(a)[0],a=a[p]):p=this.options.rootName,c=function(b){return function(N,I){var y,S,E,h,w,O;if(typeof I!="object")b.options.cdata&&r(I)?N.raw(o(I)):N.txt(I);else if(Array.isArray(I)){for(h in I)if(i.call(I,h)){S=I[h];for(w in S)E=S[w],N=c(N.ele(w),E).up()}}else for(w in I)if(i.call(I,w))if(S=I[w],w===u){if(typeof S=="object")for(y in S)O=S[y],N=N.att(y,O)}else if(w===f)b.options.cdata&&r(S)?N=N.raw(o(S)):N=N.txt(S);else if(Array.isArray(S))for(h in S)i.call(S,h)&&(E=S[h],typeof E=="string"?b.options.cdata&&r(E)?N=N.ele(w).raw(o(E)).up():N=N.ele(w,E).up():N=c(N.ele(w),E).up());else typeof S=="object"?N=c(N.ele(w),S).up():typeof S=="string"&&b.options.cdata&&r(S)?N=N.ele(w).raw(o(S)).up():(S==null&&(S=""),N=N.ele(w,S.toString()).up());return N}}(this),g=e.create(p,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(g,a).end(this.options.renderOpts)},s}()}.call(G)),lt}var Ut={},Vt={},Nr;function Co(){return Nr||(Nr=1,function(e){(function(t){t.parser=function(m,d){return new r(m,d)},t.SAXParser=r,t.SAXStream=c,t.createStream=f,t.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,d){if(!(this instanceof r))return new r(m,d);var M=this;i(M),M.q=M.c="",M.bufferCheckPosition=t.MAX_BUFFER_LENGTH,M.opt=d||{},M.opt.lowercase=M.opt.lowercase||M.opt.lowercasetags,M.looseCase=M.opt.lowercase?"toLowerCase":"toUpperCase",M.opt.maxEntityCount=M.opt.maxEntityCount||512,M.opt.maxEntityDepth=M.opt.maxEntityDepth||4,M.entityCount=M.entityDepth=0,M.tags=[],M.closed=M.closedRoot=M.sawRoot=!1,M.tag=M.error=null,M.strict=!!m,M.noscript=!!(m||M.opt.noscript),M.state=l.BEGIN,M.strictEntities=M.opt.strictEntities,M.ENTITIES=M.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),M.attribList=[],M.opt.xmlns&&(M.ns=Object.create(I)),M.opt.unquotedAttributeValues===void 0&&(M.opt.unquotedAttributeValues=!m),M.trackPosition=M.opt.position!==!1,M.trackPosition&&(M.position=M.line=M.column=0),F(M,"onready")}Object.create||(Object.create=function(m){function d(){}d.prototype=m;var M=new d;return M}),Object.keys||(Object.keys=function(m){var d=[];for(var M in m)m.hasOwnProperty(M)&&d.push(M);return d});function o(m){for(var d=Math.max(t.MAX_BUFFER_LENGTH,10),M=0,v=0,Y=n.length;v<Y;v++){var J=m[n[v]].length;if(J>d)switch(n[v]){case"textNode":q(m);break;case"cdata":k(m,"oncdata",m.cdata),m.cdata="";break;case"script":k(m,"onscript",m.script),m.script="";break;default:U(m,"Max buffer length exceeded: "+n[v])}M=Math.max(M,J)}var z=t.MAX_BUFFER_LENGTH-M;m.bufferCheckPosition=z+m.position}function i(m){for(var d=0,M=n.length;d<M;d++)m[n[d]]=""}function s(m){q(m),m.cdata!==""&&(k(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(k(m,"onscript",m.script),m.script="")}r.prototype={end:function(){H(this)},write:tt,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var u=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function f(m,d){return new c(m,d)}function c(m,d){if(!(this instanceof c))return new c(m,d);a.apply(this),this._parser=new r(m,d),this.writable=!0,this.readable=!0;var M=this;this._parser.onend=function(){M.emit("end")},this._parser.onerror=function(v){M.emit("error",v),M._parser.error=null},this._decoder=null,u.forEach(function(v){Object.defineProperty(M,"on"+v,{get:function(){return M._parser["on"+v]},set:function(Y){if(!Y)return M.removeAllListeners(v),M._parser["on"+v]=Y,Y;M.on(v,Y)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(a.prototype,{constructor:{value:c}}),c.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},c.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var d=this._decoder.decode();d&&(this._parser.write(d),this.emit("data",d))}return this._parser.end(),!0},c.prototype.on=function(m,d){var M=this;return!M._parser["on"+m]&&u.indexOf(m)!==-1&&(M._parser["on"+m]=function(){var v=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);v.splice(0,0,m),M.emit.apply(M,v)}),a.prototype.on.call(M,m,d)};var g="[CDATA[",p="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",N="http://www.w3.org/2000/xmlns/",I={xml:b,xmlns:N},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,S=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(m){return m===" "||m===`
69
- `||m==="\r"||m===" "}function O(m){return m==='"'||m==="'"}function L(m){return m===">"||w(m)}function P(m,d){return m.test(d)}function C(m,d){return!P(m,d)}var l=0;t.STATE={BEGIN:l++,BEGIN_WHITESPACE:l++,TEXT:l++,TEXT_ENTITY:l++,OPEN_WAKA:l++,SGML_DECL:l++,SGML_DECL_QUOTED:l++,DOCTYPE:l++,DOCTYPE_QUOTED:l++,DOCTYPE_DTD:l++,DOCTYPE_DTD_QUOTED:l++,COMMENT_STARTING:l++,COMMENT:l++,COMMENT_ENDING:l++,COMMENT_ENDED:l++,CDATA:l++,CDATA_ENDING:l++,CDATA_ENDING_2:l++,PROC_INST:l++,PROC_INST_BODY:l++,PROC_INST_ENDING:l++,OPEN_TAG:l++,OPEN_TAG_SLASH:l++,ATTRIB:l++,ATTRIB_NAME:l++,ATTRIB_NAME_SAW_WHITE:l++,ATTRIB_VALUE:l++,ATTRIB_VALUE_QUOTED:l++,ATTRIB_VALUE_CLOSED:l++,ATTRIB_VALUE_UNQUOTED:l++,ATTRIB_VALUE_ENTITY_Q:l++,ATTRIB_VALUE_ENTITY_U:l++,CLOSE_TAG:l++,CLOSE_TAG_SAW_WHITE:l++,SCRIPT:l++,SCRIPT_ENDING:l++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var d=t.ENTITIES[m],M=typeof d=="number"?String.fromCharCode(d):d;t.ENTITIES[m]=M});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;l=t.STATE;function F(m,d,M){m[d]&&m[d](M)}function k(m,d,M){m.textNode&&q(m),F(m,d,M)}function q(m){m.textNode=B(m.opt,m.textNode),m.textNode&&F(m,"ontext",m.textNode),m.textNode=""}function B(m,d){return m.trim&&(d=d.trim()),m.normalize&&(d=d.replace(/\s+/g," ")),d}function U(m,d){return q(m),m.trackPosition&&(d+=`
70
+ */var ut,ct,lt;const $n=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Un=(ct=(ut=process==null?void 0:process.versions)===null||ut===void 0?void 0:ut.node)!==null&&ct!==void 0?ct:(lt=process==null?void 0:process.version)===null||lt===void 0?void 0:lt.slice(1);if(Un&&Number(Un.match(/^([^.]+)/)[1])<$n)throw Error(`yargs parser supports a minimum Node.js version of ${$n}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const No=process?process.env:{};new bo({cwd:process.cwd,env:()=>No,format:_r,normalize:Oi,resolve:nn,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(tn(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const To={fs:{readFileSync:tn,writeFile:bi},format:_r,resolve:nn,exists:e=>{try{return wi(e).isFile()}catch{return!1}}};let he;class Io{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const n=t.shift();let r=function(){};return typeof t[t.length-1]=="function"&&(r=t.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),he.format.apply(he.format,[this.cache[this.locale][n]||n].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),n=t.shift(),r=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?n:r;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[s];return~s.indexOf("%d")&&a.push(o),he.format.apply(he.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let r="";return t.forEach(function(o,i){const s=n[i+1];r+=o,typeof s<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,n=this.writeQueue[0],r=n.directory,o=n.locale,i=n.cb,s=this._resolveLocaleFile(r,o),a=JSON.stringify(this.cache[o],null,2);he.fs.writeFile(s,a,"utf-8",function(u){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(u)})}_readLocaleFile(){let t={};const n=this._resolveLocaleFile(this.directory,this.locale);try{he.fs.readFileSync&&(t=JSON.parse(he.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")t={};else throw r}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let r=he.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=he.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(t){return he.exists(t)}}function vo(e,t){he=t;const n=new Io(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const Oo=e=>vo(e,To);let $e;try{$e=_i(import.meta.url)}catch{$e=process.cwd()}const xo=$e.substring(0,$e.lastIndexOf("node_modules"));xo||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,Oo({directory:nn($e,"../../../locales"),updateFiles:!1});var ft={},Vn;function un(){return Vn||(Vn=1,function(){ft.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
71
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(G)),ft}var pt={},we={},Ee={},qn;function Ne(){return qn||(qn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var p,c,d,f,y,w;if(w=arguments[0],y=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(p=0,d=y.length;p<d;p++)if(f=y[p],f!=null)for(c in f)u.call(f,c)&&(w[c]=f[c]);return w},o=function(p){return!!p&&Object.prototype.toString.call(p)==="[object Function]"},i=function(p){var c;return!!p&&((c=typeof p)=="function"||c==="object")},n=function(p){return o(Array.isArray)?Array.isArray(p):Object.prototype.toString.call(p)==="[object Array]"},r=function(p){var c;if(n(p))return!p.length;for(c in p)if(u.call(p,c))return!1;return!0},s=function(p){var c,d;return i(p)&&(d=Object.getPrototypeOf(p))&&(c=d.constructor)&&typeof c=="function"&&c instanceof c&&Function.prototype.toString.call(c)===Function.prototype.toString.call(Object)},t=function(p){return o(p.valueOf)?p.valueOf():p},Ee.assign=e,Ee.isFunction=o,Ee.isObject=i,Ee.isArray=n,Ee.isEmpty=r,Ee.isPlainObject=s,Ee.getValue=t}.call(G)),Ee}var ht={exports:{}},Wn;function ii(){return Wn||(Wn=1,function(){ht.exports=function(){function e(){}return e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(G)),ht.exports}var dt={exports:{}},gt={exports:{}},mt={exports:{}},Gn;function Po(){return Gn||(Gn=1,function(){mt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(G)),mt.exports}var yt={exports:{}},Hn;function Ao(){return Hn||(Hn=1,function(){yt.exports=function(){function e(t){this.arr=t||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e}()}.call(G)),yt.exports}var Yn;function Lo(){return Yn||(Yn=1,function(){var e,t;e=Po(),t=Ao(),gt.exports=function(){function n(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(r){return this.params.hasOwnProperty(r)?this.params[r]:null},n.prototype.canSetParameter=function(r,o){return!0},n.prototype.setParameter=function(r,o){return o!=null?this.params[r]=o:delete this.params[r]},n}()}.call(G)),gt.exports}var bt={exports:{}},wt={exports:{}},Et={exports:{}},zn;function ee(){return zn||(zn=1,function(){Et.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(G)),Et.exports}var Nt={exports:{}},Qn;function si(){return Qn||(Qn=1,function(){var e;e=ee(),pe(),Nt.exports=function(){function t(n,r,o){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),r==null)throw new Error("Missing attribute name. "+this.debugInfo(r));this.name=this.stringify.name(r),this.value=this.stringify.attValue(o),this.type=e.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},t.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},t}()}.call(G)),Nt.exports}var Tt={exports:{}},Jn;function cn(){return Jn||(Jn=1,function(){Tt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(G)),Tt.exports}var Kn;function ln(){return Kn||(Kn=1,function(){var e,t,n,r,o,i,s,a,u=function(c,d){for(var f in d)p.call(d,f)&&(c[f]=d[f]);function y(){this.constructor=c}return y.prototype=d.prototype,c.prototype=new y,c.__super__=d.prototype,c},p={}.hasOwnProperty;a=Ne(),s=a.isObject,i=a.isFunction,o=a.getValue,r=pe(),e=ee(),t=si(),n=cn(),wt.exports=function(c){u(d,c);function d(f,y,w){var v,b,S,N;if(d.__super__.constructor.call(this,f),y==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(y),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,w!=null&&this.attribute(w),f.type===e.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(N=f.children,b=0,S=N.length;b<S;b++)if(v=N[b],v.type===e.DocType){v.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,y,w,v;w=Object.create(this),w.isRoot&&(w.documentObject=null),w.attribs={},v=this.attribs;for(y in v)p.call(v,y)&&(f=v[y],w.attribs[y]=f.clone());return w.children=[],this.children.forEach(function(b){var S;return S=b.clone(),S.parent=w,w.children.push(S)}),w},d.prototype.attribute=function(f,y){var w,v;if(f!=null&&(f=o(f)),s(f))for(w in f)p.call(f,w)&&(v=f[w],this.attribute(w,v));else i(y)&&(y=y.apply()),this.options.keepNullAttributes&&y==null?this.attribs[f]=new t(this,f,""):y!=null&&(this.attribs[f]=new t(this,f,y));return this},d.prototype.removeAttribute=function(f){var y,w,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=o(f),Array.isArray(f))for(w=0,v=f.length;w<v;w++)y=f[w],delete this.attribs[y];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,y){return this.attribute(f,y)},d.prototype.a=function(f,y){return this.attribute(f,y)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,y){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:y},d.prototype.setIdAttributeNS=function(f,y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var y,w,v;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(y=w=0,v=this.attribs.length-1;0<=v?w<=v:w>=v;y=0<=v?++w:--w)if(!this.attribs[y].isEqualNode(f.attribs[y]))return!1;return!0},d}(r)}.call(G)),wt.exports}var It={exports:{}},vt={exports:{}},Zn;function Ze(){return Zn||(Zn=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=pe(),vt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,s,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(e)}.call(G)),vt.exports}var er;function fn(){return er||(er=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Ze(),It.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.cdata(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),It.exports}var Ot={exports:{}},tr;function pn(){return tr||(tr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Ze(),Ot.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.comment(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Ot.exports}var xt={exports:{}},nr;function hn(){return nr||(nr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ne().isObject,t=pe(),e=ee(),xt.exports=function(i){r(s,i);function s(a,u,p,c){var d;s.__super__.constructor.call(this,a),n(u)&&(d=u,u=d.version,p=d.encoding,c=d.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),p!=null&&(this.encoding=this.stringify.xmlEncoding(p)),c!=null&&(this.standalone=this.stringify.xmlStandalone(c))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(G)),xt.exports}var Pt={exports:{}},At={exports:{}},rr;function dn(){return rr||(rr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=pe(),e=ee(),At.exports=function(o){n(i,o);function i(s,a,u,p,c,d){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(u==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!p)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!c)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(c.indexOf("#")!==0&&(c="#"+c),!c.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(d&&!c.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(p),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=c}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),At.exports}var Lt={exports:{}},ir;function gn(){return ir||(ir=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ne().isObject,t=pe(),e=ee(),Lt.exports=function(i){r(s,i);function s(a,u,p,c){if(s.__super__.constructor.call(this,a),p==null)throw new Error("Missing DTD entity name. "+this.debugInfo(p));if(c==null)throw new Error("Missing DTD entity value. "+this.debugInfo(p));if(this.pe=!!u,this.name=this.stringify.name(p),this.type=e.EntityDeclaration,!n(c))this.value=this.stringify.dtdEntityValue(c),this.internal=!0;else{if(!c.pubID&&!c.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(p));if(c.pubID&&!c.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(p));if(this.internal=!1,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID)),c.nData!=null&&(this.nData=this.stringify.dtdNData(c.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(p))}}return Object.defineProperty(s.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(s.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(s.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(s.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlVersion",{get:function(){return null}}),s.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},s}(t)}.call(G)),Lt.exports}var _t={exports:{}},sr;function mn(){return sr||(sr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=pe(),e=ee(),_t.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(u)}return i.prototype.toString=function(s){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),_t.exports}var St={exports:{}},or;function yn(){return or||(or=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=pe(),e=ee(),St.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=e.NotationDeclaration,u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(s){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),St.exports}var ar;function bn(){return ar||(ar=1,function(){var e,t,n,r,o,i,s,a,u=function(c,d){for(var f in d)p.call(d,f)&&(c[f]=d[f]);function y(){this.constructor=c}return y.prototype=d.prototype,c.prototype=new y,c.__super__=d.prototype,c},p={}.hasOwnProperty;a=Ne().isObject,s=pe(),e=ee(),t=dn(),r=gn(),n=mn(),o=yn(),i=cn(),Pt.exports=function(c){u(d,c);function d(f,y,w){var v,b,S,N,h,E;if(d.__super__.constructor.call(this,f),this.type=e.DocType,f.children){for(N=f.children,b=0,S=N.length;b<S;b++)if(v=N[b],v.type===e.Element){this.name=v.name;break}}this.documentObject=f,a(y)&&(h=y,y=h.pubID,w=h.sysID),w==null&&(E=[y,w],w=E[0],y=E[1]),y!=null&&(this.pubID=this.stringify.dtdPubID(y)),w!=null&&(this.sysID=this.stringify.dtdSysID(w))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,y,w,v,b;for(v={},b=this.children,y=0,w=b.length;y<w;y++)f=b[y],f.type===e.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new i(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,y,w,v,b;for(v={},b=this.children,y=0,w=b.length;y<w;y++)f=b[y],f.type===e.NotationDeclaration&&(v[f.name]=f);return new i(v)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,y){var w;return w=new n(this,f,y),this.children.push(w),this},d.prototype.attList=function(f,y,w,v,b){var S;return S=new t(this,f,y,w,v,b),this.children.push(S),this},d.prototype.entity=function(f,y){var w;return w=new r(this,!1,f,y),this.children.push(w),this},d.prototype.pEntity=function(f,y){var w;return w=new r(this,!0,f,y),this.children.push(w),this},d.prototype.notation=function(f,y){var w;return w=new o(this,f,y),this.children.push(w),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,y){return this.element(f,y)},d.prototype.att=function(f,y,w,v,b){return this.attList(f,y,w,v,b)},d.prototype.ent=function(f,y){return this.entity(f,y)},d.prototype.pent=function(f,y){return this.pEntity(f,y)},d.prototype.not=function(f,y){return this.notation(f,y)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d}(s)}.call(G)),Pt.exports}var Dt={exports:{}},ur;function wn(){return ur||(ur=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=pe(),Dt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.raw(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),Dt.exports}var Mt={exports:{}},cr;function En(){return cr||(cr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Ze(),Mt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(a)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var s,a,u;for(u="",a=this.previousSibling;a;)u=a.data+u,a=a.previousSibling;for(u+=this.data,s=this.nextSibling;s;)u=u+s.data,s=s.nextSibling;return u}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.text(this,this.options.writer.filterOptions(s))},i.prototype.splitText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(G)),Mt.exports}var Ct={exports:{}},lr;function Nn(){return lr||(lr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Ze(),Ct.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,u&&(this.value=this.stringify.insValue(u))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(s))},i.prototype.isEqualNode=function(s){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(s)||s.target!==this.target)},i}(t)}.call(G)),Ct.exports}var Ft={exports:{}},fr;function oi(){return fr||(fr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=pe(),e=ee(),Ft.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=e.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(t)}.call(G)),Ft.exports}var jt={exports:{}},pr;function _o(){return pr||(pr=1,function(){jt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e}()}.call(G)),jt.exports}var kt={exports:{}},hr;function So(){return hr||(hr=1,function(){kt.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(G)),kt.exports}var dr;function pe(){return dr||(dr=1,function(){var e,t,n,r,o,i,s,a,u,p,c,d,f,y,w,v,b,S={}.hasOwnProperty;b=Ne(),v=b.isObject,w=b.isFunction,y=b.isEmpty,f=b.getValue,a=null,n=null,r=null,o=null,i=null,c=null,d=null,p=null,s=null,t=null,u=null,e=null,bt.exports=function(){function N(h){this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=ln(),n=fn(),r=pn(),o=hn(),i=bn(),c=wn(),d=En(),p=Nn(),s=oi(),t=ee(),u=_o(),cn(),e=So())}return Object.defineProperty(N.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(N.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(N.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(N.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(N.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(N.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(N.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(N.prototype,"previousSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h-1]||null}}),Object.defineProperty(N.prototype,"nextSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h+1]||null}}),Object.defineProperty(N.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(N.prototype,"textContent",{get:function(){var h,E,I,L,A;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(A="",L=this.children,E=0,I=L.length;E<I;E++)h=L[E],h.textContent&&(A+=h.textContent);return A}else return null},set:function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),N.prototype.setParent=function(h){var E,I,L,A,C;for(this.parent=h,h&&(this.options=h.options,this.stringify=h.stringify),A=this.children,C=[],I=0,L=A.length;I<L;I++)E=A[I],C.push(E.setParent(this));return C},N.prototype.element=function(h,E,I){var L,A,C,l,_,F,k,q,B,U,H;if(F=null,E===null&&I==null&&(B=[{},null],E=B[0],I=B[1]),E==null&&(E={}),E=f(E),v(E)||(U=[E,I],I=U[0],E=U[1]),h!=null&&(h=f(h)),Array.isArray(h))for(C=0,k=h.length;C<k;C++)A=h[C],F=this.element(A);else if(w(h))F=this.element(h.apply());else if(v(h)){for(_ in h)if(S.call(h,_))if(H=h[_],w(H)&&(H=H.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(_.substr(this.stringify.convertAttKey.length),H);else if(!this.options.separateArrayItems&&Array.isArray(H)&&y(H))F=this.dummy();else if(v(H)&&y(H))F=this.element(_);else if(!this.options.keepNullNodes&&H==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(H))for(l=0,q=H.length;l<q;l++)A=H[l],L={},L[_]=A,F=this.element(L);else v(H)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?F=this.element(H):(F=this.element(_),F.element(H)):F=this.element(_,H)}else!this.options.keepNullNodes&&I===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&h.indexOf(this.stringify.convertTextKey)===0?F=this.text(I):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&h.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(I):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&h.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(I):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&h.indexOf(this.stringify.convertRawKey)===0?F=this.raw(I):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&h.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(h.substr(this.stringify.convertPIKey.length),I):F=this.node(h,E,I);if(F==null)throw new Error("Could not create any elements with: "+h+". "+this.debugInfo());return F},N.prototype.insertBefore=function(h,E,I){var L,A,C,l,_;if(h?.type)return C=h,l=E,C.setParent(this),l?(A=children.indexOf(l),_=children.splice(A),children.push(C),Array.prototype.push.apply(children,_)):children.push(C),C;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return A=this.parent.children.indexOf(this),_=this.parent.children.splice(A),L=this.parent.element(h,E,I),Array.prototype.push.apply(this.parent.children,_),L},N.prototype.insertAfter=function(h,E,I){var L,A,C;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return A=this.parent.children.indexOf(this),C=this.parent.children.splice(A+1),L=this.parent.element(h,E,I),Array.prototype.push.apply(this.parent.children,C),L},N.prototype.remove=function(){var h;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return h=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[h,h-h+1].concat([])),this.parent},N.prototype.node=function(h,E,I){var L,A;return h!=null&&(h=f(h)),E||(E={}),E=f(E),v(E)||(A=[E,I],I=A[0],E=A[1]),L=new a(this,h,E),I!=null&&L.text(I),this.children.push(L),L},N.prototype.text=function(h){var E;return v(h)&&this.element(h),E=new d(this,h),this.children.push(E),this},N.prototype.cdata=function(h){var E;return E=new n(this,h),this.children.push(E),this},N.prototype.comment=function(h){var E;return E=new r(this,h),this.children.push(E),this},N.prototype.commentBefore=function(h){var E,I;return E=this.parent.children.indexOf(this),I=this.parent.children.splice(E),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.commentAfter=function(h){var E,I;return E=this.parent.children.indexOf(this),I=this.parent.children.splice(E+1),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.raw=function(h){var E;return E=new c(this,h),this.children.push(E),this},N.prototype.dummy=function(){var h;return h=new s(this),h},N.prototype.instruction=function(h,E){var I,L,A,C,l;if(h!=null&&(h=f(h)),E!=null&&(E=f(E)),Array.isArray(h))for(C=0,l=h.length;C<l;C++)I=h[C],this.instruction(I);else if(v(h))for(I in h)S.call(h,I)&&(L=h[I],this.instruction(I,L));else w(E)&&(E=E.apply()),A=new p(this,h,E),this.children.push(A);return this},N.prototype.instructionBefore=function(h,E){var I,L;return I=this.parent.children.indexOf(this),L=this.parent.children.splice(I),this.parent.instruction(h,E),Array.prototype.push.apply(this.parent.children,L),this},N.prototype.instructionAfter=function(h,E){var I,L;return I=this.parent.children.indexOf(this),L=this.parent.children.splice(I+1),this.parent.instruction(h,E),Array.prototype.push.apply(this.parent.children,L),this},N.prototype.declaration=function(h,E,I){var L,A;return L=this.document(),A=new o(L,h,E,I),L.children.length===0?L.children.unshift(A):L.children[0].type===t.Declaration?L.children[0]=A:L.children.unshift(A),L.root()||L},N.prototype.dtd=function(h,E){var I,L,A,C,l,_,F,k,q,B;for(L=this.document(),A=new i(L,h,E),q=L.children,C=l=0,F=q.length;l<F;C=++l)if(I=q[C],I.type===t.DocType)return L.children[C]=A,A;for(B=L.children,C=_=0,k=B.length;_<k;C=++_)if(I=B[C],I.isRoot)return L.children.splice(C,0,A),A;return L.children.push(A),A},N.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},N.prototype.root=function(){var h;for(h=this;h;){if(h.type===t.Document)return h.rootObject;if(h.isRoot)return h;h=h.parent}},N.prototype.document=function(){var h;for(h=this;h;){if(h.type===t.Document)return h;h=h.parent}},N.prototype.end=function(h){return this.document().end(h)},N.prototype.prev=function(){var h;if(h=this.parent.children.indexOf(this),h<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[h-1]},N.prototype.next=function(){var h;if(h=this.parent.children.indexOf(this),h===-1||h===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[h+1]},N.prototype.importDocument=function(h){var E;return E=h.root().clone(),E.parent=this,E.isRoot=!1,this.children.push(E),this},N.prototype.debugInfo=function(h){var E,I;return h=h||this.name,h==null&&!((E=this.parent)!=null&&E.name)?"":h==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+h+">, parent: <"+this.parent.name+">":"node: <"+h+">"},N.prototype.ele=function(h,E,I){return this.element(h,E,I)},N.prototype.nod=function(h,E,I){return this.node(h,E,I)},N.prototype.txt=function(h){return this.text(h)},N.prototype.dat=function(h){return this.cdata(h)},N.prototype.com=function(h){return this.comment(h)},N.prototype.ins=function(h,E){return this.instruction(h,E)},N.prototype.doc=function(){return this.document()},N.prototype.dec=function(h,E,I){return this.declaration(h,E,I)},N.prototype.e=function(h,E,I){return this.element(h,E,I)},N.prototype.n=function(h,E,I){return this.node(h,E,I)},N.prototype.t=function(h){return this.text(h)},N.prototype.d=function(h){return this.cdata(h)},N.prototype.c=function(h){return this.comment(h)},N.prototype.r=function(h){return this.raw(h)},N.prototype.i=function(h,E){return this.instruction(h,E)},N.prototype.u=function(){return this.up()},N.prototype.importXMLBuilder=function(h){return this.importDocument(h)},N.prototype.replaceChild=function(h,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.removeChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.appendChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.hasChildNodes=function(){return this.children.length!==0},N.prototype.cloneNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isSupported=function(h,E){return!0},N.prototype.hasAttributes=function(){return this.attribs.length!==0},N.prototype.compareDocumentPosition=function(h){var E,I;return E=this,E===h?0:this.document()!==h.document()?(I=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?I|=e.Preceding:I|=e.Following,I):E.isAncestor(h)?e.Contains|e.Preceding:E.isDescendant(h)?e.Contains|e.Following:E.isPreceding(h)?e.Preceding:e.Following},N.prototype.isSameNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupPrefix=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isDefaultNamespace=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupNamespaceURI=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isEqualNode=function(h){var E,I,L;if(h.nodeType!==this.nodeType||h.children.length!==this.children.length)return!1;for(E=I=0,L=this.children.length-1;0<=L?I<=L:I>=L;E=0<=L?++I:--I)if(!this.children[E].isEqualNode(h.children[E]))return!1;return!0},N.prototype.getFeature=function(h,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.setUserData=function(h,E,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.getUserData=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.contains=function(h){return h?h===this||this.isDescendant(h):!1},N.prototype.isDescendant=function(h){var E,I,L,A,C;for(C=this.children,L=0,A=C.length;L<A;L++)if(E=C[L],h===E||(I=E.isDescendant(h),I))return!0;return!1},N.prototype.isAncestor=function(h){return h.isDescendant(this)},N.prototype.isPreceding=function(h){var E,I;return E=this.treePosition(h),I=this.treePosition(this),E===-1||I===-1?!1:E<I},N.prototype.isFollowing=function(h){var E,I;return E=this.treePosition(h),I=this.treePosition(this),E===-1||I===-1?!1:E>I},N.prototype.treePosition=function(h){var E,I;return I=0,E=!1,this.foreachTreeNode(this.document(),function(L){if(I++,!E&&L===h)return E=!0}),E?I:-1},N.prototype.foreachTreeNode=function(h,E){var I,L,A,C,l;for(h||(h=this.document()),C=h.children,L=0,A=C.length;L<A;L++){if(I=C[L],l=E(I))return l;if(l=this.foreachTreeNode(I,E),l)return l}},N}()}.call(G)),bt.exports}var Rt={exports:{}},gr;function ai(){return gr||(gr=1,function(){var e=function(n,r){return function(){return n.apply(r,arguments)}},t={}.hasOwnProperty;Rt.exports=function(){function n(r){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var o,i,s;r||(r={}),this.options=r,this.options.version||(this.options.version="1.0"),i=r.stringify||{};for(o in i)t.call(i,o)&&(s=i[o],this[o]=s)}return n.prototype.name=function(r){return this.options.noValidation?r:this.assertLegalName(""+r||"")},n.prototype.text=function(r){return this.options.noValidation?r:this.assertLegalChar(this.textEscape(""+r||""))},n.prototype.cdata=function(r){return this.options.noValidation?r:(r=""+r||"",r=r.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(r))},n.prototype.comment=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+r);return this.assertLegalChar(r)},n.prototype.raw=function(r){return this.options.noValidation?r:""+r||""},n.prototype.attValue=function(r){return this.options.noValidation?r:this.assertLegalChar(this.attEscape(r=""+r||""))},n.prototype.insTarget=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.insValue=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/\?>/))throw new Error("Invalid processing instruction value: "+r);return this.assertLegalChar(r)},n.prototype.xmlVersion=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+r);return r},n.prototype.xmlEncoding=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+r);return this.assertLegalChar(r)},n.prototype.xmlStandalone=function(r){return this.options.noValidation?r:r?"yes":"no"},n.prototype.dtdPubID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdSysID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdElementValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttType=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttDefault=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdEntityValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdNData=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(r){var o,i;if(this.options.noValidation)return r;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o))throw new Error("Invalid character in string: "+r+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o)))throw new Error("Invalid character in string: "+r+" at index "+i.index);return r},n.prototype.assertLegalName=function(r){var o;if(this.options.noValidation)return r;if(this.assertLegalChar(r),o=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!r.match(o))throw new Error("Invalid character in name");return r},n.prototype.textEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n}()}.call(G)),Rt.exports}var Bt={exports:{}},Xt={exports:{}},$t={exports:{}},mr;function et(){return mr||(mr=1,function(){$t.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(G)),$t.exports}var yr;function ui(){return yr||(yr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Ne().assign,e=ee(),hn(),bn(),fn(),pn(),ln(),wn(),En(),Nn(),oi(),dn(),mn(),gn(),yn(),t=et(),Xt.exports=function(){function o(i){var s,a,u;i||(i={}),this.options=i,a=i.writer||{};for(s in a)r.call(a,s)&&(u=a[s],this["_"+s]=this[s],this[s]=u)}return o.prototype.filterOptions=function(i){var s,a,u,p,c,d,f,y;return i||(i={}),i=n({},this.options,i),s={writer:this},s.pretty=i.pretty||!1,s.allowEmpty=i.allowEmpty||!1,s.indent=(a=i.indent)!=null?a:" ",s.newline=(u=i.newline)!=null?u:`
72
+ `,s.offset=(p=i.offset)!=null?p:0,s.dontPrettyTextNodes=(c=(d=i.dontPrettyTextNodes)!=null?d:i.dontprettytextnodes)!=null?c:0,s.spaceBeforeSlash=(f=(y=i.spaceBeforeSlash)!=null?y:i.spacebeforeslash)!=null?f:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=t.None,s},o.prototype.indent=function(i,s,a){var u;return!s.pretty||s.suppressPrettyCount?"":s.pretty&&(u=(a||0)+s.offset+1,u>0)?new Array(u).join(s.indent):""},o.prototype.endline=function(i,s,a){return!s.pretty||s.suppressPrettyCount?"":s.newline},o.prototype.attribute=function(i,s,a){var u;return this.openAttribute(i,s,a),u=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,s,a),u},o.prototype.cdata=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=t.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,p,c,d,f;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,d=this.indent(i,s,a),d+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?d+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(d+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(d+=" [",d+=this.endline(i,s,a),s.state=t.InsideTag,f=i.children,p=0,c=f.length;p<c;p++)u=f[p],d+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,d+="]"}return s.state=t.CloseTag,d+=s.spaceBeforeSlash+">",d+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),d},o.prototype.element=function(i,s,a){var u,p,c,d,f,y,w,v,b,S,N,h,E,I;a||(a=0),S=!1,N="",this.openNode(i,s,a),s.state=t.OpenTag,N+=this.indent(i,s,a)+"<"+i.name,h=i.attribs;for(b in h)r.call(h,b)&&(u=h[b],N+=this.attribute(u,s,a));if(c=i.children.length,d=c===0?null:i.children[0],c===0||i.children.every(function(L){return(L.type===e.Text||L.type===e.Raw)&&L.value===""}))s.allowEmpty?(N+=">",s.state=t.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,N+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&c===1&&(d.type===e.Text||d.type===e.Raw)&&d.value!=null)N+=">",s.state=t.InsideTag,s.suppressPrettyCount++,S=!0,N+=this.writeChildNode(d,s,a+1),s.suppressPrettyCount--,S=!1,s.state=t.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(E=i.children,f=0,w=E.length;f<w;f++)if(p=E[f],(p.type===e.Text||p.type===e.Raw)&&p.value!=null){s.suppressPrettyCount++,S=!0;break}}for(N+=">"+this.endline(i,s,a),s.state=t.InsideTag,I=i.children,y=0,v=I.length;y<v;y++)p=I[y],N+=this.writeChildNode(p,s,a+1);s.state=t.CloseTag,N+=this.indent(i,s,a)+"</"+i.name+">",S&&s.suppressPrettyCount--,N+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),N},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case e.CData:return this.cdata(i,s,a);case e.Comment:return this.comment(i,s,a);case e.Element:return this.element(i,s,a);case e.Raw:return this.raw(i,s,a);case e.Text:return this.text(i,s,a);case e.ProcessingInstruction:return this.processingInstruction(i,s,a);case e.Dummy:return"";case e.Declaration:return this.declaration(i,s,a);case e.DocType:return this.docType(i,s,a);case e.AttributeDeclaration:return this.dtdAttList(i,s,a);case e.ElementDeclaration:return this.dtdElement(i,s,a);case e.EntityDeclaration:return this.dtdEntity(i,s,a);case e.NotationDeclaration:return this.dtdNotation(i,s,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?",s.state=t.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=t.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=t.InsideTag,u+=" "+i.name+" "+i.value,s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=t.InsideTag,i.pe&&(u+=" %"),u+=" "+i.name,i.value?u+=' "'+i.value+'"':(i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),i.nData&&(u+=" NDATA "+i.nData)),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=t.InsideTag,u+=" "+i.name,i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?u+=' PUBLIC "'+i.pubID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.openNode=function(i,s,a){},o.prototype.closeNode=function(i,s,a){},o.prototype.openAttribute=function(i,s,a){},o.prototype.closeAttribute=function(i,s,a){},o}()}.call(G)),Xt.exports}var br;function Tn(){return br||(br=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=ui(),Bt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,p,c,d;for(s=this.filterOptions(s),c="",d=i.children,u=0,p=d.length;u<p;u++)a=d[u],c+=this.writeChildNode(a,s,0);return s.pretty&&c.slice(-s.newline.length)===s.newline&&(c=c.slice(0,-s.newline.length)),c},o}(e)}.call(G)),Bt.exports}var wr;function ci(){return wr||(wr=1,function(){var e,t,n,r,o,i,s,a=function(p,c){for(var d in c)u.call(c,d)&&(p[d]=c[d]);function f(){this.constructor=p}return f.prototype=c.prototype,p.prototype=new f,p.__super__=c.prototype,p},u={}.hasOwnProperty;s=Ne().isPlainObject,n=ii(),t=Lo(),r=pe(),e=ee(),i=ai(),o=Tn(),dt.exports=function(p){a(c,p);function c(d){c.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,d||(d={}),d.writer||(d.writer=new o),this.options=d,this.stringify=new i(d)}return Object.defineProperty(c.prototype,"implementation",{value:new n}),Object.defineProperty(c.prototype,"doctype",{get:function(){var d,f,y,w;for(w=this.children,f=0,y=w.length;f<y;f++)if(d=w[f],d.type===e.DocType)return d;return null}}),Object.defineProperty(c.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(c.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(c.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(c.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(c.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(c.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(c.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(c.prototype,"origin",{get:function(){return null}}),Object.defineProperty(c.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(c.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(c.prototype,"contentType",{get:function(){return null}}),c.prototype.end=function(d){var f;return f={},d?s(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},c.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},c.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.renameNode=function(d,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createNodeIterator=function(d,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTreeWalker=function(d,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(r)}.call(G)),dt.exports}var Ut={exports:{}},Er;function Do(){return Er||(Er=1,function(){var e,t,n,r,o,i,s,a,u,p,c,d,f,y,w,v,b,S,N,h,E,I,L,A={}.hasOwnProperty;L=Ne(),E=L.isObject,h=L.isFunction,I=L.isPlainObject,N=L.getValue,e=ee(),d=ci(),f=ln(),r=fn(),o=pn(),w=wn(),S=En(),y=Nn(),p=hn(),c=bn(),i=dn(),a=gn(),s=mn(),u=yn(),n=si(),b=ai(),v=Tn(),t=et(),Ut.exports=function(){function C(l,_,F){var k;this.name="?xml",this.type=e.Document,l||(l={}),k={},l.writer?I(l.writer)&&(k=l.writer,l.writer=new v):l.writer=new v,this.options=l,this.writer=l.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new b(l),this.onDataCallback=_||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return C.prototype.createChildNode=function(l){var _,F,k,q,B,U,H,W;switch(l.type){case e.CData:this.cdata(l.value);break;case e.Comment:this.comment(l.value);break;case e.Element:k={},H=l.attribs;for(F in H)A.call(H,F)&&(_=H[F],k[F]=_.value);this.node(l.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(l.value);break;case e.Text:this.text(l.value);break;case e.ProcessingInstruction:this.instruction(l.target,l.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+l.constructor.name)}for(W=l.children,B=0,U=W.length;B<U;B++)q=W[B],this.createChildNode(q),q.type===e.Element&&this.up();return this},C.prototype.dummy=function(){return this},C.prototype.node=function(l,_,F){var k;if(l==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(l));return this.openCurrent(),l=N(l),_==null&&(_={}),_=N(_),E(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new f(this,l,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},C.prototype.element=function(l,_,F){var k,q,B,U,H,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(l)||E(l)||h(l))for(U=this.options.noValidation,this.options.noValidation=!0,W=new d(this.options).element("TEMP_ROOT"),W.element(l),this.options.noValidation=U,H=W.children,q=0,B=H.length;q<B;q++)k=H[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(l,_,F);return this},C.prototype.attribute=function(l,_){var F,k;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(l));if(l!=null&&(l=N(l)),E(l))for(F in l)A.call(l,F)&&(k=l[F],this.attribute(F,k));else h(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[l]=new n(this,l,""):_!=null&&(this.currentNode.attribs[l]=new n(this,l,_));return this},C.prototype.text=function(l){var _;return this.openCurrent(),_=new S(this,l),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.cdata=function(l){var _;return this.openCurrent(),_=new r(this,l),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.comment=function(l){var _;return this.openCurrent(),_=new o(this,l),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.raw=function(l){var _;return this.openCurrent(),_=new w(this,l),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.instruction=function(l,_){var F,k,q,B,U;if(this.openCurrent(),l!=null&&(l=N(l)),_!=null&&(_=N(_)),Array.isArray(l))for(F=0,B=l.length;F<B;F++)k=l[F],this.instruction(k);else if(E(l))for(k in l)A.call(l,k)&&(q=l[k],this.instruction(k,q));else h(_)&&(_=_.apply()),U=new y(this,l,_),this.onData(this.writer.processingInstruction(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},C.prototype.declaration=function(l,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new p(this,l,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.doctype=function(l,_,F){if(this.openCurrent(),l==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new c(this,_,F),this.currentNode.rootNodeName=l,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},C.prototype.dtdElement=function(l,_){var F;return this.openCurrent(),F=new s(this,l,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.attList=function(l,_,F,k,q){var B;return this.openCurrent(),B=new i(this,l,_,F,k,q),this.onData(this.writer.dtdAttList(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.entity=function(l,_){var F;return this.openCurrent(),F=new a(this,!1,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.pEntity=function(l,_){var F;return this.openCurrent(),F=new a(this,!0,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.notation=function(l,_){var F;return this.openCurrent(),F=new u(this,l,_),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},C.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},C.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},C.prototype.openNode=function(l){var _,F,k,q;if(!l.isOpen){if(!this.root&&this.currentLevel===0&&l.type===e.Element&&(this.root=l),F="",l.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<"+l.name,q=l.attribs;for(k in q)A.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(l.children?">":"/>")+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+l.rootNodeName,l.pubID&&l.sysID?F+=' PUBLIC "'+l.pubID+'" "'+l.sysID+'"':l.sysID&&(F+=' SYSTEM "'+l.sysID+'"'),l.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(l,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),l.isOpen=!0}},C.prototype.closeNode=function(l){var _;if(!l.isClosed)return _="",this.writerOptions.state=t.CloseTag,l.type===e.Element?_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"</"+l.name+">"+this.writer.endline(l,this.writerOptions,this.currentLevel):_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),l.isClosed=!0},C.prototype.onData=function(l,_){return this.documentStarted=!0,this.onDataCallback(l,_+1)},C.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},C.prototype.debugInfo=function(l){return l==null?"":"node: <"+l+">"},C.prototype.ele=function(){return this.element.apply(this,arguments)},C.prototype.nod=function(l,_,F){return this.node(l,_,F)},C.prototype.txt=function(l){return this.text(l)},C.prototype.dat=function(l){return this.cdata(l)},C.prototype.com=function(l){return this.comment(l)},C.prototype.ins=function(l,_){return this.instruction(l,_)},C.prototype.dec=function(l,_,F){return this.declaration(l,_,F)},C.prototype.dtd=function(l,_,F){return this.doctype(l,_,F)},C.prototype.e=function(l,_,F){return this.element(l,_,F)},C.prototype.n=function(l,_,F){return this.node(l,_,F)},C.prototype.t=function(l){return this.text(l)},C.prototype.d=function(l){return this.cdata(l)},C.prototype.c=function(l){return this.comment(l)},C.prototype.r=function(l){return this.raw(l)},C.prototype.i=function(l,_){return this.instruction(l,_)},C.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.ent=function(l,_){return this.entity(l,_)},C.prototype.pent=function(l,_){return this.pEntity(l,_)},C.prototype.not=function(l,_){return this.notation(l,_)},C}()}.call(G)),Ut.exports}var Vt={exports:{}},Nr;function Mo(){return Nr||(Nr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;e=ee(),n=ui(),t=et(),Vt.exports=function(i){r(s,i);function s(a,u){this.stream=a,s.__super__.constructor.call(this,u)}return s.prototype.endline=function(a,u,p){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,p)},s.prototype.document=function(a,u){var p,c,d,f,y,w,v,b,S;for(v=a.children,c=d=0,y=v.length;d<y;c=++d)p=v[c],p.isLastRootNode=c===a.children.length-1;for(u=this.filterOptions(u),b=a.children,S=[],f=0,w=b.length;f<w;f++)p=b[f],S.push(this.writeChildNode(p,u,0));return S},s.prototype.attribute=function(a,u,p){return this.stream.write(s.__super__.attribute.call(this,a,u,p))},s.prototype.cdata=function(a,u,p){return this.stream.write(s.__super__.cdata.call(this,a,u,p))},s.prototype.comment=function(a,u,p){return this.stream.write(s.__super__.comment.call(this,a,u,p))},s.prototype.declaration=function(a,u,p){return this.stream.write(s.__super__.declaration.call(this,a,u,p))},s.prototype.docType=function(a,u,p){var c,d,f,y;if(p||(p=0),this.openNode(a,u,p),u.state=t.OpenTag,this.stream.write(this.indent(a,u,p)),this.stream.write("<!DOCTYPE "+a.root().name),a.pubID&&a.sysID?this.stream.write(' PUBLIC "'+a.pubID+'" "'+a.sysID+'"'):a.sysID&&this.stream.write(' SYSTEM "'+a.sysID+'"'),a.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(a,u,p)),u.state=t.InsideTag,y=a.children,d=0,f=y.length;d<f;d++)c=y[d],this.writeChildNode(c,u,p+1);u.state=t.CloseTag,this.stream.write("]")}return u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,p)),u.state=t.None,this.closeNode(a,u,p)},s.prototype.element=function(a,u,p){var c,d,f,y,w,v,b,S,N;p||(p=0),this.openNode(a,u,p),u.state=t.OpenTag,this.stream.write(this.indent(a,u,p)+"<"+a.name),S=a.attribs;for(b in S)o.call(S,b)&&(c=S[b],this.attribute(c,u,p));if(f=a.children.length,y=f===0?null:a.children[0],f===0||a.children.every(function(h){return(h.type===e.Text||h.type===e.Raw)&&h.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=t.CloseTag,this.stream.write("</"+a.name+">")):(u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&f===1&&(y.type===e.Text||y.type===e.Raw)&&y.value!=null)this.stream.write(">"),u.state=t.InsideTag,u.suppressPrettyCount++,this.writeChildNode(y,u,p+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,p)),u.state=t.InsideTag,N=a.children,w=0,v=N.length;w<v;w++)d=N[w],this.writeChildNode(d,u,p+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,p)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,p)),u.state=t.None,this.closeNode(a,u,p)},s.prototype.processingInstruction=function(a,u,p){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,p))},s.prototype.raw=function(a,u,p){return this.stream.write(s.__super__.raw.call(this,a,u,p))},s.prototype.text=function(a,u,p){return this.stream.write(s.__super__.text.call(this,a,u,p))},s.prototype.dtdAttList=function(a,u,p){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,p))},s.prototype.dtdElement=function(a,u,p){return this.stream.write(s.__super__.dtdElement.call(this,a,u,p))},s.prototype.dtdEntity=function(a,u,p){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,p))},s.prototype.dtdNotation=function(a,u,p){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,p))},s}(n)}.call(G)),Vt.exports}var Tr;function Co(){return Tr||(Tr=1,function(){var e,t,n,r,o,i,s,a,u,p;p=Ne(),a=p.assign,u=p.isFunction,n=ii(),r=ci(),o=Do(),s=Tn(),i=Mo(),e=ee(),t=et(),we.create=function(c,d,f,y){var w,v;if(c==null)throw new Error("Root element needs a name.");return y=a({},d,f,y),w=new r(y),v=w.element(c),y.headless||(w.declaration(y),(y.pubID!=null||y.sysID!=null)&&w.dtd(y)),v},we.begin=function(c,d,f){var y;return u(c)&&(y=[c,d],d=y[0],f=y[1],c={}),d?new o(c,d,f):new r(c)},we.stringWriter=function(c){return new s(c)},we.streamWriter=function(c,d){return new i(c,d)},we.implementation=new n,we.nodeType=e,we.writerState=t}.call(G)),we}var Ir;function Fo(){return Ir||(Ir=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=Co(),t=un().defaults,r=function(s){return typeof s=="string"&&(s.indexOf("&")>=0||s.indexOf(">")>=0||s.indexOf("<")>=0)},o=function(s){return"<![CDATA["+n(s)+"]]>"},n=function(s){return s.replace("]]>","]]]]><![CDATA[>")},pt.Builder=function(){function s(a){var u,p,c;this.options={},p=t["0.2"];for(u in p)i.call(p,u)&&(c=p[u],this.options[u]=c);for(u in a)i.call(a,u)&&(c=a[u],this.options[u]=c)}return s.prototype.buildObject=function(a){var u,p,c,d,f;return u=this.options.attrkey,p=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(f=Object.keys(a)[0],a=a[f]):f=this.options.rootName,c=function(y){return function(w,v){var b,S,N,h,E,I;if(typeof v!="object")y.options.cdata&&r(v)?w.raw(o(v)):w.txt(v);else if(Array.isArray(v)){for(h in v)if(i.call(v,h)){S=v[h];for(E in S)N=S[E],w=c(w.ele(E),N).up()}}else for(E in v)if(i.call(v,E))if(S=v[E],E===u){if(typeof S=="object")for(b in S)I=S[b],w=w.att(b,I)}else if(E===p)y.options.cdata&&r(S)?w=w.raw(o(S)):w=w.txt(S);else if(Array.isArray(S))for(h in S)i.call(S,h)&&(N=S[h],typeof N=="string"?y.options.cdata&&r(N)?w=w.ele(E).raw(o(N)).up():w=w.ele(E,N).up():w=c(w.ele(E),N).up());else typeof S=="object"?w=c(w.ele(E),S).up():typeof S=="string"&&y.options.cdata&&r(S)?w=w.ele(E).raw(o(S)).up():(S==null&&(S=""),w=w.ele(E,S.toString()).up());return w}}(this),d=e.create(f,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(d,a).end(this.options.renderOpts)},s}()}.call(G)),pt}var qt={},Wt={},vr;function jo(){return vr||(vr=1,function(e){(function(t){t.parser=function(m,g){return new r(m,g)},t.SAXParser=r,t.SAXStream=c,t.createStream=p,t.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,g){if(!(this instanceof r))return new r(m,g);var M=this;i(M),M.q=M.c="",M.bufferCheckPosition=t.MAX_BUFFER_LENGTH,M.opt=g||{},M.opt.lowercase=M.opt.lowercase||M.opt.lowercasetags,M.looseCase=M.opt.lowercase?"toLowerCase":"toUpperCase",M.opt.maxEntityCount=M.opt.maxEntityCount||512,M.opt.maxEntityDepth=M.opt.maxEntityDepth||4,M.entityCount=M.entityDepth=0,M.tags=[],M.closed=M.closedRoot=M.sawRoot=!1,M.tag=M.error=null,M.strict=!!m,M.noscript=!!(m||M.opt.noscript),M.state=l.BEGIN,M.strictEntities=M.opt.strictEntities,M.ENTITIES=M.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),M.attribList=[],M.opt.xmlns&&(M.ns=Object.create(v)),M.opt.unquotedAttributeValues===void 0&&(M.opt.unquotedAttributeValues=!m),M.trackPosition=M.opt.position!==!1,M.trackPosition&&(M.position=M.line=M.column=0),F(M,"onready")}Object.create||(Object.create=function(m){function g(){}g.prototype=m;var M=new g;return M}),Object.keys||(Object.keys=function(m){var g=[];for(var M in m)m.hasOwnProperty(M)&&g.push(M);return g});function o(m){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),M=0,O=0,Y=n.length;O<Y;O++){var K=m[n[O]].length;if(K>g)switch(n[O]){case"textNode":q(m);break;case"cdata":k(m,"oncdata",m.cdata),m.cdata="";break;case"script":k(m,"onscript",m.script),m.script="";break;default:U(m,"Max buffer length exceeded: "+n[O])}M=Math.max(M,K)}var Q=t.MAX_BUFFER_LENGTH-M;m.bufferCheckPosition=Q+m.position}function i(m){for(var g=0,M=n.length;g<M;g++)m[n[g]]=""}function s(m){q(m),m.cdata!==""&&(k(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(k(m,"onscript",m.script),m.script="")}r.prototype={end:function(){H(this)},write:rt,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var u=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function p(m,g){return new c(m,g)}function c(m,g){if(!(this instanceof c))return new c(m,g);a.apply(this),this._parser=new r(m,g),this.writable=!0,this.readable=!0;var M=this;this._parser.onend=function(){M.emit("end")},this._parser.onerror=function(O){M.emit("error",O),M._parser.error=null},this._decoder=null,u.forEach(function(O){Object.defineProperty(M,"on"+O,{get:function(){return M._parser["on"+O]},set:function(Y){if(!Y)return M.removeAllListeners(O),M._parser["on"+O]=Y,Y;M.on(O,Y)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(a.prototype,{constructor:{value:c}}),c.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},c.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var g=this._decoder.decode();g&&(this._parser.write(g),this.emit("data",g))}return this._parser.end(),!0},c.prototype.on=function(m,g){var M=this;return!M._parser["on"+m]&&u.indexOf(m)!==-1&&(M._parser["on"+m]=function(){var O=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);O.splice(0,0,m),M.emit.apply(M,O)}),a.prototype.on.call(M,m,g)};var d="[CDATA[",f="DOCTYPE",y="http://www.w3.org/XML/1998/namespace",w="http://www.w3.org/2000/xmlns/",v={xml:y,xmlns:w},b=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,S=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,N=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function E(m){return m===" "||m===`
73
+ `||m==="\r"||m===" "}function I(m){return m==='"'||m==="'"}function L(m){return m===">"||E(m)}function A(m,g){return m.test(g)}function C(m,g){return!A(m,g)}var l=0;t.STATE={BEGIN:l++,BEGIN_WHITESPACE:l++,TEXT:l++,TEXT_ENTITY:l++,OPEN_WAKA:l++,SGML_DECL:l++,SGML_DECL_QUOTED:l++,DOCTYPE:l++,DOCTYPE_QUOTED:l++,DOCTYPE_DTD:l++,DOCTYPE_DTD_QUOTED:l++,COMMENT_STARTING:l++,COMMENT:l++,COMMENT_ENDING:l++,COMMENT_ENDED:l++,CDATA:l++,CDATA_ENDING:l++,CDATA_ENDING_2:l++,PROC_INST:l++,PROC_INST_BODY:l++,PROC_INST_ENDING:l++,OPEN_TAG:l++,OPEN_TAG_SLASH:l++,ATTRIB:l++,ATTRIB_NAME:l++,ATTRIB_NAME_SAW_WHITE:l++,ATTRIB_VALUE:l++,ATTRIB_VALUE_QUOTED:l++,ATTRIB_VALUE_CLOSED:l++,ATTRIB_VALUE_UNQUOTED:l++,ATTRIB_VALUE_ENTITY_Q:l++,ATTRIB_VALUE_ENTITY_U:l++,CLOSE_TAG:l++,CLOSE_TAG_SAW_WHITE:l++,SCRIPT:l++,SCRIPT_ENDING:l++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var g=t.ENTITIES[m],M=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[m]=M});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;l=t.STATE;function F(m,g,M){m[g]&&m[g](M)}function k(m,g,M){m.textNode&&q(m),F(m,g,M)}function q(m){m.textNode=B(m.opt,m.textNode),m.textNode&&F(m,"ontext",m.textNode),m.textNode=""}function B(m,g){return m.trim&&(g=g.trim()),m.normalize&&(g=g.replace(/\s+/g," ")),g}function U(m,g){return q(m),m.trackPosition&&(g+=`
70
74
  Line: `+m.line+`
71
75
  Column: `+m.column+`
72
- Char: `+m.c),d=new Error(d),m.error=d,F(m,"onerror",d),m}function H(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==l.BEGIN&&m.state!==l.BEGIN_WHITESPACE&&m.state!==l.TEXT&&U(m,"Unexpected end"),q(m),m.c="",m.closed=!0,F(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,d){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&U(m,d)}function Ze(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var d=m.tags[m.tags.length-1]||m,M=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(M.ns=d.ns),m.attribList.length=0,k(m,"onopentagstart",M)}function je(m,d){var M=m.indexOf(":"),v=M<0?["",m]:m.split(":"),Y=v[0],J=v[1];return d&&m==="xmlns"&&(Y="xmlns",J=""),{prefix:Y,local:J}}function Ae(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var d=je(m.attribName,!0),M=d.prefix,v=d.local;if(M==="xmlns")if(v==="xml"&&m.attribValue!==b)W(m,"xml: prefix must be bound to "+b+`
73
- Actual: `+m.attribValue);else if(v==="xmlns"&&m.attribValue!==N)W(m,"xmlns: prefix must be bound to "+N+`
74
- Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.ns&&(Y.ns=Object.create(J.ns)),Y.ns[v]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,k(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function ue(m,d){if(m.opt.xmlns){var M=m.tag,v=je(m.tagName);M.prefix=v.prefix,M.local=v.local,M.uri=M.ns[v.prefix]||"",M.prefix&&!M.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),M.uri=v.prefix);var Y=m.tags[m.tags.length-1]||m;M.ns&&Y.ns!==M.ns&&Object.keys(M.ns).forEach(function($){k(m,"onopennamespace",{prefix:$,uri:M.ns[$]})});for(var J=0,z=m.attribList.length;J<z;J++){var ne=m.attribList[J],T=ne[0],A=ne[1],j=je(T,!0),D=j.prefix,x=j.local,X=D===""?"":M.ns[D]||"",R={name:T,value:A,prefix:D,local:x,uri:X};D&&D!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(D)),R.uri=D),m.tag.attributes[T]=R,k(m,"onattribute",R)}m.attribList.length=0}m.tag.isSelfClosing=!!d,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),d||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=l.SCRIPT:m.state=l.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function me(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=l.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=l.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var d=m.tags.length,M=m.tagName;m.strict||(M=M[m.looseCase]());for(var v=M;d--;){var Y=m.tags[d];if(Y.name!==v)W(m,"Unexpected close tag");else break}if(d<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=l.TEXT;return}m.tagName=M;for(var J=m.tags.length;J-- >d;){var z=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var ne={};for(var T in z.ns)ne[T]=z.ns[T];var A=m.tags[m.tags.length-1]||m;m.opt.xmlns&&z.ns!==A.ns&&Object.keys(z.ns).forEach(function(j){var D=z.ns[j];k(m,"onclosenamespace",{prefix:j,uri:D})})}d===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=l.TEXT}function et(m){var d=m.entity,M=d.toLowerCase(),v,Y="";return m.ENTITIES[d]?m.ENTITIES[d]:m.ENTITIES[M]?m.ENTITIES[M]:(d=M,d.charAt(0)==="#"&&(d.charAt(1)==="x"?(d=d.slice(2),v=parseInt(d,16),Y=v.toString(16)):(d=d.slice(1),v=parseInt(d,10),Y=v.toString(10))),d=d.replace(/^0+/,""),isNaN(v)||Y.toLowerCase()!==d||v<0||v>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(v))}function V(m,d){d==="<"?(m.state=l.OPEN_WAKA,m.startTagPosition=m.position):w(d)||(W(m,"Non-whitespace before first tag."),m.textNode=d,m.state=l.TEXT)}function Pe(m,d){var M="";return d<m.length&&(M=m.charAt(d)),M}function tt(m){var d=this;if(this.error)throw this.error;if(d.closed)return U(d,"Cannot write after close. Assign an onready handler.");if(m===null)return H(d);typeof m=="object"&&(m=m.toString());for(var M=0,v="";v=Pe(m,M++),d.c=v,!!v;)switch(d.trackPosition&&(d.position++,v===`
75
- `?(d.line++,d.column=0):d.column++),d.state){case l.BEGIN:if(d.state=l.BEGIN_WHITESPACE,v==="\uFEFF")continue;V(d,v);continue;case l.BEGIN_WHITESPACE:V(d,v);continue;case l.TEXT:if(d.sawRoot&&!d.closedRoot){for(var J=M-1;v&&v!=="<"&&v!=="&";)v=Pe(m,M++),v&&d.trackPosition&&(d.position++,v===`
76
- `?(d.line++,d.column=0):d.column++);d.textNode+=m.substring(J,M-1)}v==="<"&&!(d.sawRoot&&d.closedRoot&&!d.strict)?(d.state=l.OPEN_WAKA,d.startTagPosition=d.position):(!w(v)&&(!d.sawRoot||d.closedRoot)&&W(d,"Text data outside of root node."),v==="&"?d.state=l.TEXT_ENTITY:d.textNode+=v);continue;case l.SCRIPT:v==="<"?d.state=l.SCRIPT_ENDING:d.script+=v;continue;case l.SCRIPT_ENDING:v==="/"?d.state=l.CLOSE_TAG:(d.script+="<"+v,d.state=l.SCRIPT);continue;case l.OPEN_WAKA:if(v==="!")d.state=l.SGML_DECL,d.sgmlDecl="";else if(!w(v))if(P(y,v))d.state=l.OPEN_TAG,d.tagName=v;else if(v==="/")d.state=l.CLOSE_TAG,d.tagName="";else if(v==="?")d.state=l.PROC_INST,d.procInstName=d.procInstBody="";else{if(W(d,"Unencoded <"),d.startTagPosition+1<d.position){var Y=d.position-d.startTagPosition;v=new Array(Y).join(" ")+v}d.textNode+="<"+v,d.state=l.TEXT}continue;case l.SGML_DECL:if(d.sgmlDecl+v==="--"){d.state=l.COMMENT,d.comment="",d.sgmlDecl="";continue}d.doctype&&d.doctype!==!0&&d.sgmlDecl?(d.state=l.DOCTYPE_DTD,d.doctype+="<!"+d.sgmlDecl+v,d.sgmlDecl=""):(d.sgmlDecl+v).toUpperCase()===g?(k(d,"onopencdata"),d.state=l.CDATA,d.sgmlDecl="",d.cdata=""):(d.sgmlDecl+v).toUpperCase()===p?(d.state=l.DOCTYPE,(d.doctype||d.sawRoot)&&W(d,"Inappropriately located doctype declaration"),d.doctype="",d.sgmlDecl=""):v===">"?(k(d,"onsgmldeclaration",d.sgmlDecl),d.sgmlDecl="",d.state=l.TEXT):(O(v)&&(d.state=l.SGML_DECL_QUOTED),d.sgmlDecl+=v);continue;case l.SGML_DECL_QUOTED:v===d.q&&(d.state=l.SGML_DECL,d.q=""),d.sgmlDecl+=v;continue;case l.DOCTYPE:v===">"?(d.state=l.TEXT,k(d,"ondoctype",d.doctype),d.doctype=!0):(d.doctype+=v,v==="["?d.state=l.DOCTYPE_DTD:O(v)&&(d.state=l.DOCTYPE_QUOTED,d.q=v));continue;case l.DOCTYPE_QUOTED:d.doctype+=v,v===d.q&&(d.q="",d.state=l.DOCTYPE);continue;case l.DOCTYPE_DTD:v==="]"?(d.doctype+=v,d.state=l.DOCTYPE):v==="<"?(d.state=l.OPEN_WAKA,d.startTagPosition=d.position):O(v)?(d.doctype+=v,d.state=l.DOCTYPE_DTD_QUOTED,d.q=v):d.doctype+=v;continue;case l.DOCTYPE_DTD_QUOTED:d.doctype+=v,v===d.q&&(d.state=l.DOCTYPE_DTD,d.q="");continue;case l.COMMENT:v==="-"?d.state=l.COMMENT_ENDING:d.comment+=v;continue;case l.COMMENT_ENDING:v==="-"?(d.state=l.COMMENT_ENDED,d.comment=B(d.opt,d.comment),d.comment&&k(d,"oncomment",d.comment),d.comment=""):(d.comment+="-"+v,d.state=l.COMMENT);continue;case l.COMMENT_ENDED:v!==">"?(W(d,"Malformed comment"),d.comment+="--"+v,d.state=l.COMMENT):d.doctype&&d.doctype!==!0?d.state=l.DOCTYPE_DTD:d.state=l.TEXT;continue;case l.CDATA:for(var J=M-1;v&&v!=="]";)v=Pe(m,M++),v&&d.trackPosition&&(d.position++,v===`
77
- `?(d.line++,d.column=0):d.column++);d.cdata+=m.substring(J,M-1),v==="]"&&(d.state=l.CDATA_ENDING);continue;case l.CDATA_ENDING:v==="]"?d.state=l.CDATA_ENDING_2:(d.cdata+="]"+v,d.state=l.CDATA);continue;case l.CDATA_ENDING_2:v===">"?(d.cdata&&k(d,"oncdata",d.cdata),k(d,"onclosecdata"),d.cdata="",d.state=l.TEXT):v==="]"?d.cdata+="]":(d.cdata+="]]"+v,d.state=l.CDATA);continue;case l.PROC_INST:v==="?"?d.state=l.PROC_INST_ENDING:w(v)?d.state=l.PROC_INST_BODY:d.procInstName+=v;continue;case l.PROC_INST_BODY:if(!d.procInstBody&&w(v))continue;v==="?"?d.state=l.PROC_INST_ENDING:d.procInstBody+=v;continue;case l.PROC_INST_ENDING:v===">"?(k(d,"onprocessinginstruction",{name:d.procInstName,body:d.procInstBody}),d.procInstName=d.procInstBody="",d.state=l.TEXT):(d.procInstBody+="?"+v,d.state=l.PROC_INST_BODY);continue;case l.OPEN_TAG:P(S,v)?d.tagName+=v:(Ze(d),v===">"?ue(d):v==="/"?d.state=l.OPEN_TAG_SLASH:(w(v)||W(d,"Invalid character in tag name"),d.state=l.ATTRIB));continue;case l.OPEN_TAG_SLASH:v===">"?(ue(d,!0),me(d)):(W(d,"Forward-slash in opening tag not followed by >"),d.state=l.ATTRIB);continue;case l.ATTRIB:if(w(v))continue;v===">"?ue(d):v==="/"?d.state=l.OPEN_TAG_SLASH:P(y,v)?(d.attribName=v,d.attribValue="",d.state=l.ATTRIB_NAME):W(d,"Invalid attribute name");continue;case l.ATTRIB_NAME:v==="="?d.state=l.ATTRIB_VALUE:v===">"?(W(d,"Attribute without value"),d.attribValue=d.attribName,Ae(d),ue(d)):w(v)?d.state=l.ATTRIB_NAME_SAW_WHITE:P(S,v)?d.attribName+=v:W(d,"Invalid attribute name");continue;case l.ATTRIB_NAME_SAW_WHITE:if(v==="=")d.state=l.ATTRIB_VALUE;else{if(w(v))continue;W(d,"Attribute without value"),d.tag.attributes[d.attribName]="",d.attribValue="",k(d,"onattribute",{name:d.attribName,value:""}),d.attribName="",v===">"?ue(d):P(y,v)?(d.attribName=v,d.state=l.ATTRIB_NAME):(W(d,"Invalid attribute name"),d.state=l.ATTRIB)}continue;case l.ATTRIB_VALUE:if(w(v))continue;O(v)?(d.q=v,d.state=l.ATTRIB_VALUE_QUOTED):(d.opt.unquotedAttributeValues||U(d,"Unquoted attribute value"),d.state=l.ATTRIB_VALUE_UNQUOTED,d.attribValue=v);continue;case l.ATTRIB_VALUE_QUOTED:if(v!==d.q){v==="&"?d.state=l.ATTRIB_VALUE_ENTITY_Q:d.attribValue+=v;continue}Ae(d),d.q="",d.state=l.ATTRIB_VALUE_CLOSED;continue;case l.ATTRIB_VALUE_CLOSED:w(v)?d.state=l.ATTRIB:v===">"?ue(d):v==="/"?d.state=l.OPEN_TAG_SLASH:P(y,v)?(W(d,"No whitespace between attributes"),d.attribName=v,d.attribValue="",d.state=l.ATTRIB_NAME):W(d,"Invalid attribute name");continue;case l.ATTRIB_VALUE_UNQUOTED:if(!L(v)){v==="&"?d.state=l.ATTRIB_VALUE_ENTITY_U:d.attribValue+=v;continue}Ae(d),v===">"?ue(d):d.state=l.ATTRIB;continue;case l.CLOSE_TAG:if(d.tagName)v===">"?me(d):P(S,v)?d.tagName+=v:d.script?(d.script+="</"+d.tagName+v,d.tagName="",d.state=l.SCRIPT):(w(v)||W(d,"Invalid tagname in closing tag"),d.state=l.CLOSE_TAG_SAW_WHITE);else{if(w(v))continue;C(y,v)?d.script?(d.script+="</"+v,d.state=l.SCRIPT):W(d,"Invalid tagname in closing tag."):d.tagName=v}continue;case l.CLOSE_TAG_SAW_WHITE:if(w(v))continue;v===">"?me(d):W(d,"Invalid characters in closing tag");continue;case l.TEXT_ENTITY:case l.ATTRIB_VALUE_ENTITY_Q:case l.ATTRIB_VALUE_ENTITY_U:var z,ne;switch(d.state){case l.TEXT_ENTITY:z=l.TEXT,ne="textNode";break;case l.ATTRIB_VALUE_ENTITY_Q:z=l.ATTRIB_VALUE_QUOTED,ne="attribValue";break;case l.ATTRIB_VALUE_ENTITY_U:z=l.ATTRIB_VALUE_UNQUOTED,ne="attribValue";break}if(v===";"){var T=et(d);d.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(T)?((d.entityCount+=1)>d.opt.maxEntityCount&&U(d,"Parsed entity count exceeds max entity count"),(d.entityDepth+=1)>d.opt.maxEntityDepth&&U(d,"Parsed entity depth exceeds max entity depth"),d.entity="",d.state=z,d.write(T),d.entityDepth-=1):(d[ne]+=T,d.entity="",d.state=z)}else P(d.entity.length?h:E,v)?d.entity+=v:(W(d,"Invalid character in entity name"),d[ne]+="&"+d.entity+v,d.entity="",d.state=z);continue;default:throw new Error(d,"Unknown state: "+d.state)}return d.position>=d.bufferCheckPosition&&o(d),d}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,d=Math.floor,M=function(){var v=16384,Y=[],J,z,ne=-1,T=arguments.length;if(!T)return"";for(var A="";++ne<T;){var j=Number(arguments[ne]);if(!isFinite(j)||j<0||j>1114111||d(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?Y.push(j):(j-=65536,J=(j>>10)+55296,z=j%1024+56320,Y.push(J,z)),(ne+1===T||Y.length>v)&&(A+=m.apply(null,Y),Y.length=0)}return A};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:M,configurable:!0,writable:!0}):String.fromCodePoint=M}()})(e)}(Vt)),Vt}var qt={},Tr;function Fo(){return Tr||(Tr=1,function(){qt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(G)),qt}var ve={},Or;function ci(){return Or||(Or=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),ve.normalize=function(t){return t.toLowerCase()},ve.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},ve.stripPrefix=function(t){return t.replace(e,"")},ve.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},ve.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(G)),ve}var Ir;function jo(){return Ir||(Ir=1,function(e){(function(){var t,n,r,o,i,s,a,u,f,c=function(b,N){return function(){return b.apply(N,arguments)}},g=function(b,N){for(var I in N)p.call(N,I)&&(b[I]=N[I]);function y(){this.constructor=b}return y.prototype=N.prototype,b.prototype=new y,b.__super__=N.prototype,b},p={}.hasOwnProperty;u=Co(),o=sn,t=Fo(),a=ci(),f=Si.setImmediate,n=on().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,N,I){var y,S,E;for(y=0,S=b.length;y<S;y++)E=b[y],N=E(N,I);return N},r=function(b,N,I){var y;return y=Object.create(null),y.value=I,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(b,N,y)},e.Parser=function(b){g(N,b);function N(I){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,S,E;if(!(this instanceof e.Parser))return new e.Parser(I);this.options={},S=n["0.2"];for(y in S)p.call(S,y)&&(E=S[y],this.options[y]=E);for(y in I)p.call(I,y)&&(E=I[y],this.options[y]=E);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return N.prototype.processAsync=function(){var I,y;try{return this.remaining.length<=this.options.chunkSize?(I=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(I),this.saxParser.close()):(I=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(I),f(this.processAsync))}catch(S){if(y=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},N.prototype.assignOrPush=function(I,y,S){return y in I?(I[y]instanceof Array||r(I,y,[I[y]]),I[y].push(S)):this.options.explicitArray?r(I,y,[S]):r(I,y,S)},N.prototype.reset=function(){var I,y,S,E;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(h){return function(w){if(h.saxParser.resume(),!h.saxParser.errThrown)return h.saxParser.errThrown=!0,h.emit("error",w)}}(this),this.saxParser.onend=function(h){return function(){if(!h.saxParser.ended)return h.saxParser.ended=!0,h.emit("end",h.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,E=[],I=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=function(h){return function(w){var O,L,P,C,l;if(P={},P[y]="",!h.options.ignoreAttrs){l=w.attributes;for(O in l)p.call(l,O)&&(!(I in P)&&!h.options.mergeAttrs&&(P[I]={}),L=h.options.attrValueProcessors?s(h.options.attrValueProcessors,w.attributes[O],O):w.attributes[O],C=h.options.attrNameProcessors?s(h.options.attrNameProcessors,O):O,h.options.mergeAttrs?h.assignOrPush(P,C,L):r(P[I],C,L))}return P["#name"]=h.options.tagNameProcessors?s(h.options.tagNameProcessors,w.name):w.name,h.options.xmlns&&(P[h.options.xmlnskey]={uri:w.uri,local:w.local}),E.push(P)}}(this),this.saxParser.onclosetag=function(h){return function(){var w,O,L,P,C,l,_,F,k,q;if(l=E.pop(),C=l["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete l["#name"],l.cdata===!0&&(w=l.cdata,delete l.cdata),k=E[E.length-1],l[y].match(/^\s*$/)&&!w?(O=l[y],delete l[y]):(h.options.trim&&(l[y]=l[y].trim()),h.options.normalize&&(l[y]=l[y].replace(/\s{2,}/g," ").trim()),l[y]=h.options.valueProcessors?s(h.options.valueProcessors,l[y],C):l[y],Object.keys(l).length===1&&y in l&&!h.EXPLICIT_CHARKEY&&(l=l[y])),i(l)&&(typeof h.options.emptyTag=="function"?l=h.options.emptyTag():l=h.options.emptyTag!==""?h.options.emptyTag:O),h.options.validator!=null&&(q="/"+function(){var B,U,H;for(H=[],B=0,U=E.length;B<U;B++)P=E[B],H.push(P["#name"]);return H}().concat(C).join("/"),function(){var B;try{return l=h.options.validator(q,k&&k[C],l)}catch(U){return B=U,h.emit("error",B)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof l=="object"){if(!h.options.preserveChildrenOrder)P={},h.options.attrkey in l&&(P[h.options.attrkey]=l[h.options.attrkey],delete l[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in l&&(P[h.options.charkey]=l[h.options.charkey],delete l[h.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(P[h.options.childkey]=l),l=P;else if(k){k[h.options.childkey]=k[h.options.childkey]||[],_={};for(L in l)p.call(l,L)&&r(_,L,l[L]);k[h.options.childkey].push(_),delete l["#name"],Object.keys(l).length===1&&y in l&&!h.EXPLICIT_CHARKEY&&(l=l[y])}}return E.length>0?h.assignOrPush(k,C,l):(h.options.explicitRoot&&(F=l,l={},r(l,C,F)),h.resultObject=l,h.saxParser.ended=!0,h.emit("end",h.resultObject))}}(this),S=function(h){return function(w){var O,L;if(L=E[E.length-1],L)return L[y]+=w,h.options.explicitChildren&&h.options.preserveChildrenOrder&&h.options.charsAsChildren&&(h.options.includeWhiteChars||w.replace(/\\n/g,"").trim()!=="")&&(L[h.options.childkey]=L[h.options.childkey]||[],O={"#name":"__text__"},O[y]=w,h.options.normalize&&(O[y]=O[y].replace(/\s{2,}/g," ").trim()),L[h.options.childkey].push(O)),L}}(this),this.saxParser.ontext=S,this.saxParser.oncdata=function(h){return function(w){var O;if(O=S(w),O)return O.cdata=!0}}()},N.prototype.parseString=function(I,y){var S;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return I=I.toString(),I.trim()===""?(this.emit("end",null),!0):(I=t.stripBOM(I),this.options.async?(this.remaining=I,f(this.processAsync),this.saxParser):this.saxParser.write(I).close())}catch(E){if(S=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},N.prototype.parseStringPromise=function(I){return new Promise(function(y){return function(S,E){return y.parseString(I,function(h,w){return h?E(h):S(w)})}}(this))},N}(o),e.parseString=function(b,N,I){var y,S,E;return I!=null?(typeof I=="function"&&(y=I),typeof N=="object"&&(S=N)):(typeof N=="function"&&(y=N),S={}),E=new e.Parser(S),E.parseString(b,y)},e.parseStringPromise=function(b,N){var I,y;return typeof N=="object"&&(I=N),y=new e.Parser(I),y.parseStringPromise(b)}}).call(G)}(Ut)),Ut}var li;(function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;t=on(),e=Mo(),n=jo(),ci(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,li=n.parseStringPromise}).call(G);class ko{constructor(t,n,r){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"";for(const o of r.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o));this.breakOnFirstLine=r.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const n=await li(t,{explicitArray:!1});await this.handleDbgpMessage(n)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
76
+ Char: `+m.c),g=new Error(g),m.error=g,F(m,"onerror",g),m}function H(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==l.BEGIN&&m.state!==l.BEGIN_WHITESPACE&&m.state!==l.TEXT&&U(m,"Unexpected end"),q(m),m.c="",m.closed=!0,F(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,g){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&U(m,g)}function tt(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var g=m.tags[m.tags.length-1]||m,M=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(M.ns=g.ns),m.attribList.length=0,k(m,"onopentagstart",M)}function je(m,g){var M=m.indexOf(":"),O=M<0?["",m]:m.split(":"),Y=O[0],K=O[1];return g&&m==="xmlns"&&(Y="xmlns",K=""),{prefix:Y,local:K}}function Pe(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var g=je(m.attribName,!0),M=g.prefix,O=g.local;if(M==="xmlns")if(O==="xml"&&m.attribValue!==y)W(m,"xml: prefix must be bound to "+y+`
77
+ Actual: `+m.attribValue);else if(O==="xmlns"&&m.attribValue!==w)W(m,"xmlns: prefix must be bound to "+w+`
78
+ Actual: `+m.attribValue);else{var Y=m.tag,K=m.tags[m.tags.length-1]||m;Y.ns===K.ns&&(Y.ns=Object.create(K.ns)),Y.ns[O]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,k(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function ce(m,g){if(m.opt.xmlns){var M=m.tag,O=je(m.tagName);M.prefix=O.prefix,M.local=O.local,M.uri=M.ns[O.prefix]||"",M.prefix&&!M.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),M.uri=O.prefix);var Y=m.tags[m.tags.length-1]||m;M.ns&&Y.ns!==M.ns&&Object.keys(M.ns).forEach(function($){k(m,"onopennamespace",{prefix:$,uri:M.ns[$]})});for(var K=0,Q=m.attribList.length;K<Q;K++){var re=m.attribList[K],T=re[0],P=re[1],j=je(T,!0),D=j.prefix,x=j.local,X=D===""?"":M.ns[D]||"",R={name:T,value:P,prefix:D,local:x,uri:X};D&&D!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(D)),R.uri=D),m.tag.attributes[T]=R,k(m,"onattribute",R)}m.attribList.length=0}m.tag.isSelfClosing=!!g,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),g||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=l.SCRIPT:m.state=l.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function ye(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=l.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=l.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var g=m.tags.length,M=m.tagName;m.strict||(M=M[m.looseCase]());for(var O=M;g--;){var Y=m.tags[g];if(Y.name!==O)W(m,"Unexpected close tag");else break}if(g<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=l.TEXT;return}m.tagName=M;for(var K=m.tags.length;K-- >g;){var Q=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var re={};for(var T in Q.ns)re[T]=Q.ns[T];var P=m.tags[m.tags.length-1]||m;m.opt.xmlns&&Q.ns!==P.ns&&Object.keys(Q.ns).forEach(function(j){var D=Q.ns[j];k(m,"onclosenamespace",{prefix:j,uri:D})})}g===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=l.TEXT}function nt(m){var g=m.entity,M=g.toLowerCase(),O,Y="";return m.ENTITIES[g]?m.ENTITIES[g]:m.ENTITIES[M]?m.ENTITIES[M]:(g=M,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),O=parseInt(g,16),Y=O.toString(16)):(g=g.slice(1),O=parseInt(g,10),Y=O.toString(10))),g=g.replace(/^0+/,""),isNaN(O)||Y.toLowerCase()!==g||O<0||O>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(O))}function V(m,g){g==="<"?(m.state=l.OPEN_WAKA,m.startTagPosition=m.position):E(g)||(W(m,"Non-whitespace before first tag."),m.textNode=g,m.state=l.TEXT)}function Ae(m,g){var M="";return g<m.length&&(M=m.charAt(g)),M}function rt(m){var g=this;if(this.error)throw this.error;if(g.closed)return U(g,"Cannot write after close. Assign an onready handler.");if(m===null)return H(g);typeof m=="object"&&(m=m.toString());for(var M=0,O="";O=Ae(m,M++),g.c=O,!!O;)switch(g.trackPosition&&(g.position++,O===`
79
+ `?(g.line++,g.column=0):g.column++),g.state){case l.BEGIN:if(g.state=l.BEGIN_WHITESPACE,O==="\uFEFF")continue;V(g,O);continue;case l.BEGIN_WHITESPACE:V(g,O);continue;case l.TEXT:if(g.sawRoot&&!g.closedRoot){for(var K=M-1;O&&O!=="<"&&O!=="&";)O=Ae(m,M++),O&&g.trackPosition&&(g.position++,O===`
80
+ `?(g.line++,g.column=0):g.column++);g.textNode+=m.substring(K,M-1)}O==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=l.OPEN_WAKA,g.startTagPosition=g.position):(!E(O)&&(!g.sawRoot||g.closedRoot)&&W(g,"Text data outside of root node."),O==="&"?g.state=l.TEXT_ENTITY:g.textNode+=O);continue;case l.SCRIPT:O==="<"?g.state=l.SCRIPT_ENDING:g.script+=O;continue;case l.SCRIPT_ENDING:O==="/"?g.state=l.CLOSE_TAG:(g.script+="<"+O,g.state=l.SCRIPT);continue;case l.OPEN_WAKA:if(O==="!")g.state=l.SGML_DECL,g.sgmlDecl="";else if(!E(O))if(A(b,O))g.state=l.OPEN_TAG,g.tagName=O;else if(O==="/")g.state=l.CLOSE_TAG,g.tagName="";else if(O==="?")g.state=l.PROC_INST,g.procInstName=g.procInstBody="";else{if(W(g,"Unencoded <"),g.startTagPosition+1<g.position){var Y=g.position-g.startTagPosition;O=new Array(Y).join(" ")+O}g.textNode+="<"+O,g.state=l.TEXT}continue;case l.SGML_DECL:if(g.sgmlDecl+O==="--"){g.state=l.COMMENT,g.comment="",g.sgmlDecl="";continue}g.doctype&&g.doctype!==!0&&g.sgmlDecl?(g.state=l.DOCTYPE_DTD,g.doctype+="<!"+g.sgmlDecl+O,g.sgmlDecl=""):(g.sgmlDecl+O).toUpperCase()===d?(k(g,"onopencdata"),g.state=l.CDATA,g.sgmlDecl="",g.cdata=""):(g.sgmlDecl+O).toUpperCase()===f?(g.state=l.DOCTYPE,(g.doctype||g.sawRoot)&&W(g,"Inappropriately located doctype declaration"),g.doctype="",g.sgmlDecl=""):O===">"?(k(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=l.TEXT):(I(O)&&(g.state=l.SGML_DECL_QUOTED),g.sgmlDecl+=O);continue;case l.SGML_DECL_QUOTED:O===g.q&&(g.state=l.SGML_DECL,g.q=""),g.sgmlDecl+=O;continue;case l.DOCTYPE:O===">"?(g.state=l.TEXT,k(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=O,O==="["?g.state=l.DOCTYPE_DTD:I(O)&&(g.state=l.DOCTYPE_QUOTED,g.q=O));continue;case l.DOCTYPE_QUOTED:g.doctype+=O,O===g.q&&(g.q="",g.state=l.DOCTYPE);continue;case l.DOCTYPE_DTD:O==="]"?(g.doctype+=O,g.state=l.DOCTYPE):O==="<"?(g.state=l.OPEN_WAKA,g.startTagPosition=g.position):I(O)?(g.doctype+=O,g.state=l.DOCTYPE_DTD_QUOTED,g.q=O):g.doctype+=O;continue;case l.DOCTYPE_DTD_QUOTED:g.doctype+=O,O===g.q&&(g.state=l.DOCTYPE_DTD,g.q="");continue;case l.COMMENT:O==="-"?g.state=l.COMMENT_ENDING:g.comment+=O;continue;case l.COMMENT_ENDING:O==="-"?(g.state=l.COMMENT_ENDED,g.comment=B(g.opt,g.comment),g.comment&&k(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+O,g.state=l.COMMENT);continue;case l.COMMENT_ENDED:O!==">"?(W(g,"Malformed comment"),g.comment+="--"+O,g.state=l.COMMENT):g.doctype&&g.doctype!==!0?g.state=l.DOCTYPE_DTD:g.state=l.TEXT;continue;case l.CDATA:for(var K=M-1;O&&O!=="]";)O=Ae(m,M++),O&&g.trackPosition&&(g.position++,O===`
81
+ `?(g.line++,g.column=0):g.column++);g.cdata+=m.substring(K,M-1),O==="]"&&(g.state=l.CDATA_ENDING);continue;case l.CDATA_ENDING:O==="]"?g.state=l.CDATA_ENDING_2:(g.cdata+="]"+O,g.state=l.CDATA);continue;case l.CDATA_ENDING_2:O===">"?(g.cdata&&k(g,"oncdata",g.cdata),k(g,"onclosecdata"),g.cdata="",g.state=l.TEXT):O==="]"?g.cdata+="]":(g.cdata+="]]"+O,g.state=l.CDATA);continue;case l.PROC_INST:O==="?"?g.state=l.PROC_INST_ENDING:E(O)?g.state=l.PROC_INST_BODY:g.procInstName+=O;continue;case l.PROC_INST_BODY:if(!g.procInstBody&&E(O))continue;O==="?"?g.state=l.PROC_INST_ENDING:g.procInstBody+=O;continue;case l.PROC_INST_ENDING:O===">"?(k(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=l.TEXT):(g.procInstBody+="?"+O,g.state=l.PROC_INST_BODY);continue;case l.OPEN_TAG:A(S,O)?g.tagName+=O:(tt(g),O===">"?ce(g):O==="/"?g.state=l.OPEN_TAG_SLASH:(E(O)||W(g,"Invalid character in tag name"),g.state=l.ATTRIB));continue;case l.OPEN_TAG_SLASH:O===">"?(ce(g,!0),ye(g)):(W(g,"Forward-slash in opening tag not followed by >"),g.state=l.ATTRIB);continue;case l.ATTRIB:if(E(O))continue;O===">"?ce(g):O==="/"?g.state=l.OPEN_TAG_SLASH:A(b,O)?(g.attribName=O,g.attribValue="",g.state=l.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case l.ATTRIB_NAME:O==="="?g.state=l.ATTRIB_VALUE:O===">"?(W(g,"Attribute without value"),g.attribValue=g.attribName,Pe(g),ce(g)):E(O)?g.state=l.ATTRIB_NAME_SAW_WHITE:A(S,O)?g.attribName+=O:W(g,"Invalid attribute name");continue;case l.ATTRIB_NAME_SAW_WHITE:if(O==="=")g.state=l.ATTRIB_VALUE;else{if(E(O))continue;W(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",k(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",O===">"?ce(g):A(b,O)?(g.attribName=O,g.state=l.ATTRIB_NAME):(W(g,"Invalid attribute name"),g.state=l.ATTRIB)}continue;case l.ATTRIB_VALUE:if(E(O))continue;I(O)?(g.q=O,g.state=l.ATTRIB_VALUE_QUOTED):(g.opt.unquotedAttributeValues||U(g,"Unquoted attribute value"),g.state=l.ATTRIB_VALUE_UNQUOTED,g.attribValue=O);continue;case l.ATTRIB_VALUE_QUOTED:if(O!==g.q){O==="&"?g.state=l.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=O;continue}Pe(g),g.q="",g.state=l.ATTRIB_VALUE_CLOSED;continue;case l.ATTRIB_VALUE_CLOSED:E(O)?g.state=l.ATTRIB:O===">"?ce(g):O==="/"?g.state=l.OPEN_TAG_SLASH:A(b,O)?(W(g,"No whitespace between attributes"),g.attribName=O,g.attribValue="",g.state=l.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case l.ATTRIB_VALUE_UNQUOTED:if(!L(O)){O==="&"?g.state=l.ATTRIB_VALUE_ENTITY_U:g.attribValue+=O;continue}Pe(g),O===">"?ce(g):g.state=l.ATTRIB;continue;case l.CLOSE_TAG:if(g.tagName)O===">"?ye(g):A(S,O)?g.tagName+=O:g.script?(g.script+="</"+g.tagName+O,g.tagName="",g.state=l.SCRIPT):(E(O)||W(g,"Invalid tagname in closing tag"),g.state=l.CLOSE_TAG_SAW_WHITE);else{if(E(O))continue;C(b,O)?g.script?(g.script+="</"+O,g.state=l.SCRIPT):W(g,"Invalid tagname in closing tag."):g.tagName=O}continue;case l.CLOSE_TAG_SAW_WHITE:if(E(O))continue;O===">"?ye(g):W(g,"Invalid characters in closing tag");continue;case l.TEXT_ENTITY:case l.ATTRIB_VALUE_ENTITY_Q:case l.ATTRIB_VALUE_ENTITY_U:var Q,re;switch(g.state){case l.TEXT_ENTITY:Q=l.TEXT,re="textNode";break;case l.ATTRIB_VALUE_ENTITY_Q:Q=l.ATTRIB_VALUE_QUOTED,re="attribValue";break;case l.ATTRIB_VALUE_ENTITY_U:Q=l.ATTRIB_VALUE_UNQUOTED,re="attribValue";break}if(O===";"){var T=nt(g);g.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(T)?((g.entityCount+=1)>g.opt.maxEntityCount&&U(g,"Parsed entity count exceeds max entity count"),(g.entityDepth+=1)>g.opt.maxEntityDepth&&U(g,"Parsed entity depth exceeds max entity depth"),g.entity="",g.state=Q,g.write(T),g.entityDepth-=1):(g[re]+=T,g.entity="",g.state=Q)}else A(g.entity.length?h:N,O)?g.entity+=O:(W(g,"Invalid character in entity name"),g[re]+="&"+g.entity+O,g.entity="",g.state=Q);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&o(g),g}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,g=Math.floor,M=function(){var O=16384,Y=[],K,Q,re=-1,T=arguments.length;if(!T)return"";for(var P="";++re<T;){var j=Number(arguments[re]);if(!isFinite(j)||j<0||j>1114111||g(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?Y.push(j):(j-=65536,K=(j>>10)+55296,Q=j%1024+56320,Y.push(K,Q)),(re+1===T||Y.length>O)&&(P+=m.apply(null,Y),Y.length=0)}return P};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:M,configurable:!0,writable:!0}):String.fromCodePoint=M}()})(e)}(Wt)),Wt}var Gt={},Or;function ko(){return Or||(Or=1,function(){Gt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(G)),Gt}var Oe={},xr;function li(){return xr||(xr=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),Oe.normalize=function(t){return t.toLowerCase()},Oe.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},Oe.stripPrefix=function(t){return t.replace(e,"")},Oe.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},Oe.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(G)),Oe}var Pr;function Ro(){return Pr||(Pr=1,function(e){(function(){var t,n,r,o,i,s,a,u,p,c=function(y,w){return function(){return y.apply(w,arguments)}},d=function(y,w){for(var v in w)f.call(w,v)&&(y[v]=w[v]);function b(){this.constructor=y}return b.prototype=w.prototype,y.prototype=new b,y.__super__=w.prototype,y},f={}.hasOwnProperty;u=jo(),o=an,t=ko(),a=li(),p=Di.setImmediate,n=un().defaults,i=function(y){return typeof y=="object"&&y!=null&&Object.keys(y).length===0},s=function(y,w,v){var b,S,N;for(b=0,S=y.length;b<S;b++)N=y[b],w=N(w,v);return w},r=function(y,w,v){var b;return b=Object.create(null),b.value=v,b.writable=!0,b.enumerable=!0,b.configurable=!0,Object.defineProperty(y,w,b)},e.Parser=function(y){d(w,y);function w(v){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var b,S,N;if(!(this instanceof e.Parser))return new e.Parser(v);this.options={},S=n["0.2"];for(b in S)f.call(S,b)&&(N=S[b],this.options[b]=N);for(b in v)f.call(v,b)&&(N=v[b],this.options[b]=N);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return w.prototype.processAsync=function(){var v,b;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),p(this.processAsync))}catch(S){if(b=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(b)}},w.prototype.assignOrPush=function(v,b,S){return b in v?(v[b]instanceof Array||r(v,b,[v[b]]),v[b].push(S)):this.options.explicitArray?r(v,b,[S]):r(v,b,S)},w.prototype.reset=function(){var v,b,S,N;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(h){return function(E){if(h.saxParser.resume(),!h.saxParser.errThrown)return h.saxParser.errThrown=!0,h.emit("error",E)}}(this),this.saxParser.onend=function(h){return function(){if(!h.saxParser.ended)return h.saxParser.ended=!0,h.emit("end",h.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,N=[],v=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(h){return function(E){var I,L,A,C,l;if(A={},A[b]="",!h.options.ignoreAttrs){l=E.attributes;for(I in l)f.call(l,I)&&(!(v in A)&&!h.options.mergeAttrs&&(A[v]={}),L=h.options.attrValueProcessors?s(h.options.attrValueProcessors,E.attributes[I],I):E.attributes[I],C=h.options.attrNameProcessors?s(h.options.attrNameProcessors,I):I,h.options.mergeAttrs?h.assignOrPush(A,C,L):r(A[v],C,L))}return A["#name"]=h.options.tagNameProcessors?s(h.options.tagNameProcessors,E.name):E.name,h.options.xmlns&&(A[h.options.xmlnskey]={uri:E.uri,local:E.local}),N.push(A)}}(this),this.saxParser.onclosetag=function(h){return function(){var E,I,L,A,C,l,_,F,k,q;if(l=N.pop(),C=l["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete l["#name"],l.cdata===!0&&(E=l.cdata,delete l.cdata),k=N[N.length-1],l[b].match(/^\s*$/)&&!E?(I=l[b],delete l[b]):(h.options.trim&&(l[b]=l[b].trim()),h.options.normalize&&(l[b]=l[b].replace(/\s{2,}/g," ").trim()),l[b]=h.options.valueProcessors?s(h.options.valueProcessors,l[b],C):l[b],Object.keys(l).length===1&&b in l&&!h.EXPLICIT_CHARKEY&&(l=l[b])),i(l)&&(typeof h.options.emptyTag=="function"?l=h.options.emptyTag():l=h.options.emptyTag!==""?h.options.emptyTag:I),h.options.validator!=null&&(q="/"+function(){var B,U,H;for(H=[],B=0,U=N.length;B<U;B++)A=N[B],H.push(A["#name"]);return H}().concat(C).join("/"),function(){var B;try{return l=h.options.validator(q,k&&k[C],l)}catch(U){return B=U,h.emit("error",B)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof l=="object"){if(!h.options.preserveChildrenOrder)A={},h.options.attrkey in l&&(A[h.options.attrkey]=l[h.options.attrkey],delete l[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in l&&(A[h.options.charkey]=l[h.options.charkey],delete l[h.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(A[h.options.childkey]=l),l=A;else if(k){k[h.options.childkey]=k[h.options.childkey]||[],_={};for(L in l)f.call(l,L)&&r(_,L,l[L]);k[h.options.childkey].push(_),delete l["#name"],Object.keys(l).length===1&&b in l&&!h.EXPLICIT_CHARKEY&&(l=l[b])}}return N.length>0?h.assignOrPush(k,C,l):(h.options.explicitRoot&&(F=l,l={},r(l,C,F)),h.resultObject=l,h.saxParser.ended=!0,h.emit("end",h.resultObject))}}(this),S=function(h){return function(E){var I,L;if(L=N[N.length-1],L)return L[b]+=E,h.options.explicitChildren&&h.options.preserveChildrenOrder&&h.options.charsAsChildren&&(h.options.includeWhiteChars||E.replace(/\\n/g,"").trim()!=="")&&(L[h.options.childkey]=L[h.options.childkey]||[],I={"#name":"__text__"},I[b]=E,h.options.normalize&&(I[b]=I[b].replace(/\s{2,}/g," ").trim()),L[h.options.childkey].push(I)),L}}(this),this.saxParser.ontext=S,this.saxParser.oncdata=function(h){return function(E){var I;if(I=S(E),I)return I.cdata=!0}}()},w.prototype.parseString=function(v,b){var S;b!=null&&typeof b=="function"&&(this.on("end",function(N){return this.reset(),b(null,N)}),this.on("error",function(N){return this.reset(),b(N)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=t.stripBOM(v),this.options.async?(this.remaining=v,p(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(N){if(S=N,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},w.prototype.parseStringPromise=function(v){return new Promise(function(b){return function(S,N){return b.parseString(v,function(h,E){return h?N(h):S(E)})}}(this))},w}(o),e.parseString=function(y,w,v){var b,S,N;return v!=null?(typeof v=="function"&&(b=v),typeof w=="object"&&(S=w)):(typeof w=="function"&&(b=w),S={}),N=new e.Parser(S),N.parseString(y,b)},e.parseStringPromise=function(y,w){var v,b;return typeof w=="object"&&(v=w),b=new e.Parser(v),b.parseStringPromise(y)}}).call(G)}(qt)),qt}var fi;(function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;t=un(),e=Fo(),n=Ro(),li(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,fi=n.parseStringPromise}).call(G);class Bo{constructor(t,n,r){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"";for(const o of r.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o));this.breakOnFirstLine=r.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const n=await fi(t,{explicitArray:!1});await this.handleDbgpMessage(n)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
78
82
  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
79
83
 
80
84
  1. Add breakpoints in your files to start step debugging.
@@ -82,13 +86,13 @@ Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.
82
86
  2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
83
87
 
84
88
  3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[t,n]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,n)}async sendScriptToCDP(t,n){const r=this.uriFromBridgeToCDPSyntaxHighlight(t),o=this.uriFromBridgeToCDP(t);try{const i=await this.readPHPFile(t),s=i.split(`
85
- `),a=s.map((g,p)=>p===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},c=`data:application/json;base64,${Buffer.from(JSON.stringify(u),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:n,url:o,startLine:0,startColumn:0,endLine:s.length,endColumn:0,executionContextId:1,sourceMapURL:c}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let n=this.scriptIdByUrl.get(t);return n||(n=_i("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,n)),n}formatPropertyFullName(t){let n=!1,r="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||t.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(t,n){const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(t){const{id:n,method:r,params:o}=t;let i={},s=!0;switch(r){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:u}=o;if(!a){s=!1;break}const f=this.uriFromCDPToBridge(a),c=this.uriFromBridgeToDBGP(f),g=(typeof u=="number"?u:0)+1,p=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(c)} -n ${g}`,N=this.sendDbgpCommand(b);this.pendingCommands.set(N,{cdpId:n,cdpMethod:r,params:{breakpointId:p,fileUri:f,lineNumber:g}}),s=!1}else this.breakpoints.set(p,{cdpId:p,xdebugId:null,fileUri:f,lineNumber:g}),i={breakpointId:p,locations:[{scriptId:this.getOrCreateScriptId(f),lineNumber:g-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),f=this.breakpoints.get(u);if(f){if(f.xdebugId&&this.xdebugConnected){const c=`breakpoint_remove -d ${f.xdebugId}`,g=this.sendDbgpCommand(c);this.pendingCommands.set(g,{cdpId:n,cdpMethod:r}),s=!1}this.breakpoints.delete(u)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const a=o.expression||"",u=o.callFrameId;if(r==="Debugger.evaluateOnCallFrame"){if(u===void 0||!this.callFramesMap.has(u)){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(u)!==0){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const f=Buffer.from(a).toString("base64"),c=this.sendDbgpCommand("eval",`-- ${f}`);this.pendingCommands.set(c,{cdpId:n,cdpMethod:r}),s=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=o,u=this.objectHandles.get(a);if(u&&this.xdebugConnected)if(u.type==="context"){const f=u.contextId??0,g=`context_get -d ${u.depth} -c ${f} -p 0 -m 32`,p=this.sendDbgpCommand(g),b={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,b),this.pendingCommands.set(p,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const f=u.depth,c=u.fullname,g=this.formatPropertyFullName(c),p=`property_get -d ${f} -n ${g} -p 0 -m 32`,b=this.sendDbgpCommand(p),N={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,N),this.pendingCommands.set(b,{cdpId:n,cdpMethod:r,params:{parentObjectId:a}}),s=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=o.scriptId,u=[...this.scriptIdByUrl.entries()].find(([,c])=>c===a)?.[0],f=[];u&&f.push(`Here's the full path for your convenience:
89
+ `),a=s.map((d,f)=>f===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},c=`data:application/json;base64,${Buffer.from(JSON.stringify(u),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:n,url:o,startLine:0,startColumn:0,endLine:s.length,endColumn:0,executionContextId:1,sourceMapURL:c}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let n=this.scriptIdByUrl.get(t);return n||(n=Si("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,n)),n}formatPropertyFullName(t){let n=!1,r="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||t.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(t,n){const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(t){const{id:n,method:r,params:o}=t;let i={},s=!0;switch(r){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:u}=o;if(!a){s=!1;break}const p=this.uriFromCDPToBridge(a),c=this.uriFromBridgeToDBGP(p),d=(typeof u=="number"?u:0)+1,f=String(this.breakpoints.size+1);if(this.xdebugConnected){const y=`breakpoint_set -t line -f ${this.formatPropertyFullName(c)} -n ${d}`,w=this.sendDbgpCommand(y);this.pendingCommands.set(w,{cdpId:n,cdpMethod:r,params:{breakpointId:f,fileUri:p,lineNumber:d}}),s=!1}else this.breakpoints.set(f,{cdpId:f,xdebugId:null,fileUri:p,lineNumber:d}),i={breakpointId:f,locations:[{scriptId:this.getOrCreateScriptId(p),lineNumber:d-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),p=this.breakpoints.get(u);if(p){if(p.xdebugId&&this.xdebugConnected){const c=`breakpoint_remove -d ${p.xdebugId}`,d=this.sendDbgpCommand(c);this.pendingCommands.set(d,{cdpId:n,cdpMethod:r}),s=!1}this.breakpoints.delete(u)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const a=o.expression||"",u=o.callFrameId;if(r==="Debugger.evaluateOnCallFrame"){if(u===void 0||!this.callFramesMap.has(u)){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(u)!==0){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const p=Buffer.from(a).toString("base64"),c=this.sendDbgpCommand("eval",`-- ${p}`);this.pendingCommands.set(c,{cdpId:n,cdpMethod:r}),s=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=o,u=this.objectHandles.get(a);if(u&&this.xdebugConnected)if(u.type==="context"){const p=u.contextId??0,d=`context_get -d ${u.depth} -c ${p} -p 0 -m 32`,f=this.sendDbgpCommand(d),y={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,y),this.pendingCommands.set(f,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const p=u.depth,c=u.fullname,d=this.formatPropertyFullName(c),f=`property_get -d ${p} -n ${d} -p 0 -m 32`,y=this.sendDbgpCommand(f),w={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,w),this.pendingCommands.set(y,{cdpId:n,cdpMethod:r,params:{parentObjectId:a}}),s=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=o.scriptId,u=[...this.scriptIdByUrl.entries()].find(([,c])=>c===a)?.[0],p=[];u&&p.push(`Here's the full path for your convenience:
86
90
  `,`${this.uriFromBridgeToCDPSyntaxHighlight(u).replace("file://","")}
87
- `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...f,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
91
+ `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...p,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
88
92
  `,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
89
- `)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===t.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(t){return oe.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const n=t.indexOf(this.phpRoot);return n!==-1?t.slice(n):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(r=>{this.handleCdpMessage({id:r.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(r.fileUri),lineNumber:r.lineNumber-1}})});const n=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(n,{});return}if(t.response){const n=t.response,r=n.$,o=r.command,i=r.transaction_id,s=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(s&&s.cdpId!==void 0&&s.cdpMethod==="Debugger.setBreakpointByUrl"){const a=r.id,u=s.params;if(u){const{breakpointId:f,fileUri:c,lineNumber:g}=u;this.breakpoints.set(f,{cdpId:f,xdebugId:a,fileUri:c,lineNumber:g});const p=this.getOrCreateScriptId(c),b={breakpointId:f,locations:[{scriptId:p,lineNumber:g-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:b})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=r.status;if(n["xdebug:message"]){const u=this.uriFromDBGPToBridge(n["xdebug:message"].$.filename);u&&!this.scriptIdByUrl.has(u)&&await this.sendScriptToCDP(u,this.getOrCreateScriptId(u))}if(a==="break"){const u=this.sendDbgpCommand("stack_get");this.pendingCommands.set(u,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(s&&s.cdpId!==void 0){let a;if(n.property){const f=n.property,c=f.$.type,g=f.$.encoding;let p=null;if(Object.prototype.hasOwnProperty.call(f,"_")?p=f._:typeof f.$value<"u"&&(p=f.$value),g==="base64"&&p!==null)try{p=Buffer.from(p,"base64").toString()}catch{}if(c==="string")a={type:"string",value:p??""};else if(c==="int"||c==="float"||c==="bool"||c==="boolen"||c==="integer"||c==="double"){let b=p;c.startsWith("int")||c==="integer"?b=parseInt(p||"0",10):c==="float"||c==="double"?b=parseFloat(p||"0"):c.startsWith("bool")&&(b=p==="1"||p==="true"),a={type:"number",value:b}}else if(c==="array"||c==="object"){const b=f.$.classname||(c==="array"?"Array":"Object"),N=String(this.nextObjectId++),I=f.$.fullname||"";this.objectHandles.set(N,{type:"property",depth:0,contextId:0,fullname:I}),a={type:"object",objectId:N,className:b,description:b}}else c==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const u={result:a};this.cdp.sendMessage({id:s.cdpId,result:u}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(s&&s.cdpId!==void 0){const a=s.params?.objectId||s.params?.parentObjectId,u=a?this.objectHandles.get(a):null,f=n.property?.property??n.property,c=[];if(f){const g=Array.isArray(f)?f:[f];for(const p of g){const b=p.$.name||p.$.fullname||"";let N=p.$.type||"undefined";const I=p.$.children==="1",y=p.$.encoding;let S=null;if(typeof p._<"u"&&(S=p._),y==="base64"&&S!==null)try{S=Buffer.from(S,"base64").toString()}catch{}if(I){const E=p.$.classname||(N==="array"?"Array":"Object"),h=String(this.nextObjectId++),w=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.contextId||0,O=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.depth||0;this.objectHandles.set(h,{type:"property",depth:O,contextId:w,fullname:p.$.fullname||b}),c.push({name:p.$.key||b,value:{type:"object",className:E,description:E,objectId:h},writable:!1,configurable:!1,enumerable:!0})}else{let E,h;N==="string"?E=S??"":N==="int"||N==="integer"?E=parseInt(S||"0",10):N==="float"||N==="double"?E=parseFloat(S||"0"):N==="bool"||N==="boolean"?(E=S==="1"||S==="true",N="boolean"):N==="null"?(E=null,h="null"):E=S;const w={type:N==="integer"?"number":N};h&&(w.subtype=h),w.value=E,c.push({name:p.$.key||b,value:w,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const g=(u.aggregatedProps||[]).concat(c),p=32;if(c.length===p){const N=(u.currentPage||0)+1,I={...u,currentPage:N,aggregatedProps:g};this.objectHandles.set(a,I);let y;if(o==="context_get"){const E=u.contextId??0;y=`context_get -d ${u.depth} -c ${E} -p ${N} -m ${p}`}else{const E=u.depth,h=u.fullname,w=this.formatPropertyFullName(h);y=`property_get -d ${E} -n ${w} -p ${N} -m ${p}`}const S=this.sendDbgpCommand(y);this.pendingCommands.set(S,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const N={result:g};this.cdp.sendMessage({id:s.cdpId,result:N}),this.pendingCommands.delete(i)}}else{const g={result:c};this.cdp.sendMessage({id:s.cdpId,result:g}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(n.stack){const a=Array.isArray(n.stack)?n.stack:[n.stack],u=[];this.callFramesMap.clear();for(const c of a){const g=this.uriFromDBGPToBridge(c.$.filename),p=this.getOrCreateScriptId(g);this.scriptIdByUrl.has(g)||(this.scriptIdByUrl.set(g,p),await this.sendScriptToCDP(g,p))}for(const c of a){const g=parseInt(c.$.level,10),p=this.uriFromDBGPToBridge(c.$.filename),b=parseInt(c.$.lineno,10),N=c.$.where&&c.$.where!=="{main}"?c.$.where:"(anonymous)",I=`frame:${g}`;this.callFramesMap.set(I,g);const y=[],S=String(this.nextObjectId++);this.objectHandles.set(S,{type:"context",contextId:0,depth:g}),y.push({type:"local",object:{objectId:S,className:"Object",description:"Local"}});const E=String(this.nextObjectId++);this.objectHandles.set(E,{type:"context",contextId:1,depth:g}),y.push({type:"global",object:{objectId:E,className:"Object",description:"Global"}}),u.push({callFrameId:I,functionName:N,location:{scriptId:this.getOrCreateScriptId(p),lineNumber:b-1,columnNumber:0},scopeChain:y,this:{type:"object",className:"Object",description:"Object",objectId:E}})}let f="pause";if(a.length>0){const c=a[0];if(c.$.filename&&c.$.lineno){const g=this.uriFromDBGPToBridge(c.$.filename),p=parseInt(c.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===g&&b.lineNumber===p){f="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:f,callFrames:u,hitBreakpoints:f==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const n=t.stream,r=n.$.type,o=n.$.encoding||"none";let i=typeof n._=="string"?n._:"";o==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:r==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function Ro(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;ge.log("Starting XDebug Bridge...");const s=new lo(t);ge.log("Connect Chrome DevTools to CDP at:"),ge.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
90
- `),await new Promise(g=>s.on("clientConnected",g)),await new Promise(g=>setTimeout(g,2e3)),ge.log("Chrome connected! Initializing Xdebug receiver...");const a=new fo(n);ge.log(`XDebug receiver running on port ${n}`),ge.log("Running a PHP script with Xdebug enabled...");async function u(g){const p=[],b=e.phpInstance?await e.phpInstance.listFiles(g):wi(g);for(const N of b){const I=oe.join(g,N);try{(e.phpInstance?await e.phpInstance.isDir(I):Ei(I).isDirectory())?p.push(...await u(I)):N.endsWith(".php")&&p.push(I)}catch{}}return p}const f=e.phpInstance?g=>e.phpInstance.readFileAsText(g):e.getPHPFile?e.getPHPFile:g=>Zt(g,"utf-8"),c=await u(o);return new ko(a,s,{knownScriptUrls:c,phpRoot:o,getPHPFile:f,breakOnFirstLine:i})}let se=process.argv.slice(2);se.length||(se=["--help"]);const De=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,vr=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,Bo=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,fi=(import.meta||{}).url,Kt=new URL("ca-bundle.crt",fi).pathname;Ni(Kt)||xr(Kt,Oi.join(`
91
- `));se.unshift("-d",`openssl.cafile=${Kt}`);async function Xo(){const e=new URL("php.ini",fi).pathname,t=process.env.PHP||hi;if(!pi.includes(t))throw new Error(`Unsupported PHP version ${t}`);const n=se.some(p=>p.startsWith("--xdebug"));n&&(se=se.filter(p=>p!=="--xdebug"));const r=se.some(p=>p.startsWith("--experimental-devtools"));r&&(se=se.filter(p=>p!=="--experimental-devtools"));const o=se.filter(p=>p.startsWith("--experimental-unsafe-ide-integration")).map(p=>{const b=p.split("=")[1];return b===void 0?["vscode","phpstorm"]:b.includes(",")?b.split(","):[b]})[0]??!1;o&&(se=se.filter(p=>!p.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=Nn(oe.join(Tn.tmpdir(),"php-wasm-bin"));xr(`${a}/php`,`#!/bin/sh
93
+ `)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===t.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(t){return ne.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const n=t.indexOf(this.phpRoot);return n!==-1?t.slice(n):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(r=>{this.handleCdpMessage({id:r.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(r.fileUri),lineNumber:r.lineNumber-1}})});const n=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(n,{});return}if(t.response){const n=t.response,r=n.$,o=r.command,i=r.transaction_id,s=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(s&&s.cdpId!==void 0&&s.cdpMethod==="Debugger.setBreakpointByUrl"){const a=r.id,u=s.params;if(u){const{breakpointId:p,fileUri:c,lineNumber:d}=u;this.breakpoints.set(p,{cdpId:p,xdebugId:a,fileUri:c,lineNumber:d});const f=this.getOrCreateScriptId(c),y={breakpointId:p,locations:[{scriptId:f,lineNumber:d-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:y})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=r.status;if(n["xdebug:message"]){const u=this.uriFromDBGPToBridge(n["xdebug:message"].$.filename);u&&!this.scriptIdByUrl.has(u)&&await this.sendScriptToCDP(u,this.getOrCreateScriptId(u))}if(a==="break"){const u=this.sendDbgpCommand("stack_get");this.pendingCommands.set(u,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(s&&s.cdpId!==void 0){let a;if(n.property){const p=n.property,c=p.$.type,d=p.$.encoding;let f=null;if(Object.prototype.hasOwnProperty.call(p,"_")?f=p._:typeof p.$value<"u"&&(f=p.$value),d==="base64"&&f!==null)try{f=Buffer.from(f,"base64").toString()}catch{}if(c==="string")a={type:"string",value:f??""};else if(c==="int"||c==="float"||c==="bool"||c==="boolen"||c==="integer"||c==="double"){let y=f;c.startsWith("int")||c==="integer"?y=parseInt(f||"0",10):c==="float"||c==="double"?y=parseFloat(f||"0"):c.startsWith("bool")&&(y=f==="1"||f==="true"),a={type:"number",value:y}}else if(c==="array"||c==="object"){const y=p.$.classname||(c==="array"?"Array":"Object"),w=String(this.nextObjectId++),v=p.$.fullname||"";this.objectHandles.set(w,{type:"property",depth:0,contextId:0,fullname:v}),a={type:"object",objectId:w,className:y,description:y}}else c==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const u={result:a};this.cdp.sendMessage({id:s.cdpId,result:u}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(s&&s.cdpId!==void 0){const a=s.params?.objectId||s.params?.parentObjectId,u=a?this.objectHandles.get(a):null,p=n.property?.property??n.property,c=[];if(p){const d=Array.isArray(p)?p:[p];for(const f of d){const y=f.$.name||f.$.fullname||"";let w=f.$.type||"undefined";const v=f.$.children==="1",b=f.$.encoding;let S=null;if(typeof f._<"u"&&(S=f._),b==="base64"&&S!==null)try{S=Buffer.from(S,"base64").toString()}catch{}if(v){const N=f.$.classname||(w==="array"?"Array":"Object"),h=String(this.nextObjectId++),E=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.contextId||0,I=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.depth||0;this.objectHandles.set(h,{type:"property",depth:I,contextId:E,fullname:f.$.fullname||y}),c.push({name:f.$.key||y,value:{type:"object",className:N,description:N,objectId:h},writable:!1,configurable:!1,enumerable:!0})}else{let N,h;w==="string"?N=S??"":w==="int"||w==="integer"?N=parseInt(S||"0",10):w==="float"||w==="double"?N=parseFloat(S||"0"):w==="bool"||w==="boolean"?(N=S==="1"||S==="true",w="boolean"):w==="null"?(N=null,h="null"):N=S;const E={type:w==="integer"?"number":w};h&&(E.subtype=h),E.value=N,c.push({name:f.$.key||y,value:E,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const d=(u.aggregatedProps||[]).concat(c),f=32;if(c.length===f){const w=(u.currentPage||0)+1,v={...u,currentPage:w,aggregatedProps:d};this.objectHandles.set(a,v);let b;if(o==="context_get"){const N=u.contextId??0;b=`context_get -d ${u.depth} -c ${N} -p ${w} -m ${f}`}else{const N=u.depth,h=u.fullname,E=this.formatPropertyFullName(h);b=`property_get -d ${N} -n ${E} -p ${w} -m ${f}`}const S=this.sendDbgpCommand(b);this.pendingCommands.set(S,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const w={result:d};this.cdp.sendMessage({id:s.cdpId,result:w}),this.pendingCommands.delete(i)}}else{const d={result:c};this.cdp.sendMessage({id:s.cdpId,result:d}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(n.stack){const a=Array.isArray(n.stack)?n.stack:[n.stack],u=[];this.callFramesMap.clear();for(const c of a){const d=this.uriFromDBGPToBridge(c.$.filename),f=this.getOrCreateScriptId(d);this.scriptIdByUrl.has(d)||(this.scriptIdByUrl.set(d,f),await this.sendScriptToCDP(d,f))}for(const c of a){const d=parseInt(c.$.level,10),f=this.uriFromDBGPToBridge(c.$.filename),y=parseInt(c.$.lineno,10),w=c.$.where&&c.$.where!=="{main}"?c.$.where:"(anonymous)",v=`frame:${d}`;this.callFramesMap.set(v,d);const b=[],S=String(this.nextObjectId++);this.objectHandles.set(S,{type:"context",contextId:0,depth:d}),b.push({type:"local",object:{objectId:S,className:"Object",description:"Local"}});const N=String(this.nextObjectId++);this.objectHandles.set(N,{type:"context",contextId:1,depth:d}),b.push({type:"global",object:{objectId:N,className:"Object",description:"Global"}}),u.push({callFrameId:v,functionName:w,location:{scriptId:this.getOrCreateScriptId(f),lineNumber:y-1,columnNumber:0},scopeChain:b,this:{type:"object",className:"Object",description:"Object",objectId:N}})}let p="pause";if(a.length>0){const c=a[0];if(c.$.filename&&c.$.lineno){const d=this.uriFromDBGPToBridge(c.$.filename),f=parseInt(c.$.lineno,10);for(const y of this.breakpoints.values())if(y.fileUri===d&&y.lineNumber===f){p="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:p,callFrames:u,hitBreakpoints:p==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const n=t.stream,r=n.$.type,o=n.$.encoding||"none";let i=typeof n._=="string"?n._:"";o==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:r==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function Xo(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;ge.log("Starting XDebug Bridge...");const s=new po(t);ge.log("Connect Chrome DevTools to CDP at:"),ge.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
94
+ `),await new Promise(d=>s.on("clientConnected",d)),await new Promise(d=>setTimeout(d,2e3)),ge.log("Chrome connected! Initializing Xdebug receiver...");const a=new ho(n);ge.log(`XDebug receiver running on port ${n}`),ge.log("Running a PHP script with Xdebug enabled...");async function u(d){const f=[],y=e.phpInstance?await e.phpInstance.listFiles(d):Ei(d);for(const w of y){const v=ne.join(d,w);try{(e.phpInstance?await e.phpInstance.isDir(v):Ni(v).isDirectory())?f.push(...await u(v)):w.endsWith(".php")&&f.push(v)}catch{}}return f}const p=e.phpInstance?d=>e.phpInstance.readFileAsText(d):e.getPHPFile?e.getPHPFile:d=>tn(d,"utf-8"),c=await u(o);return new Bo(a,s,{knownScriptUrls:c,phpRoot:o,getPHPFile:p,breakOnFirstLine:i})}let oe=process.argv.slice(2);oe.length||(oe=["--help"]);const De=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Ar=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,$o=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,pi=(import.meta||{}).url,en=new URL("ca-bundle.crt",pi).pathname;Ti(en)||Lr(en,vi.join(`
95
+ `));oe.unshift("-d",`openssl.cafile=${en}`);async function Uo(){const e=new URL("php.ini",pi).pathname,t=process.env.PHP||hi;if(!di.includes(t))throw new Error(`Unsupported PHP version ${t}`);const n=oe.some(f=>f.startsWith("--xdebug"));n&&(oe=oe.filter(f=>f!=="--xdebug"));const r=oe.some(f=>f.startsWith("--experimental-devtools"));r&&(oe=oe.filter(f=>f!=="--experimental-devtools"));const o=oe.filter(f=>f.startsWith("--experimental-unsafe-ide-integration")).map(f=>{const y=f.split("=")[1];return y===void 0?["vscode","phpstorm"]:y.includes(",")?y.split(","):[y]})[0]??!1;o&&(oe=oe.filter(f=>!f.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=In(ne.join(vn.tmpdir(),"php-wasm-bin"));Lr(`${a}/php`,`#!/bin/sh
92
96
  ${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
93
- `),Ti(`${a}/php`,493);const u=Nn(oe.join(Tn.tmpdir(),"php-wasm-sys-tmp")),f=new di(await vi(t,{fileLockManager:new gi,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n??Qs({pathSkippings:["/dev/","/home/","/internal/","/request/","/proc/"]})}));if(f.setSpawnHandler((p,b)=>mi(p,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),xi(f),n&&o)try{const p="PHP.wasm CLI - Listen for Xdebug",b=o;await zs(p,process.cwd());const N=await Ys({name:p,host:"example.com",port:443,ides:b,cwd:process.cwd()}),I=b.includes("vscode"),y=b.includes("phpstorm"),S=Object.values(N);console.log(""),S.length>0?(console.log(De("Xdebug configured successfully")),console.log(Bo("Updated IDE config: ")+S.join(" "))):(console.log(De("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),I&&N.vscode&&(console.log(De("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${De("PHP Debug")} extension by ${De("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${vr(p)}" from the dropdown`),console.log(' 3. Click "start debugging"'),console.log(" 5. Set a breakpoint."),console.log(" 6. Run your command with PHP.wasm CLI."),y&&console.log("")),y&&N.phpstorm&&(console.log(De("PhpStorm instructions:")),console.log(` 1. Choose "${vr(p)}" debug configuration in the toolbar`),console.log(" 2. Click the debug button (bug icon)`"),console.log(" 3. Set a breakpoint."),console.log(" 4. Run your command with PHP.wasm CLI.")),console.log("")}catch(p){throw new Error("Could not configure Xdebug",{cause:p})}n&&r&&(await Ro({breakOnFirstLine:!0})).start(),se.some(p=>p.startsWith("-c"))||se.unshift("-c",e);const g=await f.cli(["php",...se]);g.stderr.pipeTo(new WritableStream({write(p){process.stderr.write(p)}})),g.stdout.pipeTo(new WritableStream({write(p){process.stdout.write(p)}})),await g.exitCode.catch(p=>{throw p.name==="ExitStatus"&&process.exit(p.status===void 0?1:p.status),p}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Xo();
97
+ `),Ii(`${a}/php`,493);const u=In(ne.join(vn.tmpdir(),"php-wasm-sys-tmp")),p=new gi(await xi(t,{fileLockManager:new mi,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n??Ks({pathSkippings:[...jn]})}));if(p.setSpawnHandler((f,y)=>yi(f,y,{shell:!0,stdio:["pipe","pipe","pipe"]})),Pi(p),n&&o)try{const f="PHP.wasm CLI - Listen for Xdebug",y=o;await Js(f,process.cwd());const w=await Qs({name:f,host:"example.com",port:443,ides:y,cwd:process.cwd(),pathSkippings:[...jn]}),v=y.includes("vscode"),b=y.includes("phpstorm"),S=Object.values(w);console.log(""),S.length>0?(console.log(De("Xdebug configured successfully")),console.log($o("Updated IDE config: ")+S.join(" "))):(console.log(De("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),v&&w.vscode&&(console.log(De("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${De("PHP Debug")} extension by ${De("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${Ar(f)}" from the dropdown`),console.log(' 3. Click "start debugging"'),console.log(" 5. Set a breakpoint."),console.log(" 6. Run your command with PHP.wasm CLI."),b&&console.log("")),b&&w.phpstorm&&(console.log(De("PhpStorm instructions:")),console.log(` 1. Choose "${Ar(f)}" debug configuration in the toolbar`),console.log(" 2. Click the debug button (bug icon)`"),console.log(" 3. Set a breakpoint."),console.log(" 4. Run your command with PHP.wasm CLI.")),console.log("")}catch(f){throw new Error("Could not configure Xdebug",{cause:f})}n&&r&&(await Xo({breakOnFirstLine:!0})).start(),oe.some(f=>f.startsWith("-c"))||oe.unshift("-c",e);const d=await p.cli(["php",...oe]);d.stderr.pipeTo(new WritableStream({write(f){process.stderr.write(f)}})),d.stdout.pipeTo(new WritableStream({write(f){process.stdout.write(f)}})),await d.exitCode.catch(f=>{throw f.name==="ExitStatus"&&process.exit(f.status===void 0?1:f.status),f}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Uo();
94
98
  //# sourceMappingURL=main.js.map