@php-wasm/cli 3.1.36 → 3.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +49 -49
- package/main.js.map +1 -1
- package/package.json +8 -7
package/main.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import{LatestSupportedPHPVersion as
|
|
1
|
+
import{LatestSupportedPHPVersion as Li,SupportedPHPVersionsList as Si,PHP as Di,FileLockManagerInMemory as Mi}from"@php-wasm/universal";import{spawn as Ci}from"child_process";import z,{readFileSync as fn,writeFile as Fi,statSync as ji,readdirSync as ki,lstatSync as Ri,existsSync as Bi,writeFileSync as $r,mkdtempSync as Fn,chmodSync as $i}from"fs";import jn from"os";import{rootCertificates as Xi}from"tls";import ee,{resolve as hn,normalize as Vi}from"path";import{loadNodeRuntime as Ui,useHostFilesystem as qi}from"@php-wasm/node";import{WebSocketServer as Wi}from"ws";import Gi from"net";import"assert";import{format as Xr}from"util";import{fileURLToPath as Hi}from"url";import{createHash as Yi}from"crypto";import zi from"timers";class Qi{constructor(e){this.verbosity=e.verbosity,this.writeStream=e.writeStream||process.stdout}get isTTY(){return!!this.writeStream.isTTY}get isQuiet(){return this.verbosity==="quiet"}bold(e){return this.isTTY?`\x1B[1m${e}\x1B[0m`:e}dim(e){return this.isTTY?`\x1B[2m${e}\x1B[0m`:e}italic(e){return this.isTTY?`\x1B[3m${e}\x1B[0m`:e}red(e){return this.isTTY?`\x1B[31m${e}\x1B[0m`:e}green(e){return this.isTTY?`\x1B[32m${e}\x1B[0m`:e}yellow(e){return this.isTTY?`\x1B[33m${e}\x1B[0m`:e}cyan(e){return this.isTTY?`\x1B[36m${e}\x1B[0m`:e}highlight(e){return this.yellow(e)}print(e){this.isQuiet||this.writeStream.write(`${e}
|
|
2
2
|
`)}printError(e){this.writeStream.write(`${this.red("Error:")} ${e}
|
|
3
3
|
`)}printWarning(e){this.isQuiet||this.writeStream.write(`${this.yellow("Warning:")} ${e}
|
|
4
|
-
`)}}function
|
|
5
|
-
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!
|
|
6
|
-
`||t==="\r"}function _n(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return J("InvalidXml","XML declaration allowed only at the start of the document.",ne(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Ln(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const Xi='"',Ui="'";function Vi(t,e){let n="",r="",o=!1;for(;e<t.length;e++){if(t[e]===Xi||t[e]===Ui)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){o=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:o}}const qi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Sn(t,e){const n=Fr(t,qi),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return J("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",je(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return J("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",je(n[o]));if(n[o][3]===void 0&&!e.allowBooleanAttributes)return J("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",je(n[o]));const i=n[o][2];if(!Hi(i))return J("InvalidAttr","Attribute '"+i+"' is an invalid name.",je(n[o]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return J("InvalidAttr","Attribute '"+i+"' is repeated.",je(n[o]))}return!0}function Wi(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function Gi(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Wi(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function J(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Hi(t){return Ze(t)}function Yi(t){return Ze(t)}function ne(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function je(t){return t.startIndex+t[1].length}const kr=t=>sn.includes(t)?"__"+t:t,zi={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(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:kr};function Qi(t,e){if(typeof t!="string")return;const n=t.toLowerCase();if(sn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(jr.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Br(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:Br(!0)}const Ki=function(t){const e=Object.assign({},zi,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:r,name:o}of n)r&&Qi(r,o);return e.onDangerousProperty===null&&(e.onDangerousProperty=kr),e.processEntities=Br(e.processEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};let We;typeof Symbol!="function"?We="@@xmlMetadata":We=Symbol("XML Node Metadata");class Te{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][We]={startIndex:n})}static getMetaDataSymbol(){return We}}class Ji{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,n){const r=Object.create(null);let o=0;if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let i=1,s=!1,a=!1,u="";for(;n<e.length;n++)if(e[n]==="<"&&!a){if(s&&Ie(e,"!ENTITY",n)){n+=7;let p,c;if([p,c,n]=this.readEntityExp(e,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 l=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r[p]={regx:RegExp(`&${l};`,"g"),val:c},o++}}else if(s&&Ie(e,"!ELEMENT",n)){n+=8;const{index:p}=this.readElementExp(e,n+1);n=p}else if(s&&Ie(e,"!ATTLIST",n))n+=8;else if(s&&Ie(e,"!NOTATION",n)){n+=9;const{index:p}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=p}else if(Ie(e,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");i++,u=""}else if(e[n]===">"){if(a?e[n-1]==="-"&&e[n-2]==="-"&&(a=!1,i--):i--,i===0)break}else e[n]==="["?s=!0:u+=e[n];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let o=e.substring(r,n);if(ke(o),n=se(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(e,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(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);!this.suppressValidationErr&&ke(o),n=se(e,n);const i=e.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=se(e,n);let s=null,a=null;if(i==="PUBLIC")[n,s]=this.readIdentifierVal(e,n,"publicIdentifier"),n=se(e,n),(e[n]==='"'||e[n]==="'")&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(i==="SYSTEM"&&([n,a]=this.readIdentifierVal(e,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(e,n,r){let o="";const i=e[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);n++;const s=n;for(;n<e.length&&e[n]!==i;)n++;if(o=e.substring(s,n),e[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);if(!this.suppressValidationErr&&!Ze(o))throw new Error(`Invalid element name: "${o}"`);n=se(e,n);let i="";if(e[n]==="E"&&Ie(e,"MPTY",n))n+=4;else if(e[n]==="A"&&Ie(e,"NY",n))n+=2;else if(e[n]==="("){n++;const s=n;for(;n<e.length&&e[n]!==")";)n++;if(i=e.substring(s,n),e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:o,contentModel:i.trim(),index:n}}readAttlistExp(e,n){n=se(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);for(ke(o),n=se(e,n),r=n;n<e.length&&!/\s/.test(e[n]);)n++;let i=e.substring(r,n);if(!ke(i))throw new Error(`Invalid attribute name: "${i}"`);n=se(e,n);let s="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=se(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let u=[];for(;n<e.length&&e[n]!==")";){const p=n;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)n++;let c=e.substring(p,n);if(c=c.trim(),!ke(c))throw new Error(`Invalid notation name: "${c}"`);u.push(c),e[n]==="|"&&(n++,n=se(e,n))}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+u.join("|")+")"}else{const u=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;s+=e.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=se(e,n);let a="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:o,attributeName:i,attributeType:s,defaultValue:a,index:n}}}const se=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function Ie(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function ke(t){if(Ze(t))return t;throw new Error(`Invalid entity name ${t}`)}const Zi=/^[-+]?0x[a-fA-F0-9]+$/,es=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,ts={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function ns(t,e={}){if(e=Object.assign({},ts,e),!t||typeof t!="string")return t;let n=t.trim();if(n.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(n==="0")return 0;if(e.hex&&Zi.test(n))return os(n,16);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return is(t,n,e);{const r=es.exec(n);if(r){const o=r[1]||"",i=r[2];let s=ss(r[3]);const a=o?t[i.length+1]===".":t[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!a))return t;{const u=Number(n),p=String(u);if(u===0)return u;if(p.search(/[eE]/)!==-1)return e.eNotation?u:t;if(n.indexOf(".")!==-1)return p==="0"||p===s||p===`${o}${s}`?u:t;let c=i?s:n;return i?c===p||o+c===p?u:t:c===p||c===o+p?u:t}}else return t}}else return as(t,Number(n),e)}const rs=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function is(t,e,n){if(!n.eNotation)return t;const r=e.match(rs);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?t[s.length+1]===i:t[s.length]===i;return s.length>1&&a?t:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(e):s.length>0?n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}else return t}function ss(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function os(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function as(t,e,n){const r=e===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return r?"Infinity":"-Infinity";case"original":default:return t}}function us(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}class Ce{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(o=>o.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(o=>o.attrName!==void 0),this._hasPositionSelector=this.segments.some(o=>o.position!==void 0)}_parse(e){const n=[];let r=0,o="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[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+=e[r],r++);return o.trim()&&n.push(this._parseSegment(o.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,o=e;const i=e.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: ${e}`)}let u,p=null;if(a.includes(":")){const c=a.lastIndexOf(":"),l=a.substring(0,c).trim(),f=a.substring(c+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(u=l,p=f):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${e}`);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}}class cs{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;const n=e.length,o=e.segments[e.segments.length-1]?.tag;if(!o||o==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else{const i=`${n}:${o}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e)}return this}addAll(e){for(const n of e)this.add(n);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){const n=e.getDepth(),r=e.getCurrentTag(),o=`${n}:${r}`,i=this._byDepthAndTag.get(o);if(i){for(let a=0;a<i.length;a++)if(e.matches(i[a]))return i[a]}const s=this._wildcardByDepth.get(n);if(s){for(let a=0;a<s.length;a++)if(e.matches(s[a]))return s[a]}for(let a=0;a<this._deepWildcards.length;a++)if(e.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}}class ls{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class on{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new ls(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);const i=this.siblingStacks[o],s=r?`${r}:${e}`:e,a=i.get(s)||0;let u=0;for(const c of i.values())u+=c;i.set(s,a+1);const p={tag:e,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;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}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(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e 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(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const i=this.path.map(s=>s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r);return this._pathStringCache=i,i}return this.path.map(i=>n&&i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const o=e[r];if(o.type==="deep-wildcard"){if(r--,r<0)return!0;const i=e[r];let s=!1;for(let a=n;a>=0;a--)if(this._matchSegment(i,this.path[a],a===this.path.length-1)){n=a-1,r--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(o,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const o=n.counter??0;if(e.position==="first"&&o!==0)return!1;if(e.position==="odd"&&o%2!==1)return!1;if(e.position==="even"&&o%2!==0)return!1;if(e.position==="nth"&&o!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function fs(t,e){if(!t)return{};const n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return{};const r={};for(const o in n)if(o.startsWith(e.attributeNamePrefix)){const i=o.substring(e.attributeNamePrefix.length);r[i]=n[o]}else r[o]=n[o];return r}function hs(t){if(!t||typeof t!="string")return;const e=t.indexOf(":");if(e!==-1&&e>0){const n=t.substring(0,e);if(n!=="xmlns")return n}}class ps{constructor(e){this.options=e,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:(r,o)=>Dn(o,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,o)=>Dn(o,16,"&#x")}},this.addExternalEntities=ds,this.parseXml=ws,this.parseTextData=gs,this.resolveNameSpace=ms,this.buildAttributesMap=bs,this.isItStopNode=Is,this.replaceEntitiesValue=Ts,this.readStopNodeData=xs,this.saveTextToParentTag=Ns,this.addChild=Es,this.ignoreAttributesFn=us(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new on,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new cs;const n=this.options.stopNodes;if(n&&n.length>0){for(let r=0;r<n.length;r++){const o=n[r];typeof o=="string"?this.stopNodeExpressionsSet.add(new Ce(o)):o instanceof Ce&&this.stopNodeExpressionsSet.add(o)}this.stopNodeExpressionsSet.seal()}}}function ds(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n],o=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+o+";","g"),val:t[r]}}}function gs(t,e,n,r,o,i,s){const a=this.options;if(t!==void 0&&(a.trimValues&&!r&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t,e,n));const u=a.jPath?n.toString():n,p=a.tagValueProcessor(e,t,u,o,i);return p==null?t:typeof p!=typeof t||p!==t?p:a.trimValues||t.trim()===t?Qt(t,a.parseTagValue,a.numberParseOptions):t}}function ms(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const ys=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function bs(t,e,n){const r=this.options;if(r.ignoreAttributes!==!0&&typeof t=="string"){const o=Fr(t,ys),i=o.length,s={},a=new Array(i);let u=!1;const p={};for(let f=0;f<i;f++){const y=this.resolveNameSpace(o[f][1]),E=o[f][4];if(y.length&&E!==void 0){let O=E;r.trimValues&&(O=O.trim()),O=this.replaceEntitiesValue(O,n,this.readonlyMatcher),a[f]=O,p[y]=O,u=!0}}u&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(p);const c=r.jPath?e.toString():this.readonlyMatcher;let l=!1;for(let f=0;f<i;f++){const y=this.resolveNameSpace(o[f][1]);if(this.ignoreAttributesFn(y,c))continue;let E=r.attributeNamePrefix+y;if(y.length)if(r.transformAttributeName&&(E=r.transformAttributeName(E)),E=Rr(E,r),o[f][4]!==void 0){const O=a[f],w=r.attributeValueProcessor(y,O,c);w==null?s[E]=O:typeof w!=typeof O||w!==O?s[E]=w:s[E]=Qt(O,r.parseAttributeValue,r.numberParseOptions),l=!0}else r.allowBooleanAttributes&&(s[E]=!0,l=!0)}if(!l)return;if(r.attributesGroupName){const f={};return f[r.attributesGroupName]=s,f}return s}}const ws=function(t){t=t.replace(/\r\n?/g,`
|
|
7
|
-
`);const e=new Te("!xml");let n=e,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.docTypeEntitiesKeys=[],this.lastEntitiesKeys=Object.keys(this.lastEntities),this.htmlEntitiesKeys=this.options.htmlEntities?Object.keys(this.htmlEntities):[];const o=this.options,i=new Ji(o.processEntities),s=t.length;for(let a=0;a<s;a++)if(t[a]==="<"){const p=t.charCodeAt(a+1);if(p===47){const c=De(t,">",a,"Closing Tag is not closed.");let l=t.substring(a+2,c).trim();if(o.removeNSPrefix){const y=l.indexOf(":");y!==-1&&(l=l.substr(y+1))}l=ot(o.transformTagName,l,"",o).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));const f=this.matcher.getCurrentTag();if(l&&o.unpairedTagsSet.has(l))throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);f&&o.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",a=c}else if(p===63){let c=zt(t,a,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,this.readonlyMatcher),!(o.ignoreDeclaration&&c.tagName==="?xml"||o.ignorePiTags)){const l=new Te(c.tagName);l.add(o.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,this.matcher,c.tagName)),this.addChild(n,l,this.readonlyMatcher,a)}a=c.closeIndex+1}else if(p===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){const c=De(t,"-->",a+4,"Comment is not closed.");if(o.commentPropName){const l=t.substring(a+4,c-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(o.commentPropName,[{[o.textNodeName]:l}])}a=c}else if(p===33&&t.charCodeAt(a+2)===68){const c=i.readDocType(t,a);this.docTypeEntities=c.entities,this.docTypeEntitiesKeys=Object.keys(this.docTypeEntities)||[],a=c.i}else if(p===33&&t.charCodeAt(a+2)===91){const c=De(t,"]]>",a,"CDATA is not closed.")-2,l=t.substring(a+9,c);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let f=this.parseTextData(l,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),o.cdataPropName?n.add(o.cdataPropName,[{[o.textNodeName]:l}]):n.add(o.textNodeName,f),a=c+2}else{let c=zt(t,a,o.removeNSPrefix);if(!c){const I=t.substring(Math.max(0,a-50),Math.min(s,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${I}"`)}let l=c.tagName;const f=c.rawTagName;let y=c.tagExp,E=c.attrExpPresent,O=c.closeIndex;if({tagName:l,tagExp:y}=ot(o.transformTagName,l,y,o),o.strictReservedNames&&(l===o.commentPropName||l===o.cdataPropName||l===o.textNodeName||l===o.attributesGroupName))throw new Error(`Invalid tag name: ${l}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));const w=n;w&&o.unpairedTagsSet.has(w.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let L=!1;y.length>0&&y.lastIndexOf("/")===y.length-1&&(L=!0,l[l.length-1]==="/"?(l=l.substr(0,l.length-1),y=l):y=y.substr(0,y.length-1),E=l!==y);let N=null,d;d=hs(f),l!==e.tagname&&this.matcher.push(l,{},d),l!==y&&E&&(N=this.buildAttributesMap(y,this.matcher,l),N&&fs(N,o)),l!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());const v=a;if(this.isCurrentNodeStopNode){let I="";if(L)a=c.closeIndex;else if(o.unpairedTagsSet.has(l))a=c.closeIndex;else{const _=this.readStopNodeData(t,f,O+1);if(!_)throw new Error(`Unexpected end of ${f}`);a=_.i,I=_.tagContent}const A=new Te(l);N&&(A[":@"]=N),A.add(o.textNodeName,I),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,A,this.readonlyMatcher,v)}else{if(L){({tagName:l,tagExp:y}=ot(o.transformTagName,l,y,o));const I=new Te(l);N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(o.unpairedTagsSet.has(l)){const I=new Te(l);N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=c.closeIndex;continue}else{const I=new Te(l);if(this.tagsNodeStack.length>o.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),n=I}r="",a=O}}}else r+=t[a];return e.child};function Es(t,e,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.jPath?n.toString():n,i=this.options.updateTag(e.tagname,o,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),t.addChild(e,r))}function Ts(t,e,n){const r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){const o=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,o)))return t}if(r.tagFilter){const o=this.options.jPath?n.toString():n;if(!r.tagFilter(e,o))return t}for(const o of this.docTypeEntitiesKeys){const i=this.docTypeEntities[o],s=t.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=t.length;if(t=t.replace(i.regx,i.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(const o of this.lastEntitiesKeys){const i=this.lastEntities[o],s=t.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}`);t=t.replace(i.regex,i.val)}if(t.indexOf("&")===-1)return t;for(const o of this.htmlEntitiesKeys){const i=this.htmlEntities[o],s=t.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}`);t=t.replace(i.regex,i.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t}function Ns(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Is(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function vs(t,e,n=">"){let r=0;const o=[],i=t.length,s=n.charCodeAt(0),a=n.length>1?n.charCodeAt(1):-1;for(let u=e;u<i;u++){const p=t.charCodeAt(u);if(r)p===r&&(r=0);else if(p===34||p===39)r=p;else if(p===s)if(a!==-1){if(t.charCodeAt(u+1)===a)return{data:String.fromCharCode(...o),index:u}}else return{data:String.fromCharCode(...o),index:u};else if(p===9){o.push(32);continue}o.push(p)}}function De(t,e,n,r){const o=t.indexOf(e,n);if(o===-1)throw new Error(r);return o+e.length-1}function Os(t,e,n,r){const o=t.indexOf(e,n);if(o===-1)throw new Error(r);return o}function zt(t,e,n,r=">"){const o=vs(t,e+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 l=u.indexOf(":");l!==-1&&(u=u.substr(l+1),p=u!==o.data.substr(l+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:p,rawTagName:c}}function xs(t,e,n){const r=n;let o=1;const i=t.length;for(;n<i;n++)if(t[n]==="<"){const s=t.charCodeAt(n+1);if(s===47){const a=Os(t,">",n,`${e} is not closed`);if(t.substring(n+2,a).trim()===e&&(o--,o===0))return{tagContent:t.substring(r,n),i:a};n=a}else if(s===63)n=De(t,"?>",n+1,"StopNode is not closed.");else if(s===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=De(t,"-->",n+3,"StopNode is not closed.");else if(s===33&&t.charCodeAt(n+2)===91)n=De(t,"]]>",n,"StopNode is not closed.")-2;else{const a=zt(t,n,">");a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&o++,n=a.closeIndex)}}}function Qt(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:ns(t,n)}else return Bi(t)?t:""}function Dn(t,e,n){const r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):n+t+";"}function ot(t,e,n,r){if(t){const o=t(e);n===e&&(n=o),e=o}return e=Rr(e,r),{tagName:e,tagExp:n}}function Rr(t,e){if(jr.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return sn.includes(t)?e.onDangerousProperty(t):t}const at=Te.getMetaDataSymbol();function Ps(t,e){if(!t||typeof t!="object")return{};if(!e)return t;const n={};for(const r in t)if(r.startsWith(e)){const o=r.substring(e.length);n[o]=t[r]}else n[r]=t[r];return n}function As(t,e,n,r){return $r(t,e,n,r)}function $r(t,e,n,r){let o;const i={};for(let s=0;s<t.length;s++){const a=t[s],u=_s(a);if(u!==void 0&&u!==e.textNodeName){const p=Ps(a[":@"]||{},e.attributeNamePrefix);n.push(u,p)}if(u===e.textNodeName)o===void 0?o=a[u]:o+=""+a[u];else{if(u===void 0)continue;if(a[u]){let p=$r(a[u],e,n,r);const c=Ss(p,e);if(a[":@"]?Ls(p,a[":@"],r,e):Object.keys(p).length===1&&p[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?p=p[e.textNodeName]:Object.keys(p).length===0&&(e.alwaysCreateTextNode?p[e.textNodeName]="":p=""),a[at]!==void 0&&typeof p=="object"&&p!==null&&(p[at]=a[at]),i[u]!==void 0&&Object.prototype.hasOwnProperty.call(i,u))Array.isArray(i[u])||(i[u]=[i[u]]),i[u].push(p);else{const l=e.jPath?r.toString():r;e.isArray(u,l,c)?i[u]=[p]:i[u]=p}u!==void 0&&u!==e.textNodeName&&n.pop()}}}return typeof o=="string"?o.length>0&&(i[e.textNodeName]=o):o!==void 0&&(i[e.textNodeName]=o),i}function _s(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Ls(t,e,n,r){if(e){const o=Object.keys(e),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)?t[a]=[e[a]]:t[a]=e[a]}}}function Ss(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}class Ge{constructor(e){this.externalEntities={},this.options=Ki(e)}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=$i(e,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new ps(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(e);return this.options.preserveOrder||o===void 0?o:As(o,this.options,r.matcher,r.readonlyMatcher)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return Te.getMetaDataSymbol()}}const Ds=`
|
|
8
|
-
`;function
|
|
4
|
+
`)}}function Vr(t){let e=t.replaceAll("\\","/");const n=e.match(/^([A-Za-z]):\//);return n&&(e="/"+n[1]+e.slice(2)),e}const Ur=":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",Ji=Ur+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ki="["+Ur+"]["+Ji+"]*",Zi=new RegExp("^"+Ki+"$");function qr(t,e){const n=[];let r=e.exec(t);for(;r;){const o=[];o.startIndex=e.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=e.exec(t)}return n}const Wr=function(t){const e=Zi.exec(t);return!(e===null||typeof e>"u")};function es(t){return typeof t<"u"}const pn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Gr=["__proto__","constructor","prototype"],ts={allowBooleanAttributes:!1,unpairedTags:[]};function ns(t,e){e=Object.assign({},ts,e);const n=[];let r=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=Rn(t,i),i.err)return i}else if(t[i]==="<"){let s=i;if(i++,t[i]==="!"){i=Bn(t,i);continue}else{let a=!1;t[i]==="/"&&(a=!0,i++);let u="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
|
|
5
|
+
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!ls(u)){let f;return u.trim().length===0?f="Invalid space after '<'.":f="Tag '"+u+"' is an invalid name.",K("InvalidTag",f,ne(t,i))}const d=ss(t,i);if(d===!1)return K("InvalidAttr","Attributes for '"+u+"' have open quote.",ne(t,i));let c=d.value;if(i=d.index,c[c.length-1]==="/"){const f=i-c.length;c=c.substring(0,c.length-1);const l=$n(c,e);if(l===!0)r=!0;else return K(l.err.code,l.err.msg,ne(t,f+l.err.line))}else if(a)if(d.tagClosed){if(c.trim().length>0)return K("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ne(t,s));if(n.length===0)return K("InvalidTag","Closing tag '"+u+"' has not been opened.",ne(t,s));{const f=n.pop();if(u!==f.tagName){let l=ne(t,f.tagStartPos);return K("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+l.line+", col "+l.col+") instead of closing tag '"+u+"'.",ne(t,s))}n.length==0&&(o=!0)}}else return K("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ne(t,i));else{const f=$n(c,e);if(f!==!0)return K(f.err.code,f.err.msg,ne(t,i-c.length+f.err.line));if(o===!0)return K("InvalidXml","Multiple possible root nodes found.",ne(t,i));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=Bn(t,i);continue}else if(t[i+1]==="?"){if(i=Rn(t,++i),i.err)return i}else break;else if(t[i]==="&"){const f=us(t,i);if(f==-1)return K("InvalidChar","char '&' is not expected.",ne(t,i));i=f}else if(o===!0&&!kn(t[i]))return K("InvalidXml","Extra text at the end",ne(t,i));t[i]==="<"&&i--}}else{if(kn(t[i]))continue;return K("InvalidChar","char '"+t[i]+"' is not expected.",ne(t,i))}if(r){if(n.length==1)return K("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ne(t,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 kn(t){return t===" "||t===" "||t===`
|
|
6
|
+
`||t==="\r"}function Rn(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return K("InvalidXml","XML declaration allowed only at the start of the document.",ne(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Bn(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const rs='"',is="'";function ss(t,e){let n="",r="",o=!1;for(;e<t.length;e++){if(t[e]===rs||t[e]===is)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){o=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:o}}const os=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function $n(t,e){const n=qr(t,os),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.",Be(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return K("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",Be(n[o]));if(n[o][3]===void 0&&!e.allowBooleanAttributes)return K("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",Be(n[o]));const i=n[o][2];if(!cs(i))return K("InvalidAttr","Attribute '"+i+"' is an invalid name.",Be(n[o]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return K("InvalidAttr","Attribute '"+i+"' is repeated.",Be(n[o]))}return!0}function as(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function us(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,as(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function K(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function cs(t){return Wr(t)}function ls(t){return Wr(t)}function ne(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Be(t){return t.startIndex+t[1].length}const fs={cent:"¢",pound:"£",curren:"¤",yen:"¥",euro:"€",dollar:"$",fnof:"ƒ",inr:"₹",af:"؋",birr:"ብር",peso:"₱",rub:"₽",won:"₩",yuan:"¥",cedil:"¸"},Hr={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},hs={nbsp:" ",copy:"©",reg:"®",trade:"™",mdash:"—",ndash:"–",hellip:"…",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",para:"¶",sect:"§",deg:"°",frac12:"½",frac14:"¼",frac34:"¾"},ps=new Set("!?\\\\/[]$%{}^&*()<>|+");function Xn(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(const e of t)if(ps.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function lt(...t){const e=Object.create(null);for(const n of t)if(n)for(const r of Object.keys(n)){const o=n[r];if(typeof o=="string")e[r]=o;else if(o&&typeof o=="object"&&o.val!==void 0){const i=o.val;typeof i=="string"&&(e[r]=i)}}return e}const _e="external",Ye="base",nn="all";function ds(t){return!t||t===_e?new Set([_e]):t===nn?new Set([nn]):t===Ye?new Set([Ye]):Array.isArray(t)?new Set(t):new Set([_e])}const oe=Object.freeze({allow:0,leave:1,remove:2,throw:3}),gs=new Set([9,10,13]);function ms(t){if(!t)return{xmlVersion:1,onLevel:oe.allow,nullLevel:oe.remove};const e=t.xmlVersion===1.1?1.1:1,n=oe[t.onNCR]??oe.allow,r=oe[t.nullNCR]??oe.remove,o=Math.max(r,oe.remove);return{xmlVersion:e,onLevel:n,nullLevel:o}}class ys{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:r=>r,this._limitTiers=ds(this._limit.applyLimitsTo??_e),this._numericAllowed=e.numericAllowed??!0,this._baseMap=lt(Hr,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);const n=ms(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel}setExternalEntities(e){if(e)for(const n of Object.keys(e))Xn(n);this._externalMap=lt(e)}addExternalEntity(e,n){Xn(e),typeof n=="string"&&n.indexOf("&")===-1&&(this._externalMap[e]=n)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=lt(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!="string"||e.length===0||e.indexOf("&")===-1)return e;const n=e,r=[],o=e.length;let i=0,s=0;const a=this._maxTotalExpansions>0,u=this._maxExpandedLength>0,d=a||u;for(;s<o;){if(e.charCodeAt(s)!==38){s++;continue}let f=s+1;for(;f<o&&e.charCodeAt(f)!==59&&f-s<=32;)f++;if(f>=o||e.charCodeAt(f)!==59){s++;continue}const l=e.slice(s+1,f);if(l.length===0){s++;continue}let m,E;if(this._removeSet.has(l))m="",E===void 0&&(E=_e);else if(this._leaveSet.has(l)){s++;continue}else if(l.charCodeAt(0)===35){const O=this._resolveNCR(l);if(O===void 0){s++;continue}m=O,E=Ye}else{const O=this._resolveName(l);m=O?.value,E=O?.tier}if(m===void 0){s++;continue}if(s>i&&r.push(e.slice(i,s)),r.push(m),i=f+1,s=i,d&&this._tierCounts(E)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(u){const O=m.length-(l.length+2);if(O>0&&(this._expandedLength+=O,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}i<o&&r.push(e.slice(i));const c=r.length===0?e:r.join("");return this._postCheck(c,n)}_tierCounts(e){return this._limitTiers.has(nn)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:_e};if(e in this._externalMap)return{value:this._externalMap[e],tier:_e};if(e in this._baseMap)return{value:this._baseMap[e],tier:Ye}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!gs.has(e)?oe.remove:-1}_applyNCRAction(e,n,r){switch(e){case oe.allow:return String.fromCodePoint(r);case oe.remove:return"";case oe.leave:return;case oe.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${n}; (U+${r.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(r)}}_resolveNCR(e){const n=e.charCodeAt(1);let r;if(n===120||n===88?r=parseInt(e.slice(2),16):r=parseInt(e.slice(1),10),Number.isNaN(r)||r<0||r>1114111)return;const o=this._classifyNCR(r);if(!this._numericAllowed&&o<oe.remove)return;const i=o===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,o);return this._applyNCRAction(i,e,r)}}const Yr=t=>pn.includes(t)?"__"+t:t,bs={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(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:Yr};function ws(t,e){if(typeof t!="string")return;const n=t.toLowerCase();if(pn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Gr.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function zr(t,e){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:zr(!0)}const Es=function(t){const e=Object.assign({},bs,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:r,name:o}of n)r&&ws(r,o);return e.onDangerousProperty===null&&(e.onDangerousProperty=Yr),e.processEntities=zr(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};let ze;typeof Symbol!="function"?ze="@@xmlMetadata":ze=Symbol("XML Node Metadata");class Te{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][ze]={startIndex:n})}static getMetaDataSymbol(){return ze}}const Qr=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",Ns=Qr+"\\-\\.\\d·̀-ͯ‿-⁀",Jr=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",Ts=Jr+"\\-\\.\\d·̀-ͯ҇‿-⁀",Kr=(t,e,n="")=>{const r=t.replace(":",""),o=e.replace(":",""),i=`[${r}][${o}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${i}$`,n),qName:new RegExp(`^${i}(?::${i})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},vs=Kr(Qr,Ns),Is=Kr(Jr,Ts,"u"),Os=(t="1.0")=>t==="1.1"?Is:vs,rt=(t,{xmlVersion:e="1.0"}={})=>Os(e).qName.test(t);class xs{constructor(e,n){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=n||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,n){const r=Object.create(null);let o=0;if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let i=1,s=!1,a=!1,u="";for(;n<e.length;n++)if(e[n]==="<"&&!a){if(s&&Ie(e,"!ENTITY",n)){n+=7;let d,c;if([d,c,n]=this.readEntityExp(e,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})`);r[d]=c,o++}}else if(s&&Ie(e,"!ELEMENT",n)){n+=8;const{index:d}=this.readElementExp(e,n+1);n=d}else if(s&&Ie(e,"!ATTLIST",n))n+=8;else if(s&&Ie(e,"!NOTATION",n)){n+=9;const{index:d}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=d}else if(Ie(e,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");i++,u=""}else if(e[n]===">"){if(a?e[n-1]==="-"&&e[n-2]==="-"&&(a=!1,i--):i--,i===0)break}else e[n]==="["?s=!0:u+=e[n];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let o=e.substring(r,n);if($e(o,{xmlVersion:this.xmlVersion}),n=se(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(e,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(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);!this.suppressValidationErr&&$e(o,{xmlVersion:this.xmlVersion}),n=se(e,n);const i=e.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=se(e,n);let s=null,a=null;if(i==="PUBLIC")[n,s]=this.readIdentifierVal(e,n,"publicIdentifier"),n=se(e,n),(e[n]==='"'||e[n]==="'")&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(i==="SYSTEM"&&([n,a]=this.readIdentifierVal(e,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(e,n,r){let o="";const i=e[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);n++;const s=n;for(;n<e.length&&e[n]!==i;)n++;if(o=e.substring(s,n),e[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(e,n){n=se(e,n);const r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);if(!this.suppressValidationErr&&!rt(o,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${o}"`);n=se(e,n);let i="";if(e[n]==="E"&&Ie(e,"MPTY",n))n+=4;else if(e[n]==="A"&&Ie(e,"NY",n))n+=2;else if(e[n]==="("){n++;const s=n;for(;n<e.length&&e[n]!==")";)n++;if(i=e.substring(s,n),e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:o,contentModel:i.trim(),index:n}}readAttlistExp(e,n){n=se(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);for($e(o,{xmlVersion:this.xmlVersion}),n=se(e,n),r=n;n<e.length&&!/\s/.test(e[n]);)n++;let i=e.substring(r,n);if(!$e(i,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${i}"`);n=se(e,n);let s="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=se(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let u=[];for(;n<e.length&&e[n]!==")";){const d=n;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)n++;let c=e.substring(d,n);if(c=c.trim(),!$e(c,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${c}"`);u.push(c),e[n]==="|"&&(n++,n=se(e,n))}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+u.join("|")+")"}else{const u=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;s+=e.substring(u,n);const d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=se(e,n);let a="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:o,attributeName:i,attributeType:s,defaultValue:a,index:n}}}const se=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function Ie(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function $e(t,e){if(rt(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}const _s=/^[-+]?0x[a-fA-F0-9]+$/,As=/^0b[01]+$/,Ps=/^0o[0-7]+$/,Ls=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Ss={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function Ds(t,e={}){if(e=Object.assign({},Ss,e),!t||typeof t!="string")return t;let n=t.trim();if(n.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(n==="0")return 0;if(e.hex&&_s.test(n))return ft(n,16);if(e.binary&&As.test(n))return ft(n,2);if(e.octal&&Ps.test(n))return ft(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return Cs(t,n,e);{const r=Ls.exec(n);if(r){const o=r[1]||"",i=r[2];let s=Fs(r[3]);const a=o?t[i.length+1]===".":t[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!a))return t;{const u=Number(n),d=String(u);if(u===0)return u;if(d.search(/[eE]/)!==-1)return e.eNotation?u:t;if(n.indexOf(".")!==-1)return d==="0"||d===s||d===`${o}${s}`?u:t;let c=i?s:n;return i?c===d||o+c===d?u:t:c===d||c===o+d?u:t}}else return t}}else return js(t,Number(n),e)}const Ms=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Cs(t,e,n){if(!n.eNotation)return t;const r=e.match(Ms);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?t[s.length+1]===i:t[s.length]===i;return s.length>1&&a?t:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(e):s.length>0?n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}else return t}function Fs(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function ft(t,e){const n=t.trim();if((e===2||e===8)&&(t=n.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function js(t,e,n){const r=e===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return r?"Infinity":"-Infinity";case"original":default:return t}}function ks(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}class je{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(o=>o.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(o=>o.attrName!==void 0),this._hasPositionSelector=this.segments.some(o=>o.position!==void 0)}_parse(e){const n=[];let r=0,o="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[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+=e[r],r++);return o.trim()&&n.push(this._parseSegment(o.trim())),n}_parseSegment(e){const n={type:"tag"};let r=null,o=e;const i=e.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: ${e}`)}let u,d=null;if(a.includes(":")){const c=a.lastIndexOf(":"),f=a.substring(0,c).trim(),l=a.substring(c+1).trim();["first","last","odd","even"].includes(l)||/^nth\(\d+\)$/.test(l)?(u=f,d=l):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${e}`);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(d){const c=d.match(/^nth\((\d+)\)$/);c?(n.position="nth",n.positionValue=parseInt(c[1],10)):n.position=d}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class Rs{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;const n=e.length,o=e.segments[e.segments.length-1]?.tag;if(!o||o==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else{const i=`${n}:${o}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e)}return this}addAll(e){for(const n of e)this.add(n);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){const n=e.getDepth(),r=e.getCurrentTag(),o=`${n}:${r}`,i=this._byDepthAndTag.get(o);if(i){for(let a=0;a<i.length;a++)if(e.matches(i[a]))return i[a]}const s=this._wildcardByDepth.get(n);if(s){for(let a=0;a<s.length;a++)if(e.matches(s[a]))return s[a]}for(let a=0;a<this._deepWildcards.length;a++)if(e.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}}class Bs{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){const e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){const n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){const n=this._matcher.path;if(n.length===0)return!1;const r=n[n.length-1];return r.values!==void 0&&e in r.values}getPosition(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){const e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=!0){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class dn{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new Bs(this)}push(e,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);const i=this.siblingStacks[o],s=r?`${r}:${e}`:e,a=i.get(s)||0;let u=0;for(const c of i.values())u+=c;i.set(s,a+1);const d={tag:e,position:u,counter:a};r!=null&&(d.namespace=r),n!=null&&(d.values=n),this.path.push(d)}pop(){if(this.path.length===0)return;this._pathStringCache=null;const e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){const n=this.path[this.path.length-1];e!=null&&(n.values=e)}}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(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&e 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(e,n=!0){const r=e||this.separator;if(r===this.separator&&n===!0){if(this._pathStringCache!==null)return this._pathStringCache;const i=this.path.map(s=>s.namespace?`${s.namespace}:${s.tag}`:s.tag).join(r);return this._pathStringCache=i,i}return this.path.map(i=>n&&i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){const n=e.segments;return n.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){const o=e[r];if(o.type==="deep-wildcard"){if(r--,r<0)return!0;const i=e[r];let s=!1;for(let a=n;a>=0;a--)if(this._matchSegment(i,this.path[a],a===this.path.length-1)){n=a-1,r--,s=!0;break}if(!s)return!1}else{if(!this._matchSegment(o,this.path[n],n===this.path.length-1))return!1;n--,r--}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!r)return!1;const o=n.counter??0;if(e.position==="first"&&o!==0)return!1;if(e.position==="odd"&&o%2!==1)return!1;if(e.position==="even"&&o%2!==0)return!1;if(e.position==="nth"&&o!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n))}readOnly(){return this._view}}function $s(t,e){if(!t)return{};const n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return{};const r={};for(const o in n)if(o.startsWith(e.attributeNamePrefix)){const i=o.substring(e.attributeNamePrefix.length);r[i]=n[o]}else r[o]=n[o];return r}function Xs(t){if(!t||typeof t!="string")return;const e=t.indexOf(":");if(e!==-1&&e>0){const n=t.substring(0,e);if(n!=="xmlns")return n}}class Vs{constructor(e,n){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Hs,this.parseTextData=Us,this.resolveNameSpace=qs,this.buildAttributesMap=Gs,this.isItStopNode=Js,this.replaceEntitiesValue=zs,this.readStopNodeData=eo,this.saveTextToParentTag=Qs,this.addChild=Ys,this.ignoreAttributesFn=ks(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let r={...Hr};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?r=this.options.htmlEntities:this.options.htmlEntities===!0&&(r={...hs,...fs}),this.entityDecoder=new ys({namedEntities:{...r,...n},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new dn,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new Rs;const o=this.options.stopNodes;if(o&&o.length>0){for(let i=0;i<o.length;i++){const s=o[i];typeof s=="string"?this.stopNodeExpressionsSet.add(new je(s)):s instanceof je&&this.stopNodeExpressionsSet.add(s)}this.stopNodeExpressionsSet.seal()}}}function Us(t,e,n,r,o,i,s){const a=this.options;if(t!==void 0&&(a.trimValues&&!r&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t,e,n));const u=a.jPath?n.toString():n,d=a.tagValueProcessor(e,t,u,o,i);return d==null?t:typeof d!=typeof t||d!==t?d:a.trimValues||t.trim()===t?sn(t,a.parseTagValue,a.numberParseOptions):t}}function qs(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const Ws=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Gs(t,e,n,r=!1){const o=this.options;if(r===!0||o.ignoreAttributes!==!0&&typeof t=="string"){const i=qr(t,Ws),s=i.length,a={},u=new Array(s);let d=!1;const c={};for(let m=0;m<s;m++){const E=this.resolveNameSpace(i[m][1]),O=i[m][4];if(E.length&&O!==void 0){let w=O;o.trimValues&&(w=w.trim()),w=this.replaceEntitiesValue(w,n,this.readonlyMatcher),u[m]=w,c[E]=w,d=!0}}d&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(c);const f=o.jPath?e.toString():this.readonlyMatcher;let l=!1;for(let m=0;m<s;m++){const E=this.resolveNameSpace(i[m][1]);if(this.ignoreAttributesFn(E,f))continue;let O=o.attributeNamePrefix+E;if(E.length)if(o.transformAttributeName&&(O=o.transformAttributeName(O)),O=Zr(O,o),i[m][4]!==void 0){const w=u[m],A=o.attributeValueProcessor(E,w,f);A==null?a[O]=w:typeof A!=typeof w||A!==w?a[O]=A:a[O]=sn(w,o.parseAttributeValue,o.numberParseOptions),l=!0}else o.allowBooleanAttributes&&(a[O]=!0,l=!0)}if(!l)return;if(o.attributesGroupName&&!o.preserveOrder){const m={};return m[o.attributesGroupName]=a,m}return a}}const Hs=function(t){t=t.replace(/\r\n?/g,`
|
|
7
|
+
`);const e=new Te("!xml");let n=e,r="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const o=this.options,i=new xs(o.processEntities),s=t.length;for(let a=0;a<s;a++)if(t[a]==="<"){const d=t.charCodeAt(a+1);if(d===47){const c=Ce(t,">",a,"Closing Tag is not closed.");let f=t.substring(a+2,c).trim();if(o.removeNSPrefix){const m=f.indexOf(":");m!==-1&&(f=f.substr(m+1))}f=ht(o.transformTagName,f,"",o).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));const l=this.matcher.getCurrentTag();if(f&&o.unpairedTagsSet.has(f))throw new Error(`Unpaired tag can not be used as closing tag: </${f}>`);l&&o.unpairedTagsSet.has(l)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",a=c}else if(d===63){let c=rn(t,a,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");r=this.saveTextToParentTag(r,n,this.readonlyMatcher);const f=this.buildAttributesMap(c.tagExp,this.matcher,c.tagName,!0);if(f){const l=f[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(l)||1),i.setXmlVersion(Number(l)||1)}if(!(o.ignoreDeclaration&&c.tagName==="?xml"||o.ignorePiTags)){const l=new Te(c.tagName);l.add(o.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&o.ignoreAttributes!==!0&&(l[":@"]=f),this.addChild(n,l,this.readonlyMatcher,a)}a=c.closeIndex+1}else if(d===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){const c=Ce(t,"-->",a+4,"Comment is not closed.");if(o.commentPropName){const f=t.substring(a+4,c-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(o.commentPropName,[{[o.textNodeName]:f}])}a=c}else if(d===33&&t.charCodeAt(a+2)===68){const c=i.readDocType(t,a);this.entityDecoder.addInputEntities(c.entities),a=c.i}else if(d===33&&t.charCodeAt(a+2)===91){const c=Ce(t,"]]>",a,"CDATA is not closed.")-2,f=t.substring(a+9,c);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let l=this.parseTextData(f,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);l==null&&(l=""),o.cdataPropName?n.add(o.cdataPropName,[{[o.textNodeName]:f}]):n.add(o.textNodeName,l),a=c+2}else{let c=rn(t,a,o.removeNSPrefix);if(!c){const I=t.substring(Math.max(0,a-50),Math.min(s,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${I}"`)}let f=c.tagName;const l=c.rawTagName;let m=c.tagExp,E=c.attrExpPresent,O=c.closeIndex;if({tagName:f,tagExp:m}=ht(o.transformTagName,f,m,o),o.strictReservedNames&&(f===o.commentPropName||f===o.cdataPropName||f===o.textNodeName||f===o.attributesGroupName))throw new Error(`Invalid tag name: ${f}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));const w=n;w&&o.unpairedTagsSet.has(w.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let A=!1;m.length>0&&m.lastIndexOf("/")===m.length-1&&(A=!0,f[f.length-1]==="/"?(f=f.substr(0,f.length-1),m=f):m=m.substr(0,m.length-1),E=f!==m);let N=null,p;p=Xs(l),f!==e.tagname&&this.matcher.push(f,{},p),f!==m&&E&&(N=this.buildAttributesMap(m,this.matcher,f),N&&$s(N,o)),f!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());const v=a;if(this.isCurrentNodeStopNode){let I="";if(A)a=c.closeIndex;else if(o.unpairedTagsSet.has(f))a=c.closeIndex;else{const L=this.readStopNodeData(t,l,O+1);if(!L)throw new Error(`Unexpected end of ${l}`);a=L.i,I=L.tagContent}const P=new Te(f);N&&(P[":@"]=N),P.add(o.textNodeName,I),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,P,this.readonlyMatcher,v)}else{if(A){({tagName:f,tagExp:m}=ht(o.transformTagName,f,m,o));const I=new Te(f);N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(o.unpairedTagsSet.has(f)){const I=new Te(f);N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=c.closeIndex;continue}else{const I=new Te(f);if(this.tagsNodeStack.length>o.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),N&&(I[":@"]=N),this.addChild(n,I,this.readonlyMatcher,v),n=I}r="",a=O}}}else r+=t[a];return e.child};function Ys(t,e,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.jPath?n.toString():n,i=this.options.updateTag(e.tagname,o,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),t.addChild(e,r))}function zs(t,e,n){const r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){const o=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,o)))return t}if(r.tagFilter){const o=this.options.jPath?n.toString():n;if(!r.tagFilter(e,o))return t}return this.entityDecoder.decode(t)}function Qs(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Js(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Ks(t,e,n=">"){let r=0;const o=t.length,i=n.charCodeAt(0),s=n.length>1?n.charCodeAt(1):-1;let a="",u=e;for(let d=e;d<o;d++){const c=t.charCodeAt(d);if(r)c===r&&(r=0);else if(c===34||c===39)r=c;else if(c===i)if(s!==-1){if(t.charCodeAt(d+1)===s)return a+=t.substring(u,d),{data:a,index:d}}else return a+=t.substring(u,d),{data:a,index:d};else c===9&&!r&&(a+=t.substring(u,d)+" ",u=d+1)}}function Ce(t,e,n,r){const o=t.indexOf(e,n);if(o===-1)throw new Error(r);return o+e.length-1}function Zs(t,e,n,r){const o=t.indexOf(e,n);if(o===-1)throw new Error(r);return o}function rn(t,e,n,r=">"){const o=Ks(t,e+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,d=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const c=u;if(n){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1),d=u!==o.data.substr(f+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:d,rawTagName:c}}function eo(t,e,n){const r=n;let o=1;const i=t.length;for(;n<i;n++)if(t[n]==="<"){const s=t.charCodeAt(n+1);if(s===47){const a=Zs(t,">",n,`${e} is not closed`);if(t.substring(n+2,a).trim()===e&&(o--,o===0))return{tagContent:t.substring(r,n),i:a};n=a}else if(s===63)n=Ce(t,"?>",n+1,"StopNode is not closed.");else if(s===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=Ce(t,"-->",n+3,"StopNode is not closed.");else if(s===33&&t.charCodeAt(n+2)===91)n=Ce(t,"]]>",n,"StopNode is not closed.")-2;else{const a=rn(t,n,!1);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&o++,n=a.closeIndex)}}}function sn(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:Ds(t,n)}else return es(t)?t:""}function ht(t,e,n,r){if(t){const o=t(e);n===e&&(n=o),e=o}return e=Zr(e,r),{tagName:e,tagExp:n}}function Zr(t,e){if(Gr.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return pn.includes(t)?e.onDangerousProperty(t):t}const pt=Te.getMetaDataSymbol();function to(t,e){if(!t||typeof t!="object")return{};if(!e)return t;const n={};for(const r in t)if(r.startsWith(e)){const o=r.substring(e.length);n[o]=t[r]}else n[r]=t[r];return n}function no(t,e,n,r){return ei(t,e,n,r)}function ei(t,e,n,r){let o;const i={};for(let s=0;s<t.length;s++){const a=t[s],u=ro(a);if(u!==void 0&&u!==e.textNodeName){const d=to(a[":@"]||{},e.attributeNamePrefix);n.push(u,d)}if(u===e.textNodeName)o===void 0?o=a[u]:o+=""+a[u];else{if(u===void 0)continue;if(a[u]){let d=ei(a[u],e,n,r);const c=so(d,e);if(Object.keys(d).length===0&&e.alwaysCreateTextNode&&(d[e.textNodeName]=""),a[":@"]?io(d,a[":@"],r,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),a[pt]!==void 0&&typeof d=="object"&&d!==null&&(d[pt]=a[pt]),i[u]!==void 0&&Object.prototype.hasOwnProperty.call(i,u))Array.isArray(i[u])||(i[u]=[i[u]]),i[u].push(d);else{const f=e.jPath?r.toString():r;e.isArray(u,f,c)?i[u]=[d]:i[u]=d}u!==void 0&&u!==e.textNodeName&&n.pop()}}}return typeof o=="string"?o.length>0&&(i[e.textNodeName]=o):o!==void 0&&(i[e.textNodeName]=o),i}function ro(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function io(t,e,n,r){if(e){const o=Object.keys(e),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,d=r.jPath?n.toString()+"."+u:n;r.isArray(a,d,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function so(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}class Qe{constructor(e){this.externalEntities={},this.options=Es(e)}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=ns(e,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Vs(this.options,this.externalEntities),o=r.parseXml(e);return this.options.preserveOrder||o===void 0?o:no(o,this.options,r.matcher,r.readonlyMatcher)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return Te.getMetaDataSymbol()}}function ti(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function ni(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function ke(t){return String(t).replace(/"/g,""").replace(/'/g,"'")}const oo=`
|
|
8
|
+
`;function ao(t,e){if(!Array.isArray(t)||t.length===0)return"1.0";const n=t[0];if(gn(n)==="?xml"){const o=n[":@"];if(o){const i=e.attributeNamePrefix+"version";if(o[i])return o[i]}}return"1.0"}function ri(t,e,n,r,o){return!n.sanitizeName||rt(t,{xmlVersion:o})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}function uo(t,e){let n="";e.format&&(n=oo);const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let s=0;s<e.stopNodes.length;s++){const a=e.stopNodes[s];typeof a=="string"?r.push(new je(a)):a instanceof je&&r.push(a)}const o=ao(t,e),i=new dn;return ii(t,e,n,i,r,o)}function ii(t,e,n,r,o,i){let s="",a=!1;if(e.maxNestedTags&&r.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(t!=null){let u=t.toString();return u=on(u,e),u}return""}for(let u=0;u<t.length;u++){const d=t[u],c=gn(d);if(c===void 0)continue;const l=c===e.textNodeName||c===e.cdataPropName||c===e.commentPropName||c[0]==="?"?c:ri(c,!1,e,r,i),m=co(d[":@"],e);r.push(l,m);const E=fo(r,o);if(l===e.textNodeName){let p=d[c];E||(p=e.tagValueProcessor(l,p),p=on(p,e)),a&&(s+=n),s+=p,a=!1,r.pop();continue}else if(l===e.cdataPropName){a&&(s+=n);const p=d[c][0][e.textNodeName],v=ni(p);s+=`<![CDATA[${v}]]>`,a=!1,r.pop();continue}else if(l===e.commentPropName){const p=d[c][0][e.textNodeName],v=ti(p);s+=n+`<!--${v}-->`,a=!0,r.pop();continue}else if(l[0]==="?"){const p=Vn(d[":@"],e,E,r,i);s+=(l==="?xml"?"":n)+`<${l}${p}?>`,a=!0,r.pop();continue}let O=n;O!==""&&(O+=e.indentBy);const w=Vn(d[":@"],e,E,r,i),A=n+`<${l}${w}`;let N;E?N=si(d[c],e):N=ii(d[c],e,O,r,o,i),e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?s+=A+">":s+=A+"/>":(!N||N.length===0)&&e.suppressEmptyNode?s+=A+"/>":N&&N.endsWith(">")?s+=A+`>${N}${n}</${l}>`:(s+=A+">",N&&n!==""&&(N.includes("/>")||N.includes("</"))?s+=n+e.indentBy+N+n:s+=N,s+=`</${l}>`),a=!0,r.pop()}return s}function co(t,e){if(!t||e.ignoreAttributes)return null;const n={};let r=!1;for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const i=o.startsWith(e.attributeNamePrefix)?o.substr(e.attributeNamePrefix.length):o;n[i]=ke(t[o]),r=!0}return r?n:null}function si(t,e){if(!Array.isArray(t))return t!=null?t.toString():"";let n="";for(let r=0;r<t.length;r++){const o=t[r],i=gn(o);if(i===e.textNodeName)n+=o[i];else if(i===e.cdataPropName)n+=o[i][0][e.textNodeName];else if(i===e.commentPropName)n+=o[i][0][e.textNodeName];else{if(i&&i[0]==="?")continue;if(i){const s=lo(o[":@"],e),a=si(o[i],e);!a||a.length===0?n+=`<${i}${s}/>`:n+=`<${i}${s}>${a}</${i}>`}}}return n}function lo(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let o=t[r];o===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${ke(o)}"`}return n}function gn(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(Object.prototype.hasOwnProperty.call(t,r)&&r!==":@")return r}}function Vn(t,e,n,r,o){let i="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const a=s.substr(e.attributeNamePrefix.length),u=n?a:ri(a,!0,e,r,o);let d;n?d=t[s]:(d=e.attributeValueProcessor(s,t[s]),d=on(d,e)),d===!0&&e.suppressBooleanAttributes?i+=` ${u}`:i+=` ${u}="${ke(d)}"`}return i}function fo(t,e){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 on(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}function ho(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}const po={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function ie(t){if(this.options=Object.assign({},po,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){const n=this.options.stopNodes[e];typeof n=="string"?this.stopNodeExpressions.push(new je(n)):n instanceof je&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=ho(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=bo),this.processTextOrObjNode=mo,this.options.format?(this.indentate=yo,this.tagEndChar=`>
|
|
9
9
|
`,this.newLine=`
|
|
10
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ie.prototype.build=function(t){if(this.options.preserveOrder)return
|
|
11
|
-
`;break;case 114:
|
|
12
|
-
`),a++,
|
|
13
|
-
`+" ".repeat(e)),"\r":new Array(
|
|
14
|
-
`+" ".repeat(e))}," ":{"\n":new Array(
|
|
15
|
-
`+" ".repeat(e)),"\r":new Array(
|
|
16
|
-
`+" ".repeat(e))}},
|
|
10
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function go(t,e){const n=t["?xml"];if(n&&typeof n=="object"){if(e.attributesGroupName&&n[e.attributesGroupName]){const o=n[e.attributesGroupName][e.attributeNamePrefix+"version"];if(o)return o}const r=n[e.attributeNamePrefix+"version"];if(r)return r}return"1.0"}function dt(t,e,n,r,o){return!n.sanitizeName||rt(t,{xmlVersion:o})?t:n.sanitizeName(t,{isAttribute:e,matcher:r.readOnly()})}ie.prototype.build=function(t){if(this.options.preserveOrder)return uo(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new dn,n=go(t,this.options);return this.j2x(t,0,e,n).val}};ie.prototype.j2x=function(t,e,n,r){let o="",i="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const s=this.options.jPath?n.toString():n,a=this.checkStopNode(n);for(let u in t){if(!Object.prototype.hasOwnProperty.call(t,u))continue;const c=u===this.options.textNodeName||u===this.options.cdataPropName||u===this.options.commentPropName||this.options.attributesGroupName&&u===this.options.attributesGroupName||this.isAttribute(u)||u[0]==="?"?u:dt(u,!1,this.options,n,r);if(typeof t[u]>"u")this.isAttribute(u)&&(i+="");else if(t[u]===null)this.isAttribute(u)||c===this.options.cdataPropName||c===this.options.commentPropName?i+="":c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(t[u]instanceof Date)i+=this.buildTextValNode(t[u],c,"",e,n);else if(typeof t[u]!="object"){const f=this.isAttribute(u);if(f&&!this.ignoreAttributesFn(f,s)){const l=dt(f,!0,this.options,n,r);o+=this.buildAttrPairStr(l,""+t[u],a)}else if(!f)if(u===this.options.textNodeName){let l=this.options.tagValueProcessor(u,""+t[u]);i+=this.replaceEntitiesValue(l)}else{n.push(c);const l=this.checkStopNode(n);if(n.pop(),l){const m=""+t[u];m===""?i+=this.indentate(e)+"<"+c+this.closeTag(c)+this.tagEndChar:i+=this.indentate(e)+"<"+c+">"+m+"</"+c+this.tagEndChar}else i+=this.buildTextValNode(t[u],c,"",e,n)}}else if(Array.isArray(t[u])){const f=t[u].length;let l="",m="";for(let E=0;E<f;E++){const O=t[u][E];if(!(typeof O>"u"))if(O===null)c[0]==="?"?i+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(typeof O=="object")if(this.options.oneListGroup){n.push(c);const w=this.j2x(O,e+1,n,r);n.pop(),l+=w.val,this.options.attributesGroupName&&O.hasOwnProperty(this.options.attributesGroupName)&&(m+=w.attrStr)}else l+=this.processTextOrObjNode(O,c,e,n,r);else if(this.options.oneListGroup){let w=this.options.tagValueProcessor(c,O);w=this.replaceEntitiesValue(w),l+=w}else{n.push(c);const w=this.checkStopNode(n);if(n.pop(),w){const A=""+O;A===""?l+=this.indentate(e)+"<"+c+this.closeTag(c)+this.tagEndChar:l+=this.indentate(e)+"<"+c+">"+A+"</"+c+this.tagEndChar}else l+=this.buildTextValNode(O,c,"",e,n)}}this.options.oneListGroup&&(l=this.buildObjectNode(l,c,m,e)),i+=l}else if(this.options.attributesGroupName&&u===this.options.attributesGroupName){const f=Object.keys(t[u]),l=f.length;for(let m=0;m<l;m++){const E=dt(f[m],!0,this.options,n,r);o+=this.buildAttrPairStr(E,""+t[u][f[m]],a)}}else i+=this.processTextOrObjNode(t[u],c,e,n,r)}return{attrStr:o,val:i}};ie.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+ke(e)+'"'};function mo(t,e,n,r,o){const i=this.extractAttributes(t);if(r.push(e,i),this.checkStopNode(r)){const u=this.buildRawContent(t),d=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(u,e,d,n)}const a=this.j2x(t,n+1,r,o);return r.pop(),e[0]==="?"?this.buildTextValNode("",e,a.attrStr,n,r):t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,a.attrStr,n,r):this.buildObjectNode(a.val,e,a.attrStr,n)}ie.prototype.extractAttributes=function(t){if(!t||typeof t!="object")return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[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;e[i]=ke(r[o]),n=!0}}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const o=this.isAttribute(r);o&&(e[o]=ke(t[r]),n=!0)}return n?e:null};ie.prototype.buildRawContent=function(t){if(typeof t=="string")return t;if(typeof t!="object"||t===null)return String(t);if(t[this.options.textNodeName]!==void 0)return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let o of r)if(typeof o=="string"||typeof o=="number")e+=`<${n}>${o}</${n}>`;else if(typeof o=="object"&&o!==null){const i=this.buildRawContent(o),s=this.buildAttributesForStopNode(o);i===""?e+=`<${n}${s}/>`:e+=`<${n}${s}>${i}</${n}>`}}else if(typeof r=="object"&&r!==null){const o=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);o===""?e+=`<${n}${i}/>`:e+=`<${n}${i}>${o}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e};ie.prototype.buildAttributesForStopNode=function(t){if(!t||typeof t!="object")return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[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?e+=" "+o:e+=" "+o+'="'+i+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const o=t[n];o===!0&&this.options.suppressBooleanAttributes?e+=" "+r:e+=" "+r+'="'+o+'"'}}return e};ie.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let o="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",o=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+i+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+i+this.tagEndChar+t+this.indentate(r)+o}};ie.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};ie.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1};ie.prototype.buildTextValNode=function(t,e,n,r,o){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName){const i=ni(t);return this.indentate(r)+`<![CDATA[${i}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){const i=ti(t);return this.indentate(r)+`<!--${i}-->`+this.newLine}else{if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}}};ie.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function yo(t){return this.options.indentBy.repeat(t)}function bo(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}function oi(t,e=!1){const n=t.length;let r=0,o="",i=0,s=16,a=0,u=0,d=0,c=0,f=0;function l(p,v){let I=0,P=0;for(;I<p;){let L=t.charCodeAt(r);if(L>=48&&L<=57)P=P*16+L-48;else if(L>=65&&L<=70)P=P*16+L-65+10;else if(L>=97&&L<=102)P=P*16+L-97+10;else break;r++,I++}return I<p&&(P=-1),P}function m(p){r=p,o="",i=0,s=16,f=0}function E(){let p=r;if(t.charCodeAt(r)===48)r++;else for(r++;r<t.length&&Le(t.charCodeAt(r));)r++;if(r<t.length&&t.charCodeAt(r)===46)if(r++,r<t.length&&Le(t.charCodeAt(r)))for(r++;r<t.length&&Le(t.charCodeAt(r));)r++;else return f=3,t.substring(p,r);let v=r;if(r<t.length&&(t.charCodeAt(r)===69||t.charCodeAt(r)===101))if(r++,(r<t.length&&t.charCodeAt(r)===43||t.charCodeAt(r)===45)&&r++,r<t.length&&Le(t.charCodeAt(r))){for(r++;r<t.length&&Le(t.charCodeAt(r));)r++;v=r}else f=3;return t.substring(p,v)}function O(){let p="",v=r;for(;;){if(r>=n){p+=t.substring(v,r),f=2;break}const I=t.charCodeAt(r);if(I===34){p+=t.substring(v,r),r++;break}if(I===92){if(p+=t.substring(v,r),r++,r>=n){f=2;break}switch(t.charCodeAt(r++)){case 34:p+='"';break;case 92:p+="\\";break;case 47:p+="/";break;case 98:p+="\b";break;case 102:p+="\f";break;case 110:p+=`
|
|
11
|
+
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:const L=l(4);L>=0?p+=String.fromCharCode(L):f=4;break;default:f=5}v=r;continue}if(I>=0&&I<=31)if(Xe(I)){p+=t.substring(v,r),f=2;break}else f=6;r++}return p}function w(){if(o="",f=0,i=r,u=a,c=d,r>=n)return i=n,s=17;let p=t.charCodeAt(r);if(gt(p)){do r++,o+=String.fromCharCode(p),p=t.charCodeAt(r);while(gt(p));return s=15}if(Xe(p))return r++,o+=String.fromCharCode(p),p===13&&t.charCodeAt(r)===10&&(r++,o+=`
|
|
12
|
+
`),a++,d=r,s=14;switch(p){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=O(),s=10;case 47:const v=r-1;if(t.charCodeAt(r+1)===47){for(r+=2;r<n&&!Xe(t.charCodeAt(r));)r++;return o=t.substring(v,r),s=12}if(t.charCodeAt(r+1)===42){r+=2;const I=n-1;let P=!1;for(;r<I;){const L=t.charCodeAt(r);if(L===42&&t.charCodeAt(r+1)===47){r+=2,P=!0;break}r++,Xe(L)&&(L===13&&t.charCodeAt(r)===10&&r++,a++,d=r)}return P||(r++,f=1),o=t.substring(v,r),s=13}return o+=String.fromCharCode(p),r++,s=16;case 45:if(o+=String.fromCharCode(p),r++,r===n||!Le(t.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+=E(),s=11;default:for(;r<n&&A(p);)r++,p=t.charCodeAt(r);if(i!==r){switch(o=t.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(p),r++,s=16}}function A(p){if(gt(p)||Xe(p))return!1;switch(p){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function N(){let p;do p=w();while(p>=12&&p<=15);return p}return{setPosition:m,getPosition:()=>r,scan:e?N:w,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-c,getTokenError:()=>f}}function gt(t){return t===32||t===9}function Xe(t){return t===10||t===13}function Le(t){return t>=48&&t<=57}var Un;(function(t){t[t.lineFeed=10]="lineFeed",t[t.carriageReturn=13]="carriageReturn",t[t.space=32]="space",t[t._0=48]="_0",t[t._1=49]="_1",t[t._2=50]="_2",t[t._3=51]="_3",t[t._4=52]="_4",t[t._5=53]="_5",t[t._6=54]="_6",t[t._7=55]="_7",t[t._8=56]="_8",t[t._9=57]="_9",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.asterisk=42]="asterisk",t[t.backslash=92]="backslash",t[t.closeBrace=125]="closeBrace",t[t.closeBracket=93]="closeBracket",t[t.colon=58]="colon",t[t.comma=44]="comma",t[t.dot=46]="dot",t[t.doubleQuote=34]="doubleQuote",t[t.minus=45]="minus",t[t.openBrace=123]="openBrace",t[t.openBracket=91]="openBracket",t[t.plus=43]="plus",t[t.slash=47]="slash",t[t.formFeed=12]="formFeed",t[t.tab=9]="tab"})(Un||(Un={}));const ae=new Array(20).fill(0).map((t,e)=>" ".repeat(e)),Se=200,qn={" ":{"\n":new Array(Se).fill(0).map((t,e)=>`
|
|
13
|
+
`+" ".repeat(e)),"\r":new Array(Se).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(Se).fill(0).map((t,e)=>`\r
|
|
14
|
+
`+" ".repeat(e))}," ":{"\n":new Array(Se).fill(0).map((t,e)=>`
|
|
15
|
+
`+" ".repeat(e)),"\r":new Array(Se).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(Se).fill(0).map((t,e)=>`\r
|
|
16
|
+
`+" ".repeat(e))}},wo=[`
|
|
17
17
|
`,"\r",`\r
|
|
18
|
-
`];function
|
|
18
|
+
`];function Eo(t,e,n){let r,o,i,s,a;if(e){for(s=e.offset,a=s+e.length,i=s;i>0&&!Je(t,i-1);)i--;let I=a;for(;I<t.length&&!Je(t,I);)I++;o=t.substring(i,I),r=No(o,n)}else o=t,r=0,i=0,s=0,a=t.length;const u=To(n,t),d=wo.includes(u);let c=0,f=0,l;n.insertSpaces?l=ae[n.tabSize||4]??De(ae[1],n.tabSize||4):l=" ";const m=l===" "?" ":" ";let E=oi(o,!1),O=!1;function w(){if(c>1)return De(u,c)+De(l,r+f);const I=l.length*(r+f);return!d||I>qn[m][u].length?u+De(l,r+f):I<=0?u:qn[m][u][I]}function A(){let I=E.scan();for(c=0;I===15||I===14;)I===14&&n.keepLines?c+=1:I===14&&(c=1),I=E.scan();return O=I===16||E.getTokenError()!==0,I}const N=[];function p(I,P,L){!O&&(!e||P<a&&L>s)&&t.substring(P,L)!==I&&N.push({offset:P,length:L-P,content:I})}let v=A();if(n.keepLines&&c>0&&p(De(u,c),0,0),v!==17){let I=E.getTokenOffset()+i,P=l.length*r<20&&n.insertSpaces?ae[l.length*r]:De(l,r);p(P,i,I)}for(;v!==17;){let I=E.getTokenOffset()+E.getTokenLength()+i,P=A(),L="",M=!1;for(;c===0&&(P===12||P===13);){let b=E.getTokenOffset()+i;p(ae[1],I,b),I=E.getTokenOffset()+E.getTokenLength()+i,M=P===12,L=M?w():"",P=A()}if(P===2)v!==1&&f--,n.keepLines&&c>0||!n.keepLines&&v!==1?L=w():n.keepLines&&(L=ae[1]);else if(P===4)v!==3&&f--,n.keepLines&&c>0||!n.keepLines&&v!==3?L=w():n.keepLines&&(L=ae[1]);else{switch(v){case 3:case 1:f++,n.keepLines&&c>0||!n.keepLines?L=w():L=ae[1];break;case 5:n.keepLines&&c>0||!n.keepLines?L=w():L=ae[1];break;case 12:L=w();break;case 13:c>0?L=w():M||(L=ae[1]);break;case 6:n.keepLines&&c>0?L=w():M||(L=ae[1]);break;case 10:n.keepLines&&c>0?L=w():P===6&&!M&&(L="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&c>0?L=w():(P===12||P===13)&&!M?L=ae[1]:P!==5&&P!==17&&(O=!0);break;case 16:O=!0;break}c>0&&(P===12||P===13)&&(L=w())}P===17&&(n.keepLines&&c>0?L=w():L=n.insertFinalNewline?u:"");const T=E.getTokenOffset()+i;p(L,I,T),v=P}return N}function De(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}function No(t,e){let n=0,r=0;const o=e.tabSize||4;for(;n<t.length;){let i=t.charAt(n);if(i===ae[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function To(t,e){for(let n=0;n<e.length;n++){const r=e.charAt(n);if(r==="\r")return n+1<e.length&&e.charAt(n+1)===`
|
|
19
19
|
`?`\r
|
|
20
20
|
`:"\r";if(r===`
|
|
21
21
|
`)return`
|
|
22
22
|
`}return t&&t.eol||`
|
|
23
|
-
`}function
|
|
24
|
-
`.indexOf(t.charAt(e))!==-1}var Ye;(function(t){t.DEFAULT={allowTrailingComma:!1}})(Ye||(Ye={}));function Wr(t,e=[],n=Ye.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}Gs(t,{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:Hs(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)=>{e.push({error:u,offset:p,length:c})}},n);const a=r.children[0];return a&&delete a.parent,a}function Jt(t,e){if(!t)return;let n=t;for(let r of e)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 Gs(t,e,n=Ye.DEFAULT){const r=qr(t,!1),o=[];let i=0;function s(R){return R?()=>i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(R){return R?U=>i===0&&R(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(R){return R?U=>i===0&&R(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function p(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function c(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const l=p(e.onObjectBegin),f=u(e.onObjectProperty),y=c(e.onObjectEnd),E=p(e.onArrayBegin),O=c(e.onArrayEnd),w=u(e.onLiteralValue),L=a(e.onSeparator),N=s(e.onComment),d=a(e.onError),v=n&&n.disallowComments,I=n&&n.allowTrailingComma;function A(){for(;;){const R=r.scan();switch(r.getTokenError()){case 4:_(14);break;case 5:_(15);break;case 3:_(13);break;case 1:v||_(11);break;case 2:_(12);break;case 6:_(16);break}switch(R){case 12:case 13:v?_(10):N();break;case 16:_(1);break;case 15:case 14:break;default:return R}}}function _(R,U=[],W=[]){if(d(R),U.length+W.length>0){let G=r.getToken();for(;G!==17;){if(U.indexOf(G)!==-1){A();break}else if(W.indexOf(G)!==-1)break;G=A()}}}function M(R){const U=r.getTokenValue();return R?w(U):(f(U),o.push(U)),A(),!0}function T(){switch(r.getToken()){case 11:const R=r.getTokenValue();let U=Number(R);isNaN(U)&&(_(2),U=0),w(U);break;case 7:w(null);break;case 8:w(!0);break;case 9:w(!1);break;default:return!1}return A(),!0}function b(){return r.getToken()!==10?(_(3,[],[2,5]),!1):(M(!1),r.getToken()===6?(L(":"),A(),V()||_(4,[],[2,5])):_(5,[],[2,5]),o.pop(),!0)}function F(){l(),A();let R=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||_(4,[],[]),L(","),A(),r.getToken()===2&&I)break}else R&&_(6,[],[]);b()||_(4,[],[2,5]),R=!0}return y(),r.getToken()!==2?_(7,[2],[]):A(),!0}function $(){E(),A();let R=!0,U=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(U||_(4,[],[]),L(","),A(),r.getToken()===4&&I)break}else U&&_(6,[],[]);R?(o.push(0),R=!1):o[o.length-1]++,V()||_(4,[],[4,5]),U=!0}return O(),R||o.pop(),r.getToken()!==4?_(8,[4],[]):A(),!0}function V(){switch(r.getToken()){case 3:return $();case 1:return F();case 10:return M(!0);default:return T()}}return A(),r.getToken()===17?n.allowEmptyContent?!0:(_(4,[],[]),!1):V()?(r.getToken()!==17&&_(9,[],[]),!0):(_(4,[],[]),!1)}function Hs(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}function Ys(t,e,n,r){const o=e.slice(),s=Wr(t,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Jt(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=Jt(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 l,f=p.parent.offset+p.parent.length;if(c>0){let y=a.children[c-1];l=y.offset+y.length}else l=a.offset+1,a.children.length>1&&(f=a.children[1].offset);return ve(t,{offset:l,length:f-l,content:""},r)}else return ve(t,{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)}`,l=r.getInsertionIndex?r.getInsertionIndex(a.children.map(y=>y.children[0].value)):a.children.length;let f;if(l>0){let y=a.children[l-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(t,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 l;if(a.children.length===0)l={offset:a.offset+1,length:0,content:c};else{const f=a.children[a.children.length-1];l={offset:f.offset+f.length,length:0,content:","+c}}return ve(t,l,r)}else if(n===void 0&&a.children.length>=0){const c=u,l=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],E=y.offset+y.length,O=a.offset+a.length;f={offset:E,length:O-2-E,content:""}}else f={offset:l.offset,length:a.children[c+1].offset-l.offset,content:""};return ve(t,f,r)}else if(n!==void 0){let c;const l=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const f=a.children[u];c={offset:f.offset,length:f.length,content:l}}else if(a.children.length===0||u===0)c={offset:a.offset+1,length:0,content:a.children.length===0?l:l+","};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:","+l}}return ve(t,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(t,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function ve(t,e,n){if(!n.formattingOptions)return[e];let r=Zt(t,e),o=e.offset,i=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;o>0&&!He(r,o-1);)o--;for(;i<r.length&&!He(r,i);)i++}const s=Vs(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const p=s[u];r=Zt(r,p),o=Math.min(o,p.offset),i=Math.max(i,p.offset+p.length),i+=p.content.length-p.length}const a=t.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Zt(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var jn;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(jn||(jn={}));var kn;(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(kn||(kn={}));const ze=Wr,Re=Jt;var Bn;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(Bn||(Bn={}));function zs(t){switch(t){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 en(t,e,n,r){return Ys(t,e,n,r)}function Gr(t,e){let n=e.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=t.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)t=Zt(t,i);else throw new Error("Overlapping edit");r=i.offset}return t}const Qs="PHPWASMCLI",Rn=["/dev/","/home/","/internal/","/request/","/proc/"];function Hr(t,e){return e.filter(n=>{const r=ee.resolve(n.hostPath),o=ee.join(t,ee.sep);return r===t||r.startsWith(o)})}const de={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Qe={ignoreAttributes:de.ignoreAttributes,attributeNamePrefix:de.attributeNamePrefix,preserveOrder:de.preserveOrder,cdataPropName:de.cdataPropName,commentPropName:de.commentPropName,suppressBooleanAttributes:!de.allowBooleanAttributes,format:!0,indentBy:" "},Ke={allowEmptyContent:!0,allowTrailingComma:!0};function Ks(t,e){const{name:n,host:r,port:o,pathMappings:i,ideKey:s}=e,a=new Ge(de),u=(()=>{try{return a.parse(t,!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$/${Mr(ee.relative(e.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 l=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="PhpServers");l===void 0&&(l={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(l));let f=l.component?.find(N=>!!N?.servers);f===void 0&&(f={servers:[]},l.component===void 0&&(l.component=[]),l.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 E=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="RunManager");if(E===void 0&&(E={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(E)),(E.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}};E.component===void 0&&(E.component=[]),E.component.push(N)}const L=new ie(Qe).build(u);try{a.parse(L,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return L}function Js(t,e){const{pathSkippings:n}=e,r=new Ge(de),o=(()=>{try{return r.parse(t,!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(E=>!!E?.skipped_file&&E?.[":@"]?.file===f)||(a.skipped_files===void 0&&(a.skipped_files=[]),a.skipped_files.push({skipped_file:[],":@":{file:f}}))}const p=new ie(Qe).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(t,e){const{name:n,pathMappings:r,pathSkippings:o}=e,i=[];let s=t,a=ze(s,i,Ke);if(a===void 0||i.length)throw new Error("VS Code configuration file is not valid JSON.");let u=Re(a,["configurations"]);if(u===void 0||u.children===void 0){const c=en(s,["configurations"],[],{});s=Gr(s,c),a=ze(s,[],Ke),u=Re(a,["configurations"])}const p=u?.children?.findIndex(c=>Re(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,E)=>(y[E.vfsPath]=`\${workspaceFolder}/${Mr(ee.relative(e.workspaceDir,E.hostPath))}`,y),{})),o&&o.length&&(c.skipFiles=o.map(y=>y.endsWith("/")?`${y}**`:y));const l=u?.children?.length||0,f=en(s,["configurations",l],c,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
25
|
-
`}});s=
|
|
23
|
+
`}function Je(t,e){return`\r
|
|
24
|
+
`.indexOf(t.charAt(e))!==-1}var Ke;(function(t){t.DEFAULT={allowTrailingComma:!1}})(Ke||(Ke={}));function ai(t,e=[],n=Ke.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}vo(t,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,d,c)=>{r=i({type:"property",offset:d,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:d,length:c,parent:r})},onObjectEnd:(u,d)=>{o(u+d),r.length=u+d-r.offset,r=r.parent,o(u+d)},onArrayBegin:(u,d)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,d)=>{r.length=u+d-r.offset,r=r.parent,o(u+d)},onLiteralValue:(u,d,c)=>{i({type:Io(u),offset:d,length:c,parent:r,value:u}),o(d+c)},onSeparator:(u,d,c)=>{r.type==="property"&&(u===":"?r.colonOffset=d:u===","&&o(d))},onError:(u,d,c)=>{e.push({error:u,offset:d,length:c})}},n);const a=r.children[0];return a&&delete a.parent,a}function an(t,e){if(!t)return;let n=t;for(let r of e)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 vo(t,e,n=Ke.DEFAULT){const r=oi(t,!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?V=>i===0&&B(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(B){return B?V=>i===0&&B(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function d(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 f=d(e.onObjectBegin),l=u(e.onObjectProperty),m=c(e.onObjectEnd),E=d(e.onArrayBegin),O=c(e.onArrayEnd),w=u(e.onLiteralValue),A=a(e.onSeparator),N=s(e.onComment),p=a(e.onError),v=n&&n.disallowComments,I=n&&n.allowTrailingComma;function P(){for(;;){const B=r.scan();switch(r.getTokenError()){case 4:L(14);break;case 5:L(15);break;case 3:L(13);break;case 1:v||L(11);break;case 2:L(12);break;case 6:L(16);break}switch(B){case 12:case 13:v?L(10):N();break;case 16:L(1);break;case 15:case 14:break;default:return B}}}function L(B,V=[],W=[]){if(p(B),V.length+W.length>0){let G=r.getToken();for(;G!==17;){if(V.indexOf(G)!==-1){P();break}else if(W.indexOf(G)!==-1)break;G=P()}}}function M(B){const V=r.getTokenValue();return B?w(V):(l(V),o.push(V)),P(),!0}function T(){switch(r.getToken()){case 11:const B=r.getTokenValue();let V=Number(B);isNaN(V)&&(L(2),V=0),w(V);break;case 7:w(null);break;case 8:w(!0);break;case 9:w(!1);break;default:return!1}return P(),!0}function b(){return r.getToken()!==10?(L(3,[],[2,5]),!1):(M(!1),r.getToken()===6?(A(":"),P(),U()||L(4,[],[2,5])):L(5,[],[2,5]),o.pop(),!0)}function F(){f(),P();let B=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(B||L(4,[],[]),A(","),P(),r.getToken()===2&&I)break}else B&&L(6,[],[]);b()||L(4,[],[2,5]),B=!0}return m(),r.getToken()!==2?L(7,[2],[]):P(),!0}function $(){E(),P();let B=!0,V=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(V||L(4,[],[]),A(","),P(),r.getToken()===4&&I)break}else V&&L(6,[],[]);B?(o.push(0),B=!1):o[o.length-1]++,U()||L(4,[],[4,5]),V=!0}return O(),B||o.pop(),r.getToken()!==4?L(8,[4],[]):P(),!0}function U(){switch(r.getToken()){case 3:return $();case 1:return F();case 10:return M(!0);default:return T()}}return P(),r.getToken()===17?n.allowEmptyContent?!0:(L(4,[],[]),!1):U()?(r.getToken()!==17&&L(9,[],[]),!0):(L(4,[],[]),!1)}function Io(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}function Oo(t,e,n,r){const o=e.slice(),s=ai(t,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=an(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 d=an(a,[u]);if(d!==void 0)if(n===void 0){if(!d.parent)throw new Error("Malformed AST");const c=a.children.indexOf(d.parent);let f,l=d.parent.offset+d.parent.length;if(c>0){let m=a.children[c-1];f=m.offset+m.length}else f=a.offset+1,a.children.length>1&&(l=a.children[1].offset);return Oe(t,{offset:f,length:l-f,content:""},r)}else return Oe(t,{offset:d.offset,length:d.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const c=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,f=r.getInsertionIndex?r.getInsertionIndex(a.children.map(m=>m.children[0].value)):a.children.length;let l;if(f>0){let m=a.children[f-1];l={offset:m.offset+m.length,length:0,content:","+c}}else a.children.length===0?l={offset:a.offset+1,length:0,content:c}:l={offset:a.offset+1,length:0,content:c+","};return Oe(t,l,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const d=u;if(d===-1){const c=`${JSON.stringify(n)}`;let f;if(a.children.length===0)f={offset:a.offset+1,length:0,content:c};else{const l=a.children[a.children.length-1];f={offset:l.offset+l.length,length:0,content:","+c}}return Oe(t,f,r)}else if(n===void 0&&a.children.length>=0){const c=u,f=a.children[c];let l;if(a.children.length===1)l={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===c){let m=a.children[c-1],E=m.offset+m.length,O=a.offset+a.length;l={offset:E,length:O-2-E,content:""}}else l={offset:f.offset,length:a.children[c+1].offset-f.offset,content:""};return Oe(t,l,r)}else if(n!==void 0){let c;const f=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const l=a.children[u];c={offset:l.offset,length:l.length,content:f}}else if(a.children.length===0||u===0)c={offset:a.offset+1,length:0,content:a.children.length===0?f:f+","};else{const l=u>a.children.length?a.children.length:u,m=a.children[l-1];c={offset:m.offset+m.length,length:0,content:","+f}}return Oe(t,c,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${d} 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 Oe(t,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Oe(t,e,n){if(!n.formattingOptions)return[e];let r=un(t,e),o=e.offset,i=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;o>0&&!Je(r,o-1);)o--;for(;i<r.length&&!Je(r,i);)i++}const s=Eo(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const d=s[u];r=un(r,d),o=Math.min(o,d.offset),i=Math.max(i,d.offset+d.length),i+=d.content.length-d.length}const a=t.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function un(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var Wn;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(Wn||(Wn={}));var Gn;(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(Gn||(Gn={}));const Ze=ai,Ve=an;var Hn;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(Hn||(Hn={}));function xo(t){switch(t){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 cn(t,e,n,r){return Oo(t,e,n,r)}function ui(t,e){let n=e.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=t.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)t=un(t,i);else throw new Error("Overlapping edit");r=i.offset}return t}const _o="PHPWASMCLI",Yn=["/dev/","/home/","/internal/","/request/","/proc/"];function ci(t,e){return e.filter(n=>{const r=ee.resolve(n.hostPath),o=ee.join(t,ee.sep);return r===t||r.startsWith(o)})}const ge={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},et={ignoreAttributes:ge.ignoreAttributes,attributeNamePrefix:ge.attributeNamePrefix,preserveOrder:ge.preserveOrder,cdataPropName:ge.cdataPropName,commentPropName:ge.commentPropName,suppressBooleanAttributes:!ge.allowBooleanAttributes,format:!0,indentBy:" "},tt={allowEmptyContent:!0,allowTrailingComma:!0};function Ao(t,e){const{name:n,host:r,port:o,pathMappings:i,ideKey:s}=e,a=new Qe(ge),u=(()=>{try{return a.parse(t,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(d.server[0].path_mappings=i.map(N=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Vr(ee.relative(e.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 f=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="PhpServers");f===void 0&&(f={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(f));let l=f.component?.find(N=>!!N?.servers);l===void 0&&(l={servers:[]},f.component===void 0&&(f.component=[]),f.component.push(l));const m=l.servers?.findIndex(N=>!!N?.server&&N?.[":@"]?.name===n);(m===void 0||m<0)&&(l.servers===void 0&&(l.servers=[]),l.servers.push(d));let E=c.project?.find(N=>!!N?.component&&N?.[":@"]?.name==="RunManager");if(E===void 0&&(E={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(E)),(E.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}};E.component===void 0&&(E.component=[]),E.component.push(N)}const A=new ie(et).build(u);try{a.parse(A,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return A}function Po(t,e){const{pathSkippings:n}=e,r=new Qe(ge),o=(()=>{try{return r.parse(t,!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 l=`$PROJECT_DIR$${c.endsWith("/")?c.slice(0,-1):c}`;a.skipped_files?.some(E=>!!E?.skipped_file&&E?.[":@"]?.file===l)||(a.skipped_files===void 0&&(a.skipped_files=[]),a.skipped_files.push({skipped_file:[],":@":{file:l}}))}const d=new ie(et).build(o);try{r.parse(d,!0)}catch{throw new Error("The resulting PhpStorm PHP configuration file is not valid XML.")}return d}function Lo(t,e){const{name:n,pathMappings:r,pathSkippings:o}=e,i=[];let s=t,a=Ze(s,i,tt);if(a===void 0||i.length)throw new Error("VS Code configuration file is not valid JSON.");let u=Ve(a,["configurations"]);if(u===void 0||u.children===void 0){const c=cn(s,["configurations"],[],{});s=ui(s,c),a=Ze(s,[],tt),u=Ve(a,["configurations"])}const d=u?.children?.findIndex(c=>Ve(c,["name"])?.value===n);if(d===void 0||d<0){const c={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(c.pathMappings=r.reduce((m,E)=>(m[E.vfsPath]=`\${workspaceFolder}/${Vr(ee.relative(e.workspaceDir,E.hostPath))}`,m),{})),o&&o.length&&(c.skipFiles=o.map(m=>m.endsWith("/")?`${m}**`:m));const f=u?.children?.length||0,l=cn(s,["configurations",f],c,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
25
|
+
`}});s=li(s,l)}return s}async function So({name:t,ides:e,host:n,port:r,cwd:o,mounts:i,pathSkippings:s,ideKey:a=_o}){const u=i?ci(o,i):[],d={};if(e.includes("phpstorm")){const c=".idea/workspace.xml",f=ee.join(o,c);if(!z.existsSync(f)){if(z.existsSync(ee.dirname(f)))z.writeFileSync(f,`<?xml version="1.0" encoding="UTF-8"?>
|
|
26
26
|
<project version="4">
|
|
27
|
-
</project>`);else if(e.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(z.existsSync(
|
|
27
|
+
</project>`);else if(e.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(z.existsSync(f)){const l=z.readFileSync(f,"utf8"),m=Ao(l,{name:t,host:n,port:r,projectDir:o,pathMappings:u,ideKey:a});z.writeFileSync(f,m),d.phpstorm=c}if(s&&s.length){const l=".idea/php.xml",m=ee.join(o,l);if(z.existsSync(m)||z.existsSync(ee.dirname(m))&&z.writeFileSync(m,`<?xml version="1.0" encoding="UTF-8"?>
|
|
28
28
|
<project version="4">
|
|
29
|
-
</project>`),z.existsSync(
|
|
29
|
+
</project>`),z.existsSync(m)){const E=z.readFileSync(m,"utf8"),O=Po(E,{pathSkippings:s});z.writeFileSync(m,O),d["phpstorm-php"]=l}}}if(e.includes("vscode")){const c=".vscode/launch.json",f=ee.join(o,c);if(!z.existsSync(f)){if(z.existsSync(ee.dirname(f)))z.writeFileSync(f,`{
|
|
30
30
|
"configurations": []
|
|
31
|
-
}`);else if(e.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(z.existsSync(
|
|
31
|
+
}`);else if(e.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(z.existsSync(f)){const l=z.readFileSync(f,"utf-8"),m=Lo(l,{name:t,workspaceDir:o,pathMappings:u,pathSkippings:s});m!==l&&(z.writeFileSync(f,m),d.vscode=c)}}return d}async function Do(t,e){const n=ee.join(e,".idea/workspace.xml");if(z.existsSync(n)){const i=z.readFileSync(n,"utf8"),s=new Qe(ge),a=(()=>{try{return s.parse(i,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),c=a.find(l=>!!l?.project)?.project?.find(l=>!!l?.component&&l?.[":@"]?.name==="PhpServers")?.component?.find(l=>!!l?.servers),f=c?.servers?.findIndex(l=>!!l?.server&&l?.[":@"]?.name===t);if(f!==void 0&&f>=0){c.servers.splice(f,1);const m=new ie(et).build(a);try{s.parse(m,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}m===`<?xml version="1.0" encoding="UTF-8"?>
|
|
32
32
|
<project version="4">
|
|
33
33
|
<component name="PhpServers">
|
|
34
34
|
<servers></servers>
|
|
35
35
|
</component>
|
|
36
|
-
</project>`?z.unlinkSync(n):z.writeFileSync(n,
|
|
36
|
+
</project>`?z.unlinkSync(n):z.writeFileSync(n,m)}}const r=ee.join(e,".idea/php.xml");if(z.existsSync(r)){const i=z.readFileSync(r,"utf8"),s=new Qe(ge),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),d=u?.project?.findIndex(c=>!!c?.component&&c?.[":@"]?.name==="PhpStepFilterConfiguration");if(d!==void 0&&d>=0){u.project.splice(d,1);const f=new ie(et).build(a);try{s.parse(f,!0)}catch{throw new Error("The resulting PhpStorm PHP configuration file is not valid XML.")}f===`<?xml version="1.0" encoding="UTF-8"?>
|
|
37
37
|
<project version="4">
|
|
38
|
-
</project>`?z.unlinkSync(r):z.writeFileSync(r,
|
|
39
|
-
`}}),
|
|
38
|
+
</project>`?z.unlinkSync(r):z.writeFileSync(r,f)}}const o=ee.join(e,".vscode/launch.json");if(z.existsSync(o)){const i=[],s=z.readFileSync(o,"utf-8"),a=Ze(s,i,tt);if(a===void 0||i.length)throw new Error("VS Code configuration file is not valid JSON.");const d=Ve(a,["configurations"])?.children?.findIndex(c=>Ve(c,["name"])?.value===t);if(d!==void 0&&d>=0){const c=cn(s,["configurations",d],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
39
|
+
`}}),f=li(s,c);f===`{
|
|
40
40
|
"configurations": []
|
|
41
|
-
}`?z.unlinkSync(o):z.writeFileSync(o,
|
|
41
|
+
}`?z.unlinkSync(o):z.writeFileSync(o,f)}}}function Mo({cwd:t,mounts:e,pathSkippings:n}){return{pathMappings:t&&e?ci(t,e):void 0,pathSkippings:n}}function li(t,e){const n=[],r=ui(t,e);if(n.length=0,Ze(r,n,tt),n.length){const o=n.map(s=>({message:xo(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=e.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.
|
|
42
42
|
|
|
43
43
|
Applied edits: ${i.join(`
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
46
|
The errors are: ${o.join(`
|
|
47
|
-
`)}`)}return r}const
|
|
48
|
-
`):JSON.stringify(t,null,2),
|
|
47
|
+
`)}`)}return r}const Co="playground-log",Fo=(t,...e)=>{he.dispatchEvent(new CustomEvent(Co,{detail:{log:t,args:e}}))},jo=(t,...e)=>{switch(typeof t.message=="string"?Reflect.set(t,"message",ln(t.message)):t.message.message&&typeof t.message.message=="string"&&Reflect.set(t.message,"message",ln(t.message.message)),t.severity){case ue.Debug:console.debug(t.message,...e);break;case ue.Info:console.info(t.message,...e);break;case ue.Warn:console.warn(t.message,...e);break;case ue.Error:console.error(t.message,...e);break;case ue.Fatal:console.error(t.message,...e);break;default:console.log(t.message,...e)}},ko=t=>t instanceof Error?[t.message,t.stack].join(`
|
|
48
|
+
`):JSON.stringify(t,null,2),fi=[],zn=t=>{fi.push(t)},hi=t=>{if(t.raw===!0)zn(t.message);else{const e=$o(typeof t.message=="object"?ko(t.message):t.message,t.severity,t.prefix??Me.JS);zn(e)}},ue={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(e=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=ue.Info,this.handlers=e}getLogs(){return this.handlers.includes(hi)?[...fi]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
49
49
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
50
|
-
`),[])}logMessage(e,...n){const r={...e,severity:e.severity??
|
|
50
|
+
`),[])}logMessage(e,...n){const r={...e,severity:e.severity??ue.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(e){this.severity=e}log(e,...n){this.logMessage({message:e,severity:ue.Log,prefix:Me.JS,raw:!1},...n)}debug(e,...n){this.logMessage({message:e,severity:ue.Debug,prefix:Me.JS,raw:!1},...n)}info(e,...n){this.logMessage({message:e,severity:ue.Info,prefix:Me.JS,raw:!1},...n)}warn(e,...n){this.logMessage({message:e,severity:ue.Warn,prefix:Me.JS,raw:!1},...n)}error(e,...n){this.logMessage({message:e,severity:ue.Error,prefix:Me.JS,raw:!1},...n)}}const Bo=()=>{try{}catch{}return[hi,jo,Fo]},he=new Ro(Bo()),ln=t=>t.replace(/\t/g,""),$o=(t,e,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 t=ln(t),`[${s}] ${n} ${e.name}: ${t}`};var q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},mn={exports:{}},Fe=typeof Reflect=="object"?Reflect:null,Qn=Fe&&typeof Fe.apply=="function"?Fe.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},He;Fe&&typeof Fe.ownKeys=="function"?He=Fe.ownKeys:Object.getOwnPropertySymbols?He=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:He=function(e){return Object.getOwnPropertyNames(e)};function Xo(t){console&&console.warn&&console.warn(t)}var pi=Number.isNaN||function(e){return e!==e};function J(){J.init.call(this)}mn.exports=J;mn.exports.once=Wo;J.EventEmitter=J;J.prototype._events=void 0;J.prototype._eventsCount=0;J.prototype._maxListeners=void 0;var Jn=10;function it(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return Jn},set:function(t){if(typeof t!="number"||t<0||pi(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Jn=t}});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(e){if(typeof e!="number"||e<0||pi(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function di(t){return t._maxListeners===void 0?J.defaultMaxListeners:t._maxListeners}J.prototype.getMaxListeners=function(){return di(this)};J.prototype.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=e==="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[e];if(u===void 0)return!1;if(typeof u=="function")Qn(u,this,n);else for(var d=u.length,c=wi(u,d),r=0;r<d;++r)Qn(c[r],this,n);return!0};function gi(t,e,n,r){var o,i,s;if(it(n),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),s=i[e]),s===void 0)s=i[e]=n,++t._eventsCount;else if(typeof s=="function"?s=i[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=di(t),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,Xo(a)}return t}J.prototype.addListener=function(e,n){return gi(this,e,n,!1)};J.prototype.on=J.prototype.addListener;J.prototype.prependListener=function(e,n){return gi(this,e,n,!0)};function Vo(){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 mi(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=Vo.bind(r);return o.listener=n,r.wrapFn=o,o}J.prototype.once=function(e,n){return it(n),this.on(e,mi(this,e,n)),this};J.prototype.prependOnceListener=function(e,n){return it(n),this.prependListener(e,mi(this,e,n)),this};J.prototype.removeListener=function(e,n){var r,o,i,s,a;if(it(n),o=this._events,o===void 0)return this;if(r=o[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,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[e]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",e,a||n)}return this};J.prototype.off=J.prototype.removeListener;J.prototype.removeAllListeners=function(e){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[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),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[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(e,n[o]);return this};function yi(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?qo(o):wi(o,o.length)}J.prototype.listeners=function(e){return yi(this,e,!0)};J.prototype.rawListeners=function(e){return yi(this,e,!1)};J.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):bi.call(t,e)};J.prototype.listenerCount=bi;function bi(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?He(this._events):[]};function wi(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Uo(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function qo(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Wo(t,e){return new Promise(function(n,r){function o(s){t.removeListener(e,i),r(s)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",o),n([].slice.call(arguments))}Ei(t,e,i,{once:!0}),e!=="error"&&Go(t,o,{once:!0})})}function Go(t,e,n){typeof t.on=="function"&&Ei(t,"error",e,n)}function Ei(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function o(i){r.once&&t.removeEventListener(e,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var yn=mn.exports;class Ho extends yn.EventEmitter{constructor(e=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Wi({port:e}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{he.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(e){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(e);he.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class Yo extends yn.EventEmitter{constructor(e=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=Gi.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(e)}onData(e){for(he.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",e),this.buffer+=e;;){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(e){this.socket&&(he.debug("\x1B[1;32m[XDebug][send]\x1B[0m",e),this.socket.write(e+"\0"))}close(){this.server.close()}}/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright (c) 2016, Contributors
|
|
53
53
|
* SPDX-License-Identifier: ISC
|
|
54
|
-
*/function
|
|
54
|
+
*/function Ge(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let n="",r=!1;const o=t.match(/^-+/);for(let i=o?o[0].length:0;i<t.length;i++){let s=t.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function zo(t,e){const n=t.toLowerCase();e=e||"-";let r="";for(let o=0;o<t.length;o++){const i=n.charAt(o),s=t.charAt(o);i!==s&&o>0?r+=`${e}${n.charAt(o)}`:r+=s}return r}function Qo(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}/**
|
|
55
55
|
* @license
|
|
56
56
|
* Copyright (c) 2016, Contributors
|
|
57
57
|
* SPDX-License-Identifier: ISC
|
|
58
|
-
*/function
|
|
58
|
+
*/function Jo(t){if(Array.isArray(t))return t.map(s=>typeof s!="string"?s+"":s);t=t.trim();let e=0,n=null,r=null,o=null;const i=[];for(let s=0;s<t.length;s++){if(n=r,r=t.charAt(s),r===" "&&!o){n!==" "&&e++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[e]||(i[e]=""),i[e]+=r}return i}/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright (c) 2016, Contributors
|
|
61
61
|
* SPDX-License-Identifier: ISC
|
|
62
|
-
*/var
|
|
62
|
+
*/var fe;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(fe||(fe={}));/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright (c) 2016, Contributors
|
|
65
65
|
* SPDX-License-Identifier: ISC
|
|
66
|
-
*/let me;class No{constructor(e){me=e}parse(e,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=To(e),i=typeof e=="string",s=Io(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,l=a["populate--"],f=l?"--":"_",y=Object.create(null),E=Object.create(null),O=r.__||me.format,w={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:[]},L=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,N=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(g){const x=typeof g=="object"?g.key:g,C=Object.keys(g).map(function(D){return{boolean:"bools",string:"strings",number:"numbers"}[D]}).filter(Boolean).pop();C&&(w[C][x]=!0),w.arrays[x]=!0,w.keys.push(x)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(g){w.bools[g]=!0,w.keys.push(g)}),[].concat(r.string||[]).filter(Boolean).forEach(function(g){w.strings[g]=!0,w.keys.push(g)}),[].concat(r.number||[]).filter(Boolean).forEach(function(g){w.numbers[g]=!0,w.keys.push(g)}),[].concat(r.count||[]).filter(Boolean).forEach(function(g){w.counts[g]=!0,w.keys.push(g)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(g){w.normalize[g]=!0,w.keys.push(g)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([g,x])=>{typeof x=="number"&&(w.nargs[g]=x,w.keys.push(g))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([g,x])=>{typeof x=="function"&&(w.coercions[g]=x,w.keys.push(g))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(g){w.configs[g]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([g,x])=>{(typeof x=="boolean"||typeof x=="function")&&(w.configs[g]=x)})),rt(r.key,s,r.default,w.arrays),Object.keys(u).forEach(function(g){(w.aliases[g]||[]).forEach(function(x){u[x]=u[g]})});let d=null;S();let v=[];const I=Object.assign(Object.create(null),{_:[]}),A={};for(let g=0;g<o.length;g++){const x=o[g],C=x.replace(/^-{3,}/,"---");let D,P,k,j,B,Q;if(x!=="--"&&/^-/.test(x)&&Pe(x))_(x);else if(C.match(/^---+(=|$)/)){_(x);continue}else if(x.match(/^--.+=/)||!a["short-option-groups"]&&x.match(/^-.+=/))j=x.match(/^--?([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&(X(j[1],w.arrays)?g=T(g,j[1],o,j[2]):X(j[1],w.nargs)!==!1?g=M(g,j[1],o,j[2]):b(j[1],j[2],!0));else if(x.match(N)&&a["boolean-negation"])j=x.match(N),j!==null&&Array.isArray(j)&&j.length>=2&&(P=j[1],b(P,X(P,w.arrays)?[!1]:!1));else if(x.match(/^--.+/)||!a["short-option-groups"]&&x.match(/^-[^-]+/))j=x.match(/^--?(.+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(P=j[1],X(P,w.arrays)?g=T(g,P,o):X(P,w.nargs)!==!1?g=M(g,P,o):(B=o[g+1],B!==void 0&&(!B.match(/^-/)||B.match(L))&&!X(P,w.bools)&&!X(P,w.counts)||/^(true|false)$/.test(B)?(b(P,B),g++):b(P,pe(P))));else if(x.match(/^-.\..+=/))j=x.match(/^-([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&b(j[1],j[2]);else if(x.match(/^-.\..+/)&&!x.match(L))B=o[g+1],j=x.match(/^-(.\..+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(P=j[1],B!==void 0&&!B.match(/^-/)&&!X(P,w.bools)&&!X(P,w.counts)?(b(P,B),g++):b(P,pe(P)));else if(x.match(/^-[^-]+/)&&!x.match(L)){k=x.slice(1,-1).split(""),D=!1;for(let te=0;te<k.length;te++){if(B=x.slice(te+2),k[te+1]&&k[te+1]==="="){Q=x.slice(te+3),P=k[te],X(P,w.arrays)?g=T(g,P,o,Q):X(P,w.nargs)!==!1?g=M(g,P,o,Q):b(P,Q),D=!0;break}if(B==="-"){b(k[te],B);continue}if(/[A-Za-z]/.test(k[te])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(B)&&X(B,w.bools)===!1){b(k[te],B),D=!0;break}if(k[te+1]&&k[te+1].match(/\W/)){b(k[te],B),D=!0;break}else b(k[te],pe(k[te]))}P=x.slice(-1)[0],!D&&P!=="-"&&(X(P,w.arrays)?g=T(g,P,o):X(P,w.nargs)!==!1?g=M(g,P,o):(B=o[g+1],B!==void 0&&(!/^(-|--)[^-]/.test(B)||B.match(L))&&!X(P,w.bools)&&!X(P,w.counts)||/^(true|false)$/.test(B)?(b(P,B),g++):b(P,pe(P))))}else if(x.match(/^-[0-9]$/)&&x.match(L)&&X(x.slice(1),w.bools))P=x.slice(1),b(P,pe(P));else if(x==="--"){v=o.slice(g+1);break}else if(a["halt-at-non-option"]){v=o.slice(g);break}else _(x)}G(I,!0),G(I,!1),R(I),W(),he(I,w.aliases,u,!0),Ne(I),a["set-placeholder-key"]&&Xe(I),Object.keys(w.counts).forEach(function(g){Ee(I,g.split("."))||b(g,0)}),l&&v.length&&(I[f]=[]),v.forEach(function(g){I[f].push(g)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(g=>g!=="--"&&g.includes("-")).forEach(g=>{delete I[g]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(g=>s[g])).forEach(g=>{a["camel-case-expansion"]&&g.includes("-")&&delete I[g.split(".").map(x=>Ve(x)).join(".")],delete I[g]});function _(g){const x=V("_",g);(typeof x=="string"||typeof x=="number")&&I._.push(x)}function M(g,x,C,D){let P,k=X(x,w.nargs);if(k=typeof k!="number"||isNaN(k)?1:k,k===0)return h(D)||(d=Error(O("Argument unexpected for: %s",x))),b(x,pe(x)),g;let j=h(D)?0:1;if(a["nargs-eats-options"])C.length-(g+1)+j<k&&(d=Error(O("Not enough arguments following: %s",x))),j=k;else{for(P=g+1;P<C.length&&(!C[P].match(/^-[^0-9]/)||C[P].match(L)||Pe(C[P]));P++)j++;j<k&&(d=Error(O("Not enough arguments following: %s",x)))}let B=Math.min(j,k);for(!h(D)&&B>0&&(b(x,D),B--),P=g+1;P<B+g+1;P++)b(x,C[P]);return g+B}function T(g,x,C,D){let P=[],k=D||C[g+1];const j=X(x,w.nargs);if(X(x,w.bools)&&!/^(true|false)$/.test(k))P.push(!0);else if(h(k)||h(D)&&/^-/.test(k)&&!L.test(k)&&!Pe(k)){if(u[x]!==void 0){const B=u[x];P=Array.isArray(B)?B:[B]}}else{h(D)||P.push($(x,D,!0));for(let B=g+1;B<C.length&&!(!a["greedy-arrays"]&&P.length>0||j&&typeof j=="number"&&P.length>=j||(k=C[B],/^-/.test(k)&&!L.test(k)&&!Pe(k)));B++)g=B,P.push($(x,k,i))}return typeof j=="number"&&(j&&P.length<j||isNaN(j)&&P.length===0)&&(d=Error(O("Not enough arguments following: %s",x))),b(x,P),g}function b(g,x,C=i){if(/-/.test(g)&&a["camel-case-expansion"]){const k=g.split(".").map(function(j){return Ve(j)}).join(".");F(g,k)}const D=$(g,x,C),P=g.split(".");H(I,P,D),w.aliases[g]&&w.aliases[g].forEach(function(k){const j=k.split(".");H(I,j,D)}),P.length>1&&a["dot-notation"]&&(w.aliases[P[0]]||[]).forEach(function(k){let j=k.split(".");const B=[].concat(P);B.shift(),j=j.concat(B),(w.aliases[g]||[]).includes(j.join("."))||H(I,j,D)}),X(g,w.normalize)&&!X(g,w.arrays)&&[g].concat(w.aliases[g]||[]).forEach(function(j){Object.defineProperty(A,j,{enumerable:!0,get(){return x},set(B){x=typeof B=="string"?me.normalize(B):B}})})}function F(g,x){w.aliases[g]&&w.aliases[g].length||(w.aliases[g]=[x],y[x]=!0),w.aliases[x]&&w.aliases[x].length||F(x,g)}function $(g,x,C){C&&(x=vo(x)),(X(g,w.bools)||X(g,w.counts))&&typeof x=="string"&&(x=x==="true");let D=Array.isArray(x)?x.map(function(P){return V(g,P)}):V(g,x);return X(g,w.counts)&&(h(D)||typeof D=="boolean")&&(D=ct()),X(g,w.normalize)&&X(g,w.arrays)&&(Array.isArray(x)?D=x.map(P=>me.normalize(P)):D=me.normalize(x)),D}function V(g,x){return!a["parse-positional-numbers"]&&g==="_"||!X(g,w.strings)&&!X(g,w.bools)&&!Array.isArray(x)&&(Eo(x)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${x}`)))||!h(x)&&X(g,w.numbers))&&(x=Number(x)),x}function R(g){const x=Object.create(null);he(x,w.aliases,u),Object.keys(w.configs).forEach(function(C){const D=g[C]||x[C];if(D)try{let P=null;const k=me.resolve(me.cwd(),D),j=w.configs[C];if(typeof j=="function"){try{P=j(k)}catch(B){P=B}if(P instanceof Error){d=P;return}}else P=me.require(k);U(P)}catch(P){P.name==="PermissionDenied"?d=P:g[C]&&(d=Error(O("Invalid JSON config file: %s",D)))}})}function U(g,x){Object.keys(g).forEach(function(C){const D=g[C],P=x?x+"."+C:C;typeof D=="object"&&D!==null&&!Array.isArray(D)&&a["dot-notation"]?U(D,P):(!Ee(I,P.split("."))||X(P,w.arrays)&&a["combine-arrays"])&&b(P,D)})}function W(){typeof p<"u"&&p.forEach(function(g){U(g)})}function G(g,x){if(typeof c>"u")return;const C=typeof c=="string"?c:"",D=me.env();Object.keys(D).forEach(function(P){if(C===""||P.lastIndexOf(C,0)===0){const k=P.split("__").map(function(j,B){return B===0&&(j=j.substring(C.length)),Ve(j)});(x&&w.configs[k.join(".")]||!x)&&!Ee(g,k)&&b(k.join("."),D[P])}})}function Ne(g){let x;const C=new Set;Object.keys(g).forEach(function(D){if(!C.has(D)&&(x=X(D,w.coercions),typeof x=="function"))try{const P=V(D,x(g[D]));[].concat(w.aliases[D]||[],D).forEach(k=>{C.add(k),g[k]=P})}catch(P){d=P}})}function Xe(g){return w.keys.forEach(x=>{~x.indexOf(".")||typeof g[x]>"u"&&(g[x]=void 0)}),g}function he(g,x,C,D=!1){Object.keys(C).forEach(function(P){Ee(g,P.split("."))||(H(g,P.split("."),C[P]),D&&(E[P]=!0),(x[P]||[]).forEach(function(k){Ee(g,k.split("."))||H(g,k.split("."),C[P])}))})}function Ee(g,x){let C=g;a["dot-notation"]||(x=[x.join(".")]),x.slice(0,-1).forEach(function(P){C=C[P]||{}});const D=x[x.length-1];return typeof C!="object"?!1:D in C}function H(g,x,C){let D=g;a["dot-notation"]||(x=[x.join(".")]),x.slice(0,-1).forEach(function(Q){Q=Vn(Q),typeof D=="object"&&D[Q]===void 0&&(D[Q]={}),typeof D[Q]!="object"||Array.isArray(D[Q])?(Array.isArray(D[Q])?D[Q].push({}):D[Q]=[D[Q],{}],D=D[Q][D[Q].length-1]):D=D[Q]});const P=Vn(x[x.length-1]),k=X(x.join("."),w.arrays),j=Array.isArray(C);let B=a["duplicate-arguments-array"];!B&&X(P,w.nargs)&&(B=!0,(!h(D[P])&&w.nargs[P]===1||Array.isArray(D[P])&&D[P].length===w.nargs[P])&&(D[P]=void 0)),C===ct()?D[P]=ct(D[P]):Array.isArray(D[P])?B&&k&&j?D[P]=a["flatten-duplicate-arrays"]?D[P].concat(C):(Array.isArray(D[P][0])?D[P]:[D[P]]).concat([C]):!B&&!!k==!!j?D[P]=C:D[P]=D[P].concat([C]):D[P]===void 0&&k?D[P]=j?C:[C]:B&&!(D[P]===void 0||X(P,w.counts)||X(P,w.bools))?D[P]=[D[P],C]:D[P]=C}function rt(...g){g.forEach(function(x){Object.keys(x||{}).forEach(function(C){w.aliases[C]||(w.aliases[C]=[].concat(s[C]||[]),w.aliases[C].concat(C).forEach(function(D){if(/-/.test(D)&&a["camel-case-expansion"]){const P=Ve(D);P!==C&&w.aliases[C].indexOf(P)===-1&&(w.aliases[C].push(P),y[P]=!0)}}),w.aliases[C].concat(C).forEach(function(D){if(D.length>1&&/[A-Z]/.test(D)&&a["camel-case-expansion"]){const P=wo(D,"-");P!==C&&w.aliases[C].indexOf(P)===-1&&(w.aliases[C].push(P),y[P]=!0)}}),w.aliases[C].forEach(function(D){w.aliases[D]=[C].concat(w.aliases[C].filter(function(P){return D!==P}))}))})})}function X(g,x){const C=[].concat(w.aliases[g]||[],g),D=Object.keys(x),P=C.find(k=>D.includes(k));return P?x[P]:!1}function xe(g){const x=Object.keys(w);return[].concat(x.map(D=>w[D])).some(function(D){return Array.isArray(D)?D.includes(g):D[g]})}function ge(g,...x){return[].concat(...x).some(function(D){const P=g.match(D);return P&&xe(P[1])})}function Fe(g){if(g.match(L)||!g.match(/^-[^-]+/))return!1;let x=!0,C;const D=g.slice(1).split("");for(let P=0;P<D.length;P++){if(C=g.slice(P+2),!xe(D[P])){x=!1;break}if(D[P+1]&&D[P+1]==="="||C==="-"||/[A-Za-z]/.test(D[P])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(C)||D[P+1]&&D[P+1].match(/\W/))break}return x}function Pe(g){return a["unknown-options-as-args"]&&Ue(g)}function Ue(g){return g=g.replace(/^-{3,}/,"--"),g.match(L)||Fe(g)?!1:!ge(g,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function pe(g){return!X(g,w.bools)&&!X(g,w.counts)&&`${g}`in u?u[g]:it(m(g))}function it(g){return{[le.BOOLEAN]:!0,[le.STRING]:"",[le.NUMBER]:void 0,[le.ARRAY]:[]}[g]}function m(g){let x=le.BOOLEAN;return X(g,w.strings)?x=le.STRING:X(g,w.numbers)?x=le.NUMBER:X(g,w.bools)?x=le.BOOLEAN:X(g,w.arrays)&&(x=le.ARRAY),x}function h(g){return g===void 0}function S(){Object.keys(w.counts).find(g=>X(g,w.arrays)?(d=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",g)),!0):X(g,w.nargs)?(d=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",g)),!0):!1)}return{aliases:Object.assign({},w.aliases),argv:Object.assign(A,I),configuration:a,defaulted:Object.assign({},E),error:d,newAliases:Object.assign({},y)}}}function Io(t){const e=[],n=Object.create(null);let r=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});r;){r=!1;for(let o=0;o<e.length;o++)for(let i=o+1;i<e.length;i++)if(e[o].filter(function(a){return e[i].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[i]),e.splice(i,1),r=!0;break}}return e.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 ct(t){return t!==void 0?t+1:1}function Vn(t){return t==="__proto__"?"___proto___":t}function vo(t){return typeof t=="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}/**
|
|
66
|
+
*/let ye;class Ko{constructor(e){ye=e}parse(e,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=Jo(e),i=typeof e=="string",s=Zo(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),d=r.configObjects||[],c=r.envPrefix,f=a["populate--"],l=f?"--":"_",m=Object.create(null),E=Object.create(null),O=r.__||ye.format,w={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:[]},A=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,N=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(g){const x=typeof g=="object"?g.key:g,C=Object.keys(g).map(function(D){return{boolean:"bools",string:"strings",number:"numbers"}[D]}).filter(Boolean).pop();C&&(w[C][x]=!0),w.arrays[x]=!0,w.keys.push(x)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(g){w.bools[g]=!0,w.keys.push(g)}),[].concat(r.string||[]).filter(Boolean).forEach(function(g){w.strings[g]=!0,w.keys.push(g)}),[].concat(r.number||[]).filter(Boolean).forEach(function(g){w.numbers[g]=!0,w.keys.push(g)}),[].concat(r.count||[]).filter(Boolean).forEach(function(g){w.counts[g]=!0,w.keys.push(g)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(g){w.normalize[g]=!0,w.keys.push(g)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([g,x])=>{typeof x=="number"&&(w.nargs[g]=x,w.keys.push(g))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([g,x])=>{typeof x=="function"&&(w.coercions[g]=x,w.keys.push(g))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(g){w.configs[g]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([g,x])=>{(typeof x=="boolean"||typeof x=="function")&&(w.configs[g]=x)})),at(r.key,s,r.default,w.arrays),Object.keys(u).forEach(function(g){(w.aliases[g]||[]).forEach(function(x){u[x]=u[g]})});let p=null;S();let v=[];const I=Object.assign(Object.create(null),{_:[]}),P={};for(let g=0;g<o.length;g++){const x=o[g],C=x.replace(/^-{3,}/,"---");let D,_,k,j,R,Q;if(x!=="--"&&/^-/.test(x)&&Pe(x))L(x);else if(C.match(/^---+(=|$)/)){L(x);continue}else if(x.match(/^--.+=/)||!a["short-option-groups"]&&x.match(/^-.+=/))j=x.match(/^--?([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&(X(j[1],w.arrays)?g=T(g,j[1],o,j[2]):X(j[1],w.nargs)!==!1?g=M(g,j[1],o,j[2]):b(j[1],j[2],!0));else if(x.match(N)&&a["boolean-negation"])j=x.match(N),j!==null&&Array.isArray(j)&&j.length>=2&&(_=j[1],b(_,X(_,w.arrays)?[!1]:!1));else if(x.match(/^--.+/)||!a["short-option-groups"]&&x.match(/^-[^-]+/))j=x.match(/^--?(.+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(_=j[1],X(_,w.arrays)?g=T(g,_,o):X(_,w.nargs)!==!1?g=M(g,_,o):(R=o[g+1],R!==void 0&&(!R.match(/^-/)||R.match(A))&&!X(_,w.bools)&&!X(_,w.counts)||/^(true|false)$/.test(R)?(b(_,R),g++):b(_,de(_))));else if(x.match(/^-.\..+=/))j=x.match(/^-([^=]+)=([\s\S]*)$/),j!==null&&Array.isArray(j)&&j.length>=3&&b(j[1],j[2]);else if(x.match(/^-.\..+/)&&!x.match(A))R=o[g+1],j=x.match(/^-(.\..+)/),j!==null&&Array.isArray(j)&&j.length>=2&&(_=j[1],R!==void 0&&!R.match(/^-/)&&!X(_,w.bools)&&!X(_,w.counts)?(b(_,R),g++):b(_,de(_)));else if(x.match(/^-[^-]+/)&&!x.match(A)){k=x.slice(1,-1).split(""),D=!1;for(let te=0;te<k.length;te++){if(R=x.slice(te+2),k[te+1]&&k[te+1]==="="){Q=x.slice(te+3),_=k[te],X(_,w.arrays)?g=T(g,_,o,Q):X(_,w.nargs)!==!1?g=M(g,_,o,Q):b(_,Q),D=!0;break}if(R==="-"){b(k[te],R);continue}if(/[A-Za-z]/.test(k[te])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(R)&&X(R,w.bools)===!1){b(k[te],R),D=!0;break}if(k[te+1]&&k[te+1].match(/\W/)){b(k[te],R),D=!0;break}else b(k[te],de(k[te]))}_=x.slice(-1)[0],!D&&_!=="-"&&(X(_,w.arrays)?g=T(g,_,o):X(_,w.nargs)!==!1?g=M(g,_,o):(R=o[g+1],R!==void 0&&(!/^(-|--)[^-]/.test(R)||R.match(A))&&!X(_,w.bools)&&!X(_,w.counts)||/^(true|false)$/.test(R)?(b(_,R),g++):b(_,de(_))))}else if(x.match(/^-[0-9]$/)&&x.match(A)&&X(x.slice(1),w.bools))_=x.slice(1),b(_,de(_));else if(x==="--"){v=o.slice(g+1);break}else if(a["halt-at-non-option"]){v=o.slice(g);break}else L(x)}G(I,!0),G(I,!1),B(I),W(),pe(I,w.aliases,u,!0),ve(I),a["set-placeholder-key"]&&qe(I),Object.keys(w.counts).forEach(function(g){Ne(I,g.split("."))||b(g,0)}),f&&v.length&&(I[l]=[]),v.forEach(function(g){I[l].push(g)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(g=>g!=="--"&&g.includes("-")).forEach(g=>{delete I[g]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(g=>s[g])).forEach(g=>{a["camel-case-expansion"]&&g.includes("-")&&delete I[g.split(".").map(x=>Ge(x)).join(".")],delete I[g]});function L(g){const x=U("_",g);(typeof x=="string"||typeof x=="number")&&I._.push(x)}function M(g,x,C,D){let _,k=X(x,w.nargs);if(k=typeof k!="number"||isNaN(k)?1:k,k===0)return h(D)||(p=Error(O("Argument unexpected for: %s",x))),b(x,de(x)),g;let j=h(D)?0:1;if(a["nargs-eats-options"])C.length-(g+1)+j<k&&(p=Error(O("Not enough arguments following: %s",x))),j=k;else{for(_=g+1;_<C.length&&(!C[_].match(/^-[^0-9]/)||C[_].match(A)||Pe(C[_]));_++)j++;j<k&&(p=Error(O("Not enough arguments following: %s",x)))}let R=Math.min(j,k);for(!h(D)&&R>0&&(b(x,D),R--),_=g+1;_<R+g+1;_++)b(x,C[_]);return g+R}function T(g,x,C,D){let _=[],k=D||C[g+1];const j=X(x,w.nargs);if(X(x,w.bools)&&!/^(true|false)$/.test(k))_.push(!0);else if(h(k)||h(D)&&/^-/.test(k)&&!A.test(k)&&!Pe(k)){if(u[x]!==void 0){const R=u[x];_=Array.isArray(R)?R:[R]}}else{h(D)||_.push($(x,D,!0));for(let R=g+1;R<C.length&&!(!a["greedy-arrays"]&&_.length>0||j&&typeof j=="number"&&_.length>=j||(k=C[R],/^-/.test(k)&&!A.test(k)&&!Pe(k)));R++)g=R,_.push($(x,k,i))}return typeof j=="number"&&(j&&_.length<j||isNaN(j)&&_.length===0)&&(p=Error(O("Not enough arguments following: %s",x))),b(x,_),g}function b(g,x,C=i){if(/-/.test(g)&&a["camel-case-expansion"]){const k=g.split(".").map(function(j){return Ge(j)}).join(".");F(g,k)}const D=$(g,x,C),_=g.split(".");H(I,_,D),w.aliases[g]&&w.aliases[g].forEach(function(k){const j=k.split(".");H(I,j,D)}),_.length>1&&a["dot-notation"]&&(w.aliases[_[0]]||[]).forEach(function(k){let j=k.split(".");const R=[].concat(_);R.shift(),j=j.concat(R),(w.aliases[g]||[]).includes(j.join("."))||H(I,j,D)}),X(g,w.normalize)&&!X(g,w.arrays)&&[g].concat(w.aliases[g]||[]).forEach(function(j){Object.defineProperty(P,j,{enumerable:!0,get(){return x},set(R){x=typeof R=="string"?ye.normalize(R):R}})})}function F(g,x){w.aliases[g]&&w.aliases[g].length||(w.aliases[g]=[x],m[x]=!0),w.aliases[x]&&w.aliases[x].length||F(x,g)}function $(g,x,C){C&&(x=ea(x)),(X(g,w.bools)||X(g,w.counts))&&typeof x=="string"&&(x=x==="true");let D=Array.isArray(x)?x.map(function(_){return U(g,_)}):U(g,x);return X(g,w.counts)&&(h(D)||typeof D=="boolean")&&(D=mt()),X(g,w.normalize)&&X(g,w.arrays)&&(Array.isArray(x)?D=x.map(_=>ye.normalize(_)):D=ye.normalize(x)),D}function U(g,x){return!a["parse-positional-numbers"]&&g==="_"||!X(g,w.strings)&&!X(g,w.bools)&&!Array.isArray(x)&&(Qo(x)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${x}`)))||!h(x)&&X(g,w.numbers))&&(x=Number(x)),x}function B(g){const x=Object.create(null);pe(x,w.aliases,u),Object.keys(w.configs).forEach(function(C){const D=g[C]||x[C];if(D)try{let _=null;const k=ye.resolve(ye.cwd(),D),j=w.configs[C];if(typeof j=="function"){try{_=j(k)}catch(R){_=R}if(_ instanceof Error){p=_;return}}else _=ye.require(k);V(_)}catch(_){_.name==="PermissionDenied"?p=_:g[C]&&(p=Error(O("Invalid JSON config file: %s",D)))}})}function V(g,x){Object.keys(g).forEach(function(C){const D=g[C],_=x?x+"."+C:C;typeof D=="object"&&D!==null&&!Array.isArray(D)&&a["dot-notation"]?V(D,_):(!Ne(I,_.split("."))||X(_,w.arrays)&&a["combine-arrays"])&&b(_,D)})}function W(){typeof d<"u"&&d.forEach(function(g){V(g)})}function G(g,x){if(typeof c>"u")return;const C=typeof c=="string"?c:"",D=ye.env();Object.keys(D).forEach(function(_){if(C===""||_.lastIndexOf(C,0)===0){const k=_.split("__").map(function(j,R){return R===0&&(j=j.substring(C.length)),Ge(j)});(x&&w.configs[k.join(".")]||!x)&&!Ne(g,k)&&b(k.join("."),D[_])}})}function ve(g){let x;const C=new Set;Object.keys(g).forEach(function(D){if(!C.has(D)&&(x=X(D,w.coercions),typeof x=="function"))try{const _=U(D,x(g[D]));[].concat(w.aliases[D]||[],D).forEach(k=>{C.add(k),g[k]=_})}catch(_){p=_}})}function qe(g){return w.keys.forEach(x=>{~x.indexOf(".")||typeof g[x]>"u"&&(g[x]=void 0)}),g}function pe(g,x,C,D=!1){Object.keys(C).forEach(function(_){Ne(g,_.split("."))||(H(g,_.split("."),C[_]),D&&(E[_]=!0),(x[_]||[]).forEach(function(k){Ne(g,k.split("."))||H(g,k.split("."),C[_])}))})}function Ne(g,x){let C=g;a["dot-notation"]||(x=[x.join(".")]),x.slice(0,-1).forEach(function(_){C=C[_]||{}});const D=x[x.length-1];return typeof C!="object"?!1:D in C}function H(g,x,C){let D=g;a["dot-notation"]||(x=[x.join(".")]),x.slice(0,-1).forEach(function(Q){Q=Kn(Q),typeof D=="object"&&D[Q]===void 0&&(D[Q]={}),typeof D[Q]!="object"||Array.isArray(D[Q])?(Array.isArray(D[Q])?D[Q].push({}):D[Q]=[D[Q],{}],D=D[Q][D[Q].length-1]):D=D[Q]});const _=Kn(x[x.length-1]),k=X(x.join("."),w.arrays),j=Array.isArray(C);let R=a["duplicate-arguments-array"];!R&&X(_,w.nargs)&&(R=!0,(!h(D[_])&&w.nargs[_]===1||Array.isArray(D[_])&&D[_].length===w.nargs[_])&&(D[_]=void 0)),C===mt()?D[_]=mt(D[_]):Array.isArray(D[_])?R&&k&&j?D[_]=a["flatten-duplicate-arrays"]?D[_].concat(C):(Array.isArray(D[_][0])?D[_]:[D[_]]).concat([C]):!R&&!!k==!!j?D[_]=C:D[_]=D[_].concat([C]):D[_]===void 0&&k?D[_]=j?C:[C]:R&&!(D[_]===void 0||X(_,w.counts)||X(_,w.bools))?D[_]=[D[_],C]:D[_]=C}function at(...g){g.forEach(function(x){Object.keys(x||{}).forEach(function(C){w.aliases[C]||(w.aliases[C]=[].concat(s[C]||[]),w.aliases[C].concat(C).forEach(function(D){if(/-/.test(D)&&a["camel-case-expansion"]){const _=Ge(D);_!==C&&w.aliases[C].indexOf(_)===-1&&(w.aliases[C].push(_),m[_]=!0)}}),w.aliases[C].concat(C).forEach(function(D){if(D.length>1&&/[A-Z]/.test(D)&&a["camel-case-expansion"]){const _=zo(D,"-");_!==C&&w.aliases[C].indexOf(_)===-1&&(w.aliases[C].push(_),m[_]=!0)}}),w.aliases[C].forEach(function(D){w.aliases[D]=[C].concat(w.aliases[C].filter(function(_){return D!==_}))}))})})}function X(g,x){const C=[].concat(w.aliases[g]||[],g),D=Object.keys(x),_=C.find(k=>D.includes(k));return _?x[_]:!1}function Ae(g){const x=Object.keys(w);return[].concat(x.map(D=>w[D])).some(function(D){return Array.isArray(D)?D.includes(g):D[g]})}function me(g,...x){return[].concat(...x).some(function(D){const _=g.match(D);return _&&Ae(_[1])})}function Re(g){if(g.match(A)||!g.match(/^-[^-]+/))return!1;let x=!0,C;const D=g.slice(1).split("");for(let _=0;_<D.length;_++){if(C=g.slice(_+2),!Ae(D[_])){x=!1;break}if(D[_+1]&&D[_+1]==="="||C==="-"||/[A-Za-z]/.test(D[_])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(C)||D[_+1]&&D[_+1].match(/\W/))break}return x}function Pe(g){return a["unknown-options-as-args"]&&We(g)}function We(g){return g=g.replace(/^-{3,}/,"--"),g.match(A)||Re(g)?!1:!me(g,/^-+([^=]+?)=[\s\S]*$/,N,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function de(g){return!X(g,w.bools)&&!X(g,w.counts)&&`${g}`in u?u[g]:ut(y(g))}function ut(g){return{[fe.BOOLEAN]:!0,[fe.STRING]:"",[fe.NUMBER]:void 0,[fe.ARRAY]:[]}[g]}function y(g){let x=fe.BOOLEAN;return X(g,w.strings)?x=fe.STRING:X(g,w.numbers)?x=fe.NUMBER:X(g,w.bools)?x=fe.BOOLEAN:X(g,w.arrays)&&(x=fe.ARRAY),x}function h(g){return g===void 0}function S(){Object.keys(w.counts).find(g=>X(g,w.arrays)?(p=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",g)),!0):X(g,w.nargs)?(p=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",g)),!0):!1)}return{aliases:Object.assign({},w.aliases),argv:Object.assign(P,I),configuration:a,defaulted:Object.assign({},E),error:p,newAliases:Object.assign({},m)}}}function Zo(t){const e=[],n=Object.create(null);let r=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});r;){r=!1;for(let o=0;o<e.length;o++)for(let i=o+1;i<e.length;i++)if(e[o].filter(function(a){return e[i].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[i]),e.splice(i,1),r=!0;break}}return e.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 mt(t){return t!==void 0?t+1:1}function Kn(t){return t==="__proto__"?"___proto___":t}function ea(t){return typeof t=="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}/**
|
|
67
67
|
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
68
68
|
* CJS and ESM environments.
|
|
69
69
|
*
|
|
70
70
|
* @license
|
|
71
71
|
* Copyright (c) 2016, Contributors
|
|
72
72
|
* SPDX-License-Identifier: ISC
|
|
73
|
-
*/var
|
|
74
|
-
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(q)),pt}var dt={},ye={},be={},Hn;function we(){return Hn||(Hn=1,function(){var t,e,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;t=function(){var p,c,l,f,y,E;if(E=arguments[0],y=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(p=0,l=y.length;p<l;p++)if(f=y[p],f!=null)for(c in f)u.call(f,c)&&(E[c]=f[c]);return E},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,l;return i(p)&&(l=Object.getPrototypeOf(p))&&(c=l.constructor)&&typeof c=="function"&&c instanceof c&&Function.prototype.toString.call(c)===Function.prototype.toString.call(Object)},e=function(p){return o(p.valueOf)?p.valueOf():p},be.assign=t,be.isFunction=o,be.isObject=i,be.isArray=n,be.isEmpty=r,be.isPlainObject=s,be.getValue=e}.call(q)),be}var gt={exports:{}},Yn;function si(){return Yn||(Yn=1,function(){gt.exports=function(){function t(){}return t.prototype.hasFeature=function(e,n){return!0},t.prototype.createDocumentType=function(e,n,r){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(e,n,r){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(e){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(e,n){throw new Error("This DOM method is not implemented.")},t}()}.call(q)),gt.exports}var mt={exports:{}},yt={exports:{}},bt={exports:{}},zn;function So(){return zn||(zn=1,function(){bt.exports=function(){function t(){}return t.prototype.handleError=function(e){throw new Error(e)},t}()}.call(q)),bt.exports}var wt={exports:{}},Qn;function Do(){return Qn||(Qn=1,function(){wt.exports=function(){function t(e){this.arr=e||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(e){return this.arr[e]||null},t.prototype.contains=function(e){return this.arr.indexOf(e)!==-1},t}()}.call(q)),wt.exports}var Kn;function Mo(){return Kn||(Kn=1,function(){var t,e;t=So(),e=Do(),yt.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 t,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 e(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(q)),yt.exports}var Et={exports:{}},Tt={exports:{}},Nt={exports:{}},Jn;function Z(){return Jn||(Jn=1,function(){Nt.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(q)),Nt.exports}var It={exports:{}},Zn;function oi(){return Zn||(Zn=1,function(){var t;t=Z(),ue(),It.exports=function(){function e(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=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(e.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(e.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(e.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"specified",{get:function(){return!0}}),e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},e.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},e.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},e}()}.call(q)),It.exports}var vt={exports:{}},er;function ln(){return er||(er=1,function(){vt.exports=function(){function t(e){this.nodes=e}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(e){return this.nodes[e]},t.prototype.setNamedItem=function(e){var n;return n=this.nodes[e.nodeName],this.nodes[e.nodeName]=e,n||null},t.prototype.removeNamedItem=function(e){var n;return n=this.nodes[e],delete this.nodes[e],n||null},t.prototype.item=function(e){return this.nodes[Object.keys(this.nodes)[e]]||null},t.prototype.getNamedItemNS=function(e,n){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(e){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(e,n){throw new Error("This DOM method is not implemented.")},t}()}.call(q)),vt.exports}var tr;function fn(){return tr||(tr=1,function(){var t,e,n,r,o,i,s,a,u=function(c,l){for(var f in l)p.call(l,f)&&(c[f]=l[f]);function y(){this.constructor=c}return y.prototype=l.prototype,c.prototype=new y,c.__super__=l.prototype,c},p={}.hasOwnProperty;a=we(),s=a.isObject,i=a.isFunction,o=a.getValue,r=ue(),t=Z(),e=oi(),n=ln(),Tt.exports=function(c){u(l,c);function l(f,y,E){var O,w,L,N;if(l.__super__.constructor.call(this,f),y==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(y),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,E!=null&&this.attribute(E),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(N=f.children,w=0,L=N.length;w<L;w++)if(O=N[w],O.type===t.DocType){O.name=this.name;break}}}return Object.defineProperty(l.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(l.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(l.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),l.prototype.clone=function(){var f,y,E,O;E=Object.create(this),E.isRoot&&(E.documentObject=null),E.attribs={},O=this.attribs;for(y in O)p.call(O,y)&&(f=O[y],E.attribs[y]=f.clone());return E.children=[],this.children.forEach(function(w){var L;return L=w.clone(),L.parent=E,E.children.push(L)}),E},l.prototype.attribute=function(f,y){var E,O;if(f!=null&&(f=o(f)),s(f))for(E in f)p.call(f,E)&&(O=f[E],this.attribute(E,O));else i(y)&&(y=y.apply()),this.options.keepNullAttributes&&y==null?this.attribs[f]=new e(this,f,""):y!=null&&(this.attribs[f]=new e(this,f,y));return this},l.prototype.removeAttribute=function(f){var y,E,O;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=o(f),Array.isArray(f))for(E=0,O=f.length;E<O;E++)y=f[E],delete this.attribs[y];else delete this.attribs[f];return this},l.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},l.prototype.att=function(f,y){return this.attribute(f,y)},l.prototype.a=function(f,y){return this.attribute(f,y)},l.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},l.prototype.setAttribute=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},l.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNS=function(f,y,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNodeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},l.prototype.hasAttributeNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttribute=function(f,y){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:y},l.prototype.setIdAttributeNS=function(f,y,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttributeNode=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.isEqualNode=function(f){var y,E,O;if(!l.__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=E=0,O=this.attribs.length-1;0<=O?E<=O:E>=O;y=0<=O?++E:--E)if(!this.attribs[y].isEqualNode(f.attribs[y]))return!1;return!0},l}(r)}.call(q)),Tt.exports}var Ot={exports:{}},xt={exports:{}},nr;function tt(){return nr||(nr=1,function(){var t,e=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;t=ue(),xt.exports=function(r){e(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}(t)}.call(q)),xt.exports}var rr;function hn(){return rr||(rr=1,function(){var t,e,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=Z(),e=tt(),Ot.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=t.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}(e)}.call(q)),Ot.exports}var Pt={exports:{}},ir;function pn(){return ir||(ir=1,function(){var t,e,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=Z(),e=tt(),Pt.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=t.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}(e)}.call(q)),Pt.exports}var At={exports:{}},sr;function dn(){return sr||(sr=1,function(){var t,e,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=we().isObject,e=ue(),t=Z(),At.exports=function(i){r(s,i);function s(a,u,p,c){var l;s.__super__.constructor.call(this,a),n(u)&&(l=u,u=l.version,p=l.encoding,c=l.standalone),u||(u="1.0"),this.type=t.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}(e)}.call(q)),At.exports}var _t={exports:{}},Lt={exports:{}},or;function gn(){return or||(or=1,function(){var t,e,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=ue(),t=Z(),Lt.exports=function(o){n(i,o);function i(s,a,u,p,c,l){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(l&&!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=t.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(p),l&&(this.defaultValue=this.stringify.dtdAttDefault(l)),this.defaultValueType=c}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(e)}.call(q)),Lt.exports}var St={exports:{}},ar;function mn(){return ar||(ar=1,function(){var t,e,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=we().isObject,e=ue(),t=Z(),St.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=t.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}(e)}.call(q)),St.exports}var Dt={exports:{}},ur;function yn(){return ur||(ur=1,function(){var t,e,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=ue(),t=Z(),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 DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=t.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}(e)}.call(q)),Dt.exports}var Mt={exports:{}},cr;function bn(){return cr||(cr=1,function(){var t,e,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=ue(),t=Z(),Mt.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=t.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}(e)}.call(q)),Mt.exports}var lr;function wn(){return lr||(lr=1,function(){var t,e,n,r,o,i,s,a,u=function(c,l){for(var f in l)p.call(l,f)&&(c[f]=l[f]);function y(){this.constructor=c}return y.prototype=l.prototype,c.prototype=new y,c.__super__=l.prototype,c},p={}.hasOwnProperty;a=we().isObject,s=ue(),t=Z(),e=gn(),r=mn(),n=yn(),o=bn(),i=ln(),_t.exports=function(c){u(l,c);function l(f,y,E){var O,w,L,N,d,v;if(l.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(N=f.children,w=0,L=N.length;w<L;w++)if(O=N[w],O.type===t.Element){this.name=O.name;break}}this.documentObject=f,a(y)&&(d=y,y=d.pubID,E=d.sysID),E==null&&(v=[y,E],E=v[0],y=v[1]),y!=null&&(this.pubID=this.stringify.dtdPubID(y)),E!=null&&(this.sysID=this.stringify.dtdSysID(E))}return Object.defineProperty(l.prototype,"entities",{get:function(){var f,y,E,O,w;for(O={},w=this.children,y=0,E=w.length;y<E;y++)f=w[y],f.type===t.EntityDeclaration&&!f.pe&&(O[f.name]=f);return new i(O)}}),Object.defineProperty(l.prototype,"notations",{get:function(){var f,y,E,O,w;for(O={},w=this.children,y=0,E=w.length;y<E;y++)f=w[y],f.type===t.NotationDeclaration&&(O[f.name]=f);return new i(O)}}),Object.defineProperty(l.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(l.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(l.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),l.prototype.element=function(f,y){var E;return E=new n(this,f,y),this.children.push(E),this},l.prototype.attList=function(f,y,E,O,w){var L;return L=new e(this,f,y,E,O,w),this.children.push(L),this},l.prototype.entity=function(f,y){var E;return E=new r(this,!1,f,y),this.children.push(E),this},l.prototype.pEntity=function(f,y){var E;return E=new r(this,!0,f,y),this.children.push(E),this},l.prototype.notation=function(f,y){var E;return E=new o(this,f,y),this.children.push(E),this},l.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},l.prototype.ele=function(f,y){return this.element(f,y)},l.prototype.att=function(f,y,E,O,w){return this.attList(f,y,E,O,w)},l.prototype.ent=function(f,y){return this.entity(f,y)},l.prototype.pent=function(f,y){return this.pEntity(f,y)},l.prototype.not=function(f,y){return this.notation(f,y)},l.prototype.up=function(){return this.root()||this.documentObject},l.prototype.isEqualNode=function(f){return!(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},l}(s)}.call(q)),_t.exports}var Ct={exports:{}},fr;function En(){return fr||(fr=1,function(){var t,e,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=Z(),e=ue(),Ct.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=t.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}(e)}.call(q)),Ct.exports}var Ft={exports:{}},hr;function Tn(){return hr||(hr=1,function(){var t,e,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=Z(),e=tt(),Ft.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=t.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}(e)}.call(q)),Ft.exports}var jt={exports:{}},pr;function Nn(){return pr||(pr=1,function(){var t,e,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=Z(),e=tt(),jt.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=t.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}(e)}.call(q)),jt.exports}var kt={exports:{}},dr;function ai(){return dr||(dr=1,function(){var t,e,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=ue(),t=Z(),kt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=t.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(e)}.call(q)),kt.exports}var Bt={exports:{}},gr;function Co(){return gr||(gr=1,function(){Bt.exports=function(){function t(e){this.nodes=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(e){return this.nodes[e]||null},t}()}.call(q)),Bt.exports}var Rt={exports:{}},mr;function Fo(){return mr||(mr=1,function(){Rt.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(q)),Rt.exports}var yr;function ue(){return yr||(yr=1,function(){var t,e,n,r,o,i,s,a,u,p,c,l,f,y,E,O,w,L={}.hasOwnProperty;w=we(),O=w.isObject,E=w.isFunction,y=w.isEmpty,f=w.getValue,a=null,n=null,r=null,o=null,i=null,c=null,l=null,p=null,s=null,e=null,u=null,t=null,Et.exports=function(){function N(d){this.parent=d,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=fn(),n=hn(),r=pn(),o=dn(),i=wn(),c=En(),l=Tn(),p=Nn(),s=ai(),e=Z(),u=Co(),ln(),t=Fo())}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 d;return d=this.parent.children.indexOf(this),this.parent.children[d-1]||null}}),Object.defineProperty(N.prototype,"nextSibling",{get:function(){var d;return d=this.parent.children.indexOf(this),this.parent.children[d+1]||null}}),Object.defineProperty(N.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(N.prototype,"textContent",{get:function(){var d,v,I,A,_;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(_="",A=this.children,v=0,I=A.length;v<I;v++)d=A[v],d.textContent&&(_+=d.textContent);return _}else return null},set:function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),N.prototype.setParent=function(d){var v,I,A,_,M;for(this.parent=d,d&&(this.options=d.options,this.stringify=d.stringify),_=this.children,M=[],I=0,A=_.length;I<A;I++)v=_[I],M.push(v.setParent(this));return M},N.prototype.element=function(d,v,I){var A,_,M,T,b,F,$,V,R,U,W;if(F=null,v===null&&I==null&&(R=[{},null],v=R[0],I=R[1]),v==null&&(v={}),v=f(v),O(v)||(U=[v,I],I=U[0],v=U[1]),d!=null&&(d=f(d)),Array.isArray(d))for(M=0,$=d.length;M<$;M++)_=d[M],F=this.element(_);else if(E(d))F=this.element(d.apply());else if(O(d)){for(b in d)if(L.call(d,b))if(W=d[b],E(W)&&(W=W.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&b.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(b.substr(this.stringify.convertAttKey.length),W);else if(!this.options.separateArrayItems&&Array.isArray(W)&&y(W))F=this.dummy();else if(O(W)&&y(W))F=this.element(b);else if(!this.options.keepNullNodes&&W==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(W))for(T=0,V=W.length;T<V;T++)_=W[T],A={},A[b]=_,F=this.element(A);else O(W)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&b.indexOf(this.stringify.convertTextKey)===0?F=this.element(W):(F=this.element(b),F.element(W)):F=this.element(b,W)}else!this.options.keepNullNodes&&I===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&d.indexOf(this.stringify.convertTextKey)===0?F=this.text(I):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&d.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(I):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&d.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(I):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&d.indexOf(this.stringify.convertRawKey)===0?F=this.raw(I):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&d.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(d.substr(this.stringify.convertPIKey.length),I):F=this.node(d,v,I);if(F==null)throw new Error("Could not create any elements with: "+d+". "+this.debugInfo());return F},N.prototype.insertBefore=function(d,v,I){var A,_,M,T,b;if(d?.type)return M=d,T=v,M.setParent(this),T?(_=children.indexOf(T),b=children.splice(_),children.push(M),Array.prototype.push.apply(children,b)):children.push(M),M;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return _=this.parent.children.indexOf(this),b=this.parent.children.splice(_),A=this.parent.element(d,v,I),Array.prototype.push.apply(this.parent.children,b),A},N.prototype.insertAfter=function(d,v,I){var A,_,M;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return _=this.parent.children.indexOf(this),M=this.parent.children.splice(_+1),A=this.parent.element(d,v,I),Array.prototype.push.apply(this.parent.children,M),A},N.prototype.remove=function(){var d;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return d=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[d,d-d+1].concat([])),this.parent},N.prototype.node=function(d,v,I){var A,_;return d!=null&&(d=f(d)),v||(v={}),v=f(v),O(v)||(_=[v,I],I=_[0],v=_[1]),A=new a(this,d,v),I!=null&&A.text(I),this.children.push(A),A},N.prototype.text=function(d){var v;return O(d)&&this.element(d),v=new l(this,d),this.children.push(v),this},N.prototype.cdata=function(d){var v;return v=new n(this,d),this.children.push(v),this},N.prototype.comment=function(d){var v;return v=new r(this,d),this.children.push(v),this},N.prototype.commentBefore=function(d){var v,I;return v=this.parent.children.indexOf(this),I=this.parent.children.splice(v),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.commentAfter=function(d){var v,I;return v=this.parent.children.indexOf(this),I=this.parent.children.splice(v+1),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.raw=function(d){var v;return v=new c(this,d),this.children.push(v),this},N.prototype.dummy=function(){var d;return d=new s(this),d},N.prototype.instruction=function(d,v){var I,A,_,M,T;if(d!=null&&(d=f(d)),v!=null&&(v=f(v)),Array.isArray(d))for(M=0,T=d.length;M<T;M++)I=d[M],this.instruction(I);else if(O(d))for(I in d)L.call(d,I)&&(A=d[I],this.instruction(I,A));else E(v)&&(v=v.apply()),_=new p(this,d,v),this.children.push(_);return this},N.prototype.instructionBefore=function(d,v){var I,A;return I=this.parent.children.indexOf(this),A=this.parent.children.splice(I),this.parent.instruction(d,v),Array.prototype.push.apply(this.parent.children,A),this},N.prototype.instructionAfter=function(d,v){var I,A;return I=this.parent.children.indexOf(this),A=this.parent.children.splice(I+1),this.parent.instruction(d,v),Array.prototype.push.apply(this.parent.children,A),this},N.prototype.declaration=function(d,v,I){var A,_;return A=this.document(),_=new o(A,d,v,I),A.children.length===0?A.children.unshift(_):A.children[0].type===e.Declaration?A.children[0]=_:A.children.unshift(_),A.root()||A},N.prototype.dtd=function(d,v){var I,A,_,M,T,b,F,$,V,R;for(A=this.document(),_=new i(A,d,v),V=A.children,M=T=0,F=V.length;T<F;M=++T)if(I=V[M],I.type===e.DocType)return A.children[M]=_,_;for(R=A.children,M=b=0,$=R.length;b<$;M=++b)if(I=R[M],I.isRoot)return A.children.splice(M,0,_),_;return A.children.push(_),_},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 d;for(d=this;d;){if(d.type===e.Document)return d.rootObject;if(d.isRoot)return d;d=d.parent}},N.prototype.document=function(){var d;for(d=this;d;){if(d.type===e.Document)return d;d=d.parent}},N.prototype.end=function(d){return this.document().end(d)},N.prototype.prev=function(){var d;if(d=this.parent.children.indexOf(this),d<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[d-1]},N.prototype.next=function(){var d;if(d=this.parent.children.indexOf(this),d===-1||d===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[d+1]},N.prototype.importDocument=function(d){var v;return v=d.root().clone(),v.parent=this,v.isRoot=!1,this.children.push(v),this},N.prototype.debugInfo=function(d){var v,I;return d=d||this.name,d==null&&!((v=this.parent)!=null&&v.name)?"":d==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+d+">, parent: <"+this.parent.name+">":"node: <"+d+">"},N.prototype.ele=function(d,v,I){return this.element(d,v,I)},N.prototype.nod=function(d,v,I){return this.node(d,v,I)},N.prototype.txt=function(d){return this.text(d)},N.prototype.dat=function(d){return this.cdata(d)},N.prototype.com=function(d){return this.comment(d)},N.prototype.ins=function(d,v){return this.instruction(d,v)},N.prototype.doc=function(){return this.document()},N.prototype.dec=function(d,v,I){return this.declaration(d,v,I)},N.prototype.e=function(d,v,I){return this.element(d,v,I)},N.prototype.n=function(d,v,I){return this.node(d,v,I)},N.prototype.t=function(d){return this.text(d)},N.prototype.d=function(d){return this.cdata(d)},N.prototype.c=function(d){return this.comment(d)},N.prototype.r=function(d){return this.raw(d)},N.prototype.i=function(d,v){return this.instruction(d,v)},N.prototype.u=function(){return this.up()},N.prototype.importXMLBuilder=function(d){return this.importDocument(d)},N.prototype.replaceChild=function(d,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.removeChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.appendChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.hasChildNodes=function(){return this.children.length!==0},N.prototype.cloneNode=function(d){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(d,v){return!0},N.prototype.hasAttributes=function(){return this.attribs.length!==0},N.prototype.compareDocumentPosition=function(d){var v,I;return v=this,v===d?0:this.document()!==d.document()?(I=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?I|=t.Preceding:I|=t.Following,I):v.isAncestor(d)?t.Contains|t.Preceding:v.isDescendant(d)?t.Contains|t.Following:v.isPreceding(d)?t.Preceding:t.Following},N.prototype.isSameNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupPrefix=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isDefaultNamespace=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupNamespaceURI=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isEqualNode=function(d){var v,I,A;if(d.nodeType!==this.nodeType||d.children.length!==this.children.length)return!1;for(v=I=0,A=this.children.length-1;0<=A?I<=A:I>=A;v=0<=A?++I:--I)if(!this.children[v].isEqualNode(d.children[v]))return!1;return!0},N.prototype.getFeature=function(d,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.setUserData=function(d,v,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.getUserData=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.contains=function(d){return d?d===this||this.isDescendant(d):!1},N.prototype.isDescendant=function(d){var v,I,A,_,M;for(M=this.children,A=0,_=M.length;A<_;A++)if(v=M[A],d===v||(I=v.isDescendant(d),I))return!0;return!1},N.prototype.isAncestor=function(d){return d.isDescendant(this)},N.prototype.isPreceding=function(d){var v,I;return v=this.treePosition(d),I=this.treePosition(this),v===-1||I===-1?!1:v<I},N.prototype.isFollowing=function(d){var v,I;return v=this.treePosition(d),I=this.treePosition(this),v===-1||I===-1?!1:v>I},N.prototype.treePosition=function(d){var v,I;return I=0,v=!1,this.foreachTreeNode(this.document(),function(A){if(I++,!v&&A===d)return v=!0}),v?I:-1},N.prototype.foreachTreeNode=function(d,v){var I,A,_,M,T;for(d||(d=this.document()),M=d.children,A=0,_=M.length;A<_;A++){if(I=M[A],T=v(I))return T;if(T=this.foreachTreeNode(I,v),T)return T}},N}()}.call(q)),Et.exports}var $t={exports:{}},br;function ui(){return br||(br=1,function(){var t=function(n,r){return function(){return n.apply(r,arguments)}},e={}.hasOwnProperty;$t.exports=function(){function n(r){this.assertLegalName=t(this.assertLegalName,this),this.assertLegalChar=t(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)e.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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},n}()}.call(q)),$t.exports}var Xt={exports:{}},Ut={exports:{}},Vt={exports:{}},wr;function nt(){return wr||(wr=1,function(){Vt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(q)),Vt.exports}var Er;function ci(){return Er||(Er=1,function(){var t,e,n,r={}.hasOwnProperty;n=we().assign,t=Z(),dn(),wn(),hn(),pn(),fn(),En(),Tn(),Nn(),ai(),gn(),yn(),mn(),bn(),e=nt(),Ut.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,l,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:`
|
|
75
|
-
`,s.offset=(p=i.offset)!=null?p:0,s.dontPrettyTextNodes=(c=(l=i.dontPrettyTextNodes)!=null?l: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=e.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=e.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=e.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=e.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,p,c,l,f;if(a||(a=0),this.openNode(i,s,a),s.state=e.OpenTag,l=this.indent(i,s,a),l+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?l+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(l+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(l+=" [",l+=this.endline(i,s,a),s.state=e.InsideTag,f=i.children,p=0,c=f.length;p<c;p++)u=f[p],l+=this.writeChildNode(u,s,a+1);s.state=e.CloseTag,l+="]"}return s.state=e.CloseTag,l+=s.spaceBeforeSlash+">",l+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),l},o.prototype.element=function(i,s,a){var u,p,c,l,f,y,E,O,w,L,N,d,v,I;a||(a=0),L=!1,N="",this.openNode(i,s,a),s.state=e.OpenTag,N+=this.indent(i,s,a)+"<"+i.name,d=i.attribs;for(w in d)r.call(d,w)&&(u=d[w],N+=this.attribute(u,s,a));if(c=i.children.length,l=c===0?null:i.children[0],c===0||i.children.every(function(A){return(A.type===t.Text||A.type===t.Raw)&&A.value===""}))s.allowEmpty?(N+=">",s.state=e.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a)):(s.state=e.CloseTag,N+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&c===1&&(l.type===t.Text||l.type===t.Raw)&&l.value!=null)N+=">",s.state=e.InsideTag,s.suppressPrettyCount++,L=!0,N+=this.writeChildNode(l,s,a+1),s.suppressPrettyCount--,L=!1,s.state=e.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(v=i.children,f=0,E=v.length;f<E;f++)if(p=v[f],(p.type===t.Text||p.type===t.Raw)&&p.value!=null){s.suppressPrettyCount++,L=!0;break}}for(N+=">"+this.endline(i,s,a),s.state=e.InsideTag,I=i.children,y=0,O=I.length;y<O;y++)p=I[y],N+=this.writeChildNode(p,s,a+1);s.state=e.CloseTag,N+=this.indent(i,s,a)+"</"+i.name+">",L&&s.suppressPrettyCount--,N+=this.endline(i,s,a),s.state=e.None}return this.closeNode(i,s,a),N},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case t.CData:return this.cdata(i,s,a);case t.Comment:return this.comment(i,s,a);case t.Element:return this.element(i,s,a);case t.Raw:return this.raw(i,s,a);case t.Text:return this.text(i,s,a);case t.ProcessingInstruction:return this.processingInstruction(i,s,a);case t.Dummy:return"";case t.Declaration:return this.declaration(i,s,a);case t.DocType:return this.docType(i,s,a);case t.AttributeDeclaration:return this.dtdAttList(i,s,a);case t.ElementDeclaration:return this.dtdElement(i,s,a);case t.EntityDeclaration:return this.dtdEntity(i,s,a);case t.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=e.OpenTag,u=this.indent(i,s,a)+"<?",s.state=e.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=e.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a),s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a),s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=e.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=e.InsideTag,u+=" "+i.name+" "+i.value,s.state=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=e.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=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=e.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=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.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(q)),Ut.exports}var Tr;function In(){return Tr||(Tr=1,function(){var t,e=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;t=ci(),Xt.exports=function(r){e(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,p,c,l;for(s=this.filterOptions(s),c="",l=i.children,u=0,p=l.length;u<p;u++)a=l[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}(t)}.call(q)),Xt.exports}var Nr;function li(){return Nr||(Nr=1,function(){var t,e,n,r,o,i,s,a=function(p,c){for(var l in c)u.call(c,l)&&(p[l]=c[l]);function f(){this.constructor=p}return f.prototype=c.prototype,p.prototype=new f,p.__super__=c.prototype,p},u={}.hasOwnProperty;s=we().isPlainObject,n=si(),e=Mo(),r=ue(),t=Z(),i=ui(),o=In(),mt.exports=function(p){a(c,p);function c(l){c.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,l||(l={}),l.writer||(l.writer=new o),this.options=l,this.stringify=new i(l)}return Object.defineProperty(c.prototype,"implementation",{value:new n}),Object.defineProperty(c.prototype,"doctype",{get:function(){var l,f,y,E;for(E=this.children,f=0,y=E.length;f<y;f++)if(l=E[f],l.type===t.DocType)return l;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===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(c.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(c.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.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(l){var f;return f={},l?s(l)&&(f=l,l=this.options.writer):l=this.options.writer,l.document(this,l.filterOptions(f))},c.prototype.toString=function(l){return this.options.writer.document(this,this.options.writer.filterOptions(l))},c.prototype.createElement=function(l){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(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createComment=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createCDATASection=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createProcessingInstruction=function(l,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttribute=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEntityReference=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.importNode=function(l,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createElementNS=function(l,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttributeNS=function(l,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagNameNS=function(l,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementById=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.adoptNode=function(l){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(l,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByClassName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEvent=function(l){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(l,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTreeWalker=function(l,f,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(r)}.call(q)),mt.exports}var qt={exports:{}},Ir;function jo(){return Ir||(Ir=1,function(){var t,e,n,r,o,i,s,a,u,p,c,l,f,y,E,O,w,L,N,d,v,I,A,_={}.hasOwnProperty;A=we(),v=A.isObject,d=A.isFunction,I=A.isPlainObject,N=A.getValue,t=Z(),l=li(),f=fn(),r=hn(),o=pn(),E=En(),L=Tn(),y=Nn(),p=dn(),c=wn(),i=gn(),a=mn(),s=yn(),u=bn(),n=oi(),w=ui(),O=In(),e=nt(),qt.exports=function(){function M(T,b,F){var $;this.name="?xml",this.type=t.Document,T||(T={}),$={},T.writer?I(T.writer)&&($=T.writer,T.writer=new O):T.writer=new O,this.options=T,this.writer=T.writer,this.writerOptions=this.writer.filterOptions($),this.stringify=new w(T),this.onDataCallback=b||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return M.prototype.createChildNode=function(T){var b,F,$,V,R,U,W,G;switch(T.type){case t.CData:this.cdata(T.value);break;case t.Comment:this.comment(T.value);break;case t.Element:$={},W=T.attribs;for(F in W)_.call(W,F)&&(b=W[F],$[F]=b.value);this.node(T.name,$);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(T.value);break;case t.Text:this.text(T.value);break;case t.ProcessingInstruction:this.instruction(T.target,T.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+T.constructor.name)}for(G=T.children,R=0,U=G.length;R<U;R++)V=G[R],this.createChildNode(V),V.type===t.Element&&this.up();return this},M.prototype.dummy=function(){return this},M.prototype.node=function(T,b,F){var $;if(T==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(T));return this.openCurrent(),T=N(T),b==null&&(b={}),b=N(b),v(b)||($=[b,F],F=$[0],b=$[1]),this.currentNode=new f(this,T,b),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},M.prototype.element=function(T,b,F){var $,V,R,U,W,G;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(T)||v(T)||d(T))for(U=this.options.noValidation,this.options.noValidation=!0,G=new l(this.options).element("TEMP_ROOT"),G.element(T),this.options.noValidation=U,W=G.children,V=0,R=W.length;V<R;V++)$=W[V],this.createChildNode($),$.type===t.Element&&this.up();else this.node(T,b,F);return this},M.prototype.attribute=function(T,b){var F,$;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(T));if(T!=null&&(T=N(T)),v(T))for(F in T)_.call(T,F)&&($=T[F],this.attribute(F,$));else d(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.currentNode.attribs[T]=new n(this,T,""):b!=null&&(this.currentNode.attribs[T]=new n(this,T,b));return this},M.prototype.text=function(T){var b;return this.openCurrent(),b=new L(this,T),this.onData(this.writer.text(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.cdata=function(T){var b;return this.openCurrent(),b=new r(this,T),this.onData(this.writer.cdata(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.comment=function(T){var b;return this.openCurrent(),b=new o(this,T),this.onData(this.writer.comment(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.raw=function(T){var b;return this.openCurrent(),b=new E(this,T),this.onData(this.writer.raw(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.instruction=function(T,b){var F,$,V,R,U;if(this.openCurrent(),T!=null&&(T=N(T)),b!=null&&(b=N(b)),Array.isArray(T))for(F=0,R=T.length;F<R;F++)$=T[F],this.instruction($);else if(v(T))for($ in T)_.call(T,$)&&(V=T[$],this.instruction($,V));else d(b)&&(b=b.apply()),U=new y(this,T,b),this.onData(this.writer.processingInstruction(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},M.prototype.declaration=function(T,b,F){var $;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return $=new p(this,T,b,F),this.onData(this.writer.declaration($,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.doctype=function(T,b,F){if(this.openCurrent(),T==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,b,F),this.currentNode.rootNodeName=T,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},M.prototype.dtdElement=function(T,b){var F;return this.openCurrent(),F=new s(this,T,b),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.attList=function(T,b,F,$,V){var R;return this.openCurrent(),R=new i(this,T,b,F,$,V),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.entity=function(T,b){var F;return this.openCurrent(),F=new a(this,!1,T,b),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.pEntity=function(T,b){var F;return this.openCurrent(),F=new a(this,!0,T,b),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.notation=function(T,b){var F;return this.openCurrent(),F=new u(this,T,b),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.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},M.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},M.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},M.prototype.openNode=function(T){var b,F,$,V;if(!T.isOpen){if(!this.root&&this.currentLevel===0&&T.type===t.Element&&(this.root=T),F="",T.type===t.Element){this.writerOptions.state=e.OpenTag,F=this.writer.indent(T,this.writerOptions,this.currentLevel)+"<"+T.name,V=T.attribs;for($ in V)_.call(V,$)&&(b=V[$],F+=this.writer.attribute(b,this.writerOptions,this.currentLevel));F+=(T.children?">":"/>")+this.writer.endline(T,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,F=this.writer.indent(T,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+T.rootNodeName,T.pubID&&T.sysID?F+=' PUBLIC "'+T.pubID+'" "'+T.sysID+'"':T.sysID&&(F+=' SYSTEM "'+T.sysID+'"'),T.children?(F+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,F+=">"),F+=this.writer.endline(T,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),T.isOpen=!0}},M.prototype.closeNode=function(T){var b;if(!T.isClosed)return b="",this.writerOptions.state=e.CloseTag,T.type===t.Element?b=this.writer.indent(T,this.writerOptions,this.currentLevel)+"</"+T.name+">"+this.writer.endline(T,this.writerOptions,this.currentLevel):b=this.writer.indent(T,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(T,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(b,this.currentLevel),T.isClosed=!0},M.prototype.onData=function(T,b){return this.documentStarted=!0,this.onDataCallback(T,b+1)},M.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},M.prototype.debugInfo=function(T){return T==null?"":"node: <"+T+">"},M.prototype.ele=function(){return this.element.apply(this,arguments)},M.prototype.nod=function(T,b,F){return this.node(T,b,F)},M.prototype.txt=function(T){return this.text(T)},M.prototype.dat=function(T){return this.cdata(T)},M.prototype.com=function(T){return this.comment(T)},M.prototype.ins=function(T,b){return this.instruction(T,b)},M.prototype.dec=function(T,b,F){return this.declaration(T,b,F)},M.prototype.dtd=function(T,b,F){return this.doctype(T,b,F)},M.prototype.e=function(T,b,F){return this.element(T,b,F)},M.prototype.n=function(T,b,F){return this.node(T,b,F)},M.prototype.t=function(T){return this.text(T)},M.prototype.d=function(T){return this.cdata(T)},M.prototype.c=function(T){return this.comment(T)},M.prototype.r=function(T){return this.raw(T)},M.prototype.i=function(T,b){return this.instruction(T,b)},M.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},M.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},M.prototype.ent=function(T,b){return this.entity(T,b)},M.prototype.pent=function(T,b){return this.pEntity(T,b)},M.prototype.not=function(T,b){return this.notation(T,b)},M}()}.call(q)),qt.exports}var Wt={exports:{}},vr;function ko(){return vr||(vr=1,function(){var t,e,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=Z(),n=ci(),e=nt(),Wt.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===e.CloseTag?"":s.__super__.endline.call(this,a,u,p)},s.prototype.document=function(a,u){var p,c,l,f,y,E,O,w,L;for(O=a.children,c=l=0,y=O.length;l<y;c=++l)p=O[c],p.isLastRootNode=c===a.children.length-1;for(u=this.filterOptions(u),w=a.children,L=[],f=0,E=w.length;f<E;f++)p=w[f],L.push(this.writeChildNode(p,u,0));return L},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,l,f,y;if(p||(p=0),this.openNode(a,u,p),u.state=e.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=e.InsideTag,y=a.children,l=0,f=y.length;l<f;l++)c=y[l],this.writeChildNode(c,u,p+1);u.state=e.CloseTag,this.stream.write("]")}return u.state=e.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,p)),u.state=e.None,this.closeNode(a,u,p)},s.prototype.element=function(a,u,p){var c,l,f,y,E,O,w,L,N;p||(p=0),this.openNode(a,u,p),u.state=e.OpenTag,this.stream.write(this.indent(a,u,p)+"<"+a.name),L=a.attribs;for(w in L)o.call(L,w)&&(c=L[w],this.attribute(c,u,p));if(f=a.children.length,y=f===0?null:a.children[0],f===0||a.children.every(function(d){return(d.type===t.Text||d.type===t.Raw)&&d.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=e.CloseTag,this.stream.write("</"+a.name+">")):(u.state=e.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&f===1&&(y.type===t.Text||y.type===t.Raw)&&y.value!=null)this.stream.write(">"),u.state=e.InsideTag,u.suppressPrettyCount++,this.writeChildNode(y,u,p+1),u.suppressPrettyCount--,u.state=e.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,p)),u.state=e.InsideTag,N=a.children,E=0,O=N.length;E<O;E++)l=N[E],this.writeChildNode(l,u,p+1);u.state=e.CloseTag,this.stream.write(this.indent(a,u,p)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,p)),u.state=e.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(q)),Wt.exports}var Or;function Bo(){return Or||(Or=1,function(){var t,e,n,r,o,i,s,a,u,p;p=we(),a=p.assign,u=p.isFunction,n=si(),r=li(),o=jo(),s=In(),i=ko(),t=Z(),e=nt(),ye.create=function(c,l,f,y){var E,O;if(c==null)throw new Error("Root element needs a name.");return y=a({},l,f,y),E=new r(y),O=E.element(c),y.headless||(E.declaration(y),(y.pubID!=null||y.sysID!=null)&&E.dtd(y)),O},ye.begin=function(c,l,f){var y;return u(c)&&(y=[c,l],l=y[0],f=y[1],c={}),l?new o(c,l,f):new r(c)},ye.stringWriter=function(c){return new s(c)},ye.streamWriter=function(c,l){return new i(c,l)},ye.implementation=new n,ye.nodeType=t,ye.writerState=e}.call(q)),ye}var xr;function Ro(){return xr||(xr=1,function(){var t,e,n,r,o,i={}.hasOwnProperty;t=Bo(),e=cn().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[>")},dt.Builder=function(){function s(a){var u,p,c;this.options={},p=e["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,l,f;return u=this.options.attrkey,p=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(f=Object.keys(a)[0],a=a[f]):f=this.options.rootName,c=function(y){return function(E,O){var w,L,N,d,v,I;if(typeof O!="object")y.options.cdata&&r(O)?E.raw(o(O)):E.txt(O);else if(Array.isArray(O)){for(d in O)if(i.call(O,d)){L=O[d];for(v in L)N=L[v],E=c(E.ele(v),N).up()}}else for(v in O)if(i.call(O,v))if(L=O[v],v===u){if(typeof L=="object")for(w in L)I=L[w],E=E.att(w,I)}else if(v===p)y.options.cdata&&r(L)?E=E.raw(o(L)):E=E.txt(L);else if(Array.isArray(L))for(d in L)i.call(L,d)&&(N=L[d],typeof N=="string"?y.options.cdata&&r(N)?E=E.ele(v).raw(o(N)).up():E=E.ele(v,N).up():E=c(E.ele(v),N).up());else typeof L=="object"?E=c(E.ele(v),L).up():typeof L=="string"&&y.options.cdata&&r(L)?E=E.ele(v).raw(o(L)).up():(L==null&&(L=""),E=E.ele(v,L.toString()).up());return E}}(this),l=t.create(f,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(l,a).end(this.options.renderOpts)},s}()}.call(q)),dt}var Gt={},Ht={},Pr;function $o(){return Pr||(Pr=1,function(t){(function(e){e.parser=function(m,h){return new r(m,h)},e.SAXParser=r,e.SAXStream=l,e.createStream=p,e.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,h){if(!(this instanceof r))return new r(m,h);var S=this;i(S),S.q=S.c="",S.bufferCheckPosition=e.MAX_BUFFER_LENGTH,S.encoding=null,S.opt=h||{},S.opt.lowercase=S.opt.lowercase||S.opt.lowercasetags,S.looseCase=S.opt.lowercase?"toLowerCase":"toUpperCase",S.opt.maxEntityCount=S.opt.maxEntityCount||512,S.opt.maxEntityDepth=S.opt.maxEntityDepth||4,S.entityCount=S.entityDepth=0,S.tags=[],S.closed=S.closedRoot=S.sawRoot=!1,S.tag=S.error=null,S.strict=!!m,S.noscript=!!(m||S.opt.noscript),S.state=b.BEGIN,S.strictEntities=S.opt.strictEntities,S.ENTITIES=S.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),S.attribList=[],S.opt.xmlns&&(S.ns=Object.create(w)),S.opt.unquotedAttributeValues===void 0&&(S.opt.unquotedAttributeValues=!m),S.trackPosition=S.opt.position!==!1,S.trackPosition&&(S.position=S.line=S.column=0),$(S,"onready")}Object.create||(Object.create=function(m){function h(){}h.prototype=m;var S=new h;return S}),Object.keys||(Object.keys=function(m){var h=[];for(var S in m)m.hasOwnProperty(S)&&h.push(S);return h});function o(m){for(var h=Math.max(e.MAX_BUFFER_LENGTH,10),S=0,g=0,x=n.length;g<x;g++){var C=m[n[g]].length;if(C>h)switch(n[g]){case"textNode":Ne(m);break;case"cdata":G(m,"oncdata",m.cdata),m.cdata="";break;case"script":G(m,"onscript",m.script),m.script="";break;default:he(m,"Max buffer length exceeded: "+n[g])}S=Math.max(S,C)}var D=e.MAX_BUFFER_LENGTH-S;m.bufferCheckPosition=D+m.position}function i(m){for(var h=0,S=n.length;h<S;h++)m[n[h]]=""}function s(m){Ne(m),m.cdata!==""&&(G(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(G(m,"onscript",m.script),m.script="")}r.prototype={end:function(){Ee(this)},write:it,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=e.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function p(m,h){return new l(m,h)}function c(m,h){if(m.length>=2){if(m[0]===255&&m[1]===254)return"utf-16le";if(m[0]===254&&m[1]===255)return"utf-16be"}return m.length>=3&&m[0]===239&&m[1]===187&&m[2]===191?"utf8":m.length>=4?m[0]===60&&m[1]===0&&m[2]===63&&m[3]===0?"utf-16le":m[0]===0&&m[1]===60&&m[2]===0&&m[3]===63?"utf-16be":"utf8":h?"utf8":null}function l(m,h){if(!(this instanceof l))return new l(m,h);a.apply(this),this._parser=new r(m,h),this.writable=!0,this.readable=!0;var S=this;this._parser.onend=function(){S.emit("end")},this._parser.onerror=function(g){S.emit("error",g),S._parser.error=null},this._decoder=null,this._decoderBuffer=null,u.forEach(function(g){Object.defineProperty(S,"on"+g,{get:function(){return S._parser["on"+g]},set:function(x){if(!x)return S.removeAllListeners(g),S._parser["on"+g]=x,x;S.on(g,x)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(a.prototype,{constructor:{value:l}}),l.prototype._decodeBuffer=function(m,h){if(this._decoderBuffer&&(m=Buffer.concat([this._decoderBuffer,m]),this._decoderBuffer=null),!this._decoder){var S=c(m,h);if(!S)return this._decoderBuffer=m,"";this._parser.encoding=S,this._decoder=new TextDecoder(S)}return this._decoder.decode(m,{stream:!h})},l.prototype.write=function(m){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m))m=this._decodeBuffer(m,!1);else if(this._decoderBuffer){var h=this._decodeBuffer(Buffer.alloc(0),!0);h&&(this._parser.write(h),this.emit("data",h))}return this._parser.write(m.toString()),this.emit("data",m),!0},l.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoderBuffer){var h=this._decodeBuffer(Buffer.alloc(0),!0);h&&(this._parser.write(h),this.emit("data",h))}else if(this._decoder){var S=this._decoder.decode();S&&(this._parser.write(S),this.emit("data",S))}return this._parser.end(),!0},l.prototype.on=function(m,h){var S=this;return!S._parser["on"+m]&&u.indexOf(m)!==-1&&(S._parser["on"+m]=function(){var g=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);g.splice(0,0,m),S.emit.apply(S,g)}),a.prototype.on.call(S,m,h)};var f="[CDATA[",y="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",w={xml:E,xmlns:O},L=/[:_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]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_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]/,v=/[#:_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 I(m){return m===" "||m===`
|
|
76
|
-
`||
|
|
77
|
-
Line: `+
|
|
78
|
-
Column: `+
|
|
79
|
-
Char: `+
|
|
80
|
-
Actual: `+
|
|
81
|
-
Actual: `+
|
|
82
|
-
`?(h.line++,h.column=0):h.column++),h.state){case b.BEGIN:if(h.state=b.BEGIN_WHITESPACE,g==="\uFEFF")continue;
|
|
83
|
-
`?(h.line++,h.column=0):h.column++);h.textNode+=
|
|
84
|
-
`?(h.line++,h.column=0):h.column++);h.cdata+=m.substring(C,S-1),g==="]"&&(h.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:g==="]"?h.state=b.CDATA_ENDING_2:(h.cdata+="]"+g,h.state=b.CDATA);continue;case b.CDATA_ENDING_2:g===">"?(h.cdata&&G(h,"oncdata",h.cdata),G(h,"onclosecdata"),h.cdata="",h.state=b.TEXT):g==="]"?h.cdata+="]":(h.cdata+="]]"+g,h.state=b.CDATA);continue;case b.PROC_INST:g==="?"?h.state=b.PROC_INST_ENDING:I(g)?h.state=b.PROC_INST_BODY:h.procInstName+=g;continue;case b.PROC_INST_BODY:if(!h.procInstBody&&I(g))continue;g==="?"?h.state=b.PROC_INST_ENDING:h.procInstBody+=g;continue;case b.PROC_INST_ENDING:if(g===">"){const j={name:h.procInstName,body:h.procInstBody};W(h,j),G(h,"onprocessinginstruction",j),h.procInstName=h.procInstBody="",h.state=b.TEXT}else h.procInstBody+="?"+g,h.state=b.PROC_INST_BODY;continue;case b.OPEN_TAG:M(N,g)?h.tagName+=g:(rt(h),g===">"?ge(h):g==="/"?h.state=b.OPEN_TAG_SLASH:(I(g)||H(h,"Invalid character in tag name"),h.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:g===">"?(ge(h,!0),Fe(h)):(H(h,"Forward-slash in opening tag not followed by >"),h.state=b.ATTRIB);continue;case b.ATTRIB:if(I(g))continue;g===">"?ge(h):g==="/"?h.state=b.OPEN_TAG_SLASH:M(L,g)?(h.attribName=g,h.attribValue="",h.state=b.ATTRIB_NAME):H(h,"Invalid attribute name");continue;case b.ATTRIB_NAME:g==="="?h.state=b.ATTRIB_VALUE:g===">"?(H(h,"Attribute without value"),h.attribValue=h.attribName,xe(h),ge(h)):I(g)?h.state=b.ATTRIB_NAME_SAW_WHITE:M(N,g)?h.attribName+=g:H(h,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(g==="=")h.state=b.ATTRIB_VALUE;else{if(I(g))continue;H(h,"Attribute without value"),h.tag.attributes[h.attribName]="",h.attribValue="",G(h,"onattribute",{name:h.attribName,value:""}),h.attribName="",g===">"?ge(h):M(L,g)?(h.attribName=g,h.state=b.ATTRIB_NAME):(H(h,"Invalid attribute name"),h.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(I(g))continue;A(g)?(h.q=g,h.state=b.ATTRIB_VALUE_QUOTED):(h.opt.unquotedAttributeValues||he(h,"Unquoted attribute value"),h.state=b.ATTRIB_VALUE_UNQUOTED,h.attribValue=g);continue;case b.ATTRIB_VALUE_QUOTED:if(g!==h.q){g==="&"?h.state=b.ATTRIB_VALUE_ENTITY_Q:h.attribValue+=g;continue}xe(h),h.q="",h.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:I(g)?h.state=b.ATTRIB:g===">"?ge(h):g==="/"?h.state=b.OPEN_TAG_SLASH:M(L,g)?(H(h,"No whitespace between attributes"),h.attribName=g,h.attribValue="",h.state=b.ATTRIB_NAME):H(h,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!_(g)){g==="&"?h.state=b.ATTRIB_VALUE_ENTITY_U:h.attribValue+=g;continue}xe(h),g===">"?ge(h):h.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(h.tagName)g===">"?Fe(h):M(N,g)?h.tagName+=g:h.script?(h.script+="</"+h.tagName+g,h.tagName="",h.state=b.SCRIPT):(I(g)||H(h,"Invalid tagname in closing tag"),h.state=b.CLOSE_TAG_SAW_WHITE);else{if(I(g))continue;T(L,g)?h.script?(h.script+="</"+g,h.state=b.SCRIPT):H(h,"Invalid tagname in closing tag."):h.tagName=g}continue;case b.CLOSE_TAG_SAW_WHITE:if(I(g))continue;g===">"?Fe(h):H(h,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var D,P;switch(h.state){case b.TEXT_ENTITY:D=b.TEXT,P="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:D=b.ATTRIB_VALUE_QUOTED,P="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:D=b.ATTRIB_VALUE_UNQUOTED,P="attribValue";break}if(g===";"){var k=Pe(h);h.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(k)?((h.entityCount+=1)>h.opt.maxEntityCount&&he(h,"Parsed entity count exceeds max entity count"),(h.entityDepth+=1)>h.opt.maxEntityDepth&&he(h,"Parsed entity depth exceeds max entity depth"),h.entity="",h.state=D,h.write(k),h.entityDepth-=1):(h[P]+=k,h.entity="",h.state=D)}else M(h.entity.length?v:d,g)?h.entity+=g:(H(h,"Invalid character in entity name"),h[P]+="&"+h.entity+g,h.entity="",h.state=D);continue;default:throw new Error(h,"Unknown state: "+h.state)}return h.position>=h.bufferCheckPosition&&o(h),h}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,h=Math.floor,S=function(){var g=16384,x=[],C,D,P=-1,k=arguments.length;if(!k)return"";for(var j="";++P<k;){var B=Number(arguments[P]);if(!isFinite(B)||B<0||B>1114111||h(B)!==B)throw RangeError("Invalid code point: "+B);B<=65535?x.push(B):(B-=65536,C=(B>>10)+55296,D=B%1024+56320,x.push(C,D)),(P+1===k||x.length>g)&&(j+=m.apply(null,x),x.length=0)}return j};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:S,configurable:!0,writable:!0}):String.fromCodePoint=S}()})(t)}(Ht)),Ht}var Yt={},Ar;function Xo(){return Ar||(Ar=1,function(){Yt.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}.call(q)),Yt}var Oe={},_r;function fi(){return _r||(_r=1,function(){var t;t=new RegExp(/(?!xmlns)^.*:/),Oe.normalize=function(e){return e.toLowerCase()},Oe.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Oe.stripPrefix=function(e){return e.replace(t,"")},Oe.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Oe.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}.call(q)),Oe}var Lr;function Uo(){return Lr||(Lr=1,function(t){(function(){var e,n,r,o,i,s,a,u,p,c=function(y,E){return function(){return y.apply(E,arguments)}},l=function(y,E){for(var O in E)f.call(E,O)&&(y[O]=E[O]);function w(){this.constructor=y}return w.prototype=E.prototype,y.prototype=new w,y.__super__=E.prototype,y},f={}.hasOwnProperty;u=$o(),o=un,e=Xo(),a=fi(),p=Mi.setImmediate,n=cn().defaults,i=function(y){return typeof y=="object"&&y!=null&&Object.keys(y).length===0},s=function(y,E,O){var w,L,N;for(w=0,L=y.length;w<L;w++)N=y[w],E=N(E,O);return E},r=function(y,E,O){var w;return w=Object.create(null),w.value=O,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(y,E,w)},t.Parser=function(y){l(E,y);function E(O){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 w,L,N;if(!(this instanceof t.Parser))return new t.Parser(O);this.options={},L=n["0.2"];for(w in L)f.call(L,w)&&(N=L[w],this.options[w]=N);for(w in O)f.call(O,w)&&(N=O[w],this.options[w]=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 E.prototype.processAsync=function(){var O,w;try{return this.remaining.length<=this.options.chunkSize?(O=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(O),this.saxParser.close()):(O=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(O),p(this.processAsync))}catch(L){if(w=L,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},E.prototype.assignOrPush=function(O,w,L){return w in O?(O[w]instanceof Array||r(O,w,[O[w]]),O[w].push(L)):this.options.explicitArray?r(O,w,[L]):r(O,w,L)},E.prototype.reset=function(){var O,w,L,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(d){return function(v){if(d.saxParser.resume(),!d.saxParser.errThrown)return d.saxParser.errThrown=!0,d.emit("error",v)}}(this),this.saxParser.onend=function(d){return function(){if(!d.saxParser.ended)return d.saxParser.ended=!0,d.emit("end",d.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,N=[],O=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=function(d){return function(v){var I,A,_,M,T;if(_={},_[w]="",!d.options.ignoreAttrs){T=v.attributes;for(I in T)f.call(T,I)&&(!(O in _)&&!d.options.mergeAttrs&&(_[O]={}),A=d.options.attrValueProcessors?s(d.options.attrValueProcessors,v.attributes[I],I):v.attributes[I],M=d.options.attrNameProcessors?s(d.options.attrNameProcessors,I):I,d.options.mergeAttrs?d.assignOrPush(_,M,A):r(_[O],M,A))}return _["#name"]=d.options.tagNameProcessors?s(d.options.tagNameProcessors,v.name):v.name,d.options.xmlns&&(_[d.options.xmlnskey]={uri:v.uri,local:v.local}),N.push(_)}}(this),this.saxParser.onclosetag=function(d){return function(){var v,I,A,_,M,T,b,F,$,V;if(T=N.pop(),M=T["#name"],(!d.options.explicitChildren||!d.options.preserveChildrenOrder)&&delete T["#name"],T.cdata===!0&&(v=T.cdata,delete T.cdata),$=N[N.length-1],T[w].match(/^\s*$/)&&!v?(I=T[w],delete T[w]):(d.options.trim&&(T[w]=T[w].trim()),d.options.normalize&&(T[w]=T[w].replace(/\s{2,}/g," ").trim()),T[w]=d.options.valueProcessors?s(d.options.valueProcessors,T[w],M):T[w],Object.keys(T).length===1&&w in T&&!d.EXPLICIT_CHARKEY&&(T=T[w])),i(T)&&(typeof d.options.emptyTag=="function"?T=d.options.emptyTag():T=d.options.emptyTag!==""?d.options.emptyTag:I),d.options.validator!=null&&(V="/"+function(){var R,U,W;for(W=[],R=0,U=N.length;R<U;R++)_=N[R],W.push(_["#name"]);return W}().concat(M).join("/"),function(){var R;try{return T=d.options.validator(V,$&&$[M],T)}catch(U){return R=U,d.emit("error",R)}}()),d.options.explicitChildren&&!d.options.mergeAttrs&&typeof T=="object"){if(!d.options.preserveChildrenOrder)_={},d.options.attrkey in T&&(_[d.options.attrkey]=T[d.options.attrkey],delete T[d.options.attrkey]),!d.options.charsAsChildren&&d.options.charkey in T&&(_[d.options.charkey]=T[d.options.charkey],delete T[d.options.charkey]),Object.getOwnPropertyNames(T).length>0&&(_[d.options.childkey]=T),T=_;else if($){$[d.options.childkey]=$[d.options.childkey]||[],b={};for(A in T)f.call(T,A)&&r(b,A,T[A]);$[d.options.childkey].push(b),delete T["#name"],Object.keys(T).length===1&&w in T&&!d.EXPLICIT_CHARKEY&&(T=T[w])}}return N.length>0?d.assignOrPush($,M,T):(d.options.explicitRoot&&(F=T,T={},r(T,M,F)),d.resultObject=T,d.saxParser.ended=!0,d.emit("end",d.resultObject))}}(this),L=function(d){return function(v){var I,A;if(A=N[N.length-1],A)return A[w]+=v,d.options.explicitChildren&&d.options.preserveChildrenOrder&&d.options.charsAsChildren&&(d.options.includeWhiteChars||v.replace(/\\n/g,"").trim()!=="")&&(A[d.options.childkey]=A[d.options.childkey]||[],I={"#name":"__text__"},I[w]=v,d.options.normalize&&(I[w]=I[w].replace(/\s{2,}/g," ").trim()),A[d.options.childkey].push(I)),A}}(this),this.saxParser.ontext=L,this.saxParser.oncdata=function(d){return function(v){var I;if(I=L(v),I)return I.cdata=!0}}()},E.prototype.parseString=function(O,w){var L;w!=null&&typeof w=="function"&&(this.on("end",function(N){return this.reset(),w(null,N)}),this.on("error",function(N){return this.reset(),w(N)}));try{return O=O.toString(),O.trim()===""?(this.emit("end",null),!0):(O=e.stripBOM(O),this.options.async?(this.remaining=O,p(this.processAsync),this.saxParser):this.saxParser.write(O).close())}catch(N){if(L=N,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw L}else return this.emit("error",L),this.saxParser.errThrown=!0}},E.prototype.parseStringPromise=function(O){return new Promise(function(w){return function(L,N){return w.parseString(O,function(d,v){return d?N(d):L(v)})}}(this))},E}(o),t.parseString=function(y,E,O){var w,L,N;return O!=null?(typeof O=="function"&&(w=O),typeof E=="object"&&(L=E)):(typeof E=="function"&&(w=E),L={}),N=new t.Parser(L),N.parseString(y,w)},t.parseStringPromise=function(y,E){var O,w;return typeof E=="object"&&(O=E),w=new t.Parser(O),w.parseStringPromise(y)}}).call(q)}(Gt)),Gt}var hi;(function(){var t,e,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=cn(),t=Ro(),n=Uo(),fi(),e.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),t.Builder,n.Parser,n.parseString,hi=n.parseStringPromise}).call(q);class Vo{constructor(e,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=e,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 e=>{try{const n=await hi(e,{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",e=>{this.handleCdpMessage(e)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const e=this.scriptIdByUrl.entries().next().value;e&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:e[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! 🎉
|
|
73
|
+
*/var yt,bt,wt;const Zn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,er=(bt=(yt=process==null?void 0:process.versions)===null||yt===void 0?void 0:yt.node)!==null&&bt!==void 0?bt:(wt=process==null?void 0:process.version)===null||wt===void 0?void 0:wt.slice(1);if(er&&Number(er.match(/^([^.]+)/)[1])<Zn)throw Error(`yargs parser supports a minimum Node.js version of ${Zn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const ta=process?process.env:{};new Ko({cwd:process.cwd,env:()=>ta,format:Xr,normalize:Vi,resolve:hn,require:t=>{if(typeof require<"u")return require(t);if(t.match(/\.json$/))return JSON.parse(fn(t,"utf8"));throw Error("only .json config files are supported in ESM")}});const na={fs:{readFileSync:fn,writeFile:Fi},format:Xr,resolve:hn,exists:t=>{try{return ji(t).isFile()}catch{return!1}}};let le;class ra{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const n=e.shift();let r=function(){};return typeof e[e.length-1]=="function"&&(r=e.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(),le.format.apply(le.format,[this.cache[this.locale][n]||n].concat(e))}__n(){const e=Array.prototype.slice.call(arguments),n=e.shift(),r=e.shift(),o=e.shift();let i=function(){};typeof e[e.length-1]=="function"&&(i=e.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),le.format.apply(le.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.cache[this.locale][n]=e[n])}_taggedLiteral(e,...n){let r="";return e.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(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const e=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);le.fs.writeFile(s,a,"utf-8",function(u){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),i(u)})}_readLocaleFile(){let e={};const n=this._resolveLocaleFile(this.directory,this.locale);try{le.fs.readFileSync&&(e=JSON.parse(le.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")e={};else throw r}this.cache[this.locale]=e}_resolveLocaleFile(e,n){let r=le.resolve(e,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=le.resolve(e,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(e){return le.exists(e)}}function ia(t,e){le=e;const n=new ra(t);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 sa=t=>ia(t,na);let Ue;try{Ue=Hi(import.meta.url)}catch{Ue=process.cwd()}const oa=Ue.substring(0,Ue.lastIndexOf("node_modules"));oa||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,sa({directory:hn(Ue,"../../../locales"),updateFiles:!1});var Et={},tr;function bn(){return tr||(tr=1,function(){Et.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:`
|
|
74
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(q)),Et}var Nt={},be={},we={},nr;function Ee(){return nr||(nr=1,function(){var t,e,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;t=function(){var d,c,f,l,m,E;if(E=arguments[0],m=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(d=0,f=m.length;d<f;d++)if(l=m[d],l!=null)for(c in l)u.call(l,c)&&(E[c]=l[c]);return E},o=function(d){return!!d&&Object.prototype.toString.call(d)==="[object Function]"},i=function(d){var c;return!!d&&((c=typeof d)=="function"||c==="object")},n=function(d){return o(Array.isArray)?Array.isArray(d):Object.prototype.toString.call(d)==="[object Array]"},r=function(d){var c;if(n(d))return!d.length;for(c in d)if(u.call(d,c))return!1;return!0},s=function(d){var c,f;return i(d)&&(f=Object.getPrototypeOf(d))&&(c=f.constructor)&&typeof c=="function"&&c instanceof c&&Function.prototype.toString.call(c)===Function.prototype.toString.call(Object)},e=function(d){return o(d.valueOf)?d.valueOf():d},we.assign=t,we.isFunction=o,we.isObject=i,we.isArray=n,we.isEmpty=r,we.isPlainObject=s,we.getValue=e}.call(q)),we}var Tt={exports:{}},rr;function Ni(){return rr||(rr=1,function(){Tt.exports=function(){function t(){}return t.prototype.hasFeature=function(e,n){return!0},t.prototype.createDocumentType=function(e,n,r){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(e,n,r){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(e){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(e,n){throw new Error("This DOM method is not implemented.")},t}()}.call(q)),Tt.exports}var vt={exports:{}},It={exports:{}},Ot={exports:{}},ir;function aa(){return ir||(ir=1,function(){Ot.exports=function(){function t(){}return t.prototype.handleError=function(e){throw new Error(e)},t}()}.call(q)),Ot.exports}var xt={exports:{}},sr;function ua(){return sr||(sr=1,function(){xt.exports=function(){function t(e){this.arr=e||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(e){return this.arr[e]||null},t.prototype.contains=function(e){return this.arr.indexOf(e)!==-1},t}()}.call(q)),xt.exports}var or;function ca(){return or||(or=1,function(){var t,e;t=aa(),e=ua(),It.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 t,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 e(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(q)),It.exports}var _t={exports:{}},At={exports:{}},Pt={exports:{}},ar;function Z(){return ar||(ar=1,function(){Pt.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(q)),Pt.exports}var Lt={exports:{}},ur;function Ti(){return ur||(ur=1,function(){var t;t=Z(),ce(),Lt.exports=function(){function e(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=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(e.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(e.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(e.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"specified",{get:function(){return!0}}),e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},e.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},e.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},e}()}.call(q)),Lt.exports}var St={exports:{}},cr;function wn(){return cr||(cr=1,function(){St.exports=function(){function t(e){this.nodes=e}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(e){return this.nodes[e]},t.prototype.setNamedItem=function(e){var n;return n=this.nodes[e.nodeName],this.nodes[e.nodeName]=e,n||null},t.prototype.removeNamedItem=function(e){var n;return n=this.nodes[e],delete this.nodes[e],n||null},t.prototype.item=function(e){return this.nodes[Object.keys(this.nodes)[e]]||null},t.prototype.getNamedItemNS=function(e,n){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(e){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(e,n){throw new Error("This DOM method is not implemented.")},t}()}.call(q)),St.exports}var lr;function En(){return lr||(lr=1,function(){var t,e,n,r,o,i,s,a,u=function(c,f){for(var l in f)d.call(f,l)&&(c[l]=f[l]);function m(){this.constructor=c}return m.prototype=f.prototype,c.prototype=new m,c.__super__=f.prototype,c},d={}.hasOwnProperty;a=Ee(),s=a.isObject,i=a.isFunction,o=a.getValue,r=ce(),t=Z(),e=Ti(),n=wn(),At.exports=function(c){u(f,c);function f(l,m,E){var O,w,A,N;if(f.__super__.constructor.call(this,l),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,E!=null&&this.attribute(E),l.type===t.Document&&(this.isRoot=!0,this.documentObject=l,l.rootObject=this,l.children)){for(N=l.children,w=0,A=N.length;w<A;w++)if(O=N[w],O.type===t.DocType){O.name=this.name;break}}}return Object.defineProperty(f.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(f.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(f.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),f.prototype.clone=function(){var l,m,E,O;E=Object.create(this),E.isRoot&&(E.documentObject=null),E.attribs={},O=this.attribs;for(m in O)d.call(O,m)&&(l=O[m],E.attribs[m]=l.clone());return E.children=[],this.children.forEach(function(w){var A;return A=w.clone(),A.parent=E,E.children.push(A)}),E},f.prototype.attribute=function(l,m){var E,O;if(l!=null&&(l=o(l)),s(l))for(E in l)d.call(l,E)&&(O=l[E],this.attribute(E,O));else i(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[l]=new e(this,l,""):m!=null&&(this.attribs[l]=new e(this,l,m));return this},f.prototype.removeAttribute=function(l){var m,E,O;if(l==null)throw new Error("Missing attribute name. "+this.debugInfo());if(l=o(l),Array.isArray(l))for(E=0,O=l.length;E<O;E++)m=l[E],delete this.attribs[m];else delete this.attribs[l];return this},f.prototype.toString=function(l){return this.options.writer.element(this,this.options.writer.filterOptions(l))},f.prototype.att=function(l,m){return this.attribute(l,m)},f.prototype.a=function(l,m){return this.attribute(l,m)},f.prototype.getAttribute=function(l){return this.attribs.hasOwnProperty(l)?this.attribs[l].value:null},f.prototype.setAttribute=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNode=function(l){return this.attribs.hasOwnProperty(l)?this.attribs[l]:null},f.prototype.setAttributeNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNS=function(l,m,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNodeNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNodeNS=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.hasAttribute=function(l){return this.attribs.hasOwnProperty(l)},f.prototype.hasAttributeNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttribute=function(l,m){return this.attribs.hasOwnProperty(l)?this.attribs[l].isId:m},f.prototype.setIdAttributeNS=function(l,m,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttributeNode=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByClassName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.isEqualNode=function(l){var m,E,O;if(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(l)||l.namespaceURI!==this.namespaceURI||l.prefix!==this.prefix||l.localName!==this.localName||l.attribs.length!==this.attribs.length)return!1;for(m=E=0,O=this.attribs.length-1;0<=O?E<=O:E>=O;m=0<=O?++E:--E)if(!this.attribs[m].isEqualNode(l.attribs[m]))return!1;return!0},f}(r)}.call(q)),At.exports}var Dt={exports:{}},Mt={exports:{}},fr;function st(){return fr||(fr=1,function(){var t,e=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;t=ce(),Mt.exports=function(r){e(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}(t)}.call(q)),Mt.exports}var hr;function Nn(){return hr||(hr=1,function(){var t,e,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=Z(),e=st(),Dt.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=t.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}(e)}.call(q)),Dt.exports}var Ct={exports:{}},pr;function Tn(){return pr||(pr=1,function(){var t,e,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=Z(),e=st(),Ct.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=t.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}(e)}.call(q)),Ct.exports}var Ft={exports:{}},dr;function vn(){return dr||(dr=1,function(){var t,e,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,e=ce(),t=Z(),Ft.exports=function(i){r(s,i);function s(a,u,d,c){var f;s.__super__.constructor.call(this,a),n(u)&&(f=u,u=f.version,d=f.encoding,c=f.standalone),u||(u="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(u),d!=null&&(this.encoding=this.stringify.xmlEncoding(d)),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}(e)}.call(q)),Ft.exports}var jt={exports:{}},kt={exports:{}},gr;function In(){return gr||(gr=1,function(){var t,e,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=ce(),t=Z(),kt.exports=function(o){n(i,o);function i(s,a,u,d,c,f){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(!d)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(f&&!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=t.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(d),f&&(this.defaultValue=this.stringify.dtdAttDefault(f)),this.defaultValueType=c}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(e)}.call(q)),kt.exports}var Rt={exports:{}},mr;function On(){return mr||(mr=1,function(){var t,e,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,e=ce(),t=Z(),Rt.exports=function(i){r(s,i);function s(a,u,d,c){if(s.__super__.constructor.call(this,a),d==null)throw new Error("Missing DTD entity name. "+this.debugInfo(d));if(c==null)throw new Error("Missing DTD entity value. "+this.debugInfo(d));if(this.pe=!!u,this.name=this.stringify.name(d),this.type=t.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(d));if(c.pubID&&!c.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(d));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(d))}}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}(e)}.call(q)),Rt.exports}var Bt={exports:{}},yr;function xn(){return yr||(yr=1,function(){var t,e,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=ce(),t=Z(),Bt.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=t.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}(e)}.call(q)),Bt.exports}var $t={exports:{}},br;function _n(){return br||(br=1,function(){var t,e,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=ce(),t=Z(),$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 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=t.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}(e)}.call(q)),$t.exports}var wr;function An(){return wr||(wr=1,function(){var t,e,n,r,o,i,s,a,u=function(c,f){for(var l in f)d.call(f,l)&&(c[l]=f[l]);function m(){this.constructor=c}return m.prototype=f.prototype,c.prototype=new m,c.__super__=f.prototype,c},d={}.hasOwnProperty;a=Ee().isObject,s=ce(),t=Z(),e=In(),r=On(),n=xn(),o=_n(),i=wn(),jt.exports=function(c){u(f,c);function f(l,m,E){var O,w,A,N,p,v;if(f.__super__.constructor.call(this,l),this.type=t.DocType,l.children){for(N=l.children,w=0,A=N.length;w<A;w++)if(O=N[w],O.type===t.Element){this.name=O.name;break}}this.documentObject=l,a(m)&&(p=m,m=p.pubID,E=p.sysID),E==null&&(v=[m,E],E=v[0],m=v[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),E!=null&&(this.sysID=this.stringify.dtdSysID(E))}return Object.defineProperty(f.prototype,"entities",{get:function(){var l,m,E,O,w;for(O={},w=this.children,m=0,E=w.length;m<E;m++)l=w[m],l.type===t.EntityDeclaration&&!l.pe&&(O[l.name]=l);return new i(O)}}),Object.defineProperty(f.prototype,"notations",{get:function(){var l,m,E,O,w;for(O={},w=this.children,m=0,E=w.length;m<E;m++)l=w[m],l.type===t.NotationDeclaration&&(O[l.name]=l);return new i(O)}}),Object.defineProperty(f.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(f.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(f.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),f.prototype.element=function(l,m){var E;return E=new n(this,l,m),this.children.push(E),this},f.prototype.attList=function(l,m,E,O,w){var A;return A=new e(this,l,m,E,O,w),this.children.push(A),this},f.prototype.entity=function(l,m){var E;return E=new r(this,!1,l,m),this.children.push(E),this},f.prototype.pEntity=function(l,m){var E;return E=new r(this,!0,l,m),this.children.push(E),this},f.prototype.notation=function(l,m){var E;return E=new o(this,l,m),this.children.push(E),this},f.prototype.toString=function(l){return this.options.writer.docType(this,this.options.writer.filterOptions(l))},f.prototype.ele=function(l,m){return this.element(l,m)},f.prototype.att=function(l,m,E,O,w){return this.attList(l,m,E,O,w)},f.prototype.ent=function(l,m){return this.entity(l,m)},f.prototype.pent=function(l,m){return this.pEntity(l,m)},f.prototype.not=function(l,m){return this.notation(l,m)},f.prototype.up=function(){return this.root()||this.documentObject},f.prototype.isEqualNode=function(l){return!(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(l)||l.name!==this.name||l.publicId!==this.publicId||l.systemId!==this.systemId)},f}(s)}.call(q)),jt.exports}var Xt={exports:{}},Er;function Pn(){return Er||(Er=1,function(){var t,e,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=Z(),e=ce(),Xt.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=t.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}(e)}.call(q)),Xt.exports}var Vt={exports:{}},Nr;function Ln(){return Nr||(Nr=1,function(){var t,e,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=Z(),e=st(),Vt.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=t.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}(e)}.call(q)),Vt.exports}var Ut={exports:{}},Tr;function Sn(){return Tr||(Tr=1,function(){var t,e,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=Z(),e=st(),Ut.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=t.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}(e)}.call(q)),Ut.exports}var qt={exports:{}},vr;function vi(){return vr||(vr=1,function(){var t,e,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=ce(),t=Z(),qt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=t.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(e)}.call(q)),qt.exports}var Wt={exports:{}},Ir;function la(){return Ir||(Ir=1,function(){Wt.exports=function(){function t(e){this.nodes=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(e){return this.nodes[e]||null},t}()}.call(q)),Wt.exports}var Gt={exports:{}},Or;function fa(){return Or||(Or=1,function(){Gt.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(q)),Gt.exports}var xr;function ce(){return xr||(xr=1,function(){var t,e,n,r,o,i,s,a,u,d,c,f,l,m,E,O,w,A={}.hasOwnProperty;w=Ee(),O=w.isObject,E=w.isFunction,m=w.isEmpty,l=w.getValue,a=null,n=null,r=null,o=null,i=null,c=null,f=null,d=null,s=null,e=null,u=null,t=null,_t.exports=function(){function N(p){this.parent=p,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=En(),n=Nn(),r=Tn(),o=vn(),i=An(),c=Pn(),f=Ln(),d=Sn(),s=vi(),e=Z(),u=la(),wn(),t=fa())}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 p;return p=this.parent.children.indexOf(this),this.parent.children[p-1]||null}}),Object.defineProperty(N.prototype,"nextSibling",{get:function(){var p;return p=this.parent.children.indexOf(this),this.parent.children[p+1]||null}}),Object.defineProperty(N.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(N.prototype,"textContent",{get:function(){var p,v,I,P,L;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(L="",P=this.children,v=0,I=P.length;v<I;v++)p=P[v],p.textContent&&(L+=p.textContent);return L}else return null},set:function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),N.prototype.setParent=function(p){var v,I,P,L,M;for(this.parent=p,p&&(this.options=p.options,this.stringify=p.stringify),L=this.children,M=[],I=0,P=L.length;I<P;I++)v=L[I],M.push(v.setParent(this));return M},N.prototype.element=function(p,v,I){var P,L,M,T,b,F,$,U,B,V,W;if(F=null,v===null&&I==null&&(B=[{},null],v=B[0],I=B[1]),v==null&&(v={}),v=l(v),O(v)||(V=[v,I],I=V[0],v=V[1]),p!=null&&(p=l(p)),Array.isArray(p))for(M=0,$=p.length;M<$;M++)L=p[M],F=this.element(L);else if(E(p))F=this.element(p.apply());else if(O(p)){for(b in p)if(A.call(p,b))if(W=p[b],E(W)&&(W=W.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&b.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(b.substr(this.stringify.convertAttKey.length),W);else if(!this.options.separateArrayItems&&Array.isArray(W)&&m(W))F=this.dummy();else if(O(W)&&m(W))F=this.element(b);else if(!this.options.keepNullNodes&&W==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(W))for(T=0,U=W.length;T<U;T++)L=W[T],P={},P[b]=L,F=this.element(P);else O(W)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&b.indexOf(this.stringify.convertTextKey)===0?F=this.element(W):(F=this.element(b),F.element(W)):F=this.element(b,W)}else!this.options.keepNullNodes&&I===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&p.indexOf(this.stringify.convertTextKey)===0?F=this.text(I):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&p.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(I):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&p.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(I):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&p.indexOf(this.stringify.convertRawKey)===0?F=this.raw(I):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&p.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(p.substr(this.stringify.convertPIKey.length),I):F=this.node(p,v,I);if(F==null)throw new Error("Could not create any elements with: "+p+". "+this.debugInfo());return F},N.prototype.insertBefore=function(p,v,I){var P,L,M,T,b;if(p?.type)return M=p,T=v,M.setParent(this),T?(L=children.indexOf(T),b=children.splice(L),children.push(M),Array.prototype.push.apply(children,b)):children.push(M),M;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return L=this.parent.children.indexOf(this),b=this.parent.children.splice(L),P=this.parent.element(p,v,I),Array.prototype.push.apply(this.parent.children,b),P},N.prototype.insertAfter=function(p,v,I){var P,L,M;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return L=this.parent.children.indexOf(this),M=this.parent.children.splice(L+1),P=this.parent.element(p,v,I),Array.prototype.push.apply(this.parent.children,M),P},N.prototype.remove=function(){var p;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return p=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[p,p-p+1].concat([])),this.parent},N.prototype.node=function(p,v,I){var P,L;return p!=null&&(p=l(p)),v||(v={}),v=l(v),O(v)||(L=[v,I],I=L[0],v=L[1]),P=new a(this,p,v),I!=null&&P.text(I),this.children.push(P),P},N.prototype.text=function(p){var v;return O(p)&&this.element(p),v=new f(this,p),this.children.push(v),this},N.prototype.cdata=function(p){var v;return v=new n(this,p),this.children.push(v),this},N.prototype.comment=function(p){var v;return v=new r(this,p),this.children.push(v),this},N.prototype.commentBefore=function(p){var v,I;return v=this.parent.children.indexOf(this),I=this.parent.children.splice(v),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.commentAfter=function(p){var v,I;return v=this.parent.children.indexOf(this),I=this.parent.children.splice(v+1),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,I),this},N.prototype.raw=function(p){var v;return v=new c(this,p),this.children.push(v),this},N.prototype.dummy=function(){var p;return p=new s(this),p},N.prototype.instruction=function(p,v){var I,P,L,M,T;if(p!=null&&(p=l(p)),v!=null&&(v=l(v)),Array.isArray(p))for(M=0,T=p.length;M<T;M++)I=p[M],this.instruction(I);else if(O(p))for(I in p)A.call(p,I)&&(P=p[I],this.instruction(I,P));else E(v)&&(v=v.apply()),L=new d(this,p,v),this.children.push(L);return this},N.prototype.instructionBefore=function(p,v){var I,P;return I=this.parent.children.indexOf(this),P=this.parent.children.splice(I),this.parent.instruction(p,v),Array.prototype.push.apply(this.parent.children,P),this},N.prototype.instructionAfter=function(p,v){var I,P;return I=this.parent.children.indexOf(this),P=this.parent.children.splice(I+1),this.parent.instruction(p,v),Array.prototype.push.apply(this.parent.children,P),this},N.prototype.declaration=function(p,v,I){var P,L;return P=this.document(),L=new o(P,p,v,I),P.children.length===0?P.children.unshift(L):P.children[0].type===e.Declaration?P.children[0]=L:P.children.unshift(L),P.root()||P},N.prototype.dtd=function(p,v){var I,P,L,M,T,b,F,$,U,B;for(P=this.document(),L=new i(P,p,v),U=P.children,M=T=0,F=U.length;T<F;M=++T)if(I=U[M],I.type===e.DocType)return P.children[M]=L,L;for(B=P.children,M=b=0,$=B.length;b<$;M=++b)if(I=B[M],I.isRoot)return P.children.splice(M,0,L),L;return P.children.push(L),L},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 p;for(p=this;p;){if(p.type===e.Document)return p.rootObject;if(p.isRoot)return p;p=p.parent}},N.prototype.document=function(){var p;for(p=this;p;){if(p.type===e.Document)return p;p=p.parent}},N.prototype.end=function(p){return this.document().end(p)},N.prototype.prev=function(){var p;if(p=this.parent.children.indexOf(this),p<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[p-1]},N.prototype.next=function(){var p;if(p=this.parent.children.indexOf(this),p===-1||p===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[p+1]},N.prototype.importDocument=function(p){var v;return v=p.root().clone(),v.parent=this,v.isRoot=!1,this.children.push(v),this},N.prototype.debugInfo=function(p){var v,I;return p=p||this.name,p==null&&!((v=this.parent)!=null&&v.name)?"":p==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+p+">, parent: <"+this.parent.name+">":"node: <"+p+">"},N.prototype.ele=function(p,v,I){return this.element(p,v,I)},N.prototype.nod=function(p,v,I){return this.node(p,v,I)},N.prototype.txt=function(p){return this.text(p)},N.prototype.dat=function(p){return this.cdata(p)},N.prototype.com=function(p){return this.comment(p)},N.prototype.ins=function(p,v){return this.instruction(p,v)},N.prototype.doc=function(){return this.document()},N.prototype.dec=function(p,v,I){return this.declaration(p,v,I)},N.prototype.e=function(p,v,I){return this.element(p,v,I)},N.prototype.n=function(p,v,I){return this.node(p,v,I)},N.prototype.t=function(p){return this.text(p)},N.prototype.d=function(p){return this.cdata(p)},N.prototype.c=function(p){return this.comment(p)},N.prototype.r=function(p){return this.raw(p)},N.prototype.i=function(p,v){return this.instruction(p,v)},N.prototype.u=function(){return this.up()},N.prototype.importXMLBuilder=function(p){return this.importDocument(p)},N.prototype.replaceChild=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.removeChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.appendChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.hasChildNodes=function(){return this.children.length!==0},N.prototype.cloneNode=function(p){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(p,v){return!0},N.prototype.hasAttributes=function(){return this.attribs.length!==0},N.prototype.compareDocumentPosition=function(p){var v,I;return v=this,v===p?0:this.document()!==p.document()?(I=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?I|=t.Preceding:I|=t.Following,I):v.isAncestor(p)?t.Contains|t.Preceding:v.isDescendant(p)?t.Contains|t.Following:v.isPreceding(p)?t.Preceding:t.Following},N.prototype.isSameNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupPrefix=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isDefaultNamespace=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.lookupNamespaceURI=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.isEqualNode=function(p){var v,I,P;if(p.nodeType!==this.nodeType||p.children.length!==this.children.length)return!1;for(v=I=0,P=this.children.length-1;0<=P?I<=P:I>=P;v=0<=P?++I:--I)if(!this.children[v].isEqualNode(p.children[v]))return!1;return!0},N.prototype.getFeature=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.setUserData=function(p,v,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.getUserData=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},N.prototype.contains=function(p){return p?p===this||this.isDescendant(p):!1},N.prototype.isDescendant=function(p){var v,I,P,L,M;for(M=this.children,P=0,L=M.length;P<L;P++)if(v=M[P],p===v||(I=v.isDescendant(p),I))return!0;return!1},N.prototype.isAncestor=function(p){return p.isDescendant(this)},N.prototype.isPreceding=function(p){var v,I;return v=this.treePosition(p),I=this.treePosition(this),v===-1||I===-1?!1:v<I},N.prototype.isFollowing=function(p){var v,I;return v=this.treePosition(p),I=this.treePosition(this),v===-1||I===-1?!1:v>I},N.prototype.treePosition=function(p){var v,I;return I=0,v=!1,this.foreachTreeNode(this.document(),function(P){if(I++,!v&&P===p)return v=!0}),v?I:-1},N.prototype.foreachTreeNode=function(p,v){var I,P,L,M,T;for(p||(p=this.document()),M=p.children,P=0,L=M.length;P<L;P++){if(I=M[P],T=v(I))return T;if(T=this.foreachTreeNode(I,v),T)return T}},N}()}.call(q)),_t.exports}var Ht={exports:{}},_r;function Ii(){return _r||(_r=1,function(){var t=function(n,r){return function(){return n.apply(r,arguments)}},e={}.hasOwnProperty;Ht.exports=function(){function n(r){this.assertLegalName=t(this.assertLegalName,this),this.assertLegalChar=t(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)e.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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},n}()}.call(q)),Ht.exports}var Yt={exports:{}},zt={exports:{}},Qt={exports:{}},Ar;function ot(){return Ar||(Ar=1,function(){Qt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(q)),Qt.exports}var Pr;function Oi(){return Pr||(Pr=1,function(){var t,e,n,r={}.hasOwnProperty;n=Ee().assign,t=Z(),vn(),An(),Nn(),Tn(),En(),Pn(),Ln(),Sn(),vi(),In(),xn(),On(),_n(),e=ot(),zt.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,d,c,f,l,m;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:`
|
|
75
|
+
`,s.offset=(d=i.offset)!=null?d:0,s.dontPrettyTextNodes=(c=(f=i.dontPrettyTextNodes)!=null?f:i.dontprettytextnodes)!=null?c:0,s.spaceBeforeSlash=(l=(m=i.spaceBeforeSlash)!=null?m:i.spacebeforeslash)!=null?l:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=e.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=e.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=e.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=e.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,d,c,f,l;if(a||(a=0),this.openNode(i,s,a),s.state=e.OpenTag,f=this.indent(i,s,a),f+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?f+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(f+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(f+=" [",f+=this.endline(i,s,a),s.state=e.InsideTag,l=i.children,d=0,c=l.length;d<c;d++)u=l[d],f+=this.writeChildNode(u,s,a+1);s.state=e.CloseTag,f+="]"}return s.state=e.CloseTag,f+=s.spaceBeforeSlash+">",f+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),f},o.prototype.element=function(i,s,a){var u,d,c,f,l,m,E,O,w,A,N,p,v,I;a||(a=0),A=!1,N="",this.openNode(i,s,a),s.state=e.OpenTag,N+=this.indent(i,s,a)+"<"+i.name,p=i.attribs;for(w in p)r.call(p,w)&&(u=p[w],N+=this.attribute(u,s,a));if(c=i.children.length,f=c===0?null:i.children[0],c===0||i.children.every(function(P){return(P.type===t.Text||P.type===t.Raw)&&P.value===""}))s.allowEmpty?(N+=">",s.state=e.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a)):(s.state=e.CloseTag,N+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&c===1&&(f.type===t.Text||f.type===t.Raw)&&f.value!=null)N+=">",s.state=e.InsideTag,s.suppressPrettyCount++,A=!0,N+=this.writeChildNode(f,s,a+1),s.suppressPrettyCount--,A=!1,s.state=e.CloseTag,N+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(v=i.children,l=0,E=v.length;l<E;l++)if(d=v[l],(d.type===t.Text||d.type===t.Raw)&&d.value!=null){s.suppressPrettyCount++,A=!0;break}}for(N+=">"+this.endline(i,s,a),s.state=e.InsideTag,I=i.children,m=0,O=I.length;m<O;m++)d=I[m],N+=this.writeChildNode(d,s,a+1);s.state=e.CloseTag,N+=this.indent(i,s,a)+"</"+i.name+">",A&&s.suppressPrettyCount--,N+=this.endline(i,s,a),s.state=e.None}return this.closeNode(i,s,a),N},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case t.CData:return this.cdata(i,s,a);case t.Comment:return this.comment(i,s,a);case t.Element:return this.element(i,s,a);case t.Raw:return this.raw(i,s,a);case t.Text:return this.text(i,s,a);case t.ProcessingInstruction:return this.processingInstruction(i,s,a);case t.Dummy:return"";case t.Declaration:return this.declaration(i,s,a);case t.DocType:return this.docType(i,s,a);case t.AttributeDeclaration:return this.dtdAttList(i,s,a);case t.ElementDeclaration:return this.dtdElement(i,s,a);case t.EntityDeclaration:return this.dtdEntity(i,s,a);case t.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=e.OpenTag,u=this.indent(i,s,a)+"<?",s.state=e.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=e.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a),s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a),s.state=e.InsideTag,u+=i.value,s.state=e.CloseTag,u+=this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=e.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=e.InsideTag,u+=" "+i.name+" "+i.value,s.state=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=e.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=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=e.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=e.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=e.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=e.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(q)),zt.exports}var Lr;function Dn(){return Lr||(Lr=1,function(){var t,e=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;t=Oi(),Yt.exports=function(r){e(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,d,c,f;for(s=this.filterOptions(s),c="",f=i.children,u=0,d=f.length;u<d;u++)a=f[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}(t)}.call(q)),Yt.exports}var Sr;function xi(){return Sr||(Sr=1,function(){var t,e,n,r,o,i,s,a=function(d,c){for(var f in c)u.call(c,f)&&(d[f]=c[f]);function l(){this.constructor=d}return l.prototype=c.prototype,d.prototype=new l,d.__super__=c.prototype,d},u={}.hasOwnProperty;s=Ee().isPlainObject,n=Ni(),e=ca(),r=ce(),t=Z(),i=Ii(),o=Dn(),vt.exports=function(d){a(c,d);function c(f){c.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,f||(f={}),f.writer||(f.writer=new o),this.options=f,this.stringify=new i(f)}return Object.defineProperty(c.prototype,"implementation",{value:new n}),Object.defineProperty(c.prototype,"doctype",{get:function(){var f,l,m,E;for(E=this.children,l=0,m=E.length;l<m;l++)if(f=E[l],f.type===t.DocType)return f;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===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(c.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(c.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.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(f){var l;return l={},f?s(f)&&(l=f,f=this.options.writer):f=this.options.writer,f.document(this,f.filterOptions(l))},c.prototype.toString=function(f){return this.options.writer.document(this,this.options.writer.filterOptions(f))},c.prototype.createElement=function(f){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(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createComment=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createCDATASection=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createProcessingInstruction=function(f,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttribute=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEntityReference=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.importNode=function(f,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createElementNS=function(f,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttributeNS=function(f,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagNameNS=function(f,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementById=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.adoptNode=function(f){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(f,l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEvent=function(f){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(f,l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTreeWalker=function(f,l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(r)}.call(q)),vt.exports}var Jt={exports:{}},Dr;function ha(){return Dr||(Dr=1,function(){var t,e,n,r,o,i,s,a,u,d,c,f,l,m,E,O,w,A,N,p,v,I,P,L={}.hasOwnProperty;P=Ee(),v=P.isObject,p=P.isFunction,I=P.isPlainObject,N=P.getValue,t=Z(),f=xi(),l=En(),r=Nn(),o=Tn(),E=Pn(),A=Ln(),m=Sn(),d=vn(),c=An(),i=In(),a=On(),s=xn(),u=_n(),n=Ti(),w=Ii(),O=Dn(),e=ot(),Jt.exports=function(){function M(T,b,F){var $;this.name="?xml",this.type=t.Document,T||(T={}),$={},T.writer?I(T.writer)&&($=T.writer,T.writer=new O):T.writer=new O,this.options=T,this.writer=T.writer,this.writerOptions=this.writer.filterOptions($),this.stringify=new w(T),this.onDataCallback=b||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return M.prototype.createChildNode=function(T){var b,F,$,U,B,V,W,G;switch(T.type){case t.CData:this.cdata(T.value);break;case t.Comment:this.comment(T.value);break;case t.Element:$={},W=T.attribs;for(F in W)L.call(W,F)&&(b=W[F],$[F]=b.value);this.node(T.name,$);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(T.value);break;case t.Text:this.text(T.value);break;case t.ProcessingInstruction:this.instruction(T.target,T.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+T.constructor.name)}for(G=T.children,B=0,V=G.length;B<V;B++)U=G[B],this.createChildNode(U),U.type===t.Element&&this.up();return this},M.prototype.dummy=function(){return this},M.prototype.node=function(T,b,F){var $;if(T==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(T));return this.openCurrent(),T=N(T),b==null&&(b={}),b=N(b),v(b)||($=[b,F],F=$[0],b=$[1]),this.currentNode=new l(this,T,b),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},M.prototype.element=function(T,b,F){var $,U,B,V,W,G;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(T)||v(T)||p(T))for(V=this.options.noValidation,this.options.noValidation=!0,G=new f(this.options).element("TEMP_ROOT"),G.element(T),this.options.noValidation=V,W=G.children,U=0,B=W.length;U<B;U++)$=W[U],this.createChildNode($),$.type===t.Element&&this.up();else this.node(T,b,F);return this},M.prototype.attribute=function(T,b){var F,$;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(T));if(T!=null&&(T=N(T)),v(T))for(F in T)L.call(T,F)&&($=T[F],this.attribute(F,$));else p(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.currentNode.attribs[T]=new n(this,T,""):b!=null&&(this.currentNode.attribs[T]=new n(this,T,b));return this},M.prototype.text=function(T){var b;return this.openCurrent(),b=new A(this,T),this.onData(this.writer.text(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.cdata=function(T){var b;return this.openCurrent(),b=new r(this,T),this.onData(this.writer.cdata(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.comment=function(T){var b;return this.openCurrent(),b=new o(this,T),this.onData(this.writer.comment(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.raw=function(T){var b;return this.openCurrent(),b=new E(this,T),this.onData(this.writer.raw(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.instruction=function(T,b){var F,$,U,B,V;if(this.openCurrent(),T!=null&&(T=N(T)),b!=null&&(b=N(b)),Array.isArray(T))for(F=0,B=T.length;F<B;F++)$=T[F],this.instruction($);else if(v(T))for($ in T)L.call(T,$)&&(U=T[$],this.instruction($,U));else p(b)&&(b=b.apply()),V=new m(this,T,b),this.onData(this.writer.processingInstruction(V,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},M.prototype.declaration=function(T,b,F){var $;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return $=new d(this,T,b,F),this.onData(this.writer.declaration($,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.doctype=function(T,b,F){if(this.openCurrent(),T==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,b,F),this.currentNode.rootNodeName=T,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},M.prototype.dtdElement=function(T,b){var F;return this.openCurrent(),F=new s(this,T,b),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.attList=function(T,b,F,$,U){var B;return this.openCurrent(),B=new i(this,T,b,F,$,U),this.onData(this.writer.dtdAttList(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.entity=function(T,b){var F;return this.openCurrent(),F=new a(this,!1,T,b),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.pEntity=function(T,b){var F;return this.openCurrent(),F=new a(this,!0,T,b),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.prototype.notation=function(T,b){var F;return this.openCurrent(),F=new u(this,T,b),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},M.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},M.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},M.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},M.prototype.openNode=function(T){var b,F,$,U;if(!T.isOpen){if(!this.root&&this.currentLevel===0&&T.type===t.Element&&(this.root=T),F="",T.type===t.Element){this.writerOptions.state=e.OpenTag,F=this.writer.indent(T,this.writerOptions,this.currentLevel)+"<"+T.name,U=T.attribs;for($ in U)L.call(U,$)&&(b=U[$],F+=this.writer.attribute(b,this.writerOptions,this.currentLevel));F+=(T.children?">":"/>")+this.writer.endline(T,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,F=this.writer.indent(T,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+T.rootNodeName,T.pubID&&T.sysID?F+=' PUBLIC "'+T.pubID+'" "'+T.sysID+'"':T.sysID&&(F+=' SYSTEM "'+T.sysID+'"'),T.children?(F+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,F+=">"),F+=this.writer.endline(T,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),T.isOpen=!0}},M.prototype.closeNode=function(T){var b;if(!T.isClosed)return b="",this.writerOptions.state=e.CloseTag,T.type===t.Element?b=this.writer.indent(T,this.writerOptions,this.currentLevel)+"</"+T.name+">"+this.writer.endline(T,this.writerOptions,this.currentLevel):b=this.writer.indent(T,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(T,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(b,this.currentLevel),T.isClosed=!0},M.prototype.onData=function(T,b){return this.documentStarted=!0,this.onDataCallback(T,b+1)},M.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},M.prototype.debugInfo=function(T){return T==null?"":"node: <"+T+">"},M.prototype.ele=function(){return this.element.apply(this,arguments)},M.prototype.nod=function(T,b,F){return this.node(T,b,F)},M.prototype.txt=function(T){return this.text(T)},M.prototype.dat=function(T){return this.cdata(T)},M.prototype.com=function(T){return this.comment(T)},M.prototype.ins=function(T,b){return this.instruction(T,b)},M.prototype.dec=function(T,b,F){return this.declaration(T,b,F)},M.prototype.dtd=function(T,b,F){return this.doctype(T,b,F)},M.prototype.e=function(T,b,F){return this.element(T,b,F)},M.prototype.n=function(T,b,F){return this.node(T,b,F)},M.prototype.t=function(T){return this.text(T)},M.prototype.d=function(T){return this.cdata(T)},M.prototype.c=function(T){return this.comment(T)},M.prototype.r=function(T){return this.raw(T)},M.prototype.i=function(T,b){return this.instruction(T,b)},M.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},M.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},M.prototype.ent=function(T,b){return this.entity(T,b)},M.prototype.pent=function(T,b){return this.pEntity(T,b)},M.prototype.not=function(T,b){return this.notation(T,b)},M}()}.call(q)),Jt.exports}var Kt={exports:{}},Mr;function pa(){return Mr||(Mr=1,function(){var t,e,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=Z(),n=Oi(),e=ot(),Kt.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,d){return a.isLastRootNode&&u.state===e.CloseTag?"":s.__super__.endline.call(this,a,u,d)},s.prototype.document=function(a,u){var d,c,f,l,m,E,O,w,A;for(O=a.children,c=f=0,m=O.length;f<m;c=++f)d=O[c],d.isLastRootNode=c===a.children.length-1;for(u=this.filterOptions(u),w=a.children,A=[],l=0,E=w.length;l<E;l++)d=w[l],A.push(this.writeChildNode(d,u,0));return A},s.prototype.attribute=function(a,u,d){return this.stream.write(s.__super__.attribute.call(this,a,u,d))},s.prototype.cdata=function(a,u,d){return this.stream.write(s.__super__.cdata.call(this,a,u,d))},s.prototype.comment=function(a,u,d){return this.stream.write(s.__super__.comment.call(this,a,u,d))},s.prototype.declaration=function(a,u,d){return this.stream.write(s.__super__.declaration.call(this,a,u,d))},s.prototype.docType=function(a,u,d){var c,f,l,m;if(d||(d=0),this.openNode(a,u,d),u.state=e.OpenTag,this.stream.write(this.indent(a,u,d)),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,d)),u.state=e.InsideTag,m=a.children,f=0,l=m.length;f<l;f++)c=m[f],this.writeChildNode(c,u,d+1);u.state=e.CloseTag,this.stream.write("]")}return u.state=e.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,d)),u.state=e.None,this.closeNode(a,u,d)},s.prototype.element=function(a,u,d){var c,f,l,m,E,O,w,A,N;d||(d=0),this.openNode(a,u,d),u.state=e.OpenTag,this.stream.write(this.indent(a,u,d)+"<"+a.name),A=a.attribs;for(w in A)o.call(A,w)&&(c=A[w],this.attribute(c,u,d));if(l=a.children.length,m=l===0?null:a.children[0],l===0||a.children.every(function(p){return(p.type===t.Text||p.type===t.Raw)&&p.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=e.CloseTag,this.stream.write("</"+a.name+">")):(u.state=e.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&l===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),u.state=e.InsideTag,u.suppressPrettyCount++,this.writeChildNode(m,u,d+1),u.suppressPrettyCount--,u.state=e.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,d)),u.state=e.InsideTag,N=a.children,E=0,O=N.length;E<O;E++)f=N[E],this.writeChildNode(f,u,d+1);u.state=e.CloseTag,this.stream.write(this.indent(a,u,d)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,d)),u.state=e.None,this.closeNode(a,u,d)},s.prototype.processingInstruction=function(a,u,d){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,d))},s.prototype.raw=function(a,u,d){return this.stream.write(s.__super__.raw.call(this,a,u,d))},s.prototype.text=function(a,u,d){return this.stream.write(s.__super__.text.call(this,a,u,d))},s.prototype.dtdAttList=function(a,u,d){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,d))},s.prototype.dtdElement=function(a,u,d){return this.stream.write(s.__super__.dtdElement.call(this,a,u,d))},s.prototype.dtdEntity=function(a,u,d){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,d))},s.prototype.dtdNotation=function(a,u,d){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,d))},s}(n)}.call(q)),Kt.exports}var Cr;function da(){return Cr||(Cr=1,function(){var t,e,n,r,o,i,s,a,u,d;d=Ee(),a=d.assign,u=d.isFunction,n=Ni(),r=xi(),o=ha(),s=Dn(),i=pa(),t=Z(),e=ot(),be.create=function(c,f,l,m){var E,O;if(c==null)throw new Error("Root element needs a name.");return m=a({},f,l,m),E=new r(m),O=E.element(c),m.headless||(E.declaration(m),(m.pubID!=null||m.sysID!=null)&&E.dtd(m)),O},be.begin=function(c,f,l){var m;return u(c)&&(m=[c,f],f=m[0],l=m[1],c={}),f?new o(c,f,l):new r(c)},be.stringWriter=function(c){return new s(c)},be.streamWriter=function(c,f){return new i(c,f)},be.implementation=new n,be.nodeType=t,be.writerState=e}.call(q)),be}var Fr;function ga(){return Fr||(Fr=1,function(){var t,e,n,r,o,i={}.hasOwnProperty;t=da(),e=bn().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[>")},Nt.Builder=function(){function s(a){var u,d,c;this.options={},d=e["0.2"];for(u in d)i.call(d,u)&&(c=d[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,d,c,f,l;return u=this.options.attrkey,d=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(l=Object.keys(a)[0],a=a[l]):l=this.options.rootName,c=function(m){return function(E,O){var w,A,N,p,v,I;if(typeof O!="object")m.options.cdata&&r(O)?E.raw(o(O)):E.txt(O);else if(Array.isArray(O)){for(p in O)if(i.call(O,p)){A=O[p];for(v in A)N=A[v],E=c(E.ele(v),N).up()}}else for(v in O)if(i.call(O,v))if(A=O[v],v===u){if(typeof A=="object")for(w in A)I=A[w],E=E.att(w,I)}else if(v===d)m.options.cdata&&r(A)?E=E.raw(o(A)):E=E.txt(A);else if(Array.isArray(A))for(p in A)i.call(A,p)&&(N=A[p],typeof N=="string"?m.options.cdata&&r(N)?E=E.ele(v).raw(o(N)).up():E=E.ele(v,N).up():E=c(E.ele(v),N).up());else typeof A=="object"?E=c(E.ele(v),A).up():typeof A=="string"&&m.options.cdata&&r(A)?E=E.ele(v).raw(o(A)).up():(A==null&&(A=""),E=E.ele(v,A.toString()).up());return E}}(this),f=t.create(l,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(f,a).end(this.options.renderOpts)},s}()}.call(q)),Nt}var Zt={},en={},jr;function ma(){return jr||(jr=1,function(t){(function(e){e.parser=function(y,h){return new r(y,h)},e.SAXParser=r,e.SAXStream=f,e.createStream=d,e.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(y,h){if(!(this instanceof r))return new r(y,h);var S=this;i(S),S.q=S.c="",S.bufferCheckPosition=e.MAX_BUFFER_LENGTH,S.encoding=null,S.opt=h||{},S.opt.lowercase=S.opt.lowercase||S.opt.lowercasetags,S.looseCase=S.opt.lowercase?"toLowerCase":"toUpperCase",S.opt.maxEntityCount=S.opt.maxEntityCount||512,S.opt.maxEntityDepth=S.opt.maxEntityDepth||4,S.entityCount=S.entityDepth=0,S.tags=[],S.closed=S.closedRoot=S.sawRoot=!1,S.tag=S.error=null,S.strict=!!y,S.noscript=!!(y||S.opt.noscript),S.state=b.BEGIN,S.strictEntities=S.opt.strictEntities,S.ENTITIES=S.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),S.attribList=[],S.opt.xmlns&&(S.ns=Object.create(w)),S.opt.unquotedAttributeValues===void 0&&(S.opt.unquotedAttributeValues=!y),S.trackPosition=S.opt.position!==!1,S.trackPosition&&(S.position=S.line=S.column=0),$(S,"onready")}Object.create||(Object.create=function(y){function h(){}h.prototype=y;var S=new h;return S}),Object.keys||(Object.keys=function(y){var h=[];for(var S in y)y.hasOwnProperty(S)&&h.push(S);return h});function o(y){for(var h=Math.max(e.MAX_BUFFER_LENGTH,10),S=0,g=0,x=n.length;g<x;g++){var C=y[n[g]].length;if(C>h)switch(n[g]){case"textNode":ve(y);break;case"cdata":G(y,"oncdata",y.cdata),y.cdata="";break;case"script":G(y,"onscript",y.script),y.script="";break;default:pe(y,"Max buffer length exceeded: "+n[g])}S=Math.max(S,C)}var D=e.MAX_BUFFER_LENGTH-S;y.bufferCheckPosition=D+y.position}function i(y){for(var h=0,S=n.length;h<S;h++)y[n[h]]=""}function s(y){ve(y),y.cdata!==""&&(G(y,"oncdata",y.cdata),y.cdata=""),y.script!==""&&(G(y,"onscript",y.script),y.script="")}r.prototype={end:function(){Ne(this)},write:ut,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=e.EVENTS.filter(function(y){return y!=="error"&&y!=="end"});function d(y,h){return new f(y,h)}function c(y,h){if(y.length>=2){if(y[0]===255&&y[1]===254)return"utf-16le";if(y[0]===254&&y[1]===255)return"utf-16be"}return y.length>=3&&y[0]===239&&y[1]===187&&y[2]===191?"utf8":y.length>=4?y[0]===60&&y[1]===0&&y[2]===63&&y[3]===0?"utf-16le":y[0]===0&&y[1]===60&&y[2]===0&&y[3]===63?"utf-16be":"utf8":h?"utf8":null}function f(y,h){if(!(this instanceof f))return new f(y,h);a.apply(this),this._parser=new r(y,h),this.writable=!0,this.readable=!0;var S=this;this._parser.onend=function(){S.emit("end")},this._parser.onerror=function(g){S.emit("error",g),S._parser.error=null},this._decoder=null,this._decoderBuffer=null,u.forEach(function(g){Object.defineProperty(S,"on"+g,{get:function(){return S._parser["on"+g]},set:function(x){if(!x)return S.removeAllListeners(g),S._parser["on"+g]=x,x;S.on(g,x)},enumerable:!0,configurable:!1})})}f.prototype=Object.create(a.prototype,{constructor:{value:f}}),f.prototype._decodeBuffer=function(y,h){if(this._decoderBuffer&&(y=Buffer.concat([this._decoderBuffer,y]),this._decoderBuffer=null),!this._decoder){var S=c(y,h);if(!S)return this._decoderBuffer=y,"";this._parser.encoding=S,this._decoder=new TextDecoder(S)}return this._decoder.decode(y,{stream:!h})},f.prototype.write=function(y){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(y))y=this._decodeBuffer(y,!1);else if(this._decoderBuffer){var h=this._decodeBuffer(Buffer.alloc(0),!0);h&&(this._parser.write(h),this.emit("data",h))}return this._parser.write(y.toString()),this.emit("data",y),!0},f.prototype.end=function(y){if(y&&y.length&&this.write(y),this._decoderBuffer){var h=this._decodeBuffer(Buffer.alloc(0),!0);h&&(this._parser.write(h),this.emit("data",h))}else if(this._decoder){var S=this._decoder.decode();S&&(this._parser.write(S),this.emit("data",S))}return this._parser.end(),!0},f.prototype.on=function(y,h){var S=this;return!S._parser["on"+y]&&u.indexOf(y)!==-1&&(S._parser["on"+y]=function(){var g=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);g.splice(0,0,y),S.emit.apply(S,g)}),a.prototype.on.call(S,y,h)};var l="[CDATA[",m="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",w={xml:E,xmlns:O},A=/[:_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]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,p=/[#:_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]/,v=/[#:_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 I(y){return y===" "||y===`
|
|
76
|
+
`||y==="\r"||y===" "}function P(y){return y==='"'||y==="'"}function L(y){return y===">"||I(y)}function M(y,h){return y.test(h)}function T(y,h){return!M(y,h)}var b=0;e.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.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(e.ENTITIES).forEach(function(y){var h=e.ENTITIES[y],S=typeof h=="number"?String.fromCharCode(h):h;e.ENTITIES[y]=S});for(var F in e.STATE)e.STATE[e.STATE[F]]=F;b=e.STATE;function $(y,h,S){y[h]&&y[h](S)}function U(y){var h=y&&y.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return h?h[2]:null}function B(y){return y?y.toLowerCase().replace(/[^a-z0-9]/g,""):null}function V(y,h){const S=B(y),g=B(h);return!S||!g?!0:g==="utf16"?S==="utf16le"||S==="utf16be":S===g}function W(y,h){if(!(!y.strict||!y.encoding||!h||h.name!=="xml")){var S=U(h.body);S&&!V(y.encoding,S)&&H(y,"XML declaration encoding "+S+" does not match detected stream encoding "+y.encoding.toUpperCase())}}function G(y,h,S){y.textNode&&ve(y),$(y,h,S)}function ve(y){y.textNode=qe(y.opt,y.textNode),y.textNode&&$(y,"ontext",y.textNode),y.textNode=""}function qe(y,h){return y.trim&&(h=h.trim()),y.normalize&&(h=h.replace(/\s+/g," ")),h}function pe(y,h){return ve(y),y.trackPosition&&(h+=`
|
|
77
|
+
Line: `+y.line+`
|
|
78
|
+
Column: `+y.column+`
|
|
79
|
+
Char: `+y.c),h=new Error(h),y.error=h,$(y,"onerror",h),y}function Ne(y){return y.sawRoot&&!y.closedRoot&&H(y,"Unclosed root tag"),y.state!==b.BEGIN&&y.state!==b.BEGIN_WHITESPACE&&y.state!==b.TEXT&&pe(y,"Unexpected end"),ve(y),y.c="",y.closed=!0,$(y,"onend"),r.call(y,y.strict,y.opt),y}function H(y,h){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&pe(y,h)}function at(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var h=y.tags[y.tags.length-1]||y,S=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(S.ns=h.ns),y.attribList.length=0,G(y,"onopentagstart",S)}function X(y,h){var S=y.indexOf(":"),g=S<0?["",y]:y.split(":"),x=g[0],C=g[1];return h&&y==="xmlns"&&(x="xmlns",C=""),{prefix:x,local:C}}function Ae(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var h=X(y.attribName,!0),S=h.prefix,g=h.local;if(S==="xmlns")if(g==="xml"&&y.attribValue!==E)H(y,"xml: prefix must be bound to "+E+`
|
|
80
|
+
Actual: `+y.attribValue);else if(g==="xmlns"&&y.attribValue!==O)H(y,"xmlns: prefix must be bound to "+O+`
|
|
81
|
+
Actual: `+y.attribValue);else{var x=y.tag,C=y.tags[y.tags.length-1]||y;x.ns===C.ns&&(x.ns=Object.create(C.ns)),x.ns[g]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,G(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function me(y,h){if(y.opt.xmlns){var S=y.tag,g=X(y.tagName);S.prefix=g.prefix,S.local=g.local,S.uri=S.ns[g.prefix]||"",S.prefix&&!S.uri&&(H(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),S.uri=g.prefix);var x=y.tags[y.tags.length-1]||y;S.ns&&x.ns!==S.ns&&Object.keys(S.ns).forEach(function(Cn){G(y,"onopennamespace",{prefix:Cn,uri:S.ns[Cn]})});for(var C=0,D=y.attribList.length;C<D;C++){var _=y.attribList[C],k=_[0],j=_[1],R=X(k,!0),Q=R.prefix,te=R.local,Mn=Q===""?"":S.ns[Q]||"",ct={name:k,value:j,prefix:Q,local:te,uri:Mn};Q&&Q!=="xmlns"&&!Mn&&(H(y,"Unbound namespace prefix: "+JSON.stringify(Q)),ct.uri=Q),y.tag.attributes[k]=ct,G(y,"onattribute",ct)}y.attribList.length=0}y.tag.isSelfClosing=!!h,y.sawRoot=!0,y.tags.push(y.tag),G(y,"onopentag",y.tag),h||(!y.noscript&&y.tagName.toLowerCase()==="script"?y.state=b.SCRIPT:y.state=b.TEXT,y.tag=null,y.tagName=""),y.attribName=y.attribValue="",y.attribList.length=0}function Re(y){if(!y.tagName){H(y,"Weird empty close tag."),y.textNode+="</>",y.state=b.TEXT;return}if(y.script){if(y.tagName!=="script"){y.script+="</"+y.tagName+">",y.tagName="",y.state=b.SCRIPT;return}G(y,"onscript",y.script),y.script=""}var h=y.tags.length,S=y.tagName;y.strict||(S=S[y.looseCase]());for(var g=S;h--;){var x=y.tags[h];if(x.name!==g)H(y,"Unexpected close tag");else break}if(h<0){H(y,"Unmatched closing tag: "+y.tagName),y.textNode+="</"+y.tagName+">",y.state=b.TEXT;return}y.tagName=S;for(var C=y.tags.length;C-- >h;){var D=y.tag=y.tags.pop();y.tagName=y.tag.name,G(y,"onclosetag",y.tagName);var _={};for(var k in D.ns)_[k]=D.ns[k];var j=y.tags[y.tags.length-1]||y;y.opt.xmlns&&D.ns!==j.ns&&Object.keys(D.ns).forEach(function(R){var Q=D.ns[R];G(y,"onclosenamespace",{prefix:R,uri:Q})})}h===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=b.TEXT}function Pe(y){var h=y.entity,S=h.toLowerCase(),g,x="";return y.ENTITIES[h]?y.ENTITIES[h]:y.ENTITIES[S]?y.ENTITIES[S]:(h=S,h.charAt(0)==="#"&&(h.charAt(1)==="x"?(h=h.slice(2),g=parseInt(h,16),x=g.toString(16)):(h=h.slice(1),g=parseInt(h,10),x=g.toString(10))),h=h.replace(/^0+/,""),isNaN(g)||x.toLowerCase()!==h||g<0||g>1114111?(H(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(g))}function We(y,h){h==="<"?(y.state=b.OPEN_WAKA,y.startTagPosition=y.position):I(h)||(H(y,"Non-whitespace before first tag."),y.textNode=h,y.state=b.TEXT)}function de(y,h){var S="";return h<y.length&&(S=y.charAt(h)),S}function ut(y){var h=this;if(this.error)throw this.error;if(h.closed)return pe(h,"Cannot write after close. Assign an onready handler.");if(y===null)return Ne(h);typeof y=="object"&&(y=y.toString());for(var S=0,g="";g=de(y,S++),h.c=g,!!g;)switch(h.trackPosition&&(h.position++,g===`
|
|
82
|
+
`?(h.line++,h.column=0):h.column++),h.state){case b.BEGIN:if(h.state=b.BEGIN_WHITESPACE,g==="\uFEFF")continue;We(h,g);continue;case b.BEGIN_WHITESPACE:We(h,g);continue;case b.TEXT:if(h.sawRoot&&!h.closedRoot){for(var C=S-1;g&&g!=="<"&&g!=="&";)g=de(y,S++),g&&h.trackPosition&&(h.position++,g===`
|
|
83
|
+
`?(h.line++,h.column=0):h.column++);h.textNode+=y.substring(C,S-1)}g==="<"&&!(h.sawRoot&&h.closedRoot&&!h.strict)?(h.state=b.OPEN_WAKA,h.startTagPosition=h.position):(!I(g)&&(!h.sawRoot||h.closedRoot)&&H(h,"Text data outside of root node."),g==="&"?h.state=b.TEXT_ENTITY:h.textNode+=g);continue;case b.SCRIPT:g==="<"?h.state=b.SCRIPT_ENDING:h.script+=g;continue;case b.SCRIPT_ENDING:g==="/"?h.state=b.CLOSE_TAG:(h.script+="<"+g,h.state=b.SCRIPT);continue;case b.OPEN_WAKA:if(g==="!")h.state=b.SGML_DECL,h.sgmlDecl="";else if(!I(g))if(M(A,g))h.state=b.OPEN_TAG,h.tagName=g;else if(g==="/")h.state=b.CLOSE_TAG,h.tagName="";else if(g==="?")h.state=b.PROC_INST,h.procInstName=h.procInstBody="";else{if(H(h,"Unencoded <"),h.startTagPosition+1<h.position){var x=h.position-h.startTagPosition;g=new Array(x).join(" ")+g}h.textNode+="<"+g,h.state=b.TEXT}continue;case b.SGML_DECL:if(h.sgmlDecl+g==="--"){h.state=b.COMMENT,h.comment="",h.sgmlDecl="";continue}h.doctype&&h.doctype!==!0&&h.sgmlDecl?(h.state=b.DOCTYPE_DTD,h.doctype+="<!"+h.sgmlDecl+g,h.sgmlDecl=""):(h.sgmlDecl+g).toUpperCase()===l?(G(h,"onopencdata"),h.state=b.CDATA,h.sgmlDecl="",h.cdata=""):(h.sgmlDecl+g).toUpperCase()===m?(h.state=b.DOCTYPE,(h.doctype||h.sawRoot)&&H(h,"Inappropriately located doctype declaration"),h.doctype="",h.sgmlDecl=""):g===">"?(G(h,"onsgmldeclaration",h.sgmlDecl),h.sgmlDecl="",h.state=b.TEXT):(P(g)&&(h.state=b.SGML_DECL_QUOTED),h.sgmlDecl+=g);continue;case b.SGML_DECL_QUOTED:g===h.q&&(h.state=b.SGML_DECL,h.q=""),h.sgmlDecl+=g;continue;case b.DOCTYPE:g===">"?(h.state=b.TEXT,G(h,"ondoctype",h.doctype),h.doctype=!0):(h.doctype+=g,g==="["?h.state=b.DOCTYPE_DTD:P(g)&&(h.state=b.DOCTYPE_QUOTED,h.q=g));continue;case b.DOCTYPE_QUOTED:h.doctype+=g,g===h.q&&(h.q="",h.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:g==="]"?(h.doctype+=g,h.state=b.DOCTYPE):g==="<"?(h.state=b.OPEN_WAKA,h.startTagPosition=h.position):P(g)?(h.doctype+=g,h.state=b.DOCTYPE_DTD_QUOTED,h.q=g):h.doctype+=g;continue;case b.DOCTYPE_DTD_QUOTED:h.doctype+=g,g===h.q&&(h.state=b.DOCTYPE_DTD,h.q="");continue;case b.COMMENT:g==="-"?h.state=b.COMMENT_ENDING:h.comment+=g;continue;case b.COMMENT_ENDING:g==="-"?(h.state=b.COMMENT_ENDED,h.comment=qe(h.opt,h.comment),h.comment&&G(h,"oncomment",h.comment),h.comment=""):(h.comment+="-"+g,h.state=b.COMMENT);continue;case b.COMMENT_ENDED:g!==">"?(H(h,"Malformed comment"),h.comment+="--"+g,h.state=b.COMMENT):h.doctype&&h.doctype!==!0?h.state=b.DOCTYPE_DTD:h.state=b.TEXT;continue;case b.CDATA:for(var C=S-1;g&&g!=="]";)g=de(y,S++),g&&h.trackPosition&&(h.position++,g===`
|
|
84
|
+
`?(h.line++,h.column=0):h.column++);h.cdata+=y.substring(C,S-1),g==="]"&&(h.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:g==="]"?h.state=b.CDATA_ENDING_2:(h.cdata+="]"+g,h.state=b.CDATA);continue;case b.CDATA_ENDING_2:g===">"?(h.cdata&&G(h,"oncdata",h.cdata),G(h,"onclosecdata"),h.cdata="",h.state=b.TEXT):g==="]"?h.cdata+="]":(h.cdata+="]]"+g,h.state=b.CDATA);continue;case b.PROC_INST:g==="?"?h.state=b.PROC_INST_ENDING:I(g)?h.state=b.PROC_INST_BODY:h.procInstName+=g;continue;case b.PROC_INST_BODY:if(!h.procInstBody&&I(g))continue;g==="?"?h.state=b.PROC_INST_ENDING:h.procInstBody+=g;continue;case b.PROC_INST_ENDING:if(g===">"){const j={name:h.procInstName,body:h.procInstBody};W(h,j),G(h,"onprocessinginstruction",j),h.procInstName=h.procInstBody="",h.state=b.TEXT}else h.procInstBody+="?"+g,h.state=b.PROC_INST_BODY;continue;case b.OPEN_TAG:M(N,g)?h.tagName+=g:(at(h),g===">"?me(h):g==="/"?h.state=b.OPEN_TAG_SLASH:(I(g)||H(h,"Invalid character in tag name"),h.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:g===">"?(me(h,!0),Re(h)):(H(h,"Forward-slash in opening tag not followed by >"),h.state=b.ATTRIB);continue;case b.ATTRIB:if(I(g))continue;g===">"?me(h):g==="/"?h.state=b.OPEN_TAG_SLASH:M(A,g)?(h.attribName=g,h.attribValue="",h.state=b.ATTRIB_NAME):H(h,"Invalid attribute name");continue;case b.ATTRIB_NAME:g==="="?h.state=b.ATTRIB_VALUE:g===">"?(H(h,"Attribute without value"),h.attribValue=h.attribName,Ae(h),me(h)):I(g)?h.state=b.ATTRIB_NAME_SAW_WHITE:M(N,g)?h.attribName+=g:H(h,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(g==="=")h.state=b.ATTRIB_VALUE;else{if(I(g))continue;H(h,"Attribute without value"),h.tag.attributes[h.attribName]="",h.attribValue="",G(h,"onattribute",{name:h.attribName,value:""}),h.attribName="",g===">"?me(h):M(A,g)?(h.attribName=g,h.state=b.ATTRIB_NAME):(H(h,"Invalid attribute name"),h.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(I(g))continue;P(g)?(h.q=g,h.state=b.ATTRIB_VALUE_QUOTED):(h.opt.unquotedAttributeValues||pe(h,"Unquoted attribute value"),h.state=b.ATTRIB_VALUE_UNQUOTED,h.attribValue=g);continue;case b.ATTRIB_VALUE_QUOTED:if(g!==h.q){g==="&"?h.state=b.ATTRIB_VALUE_ENTITY_Q:h.attribValue+=g;continue}Ae(h),h.q="",h.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:I(g)?h.state=b.ATTRIB:g===">"?me(h):g==="/"?h.state=b.OPEN_TAG_SLASH:M(A,g)?(H(h,"No whitespace between attributes"),h.attribName=g,h.attribValue="",h.state=b.ATTRIB_NAME):H(h,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!L(g)){g==="&"?h.state=b.ATTRIB_VALUE_ENTITY_U:h.attribValue+=g;continue}Ae(h),g===">"?me(h):h.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(h.tagName)g===">"?Re(h):M(N,g)?h.tagName+=g:h.script?(h.script+="</"+h.tagName+g,h.tagName="",h.state=b.SCRIPT):(I(g)||H(h,"Invalid tagname in closing tag"),h.state=b.CLOSE_TAG_SAW_WHITE);else{if(I(g))continue;T(A,g)?h.script?(h.script+="</"+g,h.state=b.SCRIPT):H(h,"Invalid tagname in closing tag."):h.tagName=g}continue;case b.CLOSE_TAG_SAW_WHITE:if(I(g))continue;g===">"?Re(h):H(h,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var D,_;switch(h.state){case b.TEXT_ENTITY:D=b.TEXT,_="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:D=b.ATTRIB_VALUE_QUOTED,_="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:D=b.ATTRIB_VALUE_UNQUOTED,_="attribValue";break}if(g===";"){var k=Pe(h);h.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(k)?((h.entityCount+=1)>h.opt.maxEntityCount&&pe(h,"Parsed entity count exceeds max entity count"),(h.entityDepth+=1)>h.opt.maxEntityDepth&&pe(h,"Parsed entity depth exceeds max entity depth"),h.entity="",h.state=D,h.write(k),h.entityDepth-=1):(h[_]+=k,h.entity="",h.state=D)}else M(h.entity.length?v:p,g)?h.entity+=g:(H(h,"Invalid character in entity name"),h[_]+="&"+h.entity+g,h.entity="",h.state=D);continue;default:throw new Error(h,"Unknown state: "+h.state)}return h.position>=h.bufferCheckPosition&&o(h),h}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var y=String.fromCharCode,h=Math.floor,S=function(){var g=16384,x=[],C,D,_=-1,k=arguments.length;if(!k)return"";for(var j="";++_<k;){var R=Number(arguments[_]);if(!isFinite(R)||R<0||R>1114111||h(R)!==R)throw RangeError("Invalid code point: "+R);R<=65535?x.push(R):(R-=65536,C=(R>>10)+55296,D=R%1024+56320,x.push(C,D)),(_+1===k||x.length>g)&&(j+=y.apply(null,x),x.length=0)}return j};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:S,configurable:!0,writable:!0}):String.fromCodePoint=S}()})(t)}(en)),en}var tn={},kr;function ya(){return kr||(kr=1,function(){tn.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}.call(q)),tn}var xe={},Rr;function _i(){return Rr||(Rr=1,function(){var t;t=new RegExp(/(?!xmlns)^.*:/),xe.normalize=function(e){return e.toLowerCase()},xe.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},xe.stripPrefix=function(e){return e.replace(t,"")},xe.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},xe.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}.call(q)),xe}var Br;function ba(){return Br||(Br=1,function(t){(function(){var e,n,r,o,i,s,a,u,d,c=function(m,E){return function(){return m.apply(E,arguments)}},f=function(m,E){for(var O in E)l.call(E,O)&&(m[O]=E[O]);function w(){this.constructor=m}return w.prototype=E.prototype,m.prototype=new w,m.__super__=E.prototype,m},l={}.hasOwnProperty;u=ma(),o=yn,e=ya(),a=_i(),d=zi.setImmediate,n=bn().defaults,i=function(m){return typeof m=="object"&&m!=null&&Object.keys(m).length===0},s=function(m,E,O){var w,A,N;for(w=0,A=m.length;w<A;w++)N=m[w],E=N(E,O);return E},r=function(m,E,O){var w;return w=Object.create(null),w.value=O,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(m,E,w)},t.Parser=function(m){f(E,m);function E(O){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 w,A,N;if(!(this instanceof t.Parser))return new t.Parser(O);this.options={},A=n["0.2"];for(w in A)l.call(A,w)&&(N=A[w],this.options[w]=N);for(w in O)l.call(O,w)&&(N=O[w],this.options[w]=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 E.prototype.processAsync=function(){var O,w;try{return this.remaining.length<=this.options.chunkSize?(O=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(O),this.saxParser.close()):(O=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(O),d(this.processAsync))}catch(A){if(w=A,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},E.prototype.assignOrPush=function(O,w,A){return w in O?(O[w]instanceof Array||r(O,w,[O[w]]),O[w].push(A)):this.options.explicitArray?r(O,w,[A]):r(O,w,A)},E.prototype.reset=function(){var O,w,A,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(p){return function(v){if(p.saxParser.resume(),!p.saxParser.errThrown)return p.saxParser.errThrown=!0,p.emit("error",v)}}(this),this.saxParser.onend=function(p){return function(){if(!p.saxParser.ended)return p.saxParser.ended=!0,p.emit("end",p.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,N=[],O=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=function(p){return function(v){var I,P,L,M,T;if(L={},L[w]="",!p.options.ignoreAttrs){T=v.attributes;for(I in T)l.call(T,I)&&(!(O in L)&&!p.options.mergeAttrs&&(L[O]={}),P=p.options.attrValueProcessors?s(p.options.attrValueProcessors,v.attributes[I],I):v.attributes[I],M=p.options.attrNameProcessors?s(p.options.attrNameProcessors,I):I,p.options.mergeAttrs?p.assignOrPush(L,M,P):r(L[O],M,P))}return L["#name"]=p.options.tagNameProcessors?s(p.options.tagNameProcessors,v.name):v.name,p.options.xmlns&&(L[p.options.xmlnskey]={uri:v.uri,local:v.local}),N.push(L)}}(this),this.saxParser.onclosetag=function(p){return function(){var v,I,P,L,M,T,b,F,$,U;if(T=N.pop(),M=T["#name"],(!p.options.explicitChildren||!p.options.preserveChildrenOrder)&&delete T["#name"],T.cdata===!0&&(v=T.cdata,delete T.cdata),$=N[N.length-1],T[w].match(/^\s*$/)&&!v?(I=T[w],delete T[w]):(p.options.trim&&(T[w]=T[w].trim()),p.options.normalize&&(T[w]=T[w].replace(/\s{2,}/g," ").trim()),T[w]=p.options.valueProcessors?s(p.options.valueProcessors,T[w],M):T[w],Object.keys(T).length===1&&w in T&&!p.EXPLICIT_CHARKEY&&(T=T[w])),i(T)&&(typeof p.options.emptyTag=="function"?T=p.options.emptyTag():T=p.options.emptyTag!==""?p.options.emptyTag:I),p.options.validator!=null&&(U="/"+function(){var B,V,W;for(W=[],B=0,V=N.length;B<V;B++)L=N[B],W.push(L["#name"]);return W}().concat(M).join("/"),function(){var B;try{return T=p.options.validator(U,$&&$[M],T)}catch(V){return B=V,p.emit("error",B)}}()),p.options.explicitChildren&&!p.options.mergeAttrs&&typeof T=="object"){if(!p.options.preserveChildrenOrder)L={},p.options.attrkey in T&&(L[p.options.attrkey]=T[p.options.attrkey],delete T[p.options.attrkey]),!p.options.charsAsChildren&&p.options.charkey in T&&(L[p.options.charkey]=T[p.options.charkey],delete T[p.options.charkey]),Object.getOwnPropertyNames(T).length>0&&(L[p.options.childkey]=T),T=L;else if($){$[p.options.childkey]=$[p.options.childkey]||[],b={};for(P in T)l.call(T,P)&&r(b,P,T[P]);$[p.options.childkey].push(b),delete T["#name"],Object.keys(T).length===1&&w in T&&!p.EXPLICIT_CHARKEY&&(T=T[w])}}return N.length>0?p.assignOrPush($,M,T):(p.options.explicitRoot&&(F=T,T={},r(T,M,F)),p.resultObject=T,p.saxParser.ended=!0,p.emit("end",p.resultObject))}}(this),A=function(p){return function(v){var I,P;if(P=N[N.length-1],P)return P[w]+=v,p.options.explicitChildren&&p.options.preserveChildrenOrder&&p.options.charsAsChildren&&(p.options.includeWhiteChars||v.replace(/\\n/g,"").trim()!=="")&&(P[p.options.childkey]=P[p.options.childkey]||[],I={"#name":"__text__"},I[w]=v,p.options.normalize&&(I[w]=I[w].replace(/\s{2,}/g," ").trim()),P[p.options.childkey].push(I)),P}}(this),this.saxParser.ontext=A,this.saxParser.oncdata=function(p){return function(v){var I;if(I=A(v),I)return I.cdata=!0}}()},E.prototype.parseString=function(O,w){var A;w!=null&&typeof w=="function"&&(this.on("end",function(N){return this.reset(),w(null,N)}),this.on("error",function(N){return this.reset(),w(N)}));try{return O=O.toString(),O.trim()===""?(this.emit("end",null),!0):(O=e.stripBOM(O),this.options.async?(this.remaining=O,d(this.processAsync),this.saxParser):this.saxParser.write(O).close())}catch(N){if(A=N,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw A}else return this.emit("error",A),this.saxParser.errThrown=!0}},E.prototype.parseStringPromise=function(O){return new Promise(function(w){return function(A,N){return w.parseString(O,function(p,v){return p?N(p):A(v)})}}(this))},E}(o),t.parseString=function(m,E,O){var w,A,N;return O!=null?(typeof O=="function"&&(w=O),typeof E=="object"&&(A=E)):(typeof E=="function"&&(w=E),A={}),N=new t.Parser(A),N.parseString(m,w)},t.parseStringPromise=function(m,E){var O,w;return typeof E=="object"&&(O=E),w=new t.Parser(O),w.parseStringPromise(m)}}).call(q)}(Zt)),Zt}var Ai;(function(){var t,e,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=bn(),t=ga(),n=ba(),_i(),e.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),t.Builder,n.Parser,n.parseString,Ai=n.parseStringPromise}).call(q);class wa{constructor(e,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=e,this.cdp=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"",this.excludedPaths=r.excludedPaths||[];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 e=>{try{const n=await Ai(e,{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",e=>{this.handleCdpMessage(e)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const e=this.scriptIdByUrl.entries().next().value;e&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:e[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! 🎉
|
|
85
85
|
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
86
86
|
|
|
87
87
|
1. Add breakpoints in your files to start step debugging.
|
|
@@ -89,13 +89,13 @@ Actual: `+m.attribValue);else{var x=m.tag,C=m.tags[m.tags.length-1]||m;x.ns===C.
|
|
|
89
89
|
2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
|
|
90
90
|
|
|
91
91
|
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[e,n]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(e,n)}async sendScriptToCDP(e,n){const r=this.uriFromBridgeToCDPSyntaxHighlight(e),o=this.uriFromBridgeToCDP(e);try{const i=await this.readPHPFile(e),s=i.split(`
|
|
92
|
-
`),a=s.map((l
|
|
92
|
+
`),a=s.map((f,l)=>l===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a};this.isExcludedPath(e)&&(u.x_google_ignoreList=[0]);const 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(e){let n=this.scriptIdByUrl.get(e);return n||(n=Yi("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(e,n)),n}isExcludedPath(e){return this.excludedPaths.some(n=>e===n||e.startsWith(n+"/"))}formatPropertyFullName(e){let n=!1,r="";for(const o of e)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||e.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(e,n){const o=(this.nextTxnId++).toString();let i=`${e} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(e){const{id:n,method:r,params:o}=e;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 d=this.uriFromCDPToBridge(a),c=this.uriFromBridgeToDBGP(d),f=(typeof u=="number"?u:0)+1,l=String(this.breakpoints.size+1);if(this.xdebugConnected){const m=`breakpoint_set -t line -f ${this.formatPropertyFullName(c)} -n ${f}`,E=this.sendDbgpCommand(m);this.pendingCommands.set(E,{cdpId:n,cdpMethod:r,params:{breakpointId:l,fileUri:d,lineNumber:f}}),s=!1}else this.breakpoints.set(l,{cdpId:l,xdebugId:null,fileUri:d,lineNumber:f}),i={breakpointId:l,locations:[{scriptId:this.getOrCreateScriptId(d),lineNumber:f-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),d=this.breakpoints.get(u);if(d){if(d.xdebugId&&this.xdebugConnected){const c=`breakpoint_remove -d ${d.xdebugId}`,f=this.sendDbgpCommand(c);this.pendingCommands.set(f,{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 d=Buffer.from(a).toString("base64"),c=this.sendDbgpCommand("eval",`-- ${d}`);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 d=u.contextId??0,f=`context_get -d ${u.depth} -c ${d} -p 0 -m 32`,l=this.sendDbgpCommand(f),m={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,m),this.pendingCommands.set(l,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const d=u.depth,c=u.fullname,f=this.formatPropertyFullName(c),l=`property_get -d ${d} -n ${f} -p 0 -m 32`,m=this.sendDbgpCommand(l),E={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,E),this.pendingCommands.set(m,{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],d=[];u&&d.push(`Here's the full path for your convenience:
|
|
93
93
|
`,`${this.uriFromBridgeToCDPSyntaxHighlight(u).replace("file://","")}
|
|
94
|
-
`),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...
|
|
94
|
+
`),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...d,"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:
|
|
95
95
|
`,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
|
|
96
|
-
`)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(e){return`file://PHP.wasm/${e}`}uriFromBridgeToCDP(e){return e=this.scriptIdByUrl.get(e)??"",`file://placeholders/${e}`}uriFromCDPToBridge(e){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===e.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(e){return ee.resolve(process.cwd(),e)}uriFromDBGPToBridge(e){e=e.startsWith("file://")?e.slice(7):e;const n=e.indexOf(this.phpRoot);return n!==-1?e.slice(n):e}async handleDbgpMessage(e){if(e.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(e.response){const n=e.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:
|
|
97
|
-
`),await new Promise(
|
|
98
|
-
`));re.unshift("-d",`openssl.cafile=${
|
|
96
|
+
`)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(e){return`file://PHP.wasm/${e}`}uriFromBridgeToCDP(e){return e=this.scriptIdByUrl.get(e)??"",`file://placeholders/${e}`}uriFromCDPToBridge(e){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===e.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(e){return ee.resolve(process.cwd(),e)}uriFromDBGPToBridge(e){e=e.startsWith("file://")?e.slice(7):e;const n=e.indexOf(this.phpRoot);return n!==-1?e.slice(n):e}async handleDbgpMessage(e){if(e.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(e.response){const n=e.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:d,fileUri:c,lineNumber:f}=u;this.breakpoints.set(d,{cdpId:d,xdebugId:a,fileUri:c,lineNumber:f});const l=this.getOrCreateScriptId(c),m={breakpointId:d,locations:[{scriptId:l,lineNumber:f-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:m})}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 d=n.property,c=d.$.type,f=d.$.encoding;let l=null;if(Object.prototype.hasOwnProperty.call(d,"_")?l=d._:typeof d.$value<"u"&&(l=d.$value),f==="base64"&&l!==null)try{l=Buffer.from(l,"base64").toString()}catch{}if(c==="string")a={type:"string",value:l??""};else if(c==="int"||c==="float"||c==="bool"||c==="boolen"||c==="integer"||c==="double"){let m=l;c.startsWith("int")||c==="integer"?m=parseInt(l||"0",10):c==="float"||c==="double"?m=parseFloat(l||"0"):c.startsWith("bool")&&(m=l==="1"||l==="true"),a={type:"number",value:m}}else if(c==="array"||c==="object"){const m=d.$.classname||(c==="array"?"Array":"Object"),E=String(this.nextObjectId++),O=d.$.fullname||"";this.objectHandles.set(E,{type:"property",depth:0,contextId:0,fullname:O}),a={type:"object",objectId:E,className:m,description:m}}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,d=n.property?.property??n.property,c=[];if(d){const f=Array.isArray(d)?d:[d];for(const l of f){const m=l.$.name||l.$.fullname||"";let E=l.$.type||"undefined";const O=l.$.children==="1",w=l.$.encoding;let A=null;if(typeof l._<"u"&&(A=l._),w==="base64"&&A!==null)try{A=Buffer.from(A,"base64").toString()}catch{}if(O){const N=l.$.classname||(E==="array"?"Array":"Object"),p=String(this.nextObjectId++),v=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(p,{type:"property",depth:I,contextId:v,fullname:l.$.fullname||m}),c.push({name:l.$.key||m,value:{type:"object",className:N,description:N,objectId:p},writable:!1,configurable:!1,enumerable:!0})}else{let N,p;E==="string"?N=A??"":E==="int"||E==="integer"?N=parseInt(A||"0",10):E==="float"||E==="double"?N=parseFloat(A||"0"):E==="bool"||E==="boolean"?(N=A==="1"||A==="true",E="boolean"):E==="null"?(N=null,p="null"):N=A;const v={type:E==="integer"?"number":E};p&&(v.subtype=p),v.value=N,c.push({name:l.$.key||m,value:v,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const f=(u.aggregatedProps||[]).concat(c),l=32;if(c.length===l){const E=(u.currentPage||0)+1,O={...u,currentPage:E,aggregatedProps:f};this.objectHandles.set(a,O);let w;if(o==="context_get"){const N=u.contextId??0;w=`context_get -d ${u.depth} -c ${N} -p ${E} -m ${l}`}else{const N=u.depth,p=u.fullname,v=this.formatPropertyFullName(p);w=`property_get -d ${N} -n ${v} -p ${E} -m ${l}`}const A=this.sendDbgpCommand(w);this.pendingCommands.set(A,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const E={result:f};this.cdp.sendMessage({id:s.cdpId,result:E}),this.pendingCommands.delete(i)}}else{const f={result:c};this.cdp.sendMessage({id:s.cdpId,result:f}),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 f=this.uriFromDBGPToBridge(c.$.filename),l=this.getOrCreateScriptId(f);this.scriptIdByUrl.has(f)||(this.scriptIdByUrl.set(f,l),await this.sendScriptToCDP(f,l))}for(const c of a){const f=parseInt(c.$.level,10),l=this.uriFromDBGPToBridge(c.$.filename),m=parseInt(c.$.lineno,10),E=c.$.where&&c.$.where!=="{main}"?c.$.where:"(anonymous)",O=`frame:${f}`;this.callFramesMap.set(O,f);const w=[],A=String(this.nextObjectId++);this.objectHandles.set(A,{type:"context",contextId:0,depth:f}),w.push({type:"local",object:{objectId:A,className:"Object",description:"Local"}});const N=String(this.nextObjectId++);this.objectHandles.set(N,{type:"context",contextId:1,depth:f}),w.push({type:"global",object:{objectId:N,className:"Object",description:"Global"}}),u.push({callFrameId:O,functionName:E,location:{scriptId:this.getOrCreateScriptId(l),lineNumber:m-1,columnNumber:0},scopeChain:w,this:{type:"object",className:"Object",description:"Object",objectId:N}})}let d="pause";if(a.length>0){const c=a[0];if(c.$.filename&&c.$.lineno){const f=this.uriFromDBGPToBridge(c.$.filename),l=parseInt(c.$.lineno,10);for(const m of this.breakpoints.values())if(m.fileUri===f&&m.lineNumber===l){d="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:d,callFrames:u,hitBreakpoints:d==="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(e.stream){const n=e.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 e.notify}}async function Ea(t){const e=t.cdpPort??9229,n=t.dbgpPort??9003,r=t.cdpHost??"127.0.0.1",o=t.phpRoot??process.cwd(),i=t.breakOnFirstLine??!1,s=t.excludedPaths??[];he.log("Starting XDebug Bridge...");const a=new Ho(e);he.log("Connect Chrome DevTools to CDP at:"),he.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${e}
|
|
97
|
+
`),await new Promise(m=>a.on("clientConnected",m)),await new Promise(m=>setTimeout(m,2e3)),he.log("Chrome connected! Initializing Xdebug receiver...");const u=new Yo(n);he.log(`XDebug receiver running on port ${n}`),he.log("Running a PHP script with Xdebug enabled...");function d(m){return s.some(E=>m===E||m.startsWith(E+"/"))}async function c(m){if(d(m))return[];const E=[],O=t.phpInstance?await t.phpInstance.listFiles(m):ki(m);for(const w of O){const A=ee.join(m,w);if(!d(A))try{(t.phpInstance?await t.phpInstance.isDir(A):Ri(A).isDirectory())?E.push(...await c(A)):w.endsWith(".php")&&E.push(A)}catch{}}return E}const f=t.phpInstance?m=>t.phpInstance.readFileAsText(m):t.getPHPFile?t.getPHPFile:m=>fn(m,"utf-8"),l=await c(o);return new wa(u,a,{knownScriptUrls:l,phpRoot:o,getPHPFile:f,breakOnFirstLine:i,excludedPaths:s})}let re=process.argv.slice(2);re.length||(re=["--help"]);const Y=new Qi({verbosity:"normal"}),Pi=(import.meta||{}).url,nt=new URL("ca-bundle.crt",Pi).pathname;Bi(nt)||$r(nt,Xi.join(`
|
|
98
|
+
`));re.unshift("-d",`openssl.cafile=${nt}`,"-d",`curl.cainfo=${nt}`);async function Na(){const t=new URL("php.ini",Pi).pathname,e=process.env.PHP||Li;if(!Si.includes(e))throw new Error(`Unsupported PHP version ${e}`);const n=re.some(l=>l.startsWith("--xdebug"));n&&(re=re.filter(l=>l!=="--xdebug"));const r=re.some(l=>l.startsWith("--experimental-devtools"));r&&(re=re.filter(l=>l!=="--experimental-devtools"));const o=re.filter(l=>l.startsWith("--experimental-unsafe-ide-integration")).map(l=>{const m=l.split("=")[1];return m===void 0?["vscode","phpstorm"]:m.includes(",")?m.split(","):[m]})[0]??!1;o&&(re=re.filter(l=>!l.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=Fn(ee.join(jn.tmpdir(),"php-wasm-bin"));$r(`${a}/php`,`#!/bin/sh
|
|
99
99
|
${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
|
|
100
|
-
`)
|
|
100
|
+
`),$i(`${a}/php`,493);const u=Fn(ee.join(jn.tmpdir(),"php-wasm-sys-tmp")),d=new Di(await Ui(e,{fileLockManager:new Mi,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},extensions:n?[{name:"xdebug",options:Mo({pathSkippings:[...Yn]})}]:[]}));if(d.setSpawnHandler((l,m)=>Ci(l,m,{shell:!0,stdio:["pipe","pipe","pipe"]})),qi(d),n&&o)try{const l="PHP.wasm CLI - Listen for Xdebug",m=o;await Do(l,process.cwd());const E=await So({name:l,host:"example.com",port:443,ides:m,cwd:process.cwd(),pathSkippings:[...Yn]}),O=m.includes("vscode"),w=m.includes("phpstorm"),A=Object.values(E);Y.print(""),A.length>0?(Y.print(Y.bold("Xdebug configured successfully")),Y.print(Y.highlight("Updated IDE config: ")+A.join(" "))):(Y.print(Y.bold("Xdebug configuration failed.")),Y.print("No IDE-specific project settings directory was found in the current working directory.")),Y.print(""),O&&E.vscode&&(Y.print(Y.bold("VS Code / Cursor instructions:")),Y.print(" 1. Ensure you have installed an IDE extension for PHP Debugging"),Y.print(` (The ${Y.bold("PHP Debug")} extension by ${Y.bold("Xdebug")} has been a solid option)`),Y.print(" 2. Open the Run and Debug panel on the left sidebar"),Y.print(` 3. Select "${Y.italic(l)}" from the dropdown`),Y.print(' 4. Click "start debugging"'),Y.print(" 5. Set a breakpoint."),Y.print(" 6. Run your command with PHP.wasm CLI."),w&&Y.print("")),w&&E.phpstorm&&(Y.print(Y.bold("PhpStorm instructions:")),Y.print(` 1. Choose "${Y.italic(l)}" debug configuration in the toolbar`),Y.print(" 2. Click the debug button (bug icon)"),Y.print(" 3. Set a breakpoint."),Y.print(" 4. Run your command with PHP.wasm CLI.")),Y.print("")}catch(l){throw new Error("Could not configure Xdebug",{cause:l})}n&&r&&(await Ea({breakOnFirstLine:!0})).start(),re.some(l=>l.startsWith("-c"))||re.unshift("-c",t);const f=await d.cli(["php",...re]);f.stderr.pipeTo(new WritableStream({write(l){process.stderr.write(l)}})),f.stdout.pipeTo(new WritableStream({write(l){process.stdout.write(l)}})),await f.exitCode.catch(l=>{throw l.name==="ExitStatus"&&process.exit(l.status===void 0?1:l.status),l}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Na();
|
|
101
101
|
//# sourceMappingURL=main.js.map
|