@php-wasm/cli 3.0.44 → 3.0.45
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 +51 -56
- package/main.js.map +1 -1
- package/package.json +6 -6
package/main.js
CHANGED
|
@@ -1,99 +1,94 @@
|
|
|
1
|
-
import{LatestSupportedPHPVersion as
|
|
2
|
-
`&&e[
|
|
3
|
-
`||e==="\r"}function Pr(e,t){const r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const n=e.substr(r,t-r);if(t>5&&n==="xml")return ie("InvalidXml","XML declaration allowed only at the start of the document.",le(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _r(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const $i='"',qi="'";function Wi(e,t){let r="",n="",a=!1;for(;t<e.length;t++){if(e[t]===$i||e[t]===qi)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){a=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:a}}const Hi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Dr(e,t){const r=jn(e,Hi),n={};for(let a=0;a<r.length;a++){if(r[a][1].length===0)return ie("InvalidAttr","Attribute '"+r[a][2]+"' has no space in starting.",Ve(r[a]));if(r[a][3]!==void 0&&r[a][4]===void 0)return ie("InvalidAttr","Attribute '"+r[a][2]+"' is without value.",Ve(r[a]));if(r[a][3]===void 0&&!t.allowBooleanAttributes)return ie("InvalidAttr","boolean attribute '"+r[a][2]+"' is not allowed.",Ve(r[a]));const o=r[a][2];if(!zi(o))return ie("InvalidAttr","Attribute '"+o+"' is an invalid name.",Ve(r[a]));if(!n.hasOwnProperty(o))n[o]=1;else return ie("InvalidAttr","Attribute '"+o+"' is repeated.",Ve(r[a]))}return!0}function Gi(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function Yi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Gi(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function ie(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function zi(e){return it(e)}function Qi(e){return it(e)}function le(e,t){const r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function Ve(e){return e.startIndex+e[1].length}const Ji={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1},Zi=function(e){return Object.assign({},Ji,e)};let Ke;typeof Symbol!="function"?Ke="@@xmlMetadata":Ke=Symbol("XML Node Metadata");class De{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Ke]={startIndex:r})}static getMetaDataSymbol(){return Ke}}class Ki{constructor(t){this.suppressValidationErr=!t}readDocType(t,r){const n={};if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let a=1,o=!1,i=!1,s="";for(;r<t.length;r++)if(t[r]==="<"&&!i){if(o&&Le(t,"!ENTITY",r)){r+=7;let l,d;[l,d,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),d.indexOf("&")===-1&&(n[l]={regx:RegExp(`&${l};`,"g"),val:d})}else if(o&&Le(t,"!ELEMENT",r)){r+=8;const{index:l}=this.readElementExp(t,r+1);r=l}else if(o&&Le(t,"!ATTLIST",r))r+=8;else if(o&&Le(t,"!NOTATION",r)){r+=9;const{index:l}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=l}else if(Le(t,"!--",r))i=!0;else throw new Error("Invalid DOCTYPE");a++,s=""}else if(t[r]===">"){if(i?t[r-1]==="-"&&t[r-2]==="-"&&(i=!1,a--):a--,a===0)break}else t[r]==="["?o=!0:s+=t[r];if(a!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)n+=t[r],r++;if($e(n),r=he(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let a="";return[r,a]=this.readIdentifierVal(t,r,"entity"),r--,[n,a,r]}readNotationExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;!this.suppressValidationErr&&$e(n),r=he(t,r);const a=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&a!=="SYSTEM"&&a!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${a}"`);r+=a.length,r=he(t,r);let o=null,i=null;if(a==="PUBLIC")[r,o]=this.readIdentifierVal(t,r,"publicIdentifier"),r=he(t,r),(t[r]==='"'||t[r]==="'")&&([r,i]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(a==="SYSTEM"&&([r,i]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:i,index:--r}}readIdentifierVal(t,r,n){let a="";const o=t[r];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(r++;r<t.length&&t[r]!==o;)a+=t[r],r++;if(t[r]!==o)throw new Error(`Unterminated ${n} value`);return r++,[r,a]}readElementExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;if(!this.suppressValidationErr&&!it(n))throw new Error(`Invalid element name: "${n}"`);r=he(t,r);let a="";if(t[r]==="E"&&Le(t,"MPTY",r))r+=4;else if(t[r]==="A"&&Le(t,"NY",r))r+=2;else if(t[r]==="("){for(r++;r<t.length&&t[r]!==")";)a+=t[r],r++;if(t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:n,contentModel:a.trim(),index:r}}readAttlistExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;$e(n),r=he(t,r);let a="";for(;r<t.length&&!/\s/.test(t[r]);)a+=t[r],r++;if(!$e(a))throw new Error(`Invalid attribute name: "${a}"`);r=he(t,r);let o="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=he(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let s=[];for(;r<t.length&&t[r]!==")";){let l="";for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)l+=t[r],r++;if(l=l.trim(),!$e(l))throw new Error(`Invalid notation name: "${l}"`);s.push(l),t[r]==="|"&&(r++,r=he(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+s.join("|")+")"}else{for(;r<t.length&&!/\s/.test(t[r]);)o+=t[r],r++;const s=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!s.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=he(t,r);let i="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:n,attributeName:a,attributeType:o,defaultValue:i,index:r}}}const he=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Le(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1;return!0}function $e(e){if(it(e))return e;throw new Error(`Invalid entity name ${e}`)}const eo=/^[-+]?0x[a-fA-F0-9]+$/,to=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,ro={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function no(e,t={}){if(t=Object.assign({},ro,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(e==="0")return 0;if(t.hex&&eo.test(r))return ao(r,16);if(r.includes("e")||r.includes("E"))return oo(e,r,t);{const n=to.exec(r);if(n){const a=n[1]||"",o=n[2];let i=so(n[3]);const s=a?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!s))return e;{const l=Number(r),d=String(l);if(l===0)return l;if(d.search(/[eE]/)!==-1)return t.eNotation?l:e;if(r.indexOf(".")!==-1)return d==="0"||d===i||d===`${a}${i}`?l:e;let g=o?i:r;return o?g===d||a+g===d?l:e:g===d||g===a+d?l:e}}else return e}}const io=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function oo(e,t,r){if(!r.eNotation)return e;const n=t.match(io);if(n){let a=n[1]||"";const o=n[3].indexOf("e")===-1?"E":"e",i=n[2],s=a?e[i.length+1]===o:e[i.length]===o;return i.length>1&&s?e:i.length===1&&(n[3].startsWith(`.${o}`)||n[3][0]===o)?Number(t):r.leadingZeros&&!s?(t=(n[1]||"")+n[3],Number(t)):e}else return e}function so(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function ao(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Un(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}class uo{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCodePoint(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCodePoint(Number.parseInt(n,16))}},this.addExternalEntities=co,this.parseXml=go,this.parseTextData=lo,this.resolveNameSpace=fo,this.buildAttributesMap=po,this.isItStopNode=bo,this.replaceEntitiesValue=yo,this.readStopNodeData=To,this.saveTextToParentTag=wo,this.addChild=mo,this.ignoreAttributesFn=Un(this.options.ignoreAttributes)}}function co(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function lo(e,t,r,n,a,o,i){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,r,a,o);return s==null?e:typeof s!=typeof e||s!==e?s:this.options.trimValues?Kt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Kt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function fo(e){if(this.options.removeNSPrefix){const t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}const ho=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function po(e,t,r){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const n=jn(e,ho),a=n.length,o={};for(let i=0;i<a;i++){const s=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(s,t))continue;let l=n[i][4],d=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const g=this.options.attributeValueProcessor(s,l,t);g==null?o[d]=l:typeof g!=typeof l||g!==l?o[d]=g:o[d]=Kt(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const go=function(e){e=e.replace(/\r\n?/g,`
|
|
4
|
-
`);const t=new
|
|
5
|
-
`;function
|
|
1
|
+
import{LatestSupportedPHPVersion as ti,SupportedPHPVersionsList as ni,PHP as ri}from"@php-wasm/universal";import{spawn as ii}from"child_process";import K,{readFileSync as Qt,writeFile as si,statSync as oi,readdirSync as ai,lstatSync as ui,existsSync as ci,writeFileSync as Tr,mkdtempSync as mn,chmodSync as li}from"fs";import yn from"os";import{rootCertificates as fi}from"tls";import ne,{resolve as Jt,normalize as pi}from"path";import{loadNodeRuntime as hi,FileLockManagerForNode as di,useHostFilesystem as gi}from"@php-wasm/node";import{WebSocketServer as mi}from"ws";import yi from"net";import"assert";import{format as Er}from"util";import{fileURLToPath as bi}from"url";import{createHash as wi}from"crypto";import Ti from"timers";const Nr=":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",Ei=Nr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ni="["+Nr+"]["+Ei+"]*",Ii=new RegExp("^"+Ni+"$");function Ir(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const Ye=function(e){const t=Ii.exec(e);return!(t===null||typeof t>"u")};function vi(e){return typeof e<"u"}const Oi={allowBooleanAttributes:!1,unpairedTags:[]};function Ai(e,t){t=Object.assign({},Oi,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=wn(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=Tn(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
|
|
2
|
+
`&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!Ci(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Z("InvalidTag",h,se(e,i))}const l=xi(e,i);if(l===!1)return Z("InvalidAttr","Attributes for '"+u+"' have open quote.",se(e,i));let f=l.value;if(i=l.index,f[f.length-1]==="/"){const h=i-f.length;f=f.substring(0,f.length-1);const d=En(f,t);if(d===!0)r=!0;else return Z(d.err.code,d.err.msg,se(e,h+d.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return Z("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",se(e,s));if(n.length===0)return Z("InvalidTag","Closing tag '"+u+"' has not been opened.",se(e,s));{const h=n.pop();if(u!==h.tagName){let d=se(e,h.tagStartPos);return Z("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+u+"'.",se(e,s))}n.length==0&&(o=!0)}}else return Z("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",se(e,i));else{const h=En(f,t);if(h!==!0)return Z(h.err.code,h.err.msg,se(e,i-f.length+h.err.line));if(o===!0)return Z("InvalidXml","Multiple possible root nodes found.",se(e,i));t.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Tn(e,i);continue}else if(e[i+1]==="?"){if(i=wn(e,++i),i.err)return i}else break;else if(e[i]==="&"){const h=Mi(e,i);if(h==-1)return Z("InvalidChar","char '&' is not expected.",se(e,i));i=h}else if(o===!0&&!bn(e[i]))return Z("InvalidXml","Extra text at the end",se(e,i));e[i]==="<"&&i--}}else{if(bn(e[i]))continue;return Z("InvalidChar","char '"+e[i]+"' is not expected.",se(e,i))}if(r){if(n.length==1)return Z("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",se(e,n[0].tagStartPos));if(n.length>0)return Z("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Z("InvalidXml","Start tag expected.",1);return!0}function bn(e){return e===" "||e===" "||e===`
|
|
3
|
+
`||e==="\r"}function wn(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Z("InvalidXml","XML declaration allowed only at the start of the document.",se(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Tn(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const Li='"',Pi="'";function xi(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Li||e[t]===Pi)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const _i=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function En(e,t){const n=Ir(e,_i),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",je(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",je(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Z("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",je(n[o]));const i=n[o][2];if(!Si(i))return Z("InvalidAttr","Attribute '"+i+"' is an invalid name.",je(n[o]));if(!r.hasOwnProperty(i))r[i]=1;else return Z("InvalidAttr","Attribute '"+i+"' is repeated.",je(n[o]))}return!0}function Di(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Mi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Di(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Z(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Si(e){return Ye(e)}function Ci(e){return Ye(e)}function se(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function je(e){return e.startIndex+e[1].length}const Fi={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},ji=function(e){return Object.assign({},Fi,e)};let $e;typeof Symbol!="function"?$e="@@xmlMetadata":$e=Symbol("XML Node Metadata");class Oe{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][$e]={startIndex:n})}static getMetaDataSymbol(){return $e}}class ki{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,i=!1,s=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!s){if(i&&Ne(t,"!ENTITY",n)){n+=7;let u,l;[u,l,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),l.indexOf("&")===-1&&(r[u]={regx:RegExp(`&${u};`,"g"),val:l})}else if(i&&Ne(t,"!ELEMENT",n)){n+=8;const{index:u}=this.readElementExp(t,n+1);n=u}else if(i&&Ne(t,"!ATTLIST",n))n+=8;else if(i&&Ne(t,"!NOTATION",n)){n+=9;const{index:u}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=u}else if(Ne(t,"!--",n))s=!0;else throw new Error("Invalid DOCTYPE");o++,a=""}else if(t[n]===">"){if(s?t[n-1]==="-"&&t[n-2]==="-"&&(s=!1,o--):o--,o===0)break}else t[n]==="["?i=!0:a+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(ke(r),n=ae(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&ke(r),n=ae(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=ae(t,n);let i=null,s=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ae(t,n),(t[n]==='"'||t[n]==="'")&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:i,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(n++;n<t.length&&t[n]!==i;)o+=t[n],n++;if(t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Ye(r))throw new Error(`Invalid element name: "${r}"`);n=ae(t,n);let o="";if(t[n]==="E"&&Ne(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ne(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;ke(r),n=ae(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!ke(o))throw new Error(`Invalid attribute name: "${o}"`);n=ae(t,n);let i="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=ae(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let u="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)u+=t[n],n++;if(u=u.trim(),!ke(u))throw new Error(`Invalid notation name: "${u}"`);a.push(u),t[n]==="|"&&(n++,n=ae(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)i+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=ae(t,n);let s="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:i,defaultValue:s,index:n}}}const ae=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Ne(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function ke(e){if(Ye(e))return e;throw new Error(`Invalid entity name ${e}`)}const Bi=/^[-+]?0x[a-fA-F0-9]+$/,Ri=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Xi={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ui(e,t={}){if(t=Object.assign({},Xi,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Bi.test(n))return Wi(n,16);if(n.includes("e")||n.includes("E"))return $i(e,n,t);{const r=Ri.exec(n);if(r){const o=r[1]||"",i=r[2];let s=qi(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const u=Number(n),l=String(u);if(u===0)return u;if(l.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return l==="0"||l===s||l===`${o}${s}`?u:e;let f=i?s:n;return i?f===l||o+f===l?u:e:f===l||f===o+l?u:e}}else return e}}const Vi=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function $i(e,t,n){if(!n.eNotation)return e;const r=t.match(Vi);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function qi(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function Wi(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function vr(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Hi{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=Gi,this.parseXml=Zi,this.parseTextData=Yi,this.resolveNameSpace=zi,this.buildAttributesMap=Ji,this.isItStopNode=ns,this.replaceEntitiesValue=es,this.readStopNodeData=is,this.saveTextToParentTag=ts,this.addChild=Ki,this.ignoreAttributesFn=vr(this.options.ignoreAttributes)}}function Gi(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function Yi(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,o,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function zi(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Qi=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Ji(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Ir(e,Qi),o=r.length,i={};for(let s=0;s<o;s++){const a=this.resolveNameSpace(r[s][1]);if(this.ignoreAttributesFn(a,t))continue;let u=r[s][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);const f=this.options.attributeValueProcessor(a,u,t);f==null?i[l]=u:typeof f!=typeof u||f!==u?i[l]=f:i[l]=qt(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const s={};return s[this.options.attributesGroupName]=i,s}return i}}const Zi=function(e){e=e.replace(/\r\n?/g,`
|
|
4
|
+
`);const t=new Oe("!xml");let n=t,r="",o="";const i=new ki(this.options.processEntities);for(let s=0;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="/"){const u=Ae(e,">",s,"Closing Tag is not closed.");let l=e.substring(s+2,u).trim();if(this.options.removeNSPrefix){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),n&&(r=this.saveTextToParentTag(r,n,o));const f=o.substring(o.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let h=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(h=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=o.lastIndexOf("."),o=o.substring(0,h),n=this.tagsNodeStack.pop(),r="",s=u}else if(e[s+1]==="?"){let u=$t(e,s,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&u.tagName==="?xml"||this.options.ignorePiTags)){const l=new Oe(u.tagName);l.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(l[":@"]=this.buildAttributesMap(u.tagExp,o,u.tagName)),this.addChild(n,l,o,s)}s=u.closeIndex+1}else if(e.substr(s+1,3)==="!--"){const u=Ae(e,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const l=e.substring(s+4,u-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}s=u}else if(e.substr(s+1,2)==="!D"){const u=i.readDocType(e,s);this.docTypeEntities=u.entities,s=u.i}else if(e.substr(s+1,2)==="!["){const u=Ae(e,"]]>",s,"CDATA is not closed.")-2,l=e.substring(s+9,u);r=this.saveTextToParentTag(r,n,o);let f=this.parseTextData(l,n.tagname,o,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):n.add(this.options.textNodeName,f),s=u+2}else{let u=$t(e,s,this.options.removeNSPrefix),l=u.tagName;const f=u.rawTagName;let h=u.tagExp,d=u.attrExpPresent,b=u.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const T=n;T&&this.options.unpairedTags.indexOf(T.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),l!==t.tagname&&(o+=o?"."+l:l);const O=s;if(this.isItStopNode(this.options.stopNodes,o,l)){let y="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),o=o.substr(0,o.length-1),h=l):h=h.substr(0,h.length-1),s=u.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)s=u.closeIndex;else{const E=this.readStopNodeData(e,f,b+1);if(!E)throw new Error(`Unexpected end of ${f}`);s=E.i,y=E.tagContent}const D=new Oe(l);l!==h&&d&&(D[":@"]=this.buildAttributesMap(h,o,l)),y&&(y=this.parseTextData(y,l,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),D.add(this.options.textNodeName,y),this.addChild(n,D,o,O)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),o=o.substr(0,o.length-1),h=l):h=h.substr(0,h.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const y=new Oe(l);l!==h&&d&&(y[":@"]=this.buildAttributesMap(h,o,l)),this.addChild(n,y,o,O),o=o.substr(0,o.lastIndexOf("."))}else{const y=new Oe(l);this.tagsNodeStack.push(n),l!==h&&d&&(y[":@"]=this.buildAttributesMap(h,o,l)),this.addChild(n,y,o,O),n=y}r="",s=b}}else r+=e[s];return t.child};function Ki(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const es=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function ts(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function ns(e,t,n){const r="*."+n;for(const o in e){const i=e[o];if(r===i||t===i)return!0}return!1}function rs(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function Ae(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function $t(e,t,n,r=">"){const o=rs(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,l=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const f=u;if(n){const h=u.indexOf(":");h!==-1&&(u=u.substr(h+1),l=u!==o.data.substr(h+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:l,rawTagName:f}}function is(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=Ae(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Ae(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Ae(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Ae(e,"]]>",n,"StopNode is not closed.")-2;else{const i=$t(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function qt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:Ui(e,n)}else return vi(e)?e:""}const tt=Oe.getMetaDataSymbol();function ss(e,t){return Or(e,t)}function Or(e,t,n){let r;const o={};for(let i=0;i<e.length;i++){const s=e[i],a=os(s);let u="";if(n===void 0?u=a:u=n+"."+a,a===t.textNodeName)r===void 0?r=s[a]:r+=""+s[a];else{if(a===void 0)continue;if(s[a]){let l=Or(s[a],t,u);const f=us(l,t);s[tt]!==void 0&&(l[tt]=s[tt]),s[":@"]?as(l,s[":@"],u,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),o[a]!==void 0&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(l)):t.isArray(a,u,f)?o[a]=[l]:o[a]=l}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function os(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function as(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function us(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class Ar{constructor(t){this.externalEntities={},this.options=ji(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=Ai(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Hi(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:ss(o,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Oe.getMetaDataSymbol()}}const cs=`
|
|
5
|
+
`;function ls(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=cs),Lr(e,t,"",n)}function Lr(e,t,n,r){let o="",i=!1;for(let s=0;s<e.length;s++){const a=e[s],u=fs(a);if(u===void 0)continue;let l="";if(n.length===0?l=u:l=`${n}.${u}`,u===t.textNodeName){let T=a[u];ps(l,t)||(T=t.tagValueProcessor(u,T),T=Pr(T,t)),i&&(o+=r),o+=T,i=!1;continue}else if(u===t.cdataPropName){i&&(o+=r),o+=`<![CDATA[${a[u][0][t.textNodeName]}]]>`,i=!1;continue}else if(u===t.commentPropName){o+=r+`<!--${a[u][0][t.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){const T=Nn(a[":@"],t),O=u==="?xml"?"":r;let y=a[u][0][t.textNodeName];y=y.length!==0?" "+y:"",o+=O+`<${u}${y}${T}?>`,i=!0;continue}let f=r;f!==""&&(f+=t.indentBy);const h=Nn(a[":@"],t),d=r+`<${u}${h}`,b=Lr(a[u],t,l,f);t.unpairedTags.indexOf(u)!==-1?t.suppressUnpairedNode?o+=d+">":o+=d+"/>":(!b||b.length===0)&&t.suppressEmptyNode?o+=d+"/>":b&&b.endsWith(">")?o+=d+`>${b}${r}</${u}>`:(o+=d+">",b&&r!==""&&(b.includes("/>")||b.includes("</"))?o+=r+t.indentBy+b+r:o+=b,o+=`</${u}>`),i=!0}return o}function fs(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function Nn(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=Pr(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function ps(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Pr(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const hs={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{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};function we(e){this.options=Object.assign({},hs,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=vr(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ms),this.processTextOrObjNode=ds,this.options.format?(this.indentate=gs,this.tagEndChar=`>
|
|
6
6
|
`,this.newLine=`
|
|
7
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}
|
|
8
|
-
`;break;case 114:
|
|
9
|
-
`),
|
|
10
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
11
|
-
`+" ".repeat(t))}," ":{"\n":new Array(
|
|
12
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
13
|
-
`+" ".repeat(t))}},
|
|
7
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}we.prototype.build=function(e){return this.options.preserveOrder?ls(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};we.prototype.j2x=function(e,t,n){let r="",o="";const i=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(o+="");else if(e[s]===null)this.isAttribute(s)||s===this.options.cdataPropName?o+="":s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)o+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){const a=this.isAttribute(s);if(a&&!this.ignoreAttributesFn(a,i))r+=this.buildAttrPairStr(a,""+e[s]);else if(!a)if(s===this.options.textNodeName){let u=this.options.tagValueProcessor(s,""+e[s]);o+=this.replaceEntitiesValue(u)}else o+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const a=e[s].length;let u="",l="";for(let f=0;f<a;f++){const h=e[s][f];if(!(typeof h>"u"))if(h===null)s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){const d=this.j2x(h,t+1,n.concat(s));u+=d.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(l+=d.attrStr)}else u+=this.processTextOrObjNode(h,s,t,n);else if(this.options.oneListGroup){let d=this.options.tagValueProcessor(s,h);d=this.replaceEntitiesValue(d),u+=d}else u+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(u=this.buildObjectNode(u,s,l,t)),o+=u}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const a=Object.keys(e[s]),u=a.length;for(let l=0;l<u;l++)r+=this.buildAttrPairStr(a[l],""+e[s][a[l]])}else o+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:o}};we.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function ds(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}we.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+o}};we.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};we.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}};we.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function gs(e){return this.options.indentBy.repeat(e)}function ms(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function xr(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,l=0,f=0,h=0;function d(p,w){let I=0,x=0;for(;I<p;){let P=e.charCodeAt(r);if(P>=48&&P<=57)x=x*16+P-48;else if(P>=65&&P<=70)x=x*16+P-65+10;else if(P>=97&&P<=102)x=x*16+P-97+10;else break;r++,I++}return I<p&&(x=-1),x}function b(p){r=p,o="",i=0,s=16,h=0}function T(){let p=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&xe(e.charCodeAt(r)))for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;else return h=3,e.substring(p,r);let w=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&xe(e.charCodeAt(r))){for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;w=r}else h=3;return e.substring(p,w)}function O(){let p="",w=r;for(;;){if(r>=n){p+=e.substring(w,r),h=2;break}const I=e.charCodeAt(r);if(I===34){p+=e.substring(w,r),r++;break}if(I===92){if(p+=e.substring(w,r),r++,r>=n){h=2;break}switch(e.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+=`
|
|
8
|
+
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:const P=d(4);P>=0?p+=String.fromCharCode(P):h=4;break;default:h=5}w=r;continue}if(I>=0&&I<=31)if(Be(I)){p+=e.substring(w,r),h=2;break}else h=6;r++}return p}function y(){if(o="",h=0,i=r,u=a,f=l,r>=n)return i=n,s=17;let p=e.charCodeAt(r);if(nt(p)){do r++,o+=String.fromCharCode(p),p=e.charCodeAt(r);while(nt(p));return s=15}if(Be(p))return r++,o+=String.fromCharCode(p),p===13&&e.charCodeAt(r)===10&&(r++,o+=`
|
|
9
|
+
`),a++,l=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 w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Be(e.charCodeAt(r));)r++;return o=e.substring(w,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const I=n-1;let x=!1;for(;r<I;){const P=e.charCodeAt(r);if(P===42&&e.charCodeAt(r+1)===47){r+=2,x=!0;break}r++,Be(P)&&(P===13&&e.charCodeAt(r)===10&&r++,a++,l=r)}return x||(r++,h=1),o=e.substring(w,r),s=13}return o+=String.fromCharCode(p),r++,s=16;case 45:if(o+=String.fromCharCode(p),r++,r===n||!xe(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=T(),s=11;default:for(;r<n&&D(p);)r++,p=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(p),r++,s=16}}function D(p){if(nt(p)||Be(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 E(){let p;do p=y();while(p>=12&&p<=15);return p}return{setPosition:b,getPosition:()=>r,scan:t?E:y,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-f,getTokenError:()=>h}}function nt(e){return e===32||e===9}function Be(e){return e===10||e===13}function xe(e){return e>=48&&e<=57}var In;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(In||(In={}));const ce=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,vn={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
|
|
10
|
+
`+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
|
|
11
|
+
`+" ".repeat(t))}," ":{"\n":new Array(_e).fill(0).map((e,t)=>`
|
|
12
|
+
`+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
|
|
13
|
+
`+" ".repeat(t))}},ys=[`
|
|
14
14
|
`,"\r",`\r
|
|
15
|
-
`];function
|
|
15
|
+
`];function bs(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!qe(e,i-1);)i--;let I=a;for(;I<e.length&&!qe(e,I);)I++;o=e.substring(i,I),r=ws(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Ts(n,e),l=ys.includes(u);let f=0,h=0,d;n.insertSpaces?d=ce[n.tabSize||4]??De(ce[1],n.tabSize||4):d=" ";const b=d===" "?" ":" ";let T=xr(o,!1),O=!1;function y(){if(f>1)return De(u,f)+De(d,r+h);const I=d.length*(r+h);return!l||I>vn[b][u].length?u+De(d,r+h):I<=0?u:vn[b][u][I]}function D(){let I=T.scan();for(f=0;I===15||I===14;)I===14&&n.keepLines?f+=1:I===14&&(f=1),I=T.scan();return O=I===16||T.getTokenError()!==0,I}const E=[];function p(I,x,P){!O&&(!t||x<a&&P>s)&&e.substring(x,P)!==I&&E.push({offset:x,length:P-x,content:I})}let w=D();if(n.keepLines&&f>0&&p(De(u,f),0,0),w!==17){let I=T.getTokenOffset()+i,x=d.length*r<20&&n.insertSpaces?ce[d.length*r]:De(d,r);p(x,i,I)}for(;w!==17;){let I=T.getTokenOffset()+T.getTokenLength()+i,x=D(),P="",S=!1;for(;f===0&&(x===12||x===13);){let _=T.getTokenOffset()+i;p(ce[1],I,_),I=T.getTokenOffset()+T.getTokenLength()+i,S=x===12,P=S?y():"",x=D()}if(x===2)w!==1&&h--,n.keepLines&&f>0||!n.keepLines&&w!==1?P=y():n.keepLines&&(P=ce[1]);else if(x===4)w!==3&&h--,n.keepLines&&f>0||!n.keepLines&&w!==3?P=y():n.keepLines&&(P=ce[1]);else{switch(w){case 3:case 1:h++,n.keepLines&&f>0||!n.keepLines?P=y():P=ce[1];break;case 5:n.keepLines&&f>0||!n.keepLines?P=y():P=ce[1];break;case 12:P=y();break;case 13:f>0?P=y():S||(P=ce[1]);break;case 6:n.keepLines&&f>0?P=y():S||(P=ce[1]);break;case 10:n.keepLines&&f>0?P=y():x===6&&!S&&(P="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&f>0?P=y():(x===12||x===13)&&!S?P=ce[1]:x!==5&&x!==17&&(O=!0);break;case 16:O=!0;break}f>0&&(x===12||x===13)&&(P=y())}x===17&&(n.keepLines&&f>0?P=y():P=n.insertFinalNewline?u:"");const c=T.getTokenOffset()+i;p(P,I,c),w=x}return E}function De(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function ws(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===ce[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function Ts(e,t){for(let n=0;n<t.length;n++){const r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
|
|
16
16
|
`?`\r
|
|
17
|
-
`:"\r";if(
|
|
17
|
+
`:"\r";if(r===`
|
|
18
18
|
`)return`
|
|
19
19
|
`}return e&&e.eol||`
|
|
20
|
-
`}function
|
|
21
|
-
`.indexOf(e.charAt(t))!==-1}var tt;(function(e){e.DEFAULT={allowTrailingComma:!1}})(tt||(tt={}));function Hn(e,t=[],r=tt.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function a(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function o(l){return n.children.push(l),l}Ro(e,{onObjectBegin:l=>{n=o({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:(l,d,g)=>{n=o({type:"property",offset:d,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:d,length:g,parent:n})},onObjectEnd:(l,d)=>{a(l+d),n.length=l+d-n.offset,n=n.parent,a(l+d)},onArrayBegin:(l,d)=>{n=o({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:(l,d)=>{n.length=l+d-n.offset,n=n.parent,a(l+d)},onLiteralValue:(l,d,g)=>{o({type:jo(l),offset:d,length:g,parent:n,value:l}),a(d+g)},onSeparator:(l,d,g)=>{n.type==="property"&&(l===":"?n.colonOffset=d:l===","&&a(d))},onError:(l,d,g)=>{t.push({error:l,offset:d,length:g})}},r);const s=n.children[0];return s&&delete s.parent,s}function er(e,t){if(!e)return;let r=e;for(let n of t)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let a=!1;for(const o of r.children)if(Array.isArray(o.children)&&o.children[0].value===n&&o.children.length===2){r=o.children[1],a=!0;break}if(!a)return}else{const a=n;if(r.type!=="array"||a<0||!Array.isArray(r.children)||a>=r.children.length)return;r=r.children[a]}return r}function Ro(e,t,r=tt.DEFAULT){const n=Wn(e,!1),a=[];let o=0;function i(X){return X?()=>o===0&&X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function s(X){return X?$=>o===0&&X($,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(X){return X?$=>o===0&&X($,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice()):()=>!0}function d(X){return X?()=>{o>0?o++:X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice())===!1&&(o=1)}:()=>!0}function g(X){return X?()=>{o>0&&o--,o===0&&X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const m=d(t.onObjectBegin),w=l(t.onObjectProperty),E=g(t.onObjectEnd),I=d(t.onArrayBegin),_=g(t.onArrayEnd),T=l(t.onLiteralValue),x=s(t.onSeparator),v=i(t.onComment),h=s(t.onError),O=r&&r.disallowComments,A=r&&r.allowTrailingComma;function F(){for(;;){const X=n.scan();switch(n.getTokenError()){case 4:M(14);break;case 5:M(15);break;case 3:M(13);break;case 1:O||M(11);break;case 2:M(12);break;case 6:M(16);break}switch(X){case 12:case 13:O?M(10):v();break;case 16:M(1);break;case 15:case 14:break;default:return X}}}function M(X,$=[],Y=[]){if(h(X),$.length+Y.length>0){let H=n.getToken();for(;H!==17;){if($.indexOf(H)!==-1){F();break}else if(Y.indexOf(H)!==-1)break;H=F()}}}function k(X){const $=n.getTokenValue();return X?T($):(w($),a.push($)),F(),!0}function y(){switch(n.getToken()){case 11:const X=n.getTokenValue();let $=Number(X);isNaN($)&&(M(2),$=0),T($);break;case 7:T(null);break;case 8:T(!0);break;case 9:T(!1);break;default:return!1}return F(),!0}function B(){return n.getToken()!==10?(M(3,[],[2,5]),!1):(k(!1),n.getToken()===6?(x(":"),F(),W()||M(4,[],[2,5])):M(5,[],[2,5]),a.pop(),!0)}function j(){m(),F();let X=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(X||M(4,[],[]),x(","),F(),n.getToken()===2&&A)break}else X&&M(6,[],[]);B()||M(4,[],[2,5]),X=!0}return E(),n.getToken()!==2?M(7,[2],[]):F(),!0}function U(){I(),F();let X=!0,$=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if($||M(4,[],[]),x(","),F(),n.getToken()===4&&A)break}else $&&M(6,[],[]);X?(a.push(0),X=!1):a[a.length-1]++,W()||M(4,[],[4,5]),$=!0}return _(),X||a.pop(),n.getToken()!==4?M(8,[4],[]):F(),!0}function W(){switch(n.getToken()){case 3:return U();case 1:return j();case 10:return k(!0);default:return y()}}return F(),n.getToken()===17?r.allowEmptyContent?!0:(M(4,[],[]),!1):W()?(n.getToken()!==17&&M(9,[],[]),!0):(M(4,[],[]),!1)}function jo(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function Uo(e,t,r,n){const a=t.slice(),i=Hn(e,[]);let s,l;for(;a.length>0&&(l=a.pop(),s=er(i,a),s===void 0&&r!==void 0);)typeof l=="string"?r={[l]:r}:r=[r];if(s)if(s.type==="object"&&typeof l=="string"&&Array.isArray(s.children)){const d=er(s,[l]);if(d!==void 0)if(r===void 0){if(!d.parent)throw new Error("Malformed AST");const g=s.children.indexOf(d.parent);let m,w=d.parent.offset+d.parent.length;if(g>0){let E=s.children[g-1];m=E.offset+E.length}else m=s.offset+1,s.children.length>1&&(w=s.children[1].offset);return Pe(e,{offset:m,length:w-m,content:""},n)}else return Pe(e,{offset:d.offset,length:d.length,content:JSON.stringify(r)},n);else{if(r===void 0)return[];const g=`${JSON.stringify(l)}: ${JSON.stringify(r)}`,m=n.getInsertionIndex?n.getInsertionIndex(s.children.map(E=>E.children[0].value)):s.children.length;let w;if(m>0){let E=s.children[m-1];w={offset:E.offset+E.length,length:0,content:","+g}}else s.children.length===0?w={offset:s.offset+1,length:0,content:g}:w={offset:s.offset+1,length:0,content:g+","};return Pe(e,w,n)}}else if(s.type==="array"&&typeof l=="number"&&Array.isArray(s.children)){const d=l;if(d===-1){const g=`${JSON.stringify(r)}`;let m;if(s.children.length===0)m={offset:s.offset+1,length:0,content:g};else{const w=s.children[s.children.length-1];m={offset:w.offset+w.length,length:0,content:","+g}}return Pe(e,m,n)}else if(r===void 0&&s.children.length>=0){const g=l,m=s.children[g];let w;if(s.children.length===1)w={offset:s.offset+1,length:s.length-2,content:""};else if(s.children.length-1===g){let E=s.children[g-1],I=E.offset+E.length,_=s.offset+s.length;w={offset:I,length:_-2-I,content:""}}else w={offset:m.offset,length:s.children[g+1].offset-m.offset,content:""};return Pe(e,w,n)}else if(r!==void 0){let g;const m=`${JSON.stringify(r)}`;if(!n.isArrayInsertion&&s.children.length>l){const w=s.children[l];g={offset:w.offset,length:w.length,content:m}}else if(s.children.length===0||l===0)g={offset:s.offset+1,length:0,content:s.children.length===0?m:m+","};else{const w=l>s.children.length?s.children.length:l,E=s.children[w-1];g={offset:E.offset+E.length,length:0,content:","+m}}return Pe(e,g,n)}else throw new Error(`Can not ${r===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${d} as length is not sufficient`)}else throw new Error(`Can not add ${typeof l!="number"?"index":"property"} to parent of type ${s.type}`);else{if(r===void 0)throw new Error("Can not delete in empty document");return Pe(e,{offset:i?i.offset:0,length:i?i.length:0,content:JSON.stringify(r)},n)}}function Pe(e,t,r){if(!r.formattingOptions)return[t];let n=tr(e,t),a=t.offset,o=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;a>0&&!et(n,a-1);)a--;for(;o<n.length&&!et(n,o);)o++}const i=Co(n,{offset:a,length:o-a},{...r.formattingOptions,keepLines:!1});for(let l=i.length-1;l>=0;l--){const d=i[l];n=tr(n,d),a=Math.min(a,d.offset),o=Math.max(o,d.offset+d.length),o+=d.content.length-d.length}const s=e.length-(n.length-o)-a;return[{offset:a,length:s,content:n.substring(a,o)}]}function tr(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Cr;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Cr||(Cr={}));var Br;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Br||(Br={}));const rt=Hn,He=er;var kr;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(kr||(kr={}));function Xo(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function rr(e,t,r,n){return Uo(e,t,r,n)}function Gn(e,t){let r=t.slice(0).sort((a,o)=>{const i=a.offset-o.offset;return i===0?a.length-o.length:i}),n=e.length;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.offset+o.length<=n)e=tr(e,o);else throw new Error("Overlapping edit");n=o.offset}return e}function Vo(e,t){return t.filter(r=>{const n=ue.resolve(r.hostPath),a=ue.join(e,ue.sep);return n===e||n.startsWith(a)})}const Oe={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Yn={ignoreAttributes:Oe.ignoreAttributes,attributeNamePrefix:Oe.attributeNamePrefix,preserveOrder:Oe.preserveOrder,cdataPropName:Oe.cdataPropName,commentPropName:Oe.commentPropName,suppressBooleanAttributes:!Oe.allowBooleanAttributes,format:!0,indentBy:" "},nt={allowEmptyContent:!0,allowTrailingComma:!0};function $o(e,t){const{name:r,host:n,port:a,mappings:o,ideKey:i}=t,s=new Vn(Oe),l=(()=>{try{return s.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d={server:[{}],":@":{name:r,host:`${n}:${a}`,use_path_mappings:"true"}};o&&o.length&&(d.server[0].path_mappings=o.map(v=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Qn(ue.relative(t.projectDir,v.hostPath))}`,"remote-root":v.vfsPath}})));let g=l?.find(v=>!!v?.project);if(g){const v=g[":@"]?.version;if(v===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(v!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${v}".`)}g===void 0&&(g={project:[],":@":{version:"4"}},l.push(g));let m=g.project?.find(v=>!!v?.component&&v?.[":@"]?.name==="PhpServers");m===void 0&&(m={component:[],":@":{name:"PhpServers"}},g.project===void 0&&(g.project=[]),g.project.push(m));let w=m.component?.find(v=>!!v?.servers);w===void 0&&(w={servers:[]},m.component===void 0&&(m.component=[]),m.component.push(w));const E=w.servers?.findIndex(v=>!!v?.server&&v?.[":@"]?.name===r);(E===void 0||E<0)&&(w.servers===void 0&&(w.servers=[]),w.servers.push(d));let I=g.project?.find(v=>!!v?.component&&v?.[":@"]?.name==="RunManager");if(I===void 0&&(I={component:[],":@":{name:"RunManager"}},g.project===void 0&&(g.project=[]),g.project.push(I)),(I.component?.findIndex(v=>!!v?.configuration&&v?.[":@"]?.name===r)??-1)<0){const v={configuration:[{method:[],":@":{v:"2"}}],":@":{name:r,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:r,session_id:i}};I.component===void 0&&(I.component=[]),I.component.push(v)}const x=new ve(Yn).build(l);try{s.parse(x,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return x}function qo(e,t){const{name:r,mappings:n}=t,a=[];let o=e,i=rt(o,a,nt);if(i===void 0||a.length)throw new Error("VS Code configuration file is not valid JSON.");let s=He(i,["configurations"]);if(s===void 0||s.children===void 0){const d=rr(o,["configurations"],[],{});o=Gn(o,d),i=rt(o,[],nt),s=He(i,["configurations"])}const l=s?.children?.findIndex(d=>He(d,["name"])?.value===r);if(l===void 0||l<0){const d={name:r,type:"php",request:"launch",port:9003};n&&n.length&&(d.pathMappings=n.reduce((w,E)=>(w[E.vfsPath]=`\${workspaceFolder}/${Qn(ue.relative(t.workspaceDir,E.hostPath))}`,w),{}));const g=s?.children?.length||0,m=rr(o,["configurations",g],d,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
22
|
-
`}});
|
|
20
|
+
`}function qe(e,t){return`\r
|
|
21
|
+
`.indexOf(e.charAt(t))!==-1}var We;(function(e){e.DEFAULT={allowTrailingComma:!1}})(We||(We={}));function _r(e,t=[],n=We.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}Es(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,l,f)=>{r=i({type:"property",offset:l,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:l,length:f,parent:r})},onObjectEnd:(u,l)=>{o(u+l),r.length=u+l-r.offset,r=r.parent,o(u+l)},onArrayBegin:(u,l)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,l)=>{r.length=u+l-r.offset,r=r.parent,o(u+l)},onLiteralValue:(u,l,f)=>{i({type:Ns(u),offset:l,length:f,parent:r,value:u}),o(l+f)},onSeparator:(u,l,f)=>{r.type==="property"&&(u===":"?r.colonOffset=l:u===","&&o(l))},onError:(u,l,f)=>{t.push({error:u,offset:l,length:f})}},n);const a=r.children[0];return a&&delete a.parent,a}function Wt(e,t){if(!e)return;let n=e;for(let r of t)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let o=!1;for(const i of n.children)if(Array.isArray(i.children)&&i.children[0].value===r&&i.children.length===2){n=i.children[1],o=!0;break}if(!o)return}else{const o=r;if(n.type!=="array"||o<0||!Array.isArray(n.children)||o>=n.children.length)return;n=n.children[o]}return n}function Es(e,t,n=We.DEFAULT){const r=xr(e,!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?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(R){return R?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function l(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function f(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const h=l(t.onObjectBegin),d=u(t.onObjectProperty),b=f(t.onObjectEnd),T=l(t.onArrayBegin),O=f(t.onArrayEnd),y=u(t.onLiteralValue),D=a(t.onSeparator),E=s(t.onComment),p=a(t.onError),w=n&&n.disallowComments,I=n&&n.allowTrailingComma;function x(){for(;;){const R=r.scan();switch(r.getTokenError()){case 4:P(14);break;case 5:P(15);break;case 3:P(13);break;case 1:w||P(11);break;case 2:P(12);break;case 6:P(16);break}switch(R){case 12:case 13:w?P(10):E();break;case 16:P(1);break;case 15:case 14:break;default:return R}}}function P(R,V=[],G=[]){if(p(R),V.length+G.length>0){let W=r.getToken();for(;W!==17;){if(V.indexOf(W)!==-1){x();break}else if(G.indexOf(W)!==-1)break;W=x()}}}function S(R){const V=r.getTokenValue();return R?y(V):(d(V),o.push(V)),x(),!0}function c(){switch(r.getToken()){case 11:const R=r.getTokenValue();let V=Number(R);isNaN(V)&&(P(2),V=0),y(V);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return x(),!0}function _(){return r.getToken()!==10?(P(3,[],[2,5]),!1):(S(!1),r.getToken()===6?(D(":"),x(),q()||P(4,[],[2,5])):P(5,[],[2,5]),o.pop(),!0)}function F(){h(),x();let R=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||P(4,[],[]),D(","),x(),r.getToken()===2&&I)break}else R&&P(6,[],[]);_()||P(4,[],[2,5]),R=!0}return b(),r.getToken()!==2?P(7,[2],[]):x(),!0}function k(){T(),x();let R=!0,V=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(V||P(4,[],[]),D(","),x(),r.getToken()===4&&I)break}else V&&P(6,[],[]);R?(o.push(0),R=!1):o[o.length-1]++,q()||P(4,[],[4,5]),V=!0}return O(),R||o.pop(),r.getToken()!==4?P(8,[4],[]):x(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return F();case 10:return S(!0);default:return c()}}return x(),r.getToken()===17?n.allowEmptyContent?!0:(P(4,[],[]),!1):q()?(r.getToken()!==17&&P(9,[],[]),!0):(P(4,[],[]),!1)}function Ns(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function Is(e,t,n,r){const o=t.slice(),s=_r(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Wt(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 l=Wt(a,[u]);if(l!==void 0)if(n===void 0){if(!l.parent)throw new Error("Malformed AST");const f=a.children.indexOf(l.parent);let h,d=l.parent.offset+l.parent.length;if(f>0){let b=a.children[f-1];h=b.offset+b.length}else h=a.offset+1,a.children.length>1&&(d=a.children[1].offset);return Ie(e,{offset:h,length:d-h,content:""},r)}else return Ie(e,{offset:l.offset,length:l.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const f=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,h=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let d;if(h>0){let b=a.children[h-1];d={offset:b.offset+b.length,length:0,content:","+f}}else a.children.length===0?d={offset:a.offset+1,length:0,content:f}:d={offset:a.offset+1,length:0,content:f+","};return Ie(e,d,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const l=u;if(l===-1){const f=`${JSON.stringify(n)}`;let h;if(a.children.length===0)h={offset:a.offset+1,length:0,content:f};else{const d=a.children[a.children.length-1];h={offset:d.offset+d.length,length:0,content:","+f}}return Ie(e,h,r)}else if(n===void 0&&a.children.length>=0){const f=u,h=a.children[f];let d;if(a.children.length===1)d={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===f){let b=a.children[f-1],T=b.offset+b.length,O=a.offset+a.length;d={offset:T,length:O-2-T,content:""}}else d={offset:h.offset,length:a.children[f+1].offset-h.offset,content:""};return Ie(e,d,r)}else if(n!==void 0){let f;const h=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const d=a.children[u];f={offset:d.offset,length:d.length,content:h}}else if(a.children.length===0||u===0)f={offset:a.offset+1,length:0,content:a.children.length===0?h:h+","};else{const d=u>a.children.length?a.children.length:u,b=a.children[d-1];f={offset:b.offset+b.length,length:0,content:","+h}}return Ie(e,f,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${l} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return Ie(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Ie(e,t,n){if(!n.formattingOptions)return[t];let r=Ht(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!qe(r,o-1);)o--;for(;i<r.length&&!qe(r,i);)i++}const s=bs(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const l=s[u];r=Ht(r,l),o=Math.min(o,l.offset),i=Math.max(i,l.offset+l.length),i+=l.content.length-l.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Ht(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var On;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(On||(On={}));var An;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(An||(An={}));const He=_r,Re=Wt;var Ln;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Ln||(Ln={}));function vs(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function Gt(e,t,n,r){return Is(e,t,n,r)}function Dr(e,t){let n=t.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=e.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)e=Ht(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}function Os(e,t){return t.filter(n=>{const r=ne.resolve(n.hostPath),o=ne.join(e,ne.sep);return r===e||r.startsWith(o)})}const Ee={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Mr={ignoreAttributes:Ee.ignoreAttributes,attributeNamePrefix:Ee.attributeNamePrefix,preserveOrder:Ee.preserveOrder,cdataPropName:Ee.cdataPropName,commentPropName:Ee.commentPropName,suppressBooleanAttributes:!Ee.allowBooleanAttributes,format:!0,indentBy:" "},Ge={allowEmptyContent:!0,allowTrailingComma:!0};function As(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new Ar(Ee),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),l={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(l.server[0].path_mappings=i.map(E=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Cr(ne.relative(t.projectDir,E.hostPath))}`,"remote-root":E.vfsPath}})));let f=u?.find(E=>!!E?.project);if(f){const E=f[":@"]?.version;if(E===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but the <project> configuration has no version number.');if(E!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${E}".`)}f===void 0&&(f={project:[],":@":{version:"4"}},u.push(f));let h=f.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="PhpServers");h===void 0&&(h={component:[],":@":{name:"PhpServers"}},f.project===void 0&&(f.project=[]),f.project.push(h));let d=h.component?.find(E=>!!E?.servers);d===void 0&&(d={servers:[]},h.component===void 0&&(h.component=[]),h.component.push(d));const b=d.servers?.findIndex(E=>!!E?.server&&E?.[":@"]?.name===n);(b===void 0||b<0)&&(d.servers===void 0&&(d.servers=[]),d.servers.push(l));let T=f.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="RunManager");if(T===void 0&&(T={component:[],":@":{name:"RunManager"}},f.project===void 0&&(f.project=[]),f.project.push(T)),(T.component?.findIndex(E=>!!E?.configuration&&E?.[":@"]?.name===n)??-1)<0){const E={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};T.component===void 0&&(T.component=[]),T.component.push(E)}const D=new we(Mr).build(u);try{a.parse(D,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return D}function Ls(e,t){const{name:n,mappings:r}=t,o=[];let i=e,s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");let a=Re(s,["configurations"]);if(a===void 0||a.children===void 0){const l=Gt(i,["configurations"],[],{});i=Dr(i,l),s=He(i,[],Ge),a=Re(s,["configurations"])}const u=a?.children?.findIndex(l=>Re(l,["name"])?.value===n);if(u===void 0||u<0){const l={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(l.pathMappings=r.reduce((d,b)=>(d[b.vfsPath]=`\${workspaceFolder}/${Cr(ne.relative(t.workspaceDir,b.hostPath))}`,d),{}));const f=a?.children?.length||0,h=Gt(i,["configurations",f],l,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
22
|
+
`}});i=Sr(i,h)}return i}async function Ps({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s="PHPWASMCLI"}){const a=i?Os(o,i):[],u={};if(t.includes("phpstorm")){const l=".idea/workspace.xml",f=ne.join(o,l);if(!K.existsSync(f)){if(K.existsSync(ne.dirname(f)))K.writeFileSync(f,`<?xml version="1.0" encoding="UTF-8"?>
|
|
23
23
|
<project version="4">
|
|
24
|
-
</project>`);else if(t.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(
|
|
24
|
+
</project>`);else if(t.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(K.existsSync(f)){const h=K.readFileSync(f,"utf8"),d=As(h,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});K.writeFileSync(f,d),u.phpstorm=l}}if(t.includes("vscode")){const l=".vscode/launch.json",f=ne.join(o,l);if(!K.existsSync(f)){if(K.existsSync(ne.dirname(f)))K.writeFileSync(f,`{
|
|
25
25
|
"configurations": []
|
|
26
|
-
}`);else if(t.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(
|
|
26
|
+
}`);else if(t.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(K.existsSync(f)){const h=K.readFileSync(f,"utf-8"),d=Ls(h,{name:e,workspaceDir:o,mappings:a});d!==h&&(K.writeFileSync(f,d),u.vscode=l)}}return u}async function xs(e,t){const n=ne.join(t,".idea/workspace.xml");if(K.existsSync(n)){const o=K.readFileSync(n,"utf8"),i=new Ar(Ee),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),l=s.find(h=>!!h?.project)?.project?.find(h=>!!h?.component&&h?.[":@"]?.name==="PhpServers")?.component?.find(h=>!!h?.servers),f=l?.servers?.findIndex(h=>!!h?.server&&h?.[":@"]?.name===e);if(f!==void 0&&f>=0){l.servers.splice(f,1);const d=new we(Mr).build(s);try{i.parse(d,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}d===`<?xml version="1.0" encoding="UTF-8"?>
|
|
27
27
|
<project version="4">
|
|
28
28
|
<component name="PhpServers">
|
|
29
29
|
<servers></servers>
|
|
30
30
|
</component>
|
|
31
|
-
</project>`?
|
|
32
|
-
`}}),
|
|
31
|
+
</project>`?K.unlinkSync(n):K.writeFileSync(n,d)}}const r=ne.join(t,".vscode/launch.json");if(K.existsSync(r)){const o=[],i=K.readFileSync(r,"utf-8"),s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");const u=Re(s,["configurations"])?.children?.findIndex(l=>Re(l,["name"])?.value===e);if(u!==void 0&&u>=0){const l=Gt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
|
|
32
|
+
`}}),f=Sr(i,l);f===`{
|
|
33
33
|
"configurations": []
|
|
34
|
-
}`?
|
|
34
|
+
}`?K.unlinkSync(r):K.writeFileSync(r,f)}}}function Sr(e,t){const n=[],r=Dr(e,t);if(n.length=0,He(r,n,Ge),n.length){const o=n.map(s=>({message:vs(s.error),offset:s.offset,length:s.length,fragment:r.slice(Math.max(0,s.offset-20),Math.min(r.length,s.offset+s.length+10))})).map(s=>`${s.message} at ${s.offset}:${s.length} (${s.fragment})`),i=t.map(s=>`At ${s.offset}:${s.length} - (${s.content})`);throw new Error(`VS Code configuration file (.vscode/launch.json) is not valid a JSONC after CLI modifications. This is likely a CLI bug. Please report it at https://github.com/WordPress/wordpress-playground/issues and include the contents of your ".vscode/launch.json" file.
|
|
35
35
|
|
|
36
|
-
Applied edits: ${
|
|
36
|
+
Applied edits: ${i.join(`
|
|
37
37
|
`)}
|
|
38
38
|
|
|
39
|
-
The errors are: ${
|
|
40
|
-
`)}`)}return
|
|
41
|
-
`):JSON.stringify(e,null,2),
|
|
39
|
+
The errors are: ${o.join(`
|
|
40
|
+
`)}`)}return r}function Cr(e){return e.replaceAll(ne.sep,ne.posix.sep)}const Fr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Fr==="NODE"){let e=function(n){return new Promise(function(r,o){n.onload=n.onerror=function(i){n.onload=n.onerror=null,i.type==="load"?r(n.result):o(new Error("Failed to read the blob/file"))}})},t=function(){const n=new Uint8Array([1,2,3,4]),o=new File([n],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class n extends Blob{constructor(o,i,s){super(o);let a;s?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=n}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const r=new FileReader;return r.readAsArrayBuffer(this),e(r)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const r=new FileReader;return r.readAsText(this),e(r)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let n=0;const r=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const i=o.byobRequest.view,a=await r.slice(n,n+i.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(i.buffer).set(u);const l=u.byteLength;o.byobRequest.respond(l),n+=l,n>=r.size&&o.close()}})})}if(Fr==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const _s="playground-log",Ds=(e,...t)=>{de.dispatchEvent(new CustomEvent(_s,{detail:{log:e,args:t}}))},Ms=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Yt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Yt(e.message.message)),e.severity){case le.Debug:console.debug(e.message,...t);break;case le.Info:console.info(e.message,...t);break;case le.Warn:console.warn(e.message,...t);break;case le.Error:console.error(e.message,...t);break;case le.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},Ss=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
41
|
+
`):JSON.stringify(e,null,2),jr=[],Pn=e=>{jr.push(e)},kr=e=>{if(e.raw===!0)Pn(e.message);else{const t=js(typeof e.message=="object"?Ss(e.message):e.message,e.severity,e.prefix??Se.JS);Pn(t)}},le={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}},Se={JS:"JavaScript"};class Cs extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=le.Info,this.handlers=t}getLogs(){return this.handlers.includes(kr)?[...jr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
42
42
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
43
|
-
`),[])}logMessage(t,...
|
|
43
|
+
`),[])}logMessage(t,...n){const r={...t,severity:t.severity??le.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(t){this.severity=t}log(t,...n){this.logMessage({message:t,severity:le.Log,prefix:Se.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:le.Debug,prefix:Se.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:le.Info,prefix:Se.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:le.Warn,prefix:Se.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:le.Error,prefix:Se.JS,raw:!1},...n)}}const Fs=()=>{try{}catch{}return[kr,Ms,Ds]},de=new Cs(Fs()),Yt=e=>e.replace(/\t/g,""),js=(e,t,n)=>{const r=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(r).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(r),s=o+" "+i;return e=Yt(e),`[${s}] ${n} ${t.name}: ${e}`};var H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Zt={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,xn=Ce&&typeof Ce.apply=="function"?Ce.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Ve;Ce&&typeof Ce.ownKeys=="function"?Ve=Ce.ownKeys:Object.getOwnPropertySymbols?Ve=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ve=function(t){return Object.getOwnPropertyNames(t)};function ks(e){console&&console.warn&&console.warn(e)}var Br=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}Zt.exports=Q;Zt.exports.once=Us;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var _n=10;function ze(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Q,"defaultMaxListeners",{enumerable:!0,get:function(){return _n},set:function(e){if(typeof e!="number"||e<0||Br(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");_n=e}});Q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Q.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Br(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Rr(e){return e._maxListeners===void 0?Q.defaultMaxListeners:e._maxListeners}Q.prototype.getMaxListeners=function(){return Rr(this)};Q.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")xn(u,this,n);else for(var l=u.length,f=qr(u,l),r=0;r<l;++r)xn(f[r],this,n);return!0};function Xr(e,t,n,r){var o,i,s;if(ze(n),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),s===void 0)s=i[t]=n,++e._eventsCount;else if(typeof s=="function"?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=Rr(e),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,ks(a)}return e}Q.prototype.addListener=function(t,n){return Xr(this,t,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(t,n){return Xr(this,t,n,!0)};function Bs(){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 Ur(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Bs.bind(r);return o.listener=n,r.wrapFn=o,o}Q.prototype.once=function(t,n){return ze(n),this.on(t,Ur(this,t,n)),this};Q.prototype.prependOnceListener=function(t,n){return ze(n),this.prependListener(t,Ur(this,t,n)),this};Q.prototype.removeListener=function(t,n){var r,o,i,s,a;if(ze(n),o=this._events,o===void 0)return this;if(r=o[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():Rs(r,i),r.length===1&&(o[t]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners=function(t){var n,r,o;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var i=Object.keys(r),s;for(o=0;o<i.length;++o)s=i[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this};function Vr(e,t,n){var r=e._events;if(r===void 0)return[];var o=r[t];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?Xs(o):qr(o,o.length)}Q.prototype.listeners=function(t){return Vr(this,t,!0)};Q.prototype.rawListeners=function(t){return Vr(this,t,!1)};Q.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):$r.call(e,t)};Q.prototype.listenerCount=$r;function $r(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Q.prototype.eventNames=function(){return this._eventsCount>0?Ve(this._events):[]};function qr(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Rs(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Xs(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function Us(e,t){return new Promise(function(n,r){function o(s){e.removeListener(t,i),r(s)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),n([].slice.call(arguments))}Wr(e,t,i,{once:!0}),t!=="error"&&Vs(e,o,{once:!0})})}function Vs(e,t,n){typeof e.on=="function"&&Wr(e,"error",t,n)}function Wr(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Kt=Zt.exports;class $s extends Kt.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new mi({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{de.debug("\x1B[1;32m[CDP][received]\x1B[0m",r.toString());let o;try{o=JSON.parse(r.toString())}catch{return}this.connected?this.emit("message",o):this.buffer.push(o)}),n.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.on("newListener",n=>{n==="message"&&process.nextTick(()=>{for(const r of this.buffer)this.emit("message",r);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(t);de.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class qs extends Kt.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=yi.createServer(),this.server.on("connection",n=>{if(this.socket){n.destroy();return}this.socket=n,n.setEncoding("utf8"),this.emit("connected"),n.on("data",r=>this.onData(r.toString())),n.on("close",()=>{this.socket=null,this.emit("disconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.server.listen(t)}onData(t){for(de.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const n=this.buffer.indexOf("\0");if(n===-1)break;const r=this.buffer.substring(0,n),o=parseInt(r,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,this.buffer=this.buffer.slice(n+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const n=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const r=n.trim();this.expectedLength=null,this.emit("message",r);continue}break}}sendCommand(t){this.socket&&(de.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright (c) 2016, Contributors
|
|
46
46
|
* SPDX-License-Identifier: ISC
|
|
47
|
-
*/function
|
|
47
|
+
*/function Ue(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",r=!1;const o=e.match(/^-+/);for(let i=o?o[0].length:0;i<e.length;i++){let s=e.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function Ws(e,t){const n=e.toLowerCase();t=t||"-";let r="";for(let o=0;o<e.length;o++){const i=n.charAt(o),s=e.charAt(o);i!==s&&o>0?r+=`${t}${n.charAt(o)}`:r+=s}return r}function Hs(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright (c) 2016, Contributors
|
|
50
50
|
* SPDX-License-Identifier: ISC
|
|
51
|
-
*/function
|
|
51
|
+
*/function Gs(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,r=null,o=null;const i=[];for(let s=0;s<e.length;s++){if(n=r,r=e.charAt(s),r===" "&&!o){n!==" "&&t++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[t]||(i[t]=""),i[t]+=r}return i}/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
|
-
*/var
|
|
55
|
+
*/var he;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(he||(he={}));/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright (c) 2016, Contributors
|
|
58
58
|
* SPDX-License-Identifier: ISC
|
|
59
|
-
*/let Ee;class fs{constructor(t){Ee=t}parse(t,r){const n=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},r),a=ls(t),o=typeof t=="string",i=hs(Object.assign(Object.create(null),n.alias)),s=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},n.configuration),l=Object.assign(Object.create(null),n.default),d=n.configObjects||[],g=n.envPrefix,m=s["populate--"],w=m?"--":"_",E=Object.create(null),I=Object.create(null),_=n.__||Ee.format,T={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:[]},x=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,v=new RegExp("^--"+s["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(P){const f=typeof P=="object"?P.key:P,u=Object.keys(P).map(function(c){return{boolean:"bools",string:"strings",number:"numbers"}[c]}).filter(Boolean).pop();u&&(T[u][f]=!0),T.arrays[f]=!0,T.keys.push(f)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(P){T.bools[P]=!0,T.keys.push(P)}),[].concat(n.string||[]).filter(Boolean).forEach(function(P){T.strings[P]=!0,T.keys.push(P)}),[].concat(n.number||[]).filter(Boolean).forEach(function(P){T.numbers[P]=!0,T.keys.push(P)}),[].concat(n.count||[]).filter(Boolean).forEach(function(P){T.counts[P]=!0,T.keys.push(P)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(P){T.normalize[P]=!0,T.keys.push(P)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([P,f])=>{typeof f=="number"&&(T.nargs[P]=f,T.keys.push(P))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([P,f])=>{typeof f=="function"&&(T.coercions[P]=f,T.keys.push(P))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(P){T.configs[P]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([P,f])=>{(typeof f=="boolean"||typeof f=="function")&&(T.configs[P]=f)})),Me(n.key,i,n.default,T.arrays),Object.keys(l).forEach(function(P){(T.aliases[P]||[]).forEach(function(f){l[f]=l[P]})});let h=null;oe();let O=[];const A=Object.assign(Object.create(null),{_:[]}),F={};for(let P=0;P<a.length;P++){const f=a[P],u=f.replace(/^-{3,}/,"---");let c,p,L,S,C,V;if(f!=="--"&&/^-/.test(f)&&b(f))M(f);else if(u.match(/^---+(=|$)/)){M(f);continue}else if(f.match(/^--.+=/)||!s["short-option-groups"]&&f.match(/^-.+=/))S=f.match(/^--?([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&(q(S[1],T.arrays)?P=y(P,S[1],a,S[2]):q(S[1],T.nargs)!==!1?P=k(P,S[1],a,S[2]):B(S[1],S[2],!0));else if(f.match(v)&&s["boolean-negation"])S=f.match(v),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],B(p,q(p,T.arrays)?[!1]:!1));else if(f.match(/^--.+/)||!s["short-option-groups"]&&f.match(/^-[^-]+/))S=f.match(/^--?(.+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],q(p,T.arrays)?P=y(P,p,a):q(p,T.nargs)!==!1?P=k(P,p,a):(C=a[P+1],C!==void 0&&(!C.match(/^-/)||C.match(x))&&!q(p,T.bools)&&!q(p,T.counts)||/^(true|false)$/.test(C)?(B(p,C),P++):B(p,D(p))));else if(f.match(/^-.\..+=/))S=f.match(/^-([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&B(S[1],S[2]);else if(f.match(/^-.\..+/)&&!f.match(x))C=a[P+1],S=f.match(/^-(.\..+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],C!==void 0&&!C.match(/^-/)&&!q(p,T.bools)&&!q(p,T.counts)?(B(p,C),P++):B(p,D(p)));else if(f.match(/^-[^-]+/)&&!f.match(x)){L=f.slice(1,-1).split(""),c=!1;for(let G=0;G<L.length;G++){if(C=f.slice(G+2),L[G+1]&&L[G+1]==="="){V=f.slice(G+3),p=L[G],q(p,T.arrays)?P=y(P,p,a,V):q(p,T.nargs)!==!1?P=k(P,p,a,V):B(p,V),c=!0;break}if(C==="-"){B(L[G],C);continue}if(/[A-Za-z]/.test(L[G])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(C)&&q(C,T.bools)===!1){B(L[G],C),c=!0;break}if(L[G+1]&&L[G+1].match(/\W/)){B(L[G],C),c=!0;break}else B(L[G],D(L[G]))}p=f.slice(-1)[0],!c&&p!=="-"&&(q(p,T.arrays)?P=y(P,p,a):q(p,T.nargs)!==!1?P=k(P,p,a):(C=a[P+1],C!==void 0&&(!/^(-|--)[^-]/.test(C)||C.match(x))&&!q(p,T.bools)&&!q(p,T.counts)||/^(true|false)$/.test(C)?(B(p,C),P++):B(p,D(p))))}else if(f.match(/^-[0-9]$/)&&f.match(x)&&q(f.slice(1),T.bools))p=f.slice(1),B(p,D(p));else if(f==="--"){O=a.slice(P+1);break}else if(s["halt-at-non-option"]){O=a.slice(P);break}else M(f)}H(A,!0),H(A,!1),X(A),Y(),xe(A,T.aliases,l,!0),Ue(A),s["set-placeholder-key"]&&Ae(A),Object.keys(T.counts).forEach(function(P){Z(A,P.split("."))||B(P,0)}),m&&O.length&&(A[w]=[]),O.forEach(function(P){A[w].push(P)}),s["camel-case-expansion"]&&s["strip-dashed"]&&Object.keys(A).filter(P=>P!=="--"&&P.includes("-")).forEach(P=>{delete A[P]}),s["strip-aliased"]&&[].concat(...Object.keys(i).map(P=>i[P])).forEach(P=>{s["camel-case-expansion"]&&P.includes("-")&&delete A[P.split(".").map(f=>ze(f)).join(".")],delete A[P]});function M(P){const f=W("_",P);(typeof f=="string"||typeof f=="number")&&A._.push(f)}function k(P,f,u,c){let p,L=q(f,T.nargs);if(L=typeof L!="number"||isNaN(L)?1:L,L===0)return z(c)||(h=Error(_("Argument unexpected for: %s",f))),B(f,D(f)),P;let S=z(c)?0:1;if(s["nargs-eats-options"])u.length-(P+1)+S<L&&(h=Error(_("Not enough arguments following: %s",f))),S=L;else{for(p=P+1;p<u.length&&(!u[p].match(/^-[^0-9]/)||u[p].match(x)||b(u[p]));p++)S++;S<L&&(h=Error(_("Not enough arguments following: %s",f)))}let C=Math.min(S,L);for(!z(c)&&C>0&&(B(f,c),C--),p=P+1;p<C+P+1;p++)B(f,u[p]);return P+C}function y(P,f,u,c){let p=[],L=c||u[P+1];const S=q(f,T.nargs);if(q(f,T.bools)&&!/^(true|false)$/.test(L))p.push(!0);else if(z(L)||z(c)&&/^-/.test(L)&&!x.test(L)&&!b(L)){if(l[f]!==void 0){const C=l[f];p=Array.isArray(C)?C:[C]}}else{z(c)||p.push(U(f,c,!0));for(let C=P+1;C<u.length&&!(!s["greedy-arrays"]&&p.length>0||S&&typeof S=="number"&&p.length>=S||(L=u[C],/^-/.test(L)&&!x.test(L)&&!b(L)));C++)P=C,p.push(U(f,L,o))}return typeof S=="number"&&(S&&p.length<S||isNaN(S)&&p.length===0)&&(h=Error(_("Not enough arguments following: %s",f))),B(f,p),P}function B(P,f,u=o){if(/-/.test(P)&&s["camel-case-expansion"]){const L=P.split(".").map(function(S){return ze(S)}).join(".");j(P,L)}const c=U(P,f,u),p=P.split(".");te(A,p,c),T.aliases[P]&&T.aliases[P].forEach(function(L){const S=L.split(".");te(A,S,c)}),p.length>1&&s["dot-notation"]&&(T.aliases[p[0]]||[]).forEach(function(L){let S=L.split(".");const C=[].concat(p);C.shift(),S=S.concat(C),(T.aliases[P]||[]).includes(S.join("."))||te(A,S,c)}),q(P,T.normalize)&&!q(P,T.arrays)&&[P].concat(T.aliases[P]||[]).forEach(function(S){Object.defineProperty(F,S,{enumerable:!0,get(){return f},set(C){f=typeof C=="string"?Ee.normalize(C):C}})})}function j(P,f){T.aliases[P]&&T.aliases[P].length||(T.aliases[P]=[f],E[f]=!0),T.aliases[f]&&T.aliases[f].length||j(f,P)}function U(P,f,u){u&&(f=ps(f)),(q(P,T.bools)||q(P,T.counts))&&typeof f=="string"&&(f=f==="true");let c=Array.isArray(f)?f.map(function(p){return W(P,p)}):W(P,f);return q(P,T.counts)&&(z(c)||typeof c=="boolean")&&(c=lt()),q(P,T.normalize)&&q(P,T.arrays)&&(Array.isArray(f)?c=f.map(p=>Ee.normalize(p)):c=Ee.normalize(f)),c}function W(P,f){return!s["parse-positional-numbers"]&&P==="_"||!q(P,T.strings)&&!q(P,T.bools)&&!Array.isArray(f)&&(cs(f)&&s["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))||!z(f)&&q(P,T.numbers))&&(f=Number(f)),f}function X(P){const f=Object.create(null);xe(f,T.aliases,l),Object.keys(T.configs).forEach(function(u){const c=P[u]||f[u];if(c)try{let p=null;const L=Ee.resolve(Ee.cwd(),c),S=T.configs[u];if(typeof S=="function"){try{p=S(L)}catch(C){p=C}if(p instanceof Error){h=p;return}}else p=Ee.require(L);$(p)}catch(p){p.name==="PermissionDenied"?h=p:P[u]&&(h=Error(_("Invalid JSON config file: %s",c)))}})}function $(P,f){Object.keys(P).forEach(function(u){const c=P[u],p=f?f+"."+u:u;typeof c=="object"&&c!==null&&!Array.isArray(c)&&s["dot-notation"]?$(c,p):(!Z(A,p.split("."))||q(p,T.arrays)&&s["combine-arrays"])&&B(p,c)})}function Y(){typeof d<"u"&&d.forEach(function(P){$(P)})}function H(P,f){if(typeof g>"u")return;const u=typeof g=="string"?g:"",c=Ee.env();Object.keys(c).forEach(function(p){if(u===""||p.lastIndexOf(u,0)===0){const L=p.split("__").map(function(S,C){return C===0&&(S=S.substring(u.length)),ze(S)});(f&&T.configs[L.join(".")]||!f)&&!Z(P,L)&&B(L.join("."),c[p])}})}function Ue(P){let f;const u=new Set;Object.keys(P).forEach(function(c){if(!u.has(c)&&(f=q(c,T.coercions),typeof f=="function"))try{const p=W(c,f(P[c]));[].concat(T.aliases[c]||[],c).forEach(L=>{u.add(L),P[L]=p})}catch(p){h=p}})}function Ae(P){return T.keys.forEach(f=>{~f.indexOf(".")||typeof P[f]>"u"&&(P[f]=void 0)}),P}function xe(P,f,u,c=!1){Object.keys(u).forEach(function(p){Z(P,p.split("."))||(te(P,p.split("."),u[p]),c&&(I[p]=!0),(f[p]||[]).forEach(function(L){Z(P,L.split("."))||te(P,L.split("."),u[p])}))})}function Z(P,f){let u=P;s["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(p){u=u[p]||{}});const c=f[f.length-1];return typeof u!="object"?!1:c in u}function te(P,f,u){let c=P;s["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(V){V=Xr(V),typeof c=="object"&&c[V]===void 0&&(c[V]={}),typeof c[V]!="object"||Array.isArray(c[V])?(Array.isArray(c[V])?c[V].push({}):c[V]=[c[V],{}],c=c[V][c[V].length-1]):c=c[V]});const p=Xr(f[f.length-1]),L=q(f.join("."),T.arrays),S=Array.isArray(u);let C=s["duplicate-arguments-array"];!C&&q(p,T.nargs)&&(C=!0,(!z(c[p])&&T.nargs[p]===1||Array.isArray(c[p])&&c[p].length===T.nargs[p])&&(c[p]=void 0)),u===lt()?c[p]=lt(c[p]):Array.isArray(c[p])?C&&L&&S?c[p]=s["flatten-duplicate-arrays"]?c[p].concat(u):(Array.isArray(c[p][0])?c[p]:[c[p]]).concat([u]):!C&&!!L==!!S?c[p]=u:c[p]=c[p].concat([u]):c[p]===void 0&&L?c[p]=S?u:[u]:C&&!(c[p]===void 0||q(p,T.counts)||q(p,T.bools))?c[p]=[c[p],u]:c[p]=u}function Me(...P){P.forEach(function(f){Object.keys(f||{}).forEach(function(u){T.aliases[u]||(T.aliases[u]=[].concat(i[u]||[]),T.aliases[u].concat(u).forEach(function(c){if(/-/.test(c)&&s["camel-case-expansion"]){const p=ze(c);p!==u&&T.aliases[u].indexOf(p)===-1&&(T.aliases[u].push(p),E[p]=!0)}}),T.aliases[u].concat(u).forEach(function(c){if(c.length>1&&/[A-Z]/.test(c)&&s["camel-case-expansion"]){const p=us(c,"-");p!==u&&T.aliases[u].indexOf(p)===-1&&(T.aliases[u].push(p),E[p]=!0)}}),T.aliases[u].forEach(function(c){T.aliases[c]=[u].concat(T.aliases[u].filter(function(p){return c!==p}))}))})})}function q(P,f){const u=[].concat(T.aliases[P]||[],P),c=Object.keys(f),p=u.find(L=>c.includes(L));return p?f[p]:!1}function be(P){const f=Object.keys(T);return[].concat(f.map(c=>T[c])).some(function(c){return Array.isArray(c)?c.includes(P):c[P]})}function Xe(P,...f){return[].concat(...f).some(function(c){const p=P.match(c);return p&&be(p[1])})}function N(P){if(P.match(x)||!P.match(/^-[^-]+/))return!1;let f=!0,u;const c=P.slice(1).split("");for(let p=0;p<c.length;p++){if(u=P.slice(p+2),!be(c[p])){f=!1;break}if(c[p+1]&&c[p+1]==="="||u==="-"||/[A-Za-z]/.test(c[p])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(u)||c[p+1]&&c[p+1].match(/\W/))break}return f}function b(P){return s["unknown-options-as-args"]&&R(P)}function R(P){return P=P.replace(/^-{3,}/,"--"),P.match(x)||N(P)?!1:!Xe(P,/^-+([^=]+?)=[\s\S]*$/,v,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function D(P){return!q(P,T.bools)&&!q(P,T.counts)&&`${P}`in l?l[P]:J(K(P))}function J(P){return{[ye.BOOLEAN]:!0,[ye.STRING]:"",[ye.NUMBER]:void 0,[ye.ARRAY]:[]}[P]}function K(P){let f=ye.BOOLEAN;return q(P,T.strings)?f=ye.STRING:q(P,T.numbers)?f=ye.NUMBER:q(P,T.bools)?f=ye.BOOLEAN:q(P,T.arrays)&&(f=ye.ARRAY),f}function z(P){return P===void 0}function oe(){Object.keys(T.counts).find(P=>q(P,T.arrays)?(h=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",P)),!0):q(P,T.nargs)?(h=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",P)),!0):!1)}return{aliases:Object.assign({},T.aliases),argv:Object.assign(F,A),configuration:s,defaulted:Object.assign({},I),error:h,newAliases:Object.assign({},E)}}}function hs(e){const t=[],r=Object.create(null);let n=!0;for(Object.keys(e).forEach(function(a){t.push([].concat(e[a],a))});n;){n=!1;for(let a=0;a<t.length;a++)for(let o=a+1;o<t.length;o++)if(t[a].filter(function(s){return t[o].indexOf(s)!==-1}).length){t[a]=t[a].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(a){a=a.filter(function(i,s,l){return l.indexOf(i)===s});const o=a.pop();o!==void 0&&typeof o=="string"&&(r[o]=a)}),r}function lt(e){return e!==void 0?e+1:1}function Xr(e){return e==="__proto__"?"___proto___":e}function ps(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
|
|
59
|
+
*/let me;class Ys{constructor(t){me=t}parse(t,n){const r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},n),o=Gs(t),i=typeof t=="string",s=zs(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),l=r.configObjects||[],f=r.envPrefix,h=a["populate--"],d=h?"--":"_",b=Object.create(null),T=Object.create(null),O=r.__||me.format,y={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},D=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,E=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(N){const L=typeof N=="object"?N.key:N,j=Object.keys(N).map(function(M){return{boolean:"bools",string:"strings",number:"numbers"}[M]}).filter(Boolean).pop();j&&(y[j][L]=!0),y.arrays[L]=!0,y.keys.push(L)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(N){y.bools[N]=!0,y.keys.push(N)}),[].concat(r.string||[]).filter(Boolean).forEach(function(N){y.strings[N]=!0,y.keys.push(N)}),[].concat(r.number||[]).filter(Boolean).forEach(function(N){y.numbers[N]=!0,y.keys.push(N)}),[].concat(r.count||[]).filter(Boolean).forEach(function(N){y.counts[N]=!0,y.keys.push(N)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(N){y.normalize[N]=!0,y.keys.push(N)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([N,L])=>{typeof L=="number"&&(y.nargs[N]=L,y.keys.push(N))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([N,L])=>{typeof L=="function"&&(y.coercions[N]=L,y.keys.push(N))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(N){y.configs[N]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([N,L])=>{(typeof L=="boolean"||typeof L=="function")&&(y.configs[N]=L)})),Ke(r.key,s,r.default,y.arrays),Object.keys(u).forEach(function(N){(y.aliases[N]||[]).forEach(function(L){u[L]=u[N]})});let p=null;re();let w=[];const I=Object.assign(Object.create(null),{_:[]}),x={};for(let N=0;N<o.length;N++){const L=o[N],j=L.replace(/^-{3,}/,"---");let M,A,X,B,U,te;if(L!=="--"&&/^-/.test(L)&&g(L))P(L);else if(j.match(/^---+(=|$)/)){P(L);continue}else if(L.match(/^--.+=/)||!a["short-option-groups"]&&L.match(/^-.+=/))B=L.match(/^--?([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&($(B[1],y.arrays)?N=c(N,B[1],o,B[2]):$(B[1],y.nargs)!==!1?N=S(N,B[1],o,B[2]):_(B[1],B[2],!0));else if(L.match(E)&&a["boolean-negation"])B=L.match(E),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],_(A,$(A,y.arrays)?[!1]:!1));else if(L.match(/^--.+/)||!a["short-option-groups"]&&L.match(/^-[^-]+/))B=L.match(/^--?(.+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],$(A,y.arrays)?N=c(N,A,o):$(A,y.nargs)!==!1?N=S(N,A,o):(U=o[N+1],U!==void 0&&(!U.match(/^-/)||U.match(D))&&!$(A,y.bools)&&!$(A,y.counts)||/^(true|false)$/.test(U)?(_(A,U),N++):_(A,v(A))));else if(L.match(/^-.\..+=/))B=L.match(/^-([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&_(B[1],B[2]);else if(L.match(/^-.\..+/)&&!L.match(D))U=o[N+1],B=L.match(/^-(.\..+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],U!==void 0&&!U.match(/^-/)&&!$(A,y.bools)&&!$(A,y.counts)?(_(A,U),N++):_(A,v(A)));else if(L.match(/^-[^-]+/)&&!L.match(D)){X=L.slice(1,-1).split(""),M=!1;for(let ie=0;ie<X.length;ie++){if(U=L.slice(ie+2),X[ie+1]&&X[ie+1]==="="){te=L.slice(ie+3),A=X[ie],$(A,y.arrays)?N=c(N,A,o,te):$(A,y.nargs)!==!1?N=S(N,A,o,te):_(A,te),M=!0;break}if(U==="-"){_(X[ie],U);continue}if(/[A-Za-z]/.test(X[ie])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(U)&&$(U,y.bools)===!1){_(X[ie],U),M=!0;break}if(X[ie+1]&&X[ie+1].match(/\W/)){_(X[ie],U),M=!0;break}else _(X[ie],v(X[ie]))}A=L.slice(-1)[0],!M&&A!=="-"&&($(A,y.arrays)?N=c(N,A,o):$(A,y.nargs)!==!1?N=S(N,A,o):(U=o[N+1],U!==void 0&&(!/^(-|--)[^-]/.test(U)||U.match(D))&&!$(A,y.bools)&&!$(A,y.counts)||/^(true|false)$/.test(U)?(_(A,U),N++):_(A,v(A))))}else if(L.match(/^-[0-9]$/)&&L.match(D)&&$(L.slice(1),y.bools))A=L.slice(1),_(A,v(A));else if(L==="--"){w=o.slice(N+1);break}else if(a["halt-at-non-option"]){w=o.slice(N);break}else P(L)}W(I,!0),W(I,!1),R(I),G(),Le(I,y.aliases,u,!0),Ze(I),a["set-placeholder-key"]&&Fe(I),Object.keys(y.counts).forEach(function(N){ue(I,N.split("."))||_(N,0)}),h&&w.length&&(I[d]=[]),w.forEach(function(N){I[d].push(N)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(N=>N!=="--"&&N.includes("-")).forEach(N=>{delete I[N]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(N=>s[N])).forEach(N=>{a["camel-case-expansion"]&&N.includes("-")&&delete I[N.split(".").map(L=>Ue(L)).join(".")],delete I[N]});function P(N){const L=q("_",N);(typeof L=="string"||typeof L=="number")&&I._.push(L)}function S(N,L,j,M){let A,X=$(L,y.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return z(M)||(p=Error(O("Argument unexpected for: %s",L))),_(L,v(L)),N;let B=z(M)?0:1;if(a["nargs-eats-options"])j.length-(N+1)+B<X&&(p=Error(O("Not enough arguments following: %s",L))),B=X;else{for(A=N+1;A<j.length&&(!j[A].match(/^-[^0-9]/)||j[A].match(D)||g(j[A]));A++)B++;B<X&&(p=Error(O("Not enough arguments following: %s",L)))}let U=Math.min(B,X);for(!z(M)&&U>0&&(_(L,M),U--),A=N+1;A<U+N+1;A++)_(L,j[A]);return N+U}function c(N,L,j,M){let A=[],X=M||j[N+1];const B=$(L,y.nargs);if($(L,y.bools)&&!/^(true|false)$/.test(X))A.push(!0);else if(z(X)||z(M)&&/^-/.test(X)&&!D.test(X)&&!g(X)){if(u[L]!==void 0){const U=u[L];A=Array.isArray(U)?U:[U]}}else{z(M)||A.push(k(L,M,!0));for(let U=N+1;U<j.length&&!(!a["greedy-arrays"]&&A.length>0||B&&typeof B=="number"&&A.length>=B||(X=j[U],/^-/.test(X)&&!D.test(X)&&!g(X)));U++)N=U,A.push(k(L,X,i))}return typeof B=="number"&&(B&&A.length<B||isNaN(B)&&A.length===0)&&(p=Error(O("Not enough arguments following: %s",L))),_(L,A),N}function _(N,L,j=i){if(/-/.test(N)&&a["camel-case-expansion"]){const X=N.split(".").map(function(B){return Ue(B)}).join(".");F(N,X)}const M=k(N,L,j),A=N.split(".");ge(I,A,M),y.aliases[N]&&y.aliases[N].forEach(function(X){const B=X.split(".");ge(I,B,M)}),A.length>1&&a["dot-notation"]&&(y.aliases[A[0]]||[]).forEach(function(X){let B=X.split(".");const U=[].concat(A);U.shift(),B=B.concat(U),(y.aliases[N]||[]).includes(B.join("."))||ge(I,B,M)}),$(N,y.normalize)&&!$(N,y.arrays)&&[N].concat(y.aliases[N]||[]).forEach(function(B){Object.defineProperty(x,B,{enumerable:!0,get(){return L},set(U){L=typeof U=="string"?me.normalize(U):U}})})}function F(N,L){y.aliases[N]&&y.aliases[N].length||(y.aliases[N]=[L],b[L]=!0),y.aliases[L]&&y.aliases[L].length||F(L,N)}function k(N,L,j){j&&(L=Qs(L)),($(N,y.bools)||$(N,y.counts))&&typeof L=="string"&&(L=L==="true");let M=Array.isArray(L)?L.map(function(A){return q(N,A)}):q(N,L);return $(N,y.counts)&&(z(M)||typeof M=="boolean")&&(M=rt()),$(N,y.normalize)&&$(N,y.arrays)&&(Array.isArray(L)?M=L.map(A=>me.normalize(A)):M=me.normalize(L)),M}function q(N,L){return!a["parse-positional-numbers"]&&N==="_"||!$(N,y.strings)&&!$(N,y.bools)&&!Array.isArray(L)&&(Hs(L)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${L}`)))||!z(L)&&$(N,y.numbers))&&(L=Number(L)),L}function R(N){const L=Object.create(null);Le(L,y.aliases,u),Object.keys(y.configs).forEach(function(j){const M=N[j]||L[j];if(M)try{let A=null;const X=me.resolve(me.cwd(),M),B=y.configs[j];if(typeof B=="function"){try{A=B(X)}catch(U){A=U}if(A instanceof Error){p=A;return}}else A=me.require(X);V(A)}catch(A){A.name==="PermissionDenied"?p=A:N[j]&&(p=Error(O("Invalid JSON config file: %s",M)))}})}function V(N,L){Object.keys(N).forEach(function(j){const M=N[j],A=L?L+"."+j:j;typeof M=="object"&&M!==null&&!Array.isArray(M)&&a["dot-notation"]?V(M,A):(!ue(I,A.split("."))||$(A,y.arrays)&&a["combine-arrays"])&&_(A,M)})}function G(){typeof l<"u"&&l.forEach(function(N){V(N)})}function W(N,L){if(typeof f>"u")return;const j=typeof f=="string"?f:"",M=me.env();Object.keys(M).forEach(function(A){if(j===""||A.lastIndexOf(j,0)===0){const X=A.split("__").map(function(B,U){return U===0&&(B=B.substring(j.length)),Ue(B)});(L&&y.configs[X.join(".")]||!L)&&!ue(N,X)&&_(X.join("."),M[A])}})}function Ze(N){let L;const j=new Set;Object.keys(N).forEach(function(M){if(!j.has(M)&&(L=$(M,y.coercions),typeof L=="function"))try{const A=q(M,L(N[M]));[].concat(y.aliases[M]||[],M).forEach(X=>{j.add(X),N[X]=A})}catch(A){p=A}})}function Fe(N){return y.keys.forEach(L=>{~L.indexOf(".")||typeof N[L]>"u"&&(N[L]=void 0)}),N}function Le(N,L,j,M=!1){Object.keys(j).forEach(function(A){ue(N,A.split("."))||(ge(N,A.split("."),j[A]),M&&(T[A]=!0),(L[A]||[]).forEach(function(X){ue(N,X.split("."))||ge(N,X.split("."),j[A])}))})}function ue(N,L){let j=N;a["dot-notation"]||(L=[L.join(".")]),L.slice(0,-1).forEach(function(A){j=j[A]||{}});const M=L[L.length-1];return typeof j!="object"?!1:M in j}function ge(N,L,j){let M=N;a["dot-notation"]||(L=[L.join(".")]),L.slice(0,-1).forEach(function(te){te=Dn(te),typeof M=="object"&&M[te]===void 0&&(M[te]={}),typeof M[te]!="object"||Array.isArray(M[te])?(Array.isArray(M[te])?M[te].push({}):M[te]=[M[te],{}],M=M[te][M[te].length-1]):M=M[te]});const A=Dn(L[L.length-1]),X=$(L.join("."),y.arrays),B=Array.isArray(j);let U=a["duplicate-arguments-array"];!U&&$(A,y.nargs)&&(U=!0,(!z(M[A])&&y.nargs[A]===1||Array.isArray(M[A])&&M[A].length===y.nargs[A])&&(M[A]=void 0)),j===rt()?M[A]=rt(M[A]):Array.isArray(M[A])?U&&X&&B?M[A]=a["flatten-duplicate-arrays"]?M[A].concat(j):(Array.isArray(M[A][0])?M[A]:[M[A]]).concat([j]):!U&&!!X==!!B?M[A]=j:M[A]=M[A].concat([j]):M[A]===void 0&&X?M[A]=B?j:[j]:U&&!(M[A]===void 0||$(A,y.counts)||$(A,y.bools))?M[A]=[M[A],j]:M[A]=j}function Ke(...N){N.forEach(function(L){Object.keys(L||{}).forEach(function(j){y.aliases[j]||(y.aliases[j]=[].concat(s[j]||[]),y.aliases[j].concat(j).forEach(function(M){if(/-/.test(M)&&a["camel-case-expansion"]){const A=Ue(M);A!==j&&y.aliases[j].indexOf(A)===-1&&(y.aliases[j].push(A),b[A]=!0)}}),y.aliases[j].concat(j).forEach(function(M){if(M.length>1&&/[A-Z]/.test(M)&&a["camel-case-expansion"]){const A=Ws(M,"-");A!==j&&y.aliases[j].indexOf(A)===-1&&(y.aliases[j].push(A),b[A]=!0)}}),y.aliases[j].forEach(function(M){y.aliases[M]=[j].concat(y.aliases[j].filter(function(A){return M!==A}))}))})})}function $(N,L){const j=[].concat(y.aliases[N]||[],N),M=Object.keys(L),A=j.find(X=>M.includes(X));return A?L[A]:!1}function Pe(N){const L=Object.keys(y);return[].concat(L.map(M=>y[M])).some(function(M){return Array.isArray(M)?M.includes(N):M[N]})}function et(N,...L){return[].concat(...L).some(function(M){const A=N.match(M);return A&&Pe(A[1])})}function m(N){if(N.match(D)||!N.match(/^-[^-]+/))return!1;let L=!0,j;const M=N.slice(1).split("");for(let A=0;A<M.length;A++){if(j=N.slice(A+2),!Pe(M[A])){L=!1;break}if(M[A+1]&&M[A+1]==="="||j==="-"||/[A-Za-z]/.test(M[A])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||M[A+1]&&M[A+1].match(/\W/))break}return L}function g(N){return a["unknown-options-as-args"]&&C(N)}function C(N){return N=N.replace(/^-{3,}/,"--"),N.match(D)||m(N)?!1:!et(N,/^-+([^=]+?)=[\s\S]*$/,E,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function v(N){return!$(N,y.bools)&&!$(N,y.counts)&&`${N}`in u?u[N]:Y(J(N))}function Y(N){return{[he.BOOLEAN]:!0,[he.STRING]:"",[he.NUMBER]:void 0,[he.ARRAY]:[]}[N]}function J(N){let L=he.BOOLEAN;return $(N,y.strings)?L=he.STRING:$(N,y.numbers)?L=he.NUMBER:$(N,y.bools)?L=he.BOOLEAN:$(N,y.arrays)&&(L=he.ARRAY),L}function z(N){return N===void 0}function re(){Object.keys(y.counts).find(N=>$(N,y.arrays)?(p=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",N)),!0):$(N,y.nargs)?(p=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",N)),!0):!1)}return{aliases:Object.assign({},y.aliases),argv:Object.assign(x,I),configuration:a,defaulted:Object.assign({},T),error:p,newAliases:Object.assign({},b)}}}function zs(e){const t=[],n=Object.create(null);let r=!0;for(Object.keys(e).forEach(function(o){t.push([].concat(e[o],o))});r;){r=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),r=!0;break}}return t.forEach(function(o){o=o.filter(function(s,a,u){return u.indexOf(s)===a});const i=o.pop();i!==void 0&&typeof i=="string"&&(n[i]=o)}),n}function rt(e){return e!==void 0?e+1:1}function Dn(e){return e==="__proto__"?"___proto___":e}function Qs(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
|
|
60
60
|
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
61
61
|
* CJS and ESM environments.
|
|
62
62
|
*
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright (c) 2016, Contributors
|
|
65
65
|
* SPDX-License-Identifier: ISC
|
|
66
|
-
*/var
|
|
67
|
-
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(Q)),dt}var gt={},Te={},Ne={},Wr;function Ie(){return Wr||(Wr=1,function(){var e,t,r,n,a,o,i,s=[].slice,l={}.hasOwnProperty;e=function(){var d,g,m,w,E,I;if(I=arguments[0],E=2<=arguments.length?s.call(arguments,1):[],a(Object.assign))Object.assign.apply(null,arguments);else for(d=0,m=E.length;d<m;d++)if(w=E[d],w!=null)for(g in w)l.call(w,g)&&(I[g]=w[g]);return I},a=function(d){return!!d&&Object.prototype.toString.call(d)==="[object Function]"},o=function(d){var g;return!!d&&((g=typeof d)=="function"||g==="object")},r=function(d){return a(Array.isArray)?Array.isArray(d):Object.prototype.toString.call(d)==="[object Array]"},n=function(d){var g;if(r(d))return!d.length;for(g in d)if(l.call(d,g))return!1;return!0},i=function(d){var g,m;return o(d)&&(m=Object.getPrototypeOf(d))&&(g=m.constructor)&&typeof g=="function"&&g instanceof g&&Function.prototype.toString.call(g)===Function.prototype.toString.call(Object)},t=function(d){return a(d.valueOf)?d.valueOf():d},Ne.assign=e,Ne.isFunction=a,Ne.isObject=o,Ne.isArray=r,Ne.isEmpty=n,Ne.isPlainObject=i,Ne.getValue=t}.call(Q)),Ne}var mt={exports:{}},Hr;function ui(){return Hr||(Hr=1,function(){mt.exports=function(){function e(){}return e.prototype.hasFeature=function(t,r){return!0},e.prototype.createDocumentType=function(t,r,n){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,r,n){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,r){throw new Error("This DOM method is not implemented.")},e}()}.call(Q)),mt.exports}var yt={exports:{}},wt={exports:{}},bt={exports:{}},Gr;function Es(){return Gr||(Gr=1,function(){bt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(Q)),bt.exports}var Et={exports:{}},Yr;function Ts(){return Yr||(Yr=1,function(){Et.exports=function(){function e(t){this.arr=t||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e}()}.call(Q)),Et.exports}var zr;function Ns(){return zr||(zr=1,function(){var e,t;e=Es(),t=Ts(),wt.exports=function(){function r(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(r.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),r.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},r.prototype.canSetParameter=function(n,a){return!0},r.prototype.setParameter=function(n,a){return a!=null?this.params[n]=a:delete this.params[n]},r}()}.call(Q)),wt.exports}var Tt={exports:{}},Nt={exports:{}},vt={exports:{}},Qr;function ae(){return Qr||(Qr=1,function(){vt.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)),vt.exports}var It={exports:{}},Jr;function ci(){return Jr||(Jr=1,function(){var e;e=ae(),ge(),It.exports=function(){function t(r,n,a){if(this.parent=r,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),n==null)throw new Error("Missing attribute name. "+this.debugInfo(n));this.name=this.stringify.name(n),this.value=this.stringify.attValue(a),this.type=e.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(r){return this.value=r||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(r){return this.options.writer.attribute(this,this.options.writer.filterOptions(r))},t.prototype.debugInfo=function(r){return r=r||this.name,r==null?"parent: <"+this.parent.name+">":"attribute: {"+r+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(r){return!(r.namespaceURI!==this.namespaceURI||r.prefix!==this.prefix||r.localName!==this.localName||r.value!==this.value)},t}()}.call(Q)),It.exports}var xt={exports:{}},Zr;function lr(){return Zr||(Zr=1,function(){xt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var r;return r=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,r||null},e.prototype.removeNamedItem=function(t){var r;return r=this.nodes[t],delete this.nodes[t],r||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,r){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,r){throw new Error("This DOM method is not implemented.")},e}()}.call(Q)),xt.exports}var Kr;function fr(){return Kr||(Kr=1,function(){var e,t,r,n,a,o,i,s,l=function(g,m){for(var w in m)d.call(m,w)&&(g[w]=m[w]);function E(){this.constructor=g}return E.prototype=m.prototype,g.prototype=new E,g.__super__=m.prototype,g},d={}.hasOwnProperty;s=Ie(),i=s.isObject,o=s.isFunction,a=s.getValue,n=ge(),e=ae(),t=ci(),r=lr(),Nt.exports=function(g){l(m,g);function m(w,E,I){var _,T,x,v;if(m.__super__.constructor.call(this,w),E==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(E),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,I!=null&&this.attribute(I),w.type===e.Document&&(this.isRoot=!0,this.documentObject=w,w.rootObject=this,w.children)){for(v=w.children,T=0,x=v.length;T<x;T++)if(_=v[T],_.type===e.DocType){_.name=this.name;break}}}return Object.defineProperty(m.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(m.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(m.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(m.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(m.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new r(this.attribs)),this.attributeMap}}),m.prototype.clone=function(){var w,E,I,_;I=Object.create(this),I.isRoot&&(I.documentObject=null),I.attribs={},_=this.attribs;for(E in _)d.call(_,E)&&(w=_[E],I.attribs[E]=w.clone());return I.children=[],this.children.forEach(function(T){var x;return x=T.clone(),x.parent=I,I.children.push(x)}),I},m.prototype.attribute=function(w,E){var I,_;if(w!=null&&(w=a(w)),i(w))for(I in w)d.call(w,I)&&(_=w[I],this.attribute(I,_));else o(E)&&(E=E.apply()),this.options.keepNullAttributes&&E==null?this.attribs[w]=new t(this,w,""):E!=null&&(this.attribs[w]=new t(this,w,E));return this},m.prototype.removeAttribute=function(w){var E,I,_;if(w==null)throw new Error("Missing attribute name. "+this.debugInfo());if(w=a(w),Array.isArray(w))for(I=0,_=w.length;I<_;I++)E=w[I],delete this.attribs[E];else delete this.attribs[w];return this},m.prototype.toString=function(w){return this.options.writer.element(this,this.options.writer.filterOptions(w))},m.prototype.att=function(w,E){return this.attribute(w,E)},m.prototype.a=function(w,E){return this.attribute(w,E)},m.prototype.getAttribute=function(w){return this.attribs.hasOwnProperty(w)?this.attribs[w].value:null},m.prototype.setAttribute=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNode=function(w){return this.attribs.hasOwnProperty(w)?this.attribs[w]:null},m.prototype.setAttributeNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.removeAttributeNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setAttributeNS=function(w,E,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.removeAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNodeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setAttributeNodeNS=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.hasAttribute=function(w){return this.attribs.hasOwnProperty(w)},m.prototype.hasAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setIdAttribute=function(w,E){return this.attribs.hasOwnProperty(w)?this.attribs[w].isId:E},m.prototype.setIdAttributeNS=function(w,E,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setIdAttributeNode=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.isEqualNode=function(w){var E,I,_;if(!m.__super__.isEqualNode.apply(this,arguments).isEqualNode(w)||w.namespaceURI!==this.namespaceURI||w.prefix!==this.prefix||w.localName!==this.localName||w.attribs.length!==this.attribs.length)return!1;for(E=I=0,_=this.attribs.length-1;0<=_?I<=_:I>=_;E=0<=_?++I:--I)if(!this.attribs[E].isEqualNode(w.attribs[E]))return!1;return!0},m}(n)}.call(Q)),Nt.exports}var Ot={exports:{}},At={exports:{}},en;function st(){return en||(en=1,function(){var e,t=function(n,a){for(var o in a)r.call(a,o)&&(n[o]=a[o]);function i(){this.constructor=n}return i.prototype=a.prototype,n.prototype=new i,n.__super__=a.prototype,n},r={}.hasOwnProperty;e=ge(),At.exports=function(n){t(a,n);function a(o){a.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(a.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(a.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(a.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),a.prototype.clone=function(){return Object.create(this)},a.prototype.substringData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.insertData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.deleteData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.replaceData=function(o,i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.isEqualNode=function(o){return!(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},a}(e)}.call(Q)),At.exports}var tn;function hr(){return tn||(tn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Ot.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.cdata(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ot.exports}var Lt={exports:{}},rn;function pr(){return rn||(rn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Lt.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.comment(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Lt.exports}var Pt={exports:{}},nn;function dr(){return nn||(nn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;r=Ie().isObject,t=ge(),e=ae(),Pt.exports=function(o){n(i,o);function i(s,l,d,g){var m;i.__super__.constructor.call(this,s),r(l)&&(m=l,l=m.version,d=m.encoding,g=m.standalone),l||(l="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(l),d!=null&&(this.encoding=this.stringify.xmlEncoding(d)),g!=null&&(this.standalone=this.stringify.xmlStandalone(g))}return i.prototype.toString=function(s){return this.options.writer.declaration(this,this.options.writer.filterOptions(s))},i}(t)}.call(Q)),Pt.exports}var _t={exports:{}},Dt={exports:{}},on;function gr(){return on||(on=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Dt.exports=function(a){r(o,a);function o(i,s,l,d,g,m){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(l==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(s));if(!d)throw new Error("Missing DTD attribute type. "+this.debugInfo(s));if(!g)throw new Error("Missing DTD attribute default. "+this.debugInfo(s));if(g.indexOf("#")!==0&&(g="#"+g),!g.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(s));if(m&&!g.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(s));this.elementName=this.stringify.name(s),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(l),this.attributeType=this.stringify.dtdAttType(d),m&&(this.defaultValue=this.stringify.dtdAttDefault(m)),this.defaultValueType=g}return o.prototype.toString=function(i){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Dt.exports}var St={exports:{}},sn;function mr(){return sn||(sn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;r=Ie().isObject,t=ge(),e=ae(),St.exports=function(o){n(i,o);function i(s,l,d,g){if(i.__super__.constructor.call(this,s),d==null)throw new Error("Missing DTD entity name. "+this.debugInfo(d));if(g==null)throw new Error("Missing DTD entity value. "+this.debugInfo(d));if(this.pe=!!l,this.name=this.stringify.name(d),this.type=e.EntityDeclaration,!r(g))this.value=this.stringify.dtdEntityValue(g),this.internal=!0;else{if(!g.pubID&&!g.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(d));if(g.pubID&&!g.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(d));if(this.internal=!1,g.pubID!=null&&(this.pubID=this.stringify.dtdPubID(g.pubID)),g.sysID!=null&&(this.sysID=this.stringify.dtdSysID(g.sysID)),g.nData!=null&&(this.nData=this.stringify.dtdNData(g.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(d))}}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(i.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(i.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlVersion",{get:function(){return null}}),i.prototype.toString=function(s){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(s))},i}(t)}.call(Q)),St.exports}var Mt={exports:{}},an;function yr(){return an||(an=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Mt.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());l||(l="(#PCDATA)"),Array.isArray(l)&&(l="("+l.join(",")+")"),this.name=this.stringify.name(s),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(l)}return o.prototype.toString=function(i){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Mt.exports}var Ft={exports:{}},un;function wr(){return un||(un=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Ft.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD notation name. "+this.debugInfo(s));if(!l.pubID&&!l.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(s));this.name=this.stringify.name(s),this.type=e.NotationDeclaration,l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysID!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(i){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ft.exports}var cn;function br(){return cn||(cn=1,function(){var e,t,r,n,a,o,i,s,l=function(g,m){for(var w in m)d.call(m,w)&&(g[w]=m[w]);function E(){this.constructor=g}return E.prototype=m.prototype,g.prototype=new E,g.__super__=m.prototype,g},d={}.hasOwnProperty;s=Ie().isObject,i=ge(),e=ae(),t=gr(),n=mr(),r=yr(),a=wr(),o=lr(),_t.exports=function(g){l(m,g);function m(w,E,I){var _,T,x,v,h,O;if(m.__super__.constructor.call(this,w),this.type=e.DocType,w.children){for(v=w.children,T=0,x=v.length;T<x;T++)if(_=v[T],_.type===e.Element){this.name=_.name;break}}this.documentObject=w,s(E)&&(h=E,E=h.pubID,I=h.sysID),I==null&&(O=[E,I],I=O[0],E=O[1]),E!=null&&(this.pubID=this.stringify.dtdPubID(E)),I!=null&&(this.sysID=this.stringify.dtdSysID(I))}return Object.defineProperty(m.prototype,"entities",{get:function(){var w,E,I,_,T;for(_={},T=this.children,E=0,I=T.length;E<I;E++)w=T[E],w.type===e.EntityDeclaration&&!w.pe&&(_[w.name]=w);return new o(_)}}),Object.defineProperty(m.prototype,"notations",{get:function(){var w,E,I,_,T;for(_={},T=this.children,E=0,I=T.length;E<I;E++)w=T[E],w.type===e.NotationDeclaration&&(_[w.name]=w);return new o(_)}}),Object.defineProperty(m.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(m.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(m.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),m.prototype.element=function(w,E){var I;return I=new r(this,w,E),this.children.push(I),this},m.prototype.attList=function(w,E,I,_,T){var x;return x=new t(this,w,E,I,_,T),this.children.push(x),this},m.prototype.entity=function(w,E){var I;return I=new n(this,!1,w,E),this.children.push(I),this},m.prototype.pEntity=function(w,E){var I;return I=new n(this,!0,w,E),this.children.push(I),this},m.prototype.notation=function(w,E){var I;return I=new a(this,w,E),this.children.push(I),this},m.prototype.toString=function(w){return this.options.writer.docType(this,this.options.writer.filterOptions(w))},m.prototype.ele=function(w,E){return this.element(w,E)},m.prototype.att=function(w,E,I,_,T){return this.attList(w,E,I,_,T)},m.prototype.ent=function(w,E){return this.entity(w,E)},m.prototype.pent=function(w,E){return this.pEntity(w,E)},m.prototype.not=function(w,E){return this.notation(w,E)},m.prototype.up=function(){return this.root()||this.documentObject},m.prototype.isEqualNode=function(w){return!(!m.__super__.isEqualNode.apply(this,arguments).isEqualNode(w)||w.name!==this.name||w.publicId!==this.publicId||w.systemId!==this.systemId)},m}(i)}.call(Q)),_t.exports}var Ct={exports:{}},ln;function Er(){return ln||(ln=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=ge(),Ct.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.raw(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ct.exports}var Bt={exports:{}},fn;function Tr(){return fn||(fn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Bt.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(s)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var i,s,l;for(l="",s=this.previousSibling;s;)l=s.data+l,s=s.previousSibling;for(l+=this.data,i=this.nextSibling;i;)l=l+i.data,i=i.nextSibling;return l}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.text(this,this.options.writer.filterOptions(i))},o.prototype.splitText=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o}(t)}.call(Q)),Bt.exports}var kt={exports:{}},hn;function Nr(){return hn||(hn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),kt.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(s),this.name=this.target,l&&(this.value=this.stringify.insValue(l))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(i))},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.target!==this.target)},o}(t)}.call(Q)),kt.exports}var Rt={exports:{}},pn;function li(){return pn||(pn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Rt.exports=function(a){r(o,a);function o(i){o.__super__.constructor.call(this,i),this.type=e.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return""},o}(t)}.call(Q)),Rt.exports}var jt={exports:{}},dn;function vs(){return dn||(dn=1,function(){jt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e}()}.call(Q)),jt.exports}var Ut={exports:{}},gn;function Is(){return gn||(gn=1,function(){Ut.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(Q)),Ut.exports}var mn;function ge(){return mn||(mn=1,function(){var e,t,r,n,a,o,i,s,l,d,g,m,w,E,I,_,T,x={}.hasOwnProperty;T=Ie(),_=T.isObject,I=T.isFunction,E=T.isEmpty,w=T.getValue,s=null,r=null,n=null,a=null,o=null,g=null,m=null,d=null,i=null,t=null,l=null,e=null,Tt.exports=function(){function v(h){this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,s||(s=fr(),r=hr(),n=pr(),a=dr(),o=br(),g=Er(),m=Tr(),d=Nr(),i=li(),t=ae(),l=vs(),lr(),e=Is())}return Object.defineProperty(v.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(v.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(v.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(v.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(v.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(v.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(v.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(v.prototype,"previousSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h-1]||null}}),Object.defineProperty(v.prototype,"nextSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h+1]||null}}),Object.defineProperty(v.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(v.prototype,"textContent",{get:function(){var h,O,A,F,M;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(M="",F=this.children,O=0,A=F.length;O<A;O++)h=F[O],h.textContent&&(M+=h.textContent);return M}else return null},set:function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),v.prototype.setParent=function(h){var O,A,F,M,k;for(this.parent=h,h&&(this.options=h.options,this.stringify=h.stringify),M=this.children,k=[],A=0,F=M.length;A<F;A++)O=M[A],k.push(O.setParent(this));return k},v.prototype.element=function(h,O,A){var F,M,k,y,B,j,U,W,X,$,Y;if(j=null,O===null&&A==null&&(X=[{},null],O=X[0],A=X[1]),O==null&&(O={}),O=w(O),_(O)||($=[O,A],A=$[0],O=$[1]),h!=null&&(h=w(h)),Array.isArray(h))for(k=0,U=h.length;k<U;k++)M=h[k],j=this.element(M);else if(I(h))j=this.element(h.apply());else if(_(h)){for(B in h)if(x.call(h,B))if(Y=h[B],I(Y)&&(Y=Y.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)j=this.attribute(B.substr(this.stringify.convertAttKey.length),Y);else if(!this.options.separateArrayItems&&Array.isArray(Y)&&E(Y))j=this.dummy();else if(_(Y)&&E(Y))j=this.element(B);else if(!this.options.keepNullNodes&&Y==null)j=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(Y))for(y=0,W=Y.length;y<W;y++)M=Y[y],F={},F[B]=M,j=this.element(F);else _(Y)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?j=this.element(Y):(j=this.element(B),j.element(Y)):j=this.element(B,Y)}else!this.options.keepNullNodes&&A===null?j=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&h.indexOf(this.stringify.convertTextKey)===0?j=this.text(A):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&h.indexOf(this.stringify.convertCDataKey)===0?j=this.cdata(A):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&h.indexOf(this.stringify.convertCommentKey)===0?j=this.comment(A):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&h.indexOf(this.stringify.convertRawKey)===0?j=this.raw(A):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&h.indexOf(this.stringify.convertPIKey)===0?j=this.instruction(h.substr(this.stringify.convertPIKey.length),A):j=this.node(h,O,A);if(j==null)throw new Error("Could not create any elements with: "+h+". "+this.debugInfo());return j},v.prototype.insertBefore=function(h,O,A){var F,M,k,y,B;if(h?.type)return k=h,y=O,k.setParent(this),y?(M=children.indexOf(y),B=children.splice(M),children.push(k),Array.prototype.push.apply(children,B)):children.push(k),k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return M=this.parent.children.indexOf(this),B=this.parent.children.splice(M),F=this.parent.element(h,O,A),Array.prototype.push.apply(this.parent.children,B),F},v.prototype.insertAfter=function(h,O,A){var F,M,k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return M=this.parent.children.indexOf(this),k=this.parent.children.splice(M+1),F=this.parent.element(h,O,A),Array.prototype.push.apply(this.parent.children,k),F},v.prototype.remove=function(){var h;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return h=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[h,h-h+1].concat([])),this.parent},v.prototype.node=function(h,O,A){var F,M;return h!=null&&(h=w(h)),O||(O={}),O=w(O),_(O)||(M=[O,A],A=M[0],O=M[1]),F=new s(this,h,O),A!=null&&F.text(A),this.children.push(F),F},v.prototype.text=function(h){var O;return _(h)&&this.element(h),O=new m(this,h),this.children.push(O),this},v.prototype.cdata=function(h){var O;return O=new r(this,h),this.children.push(O),this},v.prototype.comment=function(h){var O;return O=new n(this,h),this.children.push(O),this},v.prototype.commentBefore=function(h){var O,A;return O=this.parent.children.indexOf(this),A=this.parent.children.splice(O),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,A),this},v.prototype.commentAfter=function(h){var O,A;return O=this.parent.children.indexOf(this),A=this.parent.children.splice(O+1),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,A),this},v.prototype.raw=function(h){var O;return O=new g(this,h),this.children.push(O),this},v.prototype.dummy=function(){var h;return h=new i(this),h},v.prototype.instruction=function(h,O){var A,F,M,k,y;if(h!=null&&(h=w(h)),O!=null&&(O=w(O)),Array.isArray(h))for(k=0,y=h.length;k<y;k++)A=h[k],this.instruction(A);else if(_(h))for(A in h)x.call(h,A)&&(F=h[A],this.instruction(A,F));else I(O)&&(O=O.apply()),M=new d(this,h,O),this.children.push(M);return this},v.prototype.instructionBefore=function(h,O){var A,F;return A=this.parent.children.indexOf(this),F=this.parent.children.splice(A),this.parent.instruction(h,O),Array.prototype.push.apply(this.parent.children,F),this},v.prototype.instructionAfter=function(h,O){var A,F;return A=this.parent.children.indexOf(this),F=this.parent.children.splice(A+1),this.parent.instruction(h,O),Array.prototype.push.apply(this.parent.children,F),this},v.prototype.declaration=function(h,O,A){var F,M;return F=this.document(),M=new a(F,h,O,A),F.children.length===0?F.children.unshift(M):F.children[0].type===t.Declaration?F.children[0]=M:F.children.unshift(M),F.root()||F},v.prototype.dtd=function(h,O){var A,F,M,k,y,B,j,U,W,X;for(F=this.document(),M=new o(F,h,O),W=F.children,k=y=0,j=W.length;y<j;k=++y)if(A=W[k],A.type===t.DocType)return F.children[k]=M,M;for(X=F.children,k=B=0,U=X.length;B<U;k=++B)if(A=X[k],A.isRoot)return F.children.splice(k,0,M),M;return F.children.push(M),M},v.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},v.prototype.root=function(){var h;for(h=this;h;){if(h.type===t.Document)return h.rootObject;if(h.isRoot)return h;h=h.parent}},v.prototype.document=function(){var h;for(h=this;h;){if(h.type===t.Document)return h;h=h.parent}},v.prototype.end=function(h){return this.document().end(h)},v.prototype.prev=function(){var h;if(h=this.parent.children.indexOf(this),h<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[h-1]},v.prototype.next=function(){var h;if(h=this.parent.children.indexOf(this),h===-1||h===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[h+1]},v.prototype.importDocument=function(h){var O;return O=h.root().clone(),O.parent=this,O.isRoot=!1,this.children.push(O),this},v.prototype.debugInfo=function(h){var O,A;return h=h||this.name,h==null&&!((O=this.parent)!=null&&O.name)?"":h==null?"parent: <"+this.parent.name+">":(A=this.parent)!=null&&A.name?"node: <"+h+">, parent: <"+this.parent.name+">":"node: <"+h+">"},v.prototype.ele=function(h,O,A){return this.element(h,O,A)},v.prototype.nod=function(h,O,A){return this.node(h,O,A)},v.prototype.txt=function(h){return this.text(h)},v.prototype.dat=function(h){return this.cdata(h)},v.prototype.com=function(h){return this.comment(h)},v.prototype.ins=function(h,O){return this.instruction(h,O)},v.prototype.doc=function(){return this.document()},v.prototype.dec=function(h,O,A){return this.declaration(h,O,A)},v.prototype.e=function(h,O,A){return this.element(h,O,A)},v.prototype.n=function(h,O,A){return this.node(h,O,A)},v.prototype.t=function(h){return this.text(h)},v.prototype.d=function(h){return this.cdata(h)},v.prototype.c=function(h){return this.comment(h)},v.prototype.r=function(h){return this.raw(h)},v.prototype.i=function(h,O){return this.instruction(h,O)},v.prototype.u=function(){return this.up()},v.prototype.importXMLBuilder=function(h){return this.importDocument(h)},v.prototype.replaceChild=function(h,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.removeChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.appendChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.hasChildNodes=function(){return this.children.length!==0},v.prototype.cloneNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isSupported=function(h,O){return!0},v.prototype.hasAttributes=function(){return this.attribs.length!==0},v.prototype.compareDocumentPosition=function(h){var O,A;return O=this,O===h?0:this.document()!==h.document()?(A=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?A|=e.Preceding:A|=e.Following,A):O.isAncestor(h)?e.Contains|e.Preceding:O.isDescendant(h)?e.Contains|e.Following:O.isPreceding(h)?e.Preceding:e.Following},v.prototype.isSameNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.lookupPrefix=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isDefaultNamespace=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.lookupNamespaceURI=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isEqualNode=function(h){var O,A,F;if(h.nodeType!==this.nodeType||h.children.length!==this.children.length)return!1;for(O=A=0,F=this.children.length-1;0<=F?A<=F:A>=F;O=0<=F?++A:--A)if(!this.children[O].isEqualNode(h.children[O]))return!1;return!0},v.prototype.getFeature=function(h,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.setUserData=function(h,O,A){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.getUserData=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.contains=function(h){return h?h===this||this.isDescendant(h):!1},v.prototype.isDescendant=function(h){var O,A,F,M,k;for(k=this.children,F=0,M=k.length;F<M;F++)if(O=k[F],h===O||(A=O.isDescendant(h),A))return!0;return!1},v.prototype.isAncestor=function(h){return h.isDescendant(this)},v.prototype.isPreceding=function(h){var O,A;return O=this.treePosition(h),A=this.treePosition(this),O===-1||A===-1?!1:O<A},v.prototype.isFollowing=function(h){var O,A;return O=this.treePosition(h),A=this.treePosition(this),O===-1||A===-1?!1:O>A},v.prototype.treePosition=function(h){var O,A;return A=0,O=!1,this.foreachTreeNode(this.document(),function(F){if(A++,!O&&F===h)return O=!0}),O?A:-1},v.prototype.foreachTreeNode=function(h,O){var A,F,M,k,y;for(h||(h=this.document()),k=h.children,F=0,M=k.length;F<M;F++){if(A=k[F],y=O(A))return y;if(y=this.foreachTreeNode(A,O),y)return y}},v}()}.call(Q)),Tt.exports}var Xt={exports:{}},yn;function fi(){return yn||(yn=1,function(){var e=function(r,n){return function(){return r.apply(n,arguments)}},t={}.hasOwnProperty;Xt.exports=function(){function r(n){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var a,o,i;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),o=n.stringify||{};for(a in o)t.call(o,a)&&(i=o[a],this[a]=i)}return r.prototype.name=function(n){return this.options.noValidation?n:this.assertLegalName(""+n||"")},r.prototype.text=function(n){return this.options.noValidation?n:this.assertLegalChar(this.textEscape(""+n||""))},r.prototype.cdata=function(n){return this.options.noValidation?n:(n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n))},r.prototype.comment=function(n){if(this.options.noValidation)return n;if(n=""+n||"",n.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+n);return this.assertLegalChar(n)},r.prototype.raw=function(n){return this.options.noValidation?n:""+n||""},r.prototype.attValue=function(n){return this.options.noValidation?n:this.assertLegalChar(this.attEscape(n=""+n||""))},r.prototype.insTarget=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.insValue=function(n){if(this.options.noValidation)return n;if(n=""+n||"",n.match(/\?>/))throw new Error("Invalid processing instruction value: "+n);return this.assertLegalChar(n)},r.prototype.xmlVersion=function(n){if(this.options.noValidation)return n;if(n=""+n||"",!n.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+n);return n},r.prototype.xmlEncoding=function(n){if(this.options.noValidation)return n;if(n=""+n||"",!n.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+n);return this.assertLegalChar(n)},r.prototype.xmlStandalone=function(n){return this.options.noValidation?n:n?"yes":"no"},r.prototype.dtdPubID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdSysID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdElementValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdAttType=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdAttDefault=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdEntityValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdNData=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.convertAttKey="@",r.prototype.convertPIKey="?",r.prototype.convertTextKey="#text",r.prototype.convertCDataKey="#cdata",r.prototype.convertCommentKey="#comment",r.prototype.convertRawKey="#raw",r.prototype.assertLegalChar=function(n){var a,o;if(this.options.noValidation)return n;if(a="",this.options.version==="1.0"){if(a=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=n.match(a))throw new Error("Invalid character in string: "+n+" at index "+o.index)}else if(this.options.version==="1.1"&&(a=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=n.match(a)))throw new Error("Invalid character in string: "+n+" at index "+o.index);return n},r.prototype.assertLegalName=function(n){var a;if(this.options.noValidation)return n;if(this.assertLegalChar(n),a=/^([: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])*$/,!n.match(a))throw new Error("Invalid character in name");return n},r.prototype.textEscape=function(n){var a;return this.options.noValidation?n:(a=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(a,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},r.prototype.attEscape=function(n){var a;return this.options.noValidation?n:(a=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(a,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},r}()}.call(Q)),Xt.exports}var Vt={exports:{}},$t={exports:{}},qt={exports:{}},wn;function at(){return wn||(wn=1,function(){qt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(Q)),qt.exports}var bn;function hi(){return bn||(bn=1,function(){var e,t,r,n={}.hasOwnProperty;r=Ie().assign,e=ae(),dr(),br(),hr(),pr(),fr(),Er(),Tr(),Nr(),li(),gr(),yr(),mr(),wr(),t=at(),$t.exports=function(){function a(o){var i,s,l;o||(o={}),this.options=o,s=o.writer||{};for(i in s)n.call(s,i)&&(l=s[i],this["_"+i]=this[i],this[i]=l)}return a.prototype.filterOptions=function(o){var i,s,l,d,g,m,w,E;return o||(o={}),o=r({},this.options,o),i={writer:this},i.pretty=o.pretty||!1,i.allowEmpty=o.allowEmpty||!1,i.indent=(s=o.indent)!=null?s:" ",i.newline=(l=o.newline)!=null?l:`
|
|
68
|
-
`,i.offset=(d=o.offset)!=null?d:0,i.dontPrettyTextNodes=(g=(m=o.dontPrettyTextNodes)!=null?m:o.dontprettytextnodes)!=null?g:0,i.spaceBeforeSlash=(w=(E=o.spaceBeforeSlash)!=null?E:o.spacebeforeslash)!=null?w:"",i.spaceBeforeSlash===!0&&(i.spaceBeforeSlash=" "),i.suppressPrettyCount=0,i.user={},i.state=t.None,i},a.prototype.indent=function(o,i,s){var l;return!i.pretty||i.suppressPrettyCount?"":i.pretty&&(l=(s||0)+i.offset+1,l>0)?new Array(l).join(i.indent):""},a.prototype.endline=function(o,i,s){return!i.pretty||i.suppressPrettyCount?"":i.newline},a.prototype.attribute=function(o,i,s){var l;return this.openAttribute(o,i,s),l=" "+o.name+'="'+o.value+'"',this.closeAttribute(o,i,s),l},a.prototype.cdata=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<![CDATA[",i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+="]]>"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.comment=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!-- ",i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=" -->"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.declaration=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<?xml",i.state=t.InsideTag,l+=' version="'+o.version+'"',o.encoding!=null&&(l+=' encoding="'+o.encoding+'"'),o.standalone!=null&&(l+=' standalone="'+o.standalone+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+"?>",l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.docType=function(o,i,s){var l,d,g,m,w;if(s||(s=0),this.openNode(o,i,s),i.state=t.OpenTag,m=this.indent(o,i,s),m+="<!DOCTYPE "+o.root().name,o.pubID&&o.sysID?m+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(m+=' SYSTEM "'+o.sysID+'"'),o.children.length>0){for(m+=" [",m+=this.endline(o,i,s),i.state=t.InsideTag,w=o.children,d=0,g=w.length;d<g;d++)l=w[d],m+=this.writeChildNode(l,i,s+1);i.state=t.CloseTag,m+="]"}return i.state=t.CloseTag,m+=i.spaceBeforeSlash+">",m+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),m},a.prototype.element=function(o,i,s){var l,d,g,m,w,E,I,_,T,x,v,h,O,A;s||(s=0),x=!1,v="",this.openNode(o,i,s),i.state=t.OpenTag,v+=this.indent(o,i,s)+"<"+o.name,h=o.attribs;for(T in h)n.call(h,T)&&(l=h[T],v+=this.attribute(l,i,s));if(g=o.children.length,m=g===0?null:o.children[0],g===0||o.children.every(function(F){return(F.type===e.Text||F.type===e.Raw)&&F.value===""}))i.allowEmpty?(v+=">",i.state=t.CloseTag,v+="</"+o.name+">"+this.endline(o,i,s)):(i.state=t.CloseTag,v+=i.spaceBeforeSlash+"/>"+this.endline(o,i,s));else if(i.pretty&&g===1&&(m.type===e.Text||m.type===e.Raw)&&m.value!=null)v+=">",i.state=t.InsideTag,i.suppressPrettyCount++,x=!0,v+=this.writeChildNode(m,i,s+1),i.suppressPrettyCount--,x=!1,i.state=t.CloseTag,v+="</"+o.name+">"+this.endline(o,i,s);else{if(i.dontPrettyTextNodes){for(O=o.children,w=0,I=O.length;w<I;w++)if(d=O[w],(d.type===e.Text||d.type===e.Raw)&&d.value!=null){i.suppressPrettyCount++,x=!0;break}}for(v+=">"+this.endline(o,i,s),i.state=t.InsideTag,A=o.children,E=0,_=A.length;E<_;E++)d=A[E],v+=this.writeChildNode(d,i,s+1);i.state=t.CloseTag,v+=this.indent(o,i,s)+"</"+o.name+">",x&&i.suppressPrettyCount--,v+=this.endline(o,i,s),i.state=t.None}return this.closeNode(o,i,s),v},a.prototype.writeChildNode=function(o,i,s){switch(o.type){case e.CData:return this.cdata(o,i,s);case e.Comment:return this.comment(o,i,s);case e.Element:return this.element(o,i,s);case e.Raw:return this.raw(o,i,s);case e.Text:return this.text(o,i,s);case e.ProcessingInstruction:return this.processingInstruction(o,i,s);case e.Dummy:return"";case e.Declaration:return this.declaration(o,i,s);case e.DocType:return this.docType(o,i,s);case e.AttributeDeclaration:return this.dtdAttList(o,i,s);case e.ElementDeclaration:return this.dtdElement(o,i,s);case e.EntityDeclaration:return this.dtdEntity(o,i,s);case e.NotationDeclaration:return this.dtdNotation(o,i,s);default:throw new Error("Unknown XML node type: "+o.constructor.name)}},a.prototype.processingInstruction=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<?",i.state=t.InsideTag,l+=o.target,o.value&&(l+=" "+o.value),i.state=t.CloseTag,l+=i.spaceBeforeSlash+"?>",l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.raw=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s),i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.text=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s),i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdAttList=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ATTLIST",i.state=t.InsideTag,l+=" "+o.elementName+" "+o.attributeName+" "+o.attributeType,o.defaultValueType!=="#DEFAULT"&&(l+=" "+o.defaultValueType),o.defaultValue&&(l+=' "'+o.defaultValue+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdElement=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ELEMENT",i.state=t.InsideTag,l+=" "+o.name+" "+o.value,i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdEntity=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ENTITY",i.state=t.InsideTag,o.pe&&(l+=" %"),l+=" "+o.name,o.value?l+=' "'+o.value+'"':(o.pubID&&o.sysID?l+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(l+=' SYSTEM "'+o.sysID+'"'),o.nData&&(l+=" NDATA "+o.nData)),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdNotation=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!NOTATION",i.state=t.InsideTag,l+=" "+o.name,o.pubID&&o.sysID?l+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.pubID?l+=' PUBLIC "'+o.pubID+'"':o.sysID&&(l+=' SYSTEM "'+o.sysID+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.openNode=function(o,i,s){},a.prototype.closeNode=function(o,i,s){},a.prototype.openAttribute=function(o,i,s){},a.prototype.closeAttribute=function(o,i,s){},a}()}.call(Q)),$t.exports}var En;function vr(){return En||(En=1,function(){var e,t=function(n,a){for(var o in a)r.call(a,o)&&(n[o]=a[o]);function i(){this.constructor=n}return i.prototype=a.prototype,n.prototype=new i,n.__super__=a.prototype,n},r={}.hasOwnProperty;e=hi(),Vt.exports=function(n){t(a,n);function a(o){a.__super__.constructor.call(this,o)}return a.prototype.document=function(o,i){var s,l,d,g,m;for(i=this.filterOptions(i),g="",m=o.children,l=0,d=m.length;l<d;l++)s=m[l],g+=this.writeChildNode(s,i,0);return i.pretty&&g.slice(-i.newline.length)===i.newline&&(g=g.slice(0,-i.newline.length)),g},a}(e)}.call(Q)),Vt.exports}var Tn;function pi(){return Tn||(Tn=1,function(){var e,t,r,n,a,o,i,s=function(d,g){for(var m in g)l.call(g,m)&&(d[m]=g[m]);function w(){this.constructor=d}return w.prototype=g.prototype,d.prototype=new w,d.__super__=g.prototype,d},l={}.hasOwnProperty;i=Ie().isPlainObject,r=ui(),t=Ns(),n=ge(),e=ae(),o=fi(),a=vr(),yt.exports=function(d){s(g,d);function g(m){g.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,m||(m={}),m.writer||(m.writer=new a),this.options=m,this.stringify=new o(m)}return Object.defineProperty(g.prototype,"implementation",{value:new r}),Object.defineProperty(g.prototype,"doctype",{get:function(){var m,w,E,I;for(I=this.children,w=0,E=I.length;w<E;w++)if(m=I[w],m.type===e.DocType)return m;return null}}),Object.defineProperty(g.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(g.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(g.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(g.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(g.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(g.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(g.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(g.prototype,"origin",{get:function(){return null}}),Object.defineProperty(g.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(g.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(g.prototype,"contentType",{get:function(){return null}}),g.prototype.end=function(m){var w;return w={},m?i(m)&&(w=m,m=this.options.writer):m=this.options.writer,m.document(this,m.filterOptions(w))},g.prototype.toString=function(m){return this.options.writer.document(this,this.options.writer.filterOptions(m))},g.prototype.createElement=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createTextNode=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createComment=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createCDATASection=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createProcessingInstruction=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createAttribute=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createEntityReference=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.importNode=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createElementNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createAttributeNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementById=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.adoptNode=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.renameNode=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createEvent=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createNodeIterator=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createTreeWalker=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g}(n)}.call(Q)),yt.exports}var Wt={exports:{}},Nn;function xs(){return Nn||(Nn=1,function(){var e,t,r,n,a,o,i,s,l,d,g,m,w,E,I,_,T,x,v,h,O,A,F,M={}.hasOwnProperty;F=Ie(),O=F.isObject,h=F.isFunction,A=F.isPlainObject,v=F.getValue,e=ae(),m=pi(),w=fr(),n=hr(),a=pr(),I=Er(),x=Tr(),E=Nr(),d=dr(),g=br(),o=gr(),s=mr(),i=yr(),l=wr(),r=ci(),T=fi(),_=vr(),t=at(),Wt.exports=function(){function k(y,B,j){var U;this.name="?xml",this.type=e.Document,y||(y={}),U={},y.writer?A(y.writer)&&(U=y.writer,y.writer=new _):y.writer=new _,this.options=y,this.writer=y.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new T(y),this.onDataCallback=B||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(y){var B,j,U,W,X,$,Y,H;switch(y.type){case e.CData:this.cdata(y.value);break;case e.Comment:this.comment(y.value);break;case e.Element:U={},Y=y.attribs;for(j in Y)M.call(Y,j)&&(B=Y[j],U[j]=B.value);this.node(y.name,U);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(y.value);break;case e.Text:this.text(y.value);break;case e.ProcessingInstruction:this.instruction(y.target,y.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+y.constructor.name)}for(H=y.children,X=0,$=H.length;X<$;X++)W=H[X],this.createChildNode(W),W.type===e.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(y,B,j){var U;if(y==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(y));return this.openCurrent(),y=v(y),B==null&&(B={}),B=v(B),O(B)||(U=[B,j],j=U[0],B=U[1]),this.currentNode=new w(this,y,B),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},k.prototype.element=function(y,B,j){var U,W,X,$,Y,H;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(y)||O(y)||h(y))for($=this.options.noValidation,this.options.noValidation=!0,H=new m(this.options).element("TEMP_ROOT"),H.element(y),this.options.noValidation=$,Y=H.children,W=0,X=Y.length;W<X;W++)U=Y[W],this.createChildNode(U),U.type===e.Element&&this.up();else this.node(y,B,j);return this},k.prototype.attribute=function(y,B){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(y));if(y!=null&&(y=v(y)),O(y))for(j in y)M.call(y,j)&&(U=y[j],this.attribute(j,U));else h(B)&&(B=B.apply()),this.options.keepNullAttributes&&B==null?this.currentNode.attribs[y]=new r(this,y,""):B!=null&&(this.currentNode.attribs[y]=new r(this,y,B));return this},k.prototype.text=function(y){var B;return this.openCurrent(),B=new x(this,y),this.onData(this.writer.text(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(y){var B;return this.openCurrent(),B=new n(this,y),this.onData(this.writer.cdata(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(y){var B;return this.openCurrent(),B=new a(this,y),this.onData(this.writer.comment(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(y){var B;return this.openCurrent(),B=new I(this,y),this.onData(this.writer.raw(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(y,B){var j,U,W,X,$;if(this.openCurrent(),y!=null&&(y=v(y)),B!=null&&(B=v(B)),Array.isArray(y))for(j=0,X=y.length;j<X;j++)U=y[j],this.instruction(U);else if(O(y))for(U in y)M.call(y,U)&&(W=y[U],this.instruction(U,W));else h(B)&&(B=B.apply()),$=new E(this,y,B),this.onData(this.writer.processingInstruction($,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(y,B,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new d(this,y,B,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(y,B,j){if(this.openCurrent(),y==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 g(this,B,j),this.currentNode.rootNodeName=y,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(y,B){var j;return this.openCurrent(),j=new i(this,y,B),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(y,B,j,U,W){var X;return this.openCurrent(),X=new o(this,y,B,j,U,W),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(y,B){var j;return this.openCurrent(),j=new s(this,!1,y,B),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(y,B){var j;return this.openCurrent(),j=new s(this,!0,y,B),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(y,B){var j;return this.openCurrent(),j=new l(this,y,B),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.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},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(y){var B,j,U,W;if(!y.isOpen){if(!this.root&&this.currentLevel===0&&y.type===e.Element&&(this.root=y),j="",y.type===e.Element){this.writerOptions.state=t.OpenTag,j=this.writer.indent(y,this.writerOptions,this.currentLevel)+"<"+y.name,W=y.attribs;for(U in W)M.call(W,U)&&(B=W[U],j+=this.writer.attribute(B,this.writerOptions,this.currentLevel));j+=(y.children?">":"/>")+this.writer.endline(y,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,j=this.writer.indent(y,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+y.rootNodeName,y.pubID&&y.sysID?j+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.sysID&&(j+=' SYSTEM "'+y.sysID+'"'),y.children?(j+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,j+=">"),j+=this.writer.endline(y,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),y.isOpen=!0}},k.prototype.closeNode=function(y){var B;if(!y.isClosed)return B="",this.writerOptions.state=t.CloseTag,y.type===e.Element?B=this.writer.indent(y,this.writerOptions,this.currentLevel)+"</"+y.name+">"+this.writer.endline(y,this.writerOptions,this.currentLevel):B=this.writer.indent(y,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(y,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(B,this.currentLevel),y.isClosed=!0},k.prototype.onData=function(y,B){return this.documentStarted=!0,this.onDataCallback(y,B+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(y){return y==null?"":"node: <"+y+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(y,B,j){return this.node(y,B,j)},k.prototype.txt=function(y){return this.text(y)},k.prototype.dat=function(y){return this.cdata(y)},k.prototype.com=function(y){return this.comment(y)},k.prototype.ins=function(y,B){return this.instruction(y,B)},k.prototype.dec=function(y,B,j){return this.declaration(y,B,j)},k.prototype.dtd=function(y,B,j){return this.doctype(y,B,j)},k.prototype.e=function(y,B,j){return this.element(y,B,j)},k.prototype.n=function(y,B,j){return this.node(y,B,j)},k.prototype.t=function(y){return this.text(y)},k.prototype.d=function(y){return this.cdata(y)},k.prototype.c=function(y){return this.comment(y)},k.prototype.r=function(y){return this.raw(y)},k.prototype.i=function(y,B){return this.instruction(y,B)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(y,B){return this.entity(y,B)},k.prototype.pent=function(y,B){return this.pEntity(y,B)},k.prototype.not=function(y,B){return this.notation(y,B)},k}()}.call(Q)),Wt.exports}var Ht={exports:{}},vn;function Os(){return vn||(vn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;e=ae(),r=hi(),t=at(),Ht.exports=function(o){n(i,o);function i(s,l){this.stream=s,i.__super__.constructor.call(this,l)}return i.prototype.endline=function(s,l,d){return s.isLastRootNode&&l.state===t.CloseTag?"":i.__super__.endline.call(this,s,l,d)},i.prototype.document=function(s,l){var d,g,m,w,E,I,_,T,x;for(_=s.children,g=m=0,E=_.length;m<E;g=++m)d=_[g],d.isLastRootNode=g===s.children.length-1;for(l=this.filterOptions(l),T=s.children,x=[],w=0,I=T.length;w<I;w++)d=T[w],x.push(this.writeChildNode(d,l,0));return x},i.prototype.attribute=function(s,l,d){return this.stream.write(i.__super__.attribute.call(this,s,l,d))},i.prototype.cdata=function(s,l,d){return this.stream.write(i.__super__.cdata.call(this,s,l,d))},i.prototype.comment=function(s,l,d){return this.stream.write(i.__super__.comment.call(this,s,l,d))},i.prototype.declaration=function(s,l,d){return this.stream.write(i.__super__.declaration.call(this,s,l,d))},i.prototype.docType=function(s,l,d){var g,m,w,E;if(d||(d=0),this.openNode(s,l,d),l.state=t.OpenTag,this.stream.write(this.indent(s,l,d)),this.stream.write("<!DOCTYPE "+s.root().name),s.pubID&&s.sysID?this.stream.write(' PUBLIC "'+s.pubID+'" "'+s.sysID+'"'):s.sysID&&this.stream.write(' SYSTEM "'+s.sysID+'"'),s.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(s,l,d)),l.state=t.InsideTag,E=s.children,m=0,w=E.length;m<w;m++)g=E[m],this.writeChildNode(g,l,d+1);l.state=t.CloseTag,this.stream.write("]")}return l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+">"),this.stream.write(this.endline(s,l,d)),l.state=t.None,this.closeNode(s,l,d)},i.prototype.element=function(s,l,d){var g,m,w,E,I,_,T,x,v;d||(d=0),this.openNode(s,l,d),l.state=t.OpenTag,this.stream.write(this.indent(s,l,d)+"<"+s.name),x=s.attribs;for(T in x)a.call(x,T)&&(g=x[T],this.attribute(g,l,d));if(w=s.children.length,E=w===0?null:s.children[0],w===0||s.children.every(function(h){return(h.type===e.Text||h.type===e.Raw)&&h.value===""}))l.allowEmpty?(this.stream.write(">"),l.state=t.CloseTag,this.stream.write("</"+s.name+">")):(l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+"/>"));else if(l.pretty&&w===1&&(E.type===e.Text||E.type===e.Raw)&&E.value!=null)this.stream.write(">"),l.state=t.InsideTag,l.suppressPrettyCount++,this.writeChildNode(E,l,d+1),l.suppressPrettyCount--,l.state=t.CloseTag,this.stream.write("</"+s.name+">");else{for(this.stream.write(">"+this.endline(s,l,d)),l.state=t.InsideTag,v=s.children,I=0,_=v.length;I<_;I++)m=v[I],this.writeChildNode(m,l,d+1);l.state=t.CloseTag,this.stream.write(this.indent(s,l,d)+"</"+s.name+">")}return this.stream.write(this.endline(s,l,d)),l.state=t.None,this.closeNode(s,l,d)},i.prototype.processingInstruction=function(s,l,d){return this.stream.write(i.__super__.processingInstruction.call(this,s,l,d))},i.prototype.raw=function(s,l,d){return this.stream.write(i.__super__.raw.call(this,s,l,d))},i.prototype.text=function(s,l,d){return this.stream.write(i.__super__.text.call(this,s,l,d))},i.prototype.dtdAttList=function(s,l,d){return this.stream.write(i.__super__.dtdAttList.call(this,s,l,d))},i.prototype.dtdElement=function(s,l,d){return this.stream.write(i.__super__.dtdElement.call(this,s,l,d))},i.prototype.dtdEntity=function(s,l,d){return this.stream.write(i.__super__.dtdEntity.call(this,s,l,d))},i.prototype.dtdNotation=function(s,l,d){return this.stream.write(i.__super__.dtdNotation.call(this,s,l,d))},i}(r)}.call(Q)),Ht.exports}var In;function As(){return In||(In=1,function(){var e,t,r,n,a,o,i,s,l,d;d=Ie(),s=d.assign,l=d.isFunction,r=ui(),n=pi(),a=xs(),i=vr(),o=Os(),e=ae(),t=at(),Te.create=function(g,m,w,E){var I,_;if(g==null)throw new Error("Root element needs a name.");return E=s({},m,w,E),I=new n(E),_=I.element(g),E.headless||(I.declaration(E),(E.pubID!=null||E.sysID!=null)&&I.dtd(E)),_},Te.begin=function(g,m,w){var E;return l(g)&&(E=[g,m],m=E[0],w=E[1],g={}),m?new a(g,m,w):new n(g)},Te.stringWriter=function(g){return new i(g)},Te.streamWriter=function(g,m){return new o(g,m)},Te.implementation=new r,Te.nodeType=e,Te.writerState=t}.call(Q)),Te}var xn;function Ls(){return xn||(xn=1,function(){var e,t,r,n,a,o={}.hasOwnProperty;e=As(),t=cr().defaults,n=function(i){return typeof i=="string"&&(i.indexOf("&")>=0||i.indexOf(">")>=0||i.indexOf("<")>=0)},a=function(i){return"<![CDATA["+r(i)+"]]>"},r=function(i){return i.replace("]]>","]]]]><![CDATA[>")},gt.Builder=function(){function i(s){var l,d,g;this.options={},d=t["0.2"];for(l in d)o.call(d,l)&&(g=d[l],this.options[l]=g);for(l in s)o.call(s,l)&&(g=s[l],this.options[l]=g)}return i.prototype.buildObject=function(s){var l,d,g,m,w;return l=this.options.attrkey,d=this.options.charkey,Object.keys(s).length===1&&this.options.rootName===t["0.2"].rootName?(w=Object.keys(s)[0],s=s[w]):w=this.options.rootName,g=function(E){return function(I,_){var T,x,v,h,O,A;if(typeof _!="object")E.options.cdata&&n(_)?I.raw(a(_)):I.txt(_);else if(Array.isArray(_)){for(h in _)if(o.call(_,h)){x=_[h];for(O in x)v=x[O],I=g(I.ele(O),v).up()}}else for(O in _)if(o.call(_,O))if(x=_[O],O===l){if(typeof x=="object")for(T in x)A=x[T],I=I.att(T,A)}else if(O===d)E.options.cdata&&n(x)?I=I.raw(a(x)):I=I.txt(x);else if(Array.isArray(x))for(h in x)o.call(x,h)&&(v=x[h],typeof v=="string"?E.options.cdata&&n(v)?I=I.ele(O).raw(a(v)).up():I=I.ele(O,v).up():I=g(I.ele(O),v).up());else typeof x=="object"?I=g(I.ele(O),x).up():typeof x=="string"&&E.options.cdata&&n(x)?I=I.ele(O).raw(a(x)).up():(x==null&&(x=""),I=I.ele(O,x.toString()).up());return I}}(this),m=e.create(w,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),g(m,s).end(this.options.renderOpts)},i}()}.call(Q)),gt}var Gt={},Yt={},zt={},Qe={exports:{}},Qt={},We={},On;function Ps(){if(On)return We;On=1,We.byteLength=s,We.toByteArray=d,We.fromByteArray=w;for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=n.length;a<o;++a)e[a]=n[a],t[n.charCodeAt(a)]=a;t[45]=62,t[95]=63;function i(E){var I=E.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=E.indexOf("=");_===-1&&(_=I);var T=_===I?0:4-_%4;return[_,T]}function s(E){var I=i(E),_=I[0],T=I[1];return(_+T)*3/4-T}function l(E,I,_){return(I+_)*3/4-_}function d(E){var I,_=i(E),T=_[0],x=_[1],v=new r(l(E,T,x)),h=0,O=x>0?T-4:T,A;for(A=0;A<O;A+=4)I=t[E.charCodeAt(A)]<<18|t[E.charCodeAt(A+1)]<<12|t[E.charCodeAt(A+2)]<<6|t[E.charCodeAt(A+3)],v[h++]=I>>16&255,v[h++]=I>>8&255,v[h++]=I&255;return x===2&&(I=t[E.charCodeAt(A)]<<2|t[E.charCodeAt(A+1)]>>4,v[h++]=I&255),x===1&&(I=t[E.charCodeAt(A)]<<10|t[E.charCodeAt(A+1)]<<4|t[E.charCodeAt(A+2)]>>2,v[h++]=I>>8&255,v[h++]=I&255),v}function g(E){return e[E>>18&63]+e[E>>12&63]+e[E>>6&63]+e[E&63]}function m(E,I,_){for(var T,x=[],v=I;v<_;v+=3)T=(E[v]<<16&16711680)+(E[v+1]<<8&65280)+(E[v+2]&255),x.push(g(T));return x.join("")}function w(E){for(var I,_=E.length,T=_%3,x=[],v=16383,h=0,O=_-T;h<O;h+=v)x.push(m(E,h,h+v>O?O:h+v));return T===1?(I=E[_-1],x.push(e[I>>2]+e[I<<4&63]+"==")):T===2&&(I=(E[_-2]<<8)+E[_-1],x.push(e[I>>10]+e[I>>4&63]+e[I<<2&63]+"=")),x.join("")}return We}var Je={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var An;function _s(){return An||(An=1,Je.read=function(e,t,r,n,a){var o,i,s=a*8-n-1,l=(1<<s)-1,d=l>>1,g=-7,m=r?a-1:0,w=r?-1:1,E=e[t+m];for(m+=w,o=E&(1<<-g)-1,E>>=-g,g+=s;g>0;o=o*256+e[t+m],m+=w,g-=8);for(i=o&(1<<-g)-1,o>>=-g,g+=n;g>0;i=i*256+e[t+m],m+=w,g-=8);if(o===0)o=1-d;else{if(o===l)return i?NaN:(E?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-d}return(E?-1:1)*i*Math.pow(2,o-n)},Je.write=function(e,t,r,n,a,o){var i,s,l,d=o*8-a-1,g=(1<<d)-1,m=g>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,I=n?1:-1,_=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,i=g):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+m>=1?t+=w/l:t+=w*Math.pow(2,1-m),t*l>=2&&(i++,l/=2),i+m>=g?(s=0,i=g):i+m>=1?(s=(t*l-1)*Math.pow(2,a),i=i+m):(s=t*Math.pow(2,m-1)*Math.pow(2,a),i=0));a>=8;e[r+E]=s&255,E+=I,s/=256,a-=8);for(i=i<<a|s,d+=a;d>0;e[r+E]=i&255,E+=I,i/=256,d-=8);e[r+E-I]|=_*128}),Je}/*!
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/var Ln;function Ds(){return Ln||(Ln=1,function(e){var t=Ps(),r=_s(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var a=2147483647;e.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=o(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{var f=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(f,u),f.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function i(f){if(f>a)throw new RangeError('The value "'+f+'" is invalid for option "size"');var u=new Uint8Array(f);return Object.setPrototypeOf(u,s.prototype),u}function s(f,u,c){if(typeof f=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(f)}return l(f,u,c)}s.poolSize=8192;function l(f,u,c){if(typeof f=="string")return w(f,u);if(ArrayBuffer.isView(f))return I(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(z(f,ArrayBuffer)||f&&z(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(z(f,SharedArrayBuffer)||f&&z(f.buffer,SharedArrayBuffer)))return _(f,u,c);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var p=f.valueOf&&f.valueOf();if(p!=null&&p!==f)return s.from(p,u,c);var L=T(f);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return s.from(f[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}s.from=function(f,u,c){return l(f,u,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function d(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function g(f,u,c){return d(f),f<=0?i(f):u!==void 0?typeof c=="string"?i(f).fill(u,c):i(f).fill(u):i(f)}s.alloc=function(f,u,c){return g(f,u,c)};function m(f){return d(f),i(f<0?0:x(f)|0)}s.allocUnsafe=function(f){return m(f)},s.allocUnsafeSlow=function(f){return m(f)};function w(f,u){if((typeof u!="string"||u==="")&&(u="utf8"),!s.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var c=h(f,u)|0,p=i(c),L=p.write(f,u);return L!==c&&(p=p.slice(0,L)),p}function E(f){for(var u=f.length<0?0:x(f.length)|0,c=i(u),p=0;p<u;p+=1)c[p]=f[p]&255;return c}function I(f){if(z(f,Uint8Array)){var u=new Uint8Array(f);return _(u.buffer,u.byteOffset,u.byteLength)}return E(f)}function _(f,u,c){if(u<0||f.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');var p;return u===void 0&&c===void 0?p=new Uint8Array(f):c===void 0?p=new Uint8Array(f,u):p=new Uint8Array(f,u,c),Object.setPrototypeOf(p,s.prototype),p}function T(f){if(s.isBuffer(f)){var u=x(f.length)|0,c=i(u);return c.length===0||f.copy(c,0,0,u),c}if(f.length!==void 0)return typeof f.length!="number"||oe(f.length)?i(0):E(f);if(f.type==="Buffer"&&Array.isArray(f.data))return E(f.data)}function x(f){if(f>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return f|0}function v(f){return+f!=f&&(f=0),s.alloc(+f)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,c){if(z(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),z(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(u)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;for(var p=u.length,L=c.length,S=0,C=Math.min(p,L);S<C;++S)if(u[S]!==c[S]){p=u[S],L=c[S];break}return p<L?-1:L<p?1:0},s.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(u,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return s.alloc(0);var p;if(c===void 0)for(c=0,p=0;p<u.length;++p)c+=u[p].length;var L=s.allocUnsafe(c),S=0;for(p=0;p<u.length;++p){var C=u[p];if(z(C,Uint8Array))S+C.length>L.length?s.from(C).copy(L,S):Uint8Array.prototype.set.call(L,C,S);else if(s.isBuffer(C))C.copy(L,S);else throw new TypeError('"list" argument must be an Array of Buffers');S+=C.length}return L};function h(f,u){if(s.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||z(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);var c=f.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&c===0)return 0;for(var L=!1;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return b(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return J(f).length;default:if(L)return p?-1:b(f).length;u=(""+u).toLowerCase(),L=!0}}s.byteLength=h;function O(f,u,c){var p=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(f||(f="utf8");;)switch(f){case"hex":return Ae(this,u,c);case"utf8":case"utf-8":return X(this,u,c);case"ascii":return H(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return W(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,u,c);default:if(p)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),p=!0}}s.prototype._isBuffer=!0;function A(f,u,c){var p=f[u];f[u]=f[c],f[c]=p}s.prototype.swap16=function(){var u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<u;c+=2)A(this,c,c+1);return this},s.prototype.swap32=function(){var u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<u;c+=4)A(this,c,c+3),A(this,c+1,c+2);return this},s.prototype.swap64=function(){var u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<u;c+=8)A(this,c,c+7),A(this,c+1,c+6),A(this,c+2,c+5),A(this,c+3,c+4);return this},s.prototype.toString=function(){var u=this.length;return u===0?"":arguments.length===0?X(this,0,u):O.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(u){if(!s.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:s.compare(this,u)===0},s.prototype.inspect=function(){var u="",c=e.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(u,c,p,L,S){if(z(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),p===void 0&&(p=u?u.length:0),L===void 0&&(L=0),S===void 0&&(S=this.length),c<0||p>u.length||L<0||S>this.length)throw new RangeError("out of range index");if(L>=S&&c>=p)return 0;if(L>=S)return-1;if(c>=p)return 1;if(c>>>=0,p>>>=0,L>>>=0,S>>>=0,this===u)return 0;for(var C=S-L,V=p-c,G=Math.min(C,V),re=this.slice(L,S),ce=u.slice(c,p),ne=0;ne<G;++ne)if(re[ne]!==ce[ne]){C=re[ne],V=ce[ne];break}return C<V?-1:V<C?1:0};function F(f,u,c,p,L){if(f.length===0)return-1;if(typeof c=="string"?(p=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,oe(c)&&(c=L?0:f.length-1),c<0&&(c=f.length+c),c>=f.length){if(L)return-1;c=f.length-1}else if(c<0)if(L)c=0;else return-1;if(typeof u=="string"&&(u=s.from(u,p)),s.isBuffer(u))return u.length===0?-1:M(f,u,c,p,L);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?L?Uint8Array.prototype.indexOf.call(f,u,c):Uint8Array.prototype.lastIndexOf.call(f,u,c):M(f,[u],c,p,L);throw new TypeError("val must be string, number or Buffer")}function M(f,u,c,p,L){var S=1,C=f.length,V=u.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(f.length<2||u.length<2)return-1;S=2,C/=2,V/=2,c/=2}function G(Ir,xr){return S===1?Ir[xr]:Ir.readUInt16BE(xr*S)}var re;if(L){var ce=-1;for(re=c;re<C;re++)if(G(f,re)===G(u,ce===-1?0:re-ce)){if(ce===-1&&(ce=re),re-ce+1===V)return ce*S}else ce!==-1&&(re-=re-ce),ce=-1}else for(c+V>C&&(c=C-V),re=c;re>=0;re--){for(var ne=!0,Ye=0;Ye<V;Ye++)if(G(f,re+Ye)!==G(u,Ye)){ne=!1;break}if(ne)return re}return-1}s.prototype.includes=function(u,c,p){return this.indexOf(u,c,p)!==-1},s.prototype.indexOf=function(u,c,p){return F(this,u,c,p,!0)},s.prototype.lastIndexOf=function(u,c,p){return F(this,u,c,p,!1)};function k(f,u,c,p){c=Number(c)||0;var L=f.length-c;p?(p=Number(p),p>L&&(p=L)):p=L;var S=u.length;p>S/2&&(p=S/2);for(var C=0;C<p;++C){var V=parseInt(u.substr(C*2,2),16);if(oe(V))return C;f[c+C]=V}return C}function y(f,u,c,p){return K(b(u,f.length-c),f,c,p)}function B(f,u,c,p){return K(R(u),f,c,p)}function j(f,u,c,p){return K(J(u),f,c,p)}function U(f,u,c,p){return K(D(u,f.length-c),f,c,p)}s.prototype.write=function(u,c,p,L){if(c===void 0)L="utf8",p=this.length,c=0;else if(p===void 0&&typeof c=="string")L=c,p=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(p)?(p=p>>>0,L===void 0&&(L="utf8")):(L=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var S=this.length-c;if((p===void 0||p>S)&&(p=S),u.length>0&&(p<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");for(var C=!1;;)switch(L){case"hex":return k(this,u,c,p);case"utf8":case"utf-8":return y(this,u,c,p);case"ascii":case"latin1":case"binary":return B(this,u,c,p);case"base64":return j(this,u,c,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,u,c,p);default:if(C)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),C=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function W(f,u,c){return u===0&&c===f.length?t.fromByteArray(f):t.fromByteArray(f.slice(u,c))}function X(f,u,c){c=Math.min(f.length,c);for(var p=[],L=u;L<c;){var S=f[L],C=null,V=S>239?4:S>223?3:S>191?2:1;if(L+V<=c){var G,re,ce,ne;switch(V){case 1:S<128&&(C=S);break;case 2:G=f[L+1],(G&192)===128&&(ne=(S&31)<<6|G&63,ne>127&&(C=ne));break;case 3:G=f[L+1],re=f[L+2],(G&192)===128&&(re&192)===128&&(ne=(S&15)<<12|(G&63)<<6|re&63,ne>2047&&(ne<55296||ne>57343)&&(C=ne));break;case 4:G=f[L+1],re=f[L+2],ce=f[L+3],(G&192)===128&&(re&192)===128&&(ce&192)===128&&(ne=(S&15)<<18|(G&63)<<12|(re&63)<<6|ce&63,ne>65535&&ne<1114112&&(C=ne))}}C===null?(C=65533,V=1):C>65535&&(C-=65536,p.push(C>>>10&1023|55296),C=56320|C&1023),p.push(C),L+=V}return Y(p)}var $=4096;function Y(f){var u=f.length;if(u<=$)return String.fromCharCode.apply(String,f);for(var c="",p=0;p<u;)c+=String.fromCharCode.apply(String,f.slice(p,p+=$));return c}function H(f,u,c){var p="";c=Math.min(f.length,c);for(var L=u;L<c;++L)p+=String.fromCharCode(f[L]&127);return p}function Ue(f,u,c){var p="";c=Math.min(f.length,c);for(var L=u;L<c;++L)p+=String.fromCharCode(f[L]);return p}function Ae(f,u,c){var p=f.length;(!u||u<0)&&(u=0),(!c||c<0||c>p)&&(c=p);for(var L="",S=u;S<c;++S)L+=P[f[S]];return L}function xe(f,u,c){for(var p=f.slice(u,c),L="",S=0;S<p.length-1;S+=2)L+=String.fromCharCode(p[S]+p[S+1]*256);return L}s.prototype.slice=function(u,c){var p=this.length;u=~~u,c=c===void 0?p:~~c,u<0?(u+=p,u<0&&(u=0)):u>p&&(u=p),c<0?(c+=p,c<0&&(c=0)):c>p&&(c=p),c<u&&(c=u);var L=this.subarray(u,c);return Object.setPrototypeOf(L,s.prototype),L};function Z(f,u,c){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+u>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u],S=1,C=0;++C<c&&(S*=256);)L+=this[u+C]*S;return L},s.prototype.readUintBE=s.prototype.readUIntBE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u+--c],S=1;c>0&&(S*=256);)L+=this[u+--c]*S;return L},s.prototype.readUint8=s.prototype.readUInt8=function(u,c){return u=u>>>0,c||Z(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||Z(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||Z(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readIntLE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u],S=1,C=0;++C<c&&(S*=256);)L+=this[u+C]*S;return S*=128,L>=S&&(L-=Math.pow(2,8*c)),L},s.prototype.readIntBE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=c,S=1,C=this[u+--L];L>0&&(S*=256);)C+=this[u+--L]*S;return S*=128,C>=S&&(C-=Math.pow(2,8*c)),C},s.prototype.readInt8=function(u,c){return u=u>>>0,c||Z(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,c){u=u>>>0,c||Z(u,2,this.length);var p=this[u]|this[u+1]<<8;return p&32768?p|4294901760:p},s.prototype.readInt16BE=function(u,c){u=u>>>0,c||Z(u,2,this.length);var p=this[u+1]|this[u]<<8;return p&32768?p|4294901760:p},s.prototype.readInt32LE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},s.prototype.readInt32BE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},s.prototype.readFloatLE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),r.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),r.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||Z(u,8,this.length),r.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||Z(u,8,this.length),r.read(this,u,!1,52,8)};function te(f,u,c,p,L,S){if(!s.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>L||u<S)throw new RangeError('"value" argument is out of bounds');if(c+p>f.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,c,p,L){if(u=+u,c=c>>>0,p=p>>>0,!L){var S=Math.pow(2,8*p)-1;te(this,u,c,p,S,0)}var C=1,V=0;for(this[c]=u&255;++V<p&&(C*=256);)this[c+V]=u/C&255;return c+p},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(u,c,p,L){if(u=+u,c=c>>>0,p=p>>>0,!L){var S=Math.pow(2,8*p)-1;te(this,u,c,p,S,0)}var C=p-1,V=1;for(this[c+C]=u&255;--C>=0&&(V*=256);)this[c+C]=u/V&255;return c+p},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,1,255,0),this[c]=u&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},s.prototype.writeIntLE=function(u,c,p,L){if(u=+u,c=c>>>0,!L){var S=Math.pow(2,8*p-1);te(this,u,c,p,S-1,-S)}var C=0,V=1,G=0;for(this[c]=u&255;++C<p&&(V*=256);)u<0&&G===0&&this[c+C-1]!==0&&(G=1),this[c+C]=(u/V>>0)-G&255;return c+p},s.prototype.writeIntBE=function(u,c,p,L){if(u=+u,c=c>>>0,!L){var S=Math.pow(2,8*p-1);te(this,u,c,p,S-1,-S)}var C=p-1,V=1,G=0;for(this[c+C]=u&255;--C>=0&&(V*=256);)u<0&&G===0&&this[c+C+1]!==0&&(G=1),this[c+C]=(u/V>>0)-G&255;return c+p},s.prototype.writeInt8=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},s.prototype.writeInt16LE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},s.prototype.writeInt16BE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},s.prototype.writeInt32LE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},s.prototype.writeInt32BE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function Me(f,u,c,p,L,S){if(c+p>f.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function q(f,u,c,p,L){return u=+u,c=c>>>0,L||Me(f,u,c,4),r.write(f,u,c,p,23,4),c+4}s.prototype.writeFloatLE=function(u,c,p){return q(this,u,c,!0,p)},s.prototype.writeFloatBE=function(u,c,p){return q(this,u,c,!1,p)};function be(f,u,c,p,L){return u=+u,c=c>>>0,L||Me(f,u,c,8),r.write(f,u,c,p,52,8),c+8}s.prototype.writeDoubleLE=function(u,c,p){return be(this,u,c,!0,p)},s.prototype.writeDoubleBE=function(u,c,p){return be(this,u,c,!1,p)},s.prototype.copy=function(u,c,p,L){if(!s.isBuffer(u))throw new TypeError("argument should be a Buffer");if(p||(p=0),!L&&L!==0&&(L=this.length),c>=u.length&&(c=u.length),c||(c=0),L>0&&L<p&&(L=p),L===p||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),u.length-c<L-p&&(L=u.length-c+p);var S=L-p;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,p,L):Uint8Array.prototype.set.call(u,this.subarray(p,L),c),S},s.prototype.fill=function(u,c,p,L){if(typeof u=="string"){if(typeof c=="string"?(L=c,c=0,p=this.length):typeof p=="string"&&(L=p,p=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!s.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(u.length===1){var S=u.charCodeAt(0);(L==="utf8"&&S<128||L==="latin1")&&(u=S)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<p)throw new RangeError("Out of range index");if(p<=c)return this;c=c>>>0,p=p===void 0?this.length:p>>>0,u||(u=0);var C;if(typeof u=="number")for(C=c;C<p;++C)this[C]=u;else{var V=s.isBuffer(u)?u:s.from(u,L),G=V.length;if(G===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(C=0;C<p-c;++C)this[C+c]=V[C%G]}return this};var Xe=/[^+/0-9A-Za-z-_]/g;function N(f){if(f=f.split("=")[0],f=f.trim().replace(Xe,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function b(f,u){u=u||1/0;for(var c,p=f.length,L=null,S=[],C=0;C<p;++C){if(c=f.charCodeAt(C),c>55295&&c<57344){if(!L){if(c>56319){(u-=3)>-1&&S.push(239,191,189);continue}else if(C+1===p){(u-=3)>-1&&S.push(239,191,189);continue}L=c;continue}if(c<56320){(u-=3)>-1&&S.push(239,191,189),L=c;continue}c=(L-55296<<10|c-56320)+65536}else L&&(u-=3)>-1&&S.push(239,191,189);if(L=null,c<128){if((u-=1)<0)break;S.push(c)}else if(c<2048){if((u-=2)<0)break;S.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;S.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;S.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return S}function R(f){for(var u=[],c=0;c<f.length;++c)u.push(f.charCodeAt(c)&255);return u}function D(f,u){for(var c,p,L,S=[],C=0;C<f.length&&!((u-=2)<0);++C)c=f.charCodeAt(C),p=c>>8,L=c%256,S.push(L),S.push(p);return S}function J(f){return t.toByteArray(N(f))}function K(f,u,c,p){for(var L=0;L<p&&!(L+c>=u.length||L>=f.length);++L)u[L+c]=f[L];return L}function z(f,u){return f instanceof u||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===u.name}function oe(f){return f!==f}var P=function(){for(var f="0123456789abcdef",u=new Array(256),c=0;c<16;++c)for(var p=c*16,L=0;L<16;++L)u[p+L]=f[c]+f[L];return u}()}(Qt)),Qt}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Pn;function Ss(){return Pn||(Pn=1,function(e,t){var r=Ds(),n=r.Buffer;function a(i,s){for(var l in i)s[l]=i[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(a(r,t),t.Buffer=o);function o(i,s,l){return n(i,s,l)}o.prototype=Object.create(n.prototype),a(n,o),o.from=function(i,s,l){if(typeof i=="number")throw new TypeError("Argument must not be a number");return n(i,s,l)},o.alloc=function(i,s,l){if(typeof i!="number")throw new TypeError("Argument must be a number");var d=n(i);return s!==void 0?typeof l=="string"?d.fill(s,l):d.fill(s):d.fill(0),d},o.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return n(i)},o.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(i)}}(Qe,Qe.exports)),Qe.exports}var _n;function Ms(){if(_n)return zt;_n=1;var e=Ss().Buffer,t=e.isEncoding||function(x){switch(x=""+x,x&&x.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(x){if(!x)return"utf8";for(var v;;)switch(x){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return x;default:if(v)return;x=(""+x).toLowerCase(),v=!0}}function n(x){var v=r(x);if(typeof v!="string"&&(e.isEncoding===t||!t(x)))throw new Error("Unknown encoding: "+x);return v||x}zt.StringDecoder=a;function a(x){this.encoding=n(x);var v;switch(this.encoding){case"utf16le":this.text=m,this.end=w,v=4;break;case"utf8":this.fillLast=l,v=4;break;case"base64":this.text=E,this.end=I,v=3;break;default:this.write=_,this.end=T;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(v)}a.prototype.write=function(x){if(x.length===0)return"";var v,h;if(this.lastNeed){if(v=this.fillLast(x),v===void 0)return"";h=this.lastNeed,this.lastNeed=0}else h=0;return h<x.length?v?v+this.text(x,h):this.text(x,h):v||""},a.prototype.end=g,a.prototype.text=d,a.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function o(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function i(x,v,h){var O=v.length-1;if(O<h)return 0;var A=o(v[O]);return A>=0?(A>0&&(x.lastNeed=A-1),A):--O<h||A===-2?0:(A=o(v[O]),A>=0?(A>0&&(x.lastNeed=A-2),A):--O<h||A===-2?0:(A=o(v[O]),A>=0?(A>0&&(A===2?A=0:x.lastNeed=A-3),A):0))}function s(x,v,h){if((v[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return x.lastNeed=2,"�"}}function l(x){var v=this.lastTotal-this.lastNeed,h=s(this,x);if(h!==void 0)return h;if(this.lastNeed<=x.length)return x.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,v,0,x.length),this.lastNeed-=x.length}function d(x,v){var h=i(this,x,v);if(!this.lastNeed)return x.toString("utf8",v);this.lastTotal=h;var O=x.length-(h-this.lastNeed);return x.copy(this.lastChar,0,O),x.toString("utf8",v,O)}function g(x){var v=x&&x.length?this.write(x):"";return this.lastNeed?v+"�":v}function m(x,v){if((x.length-v)%2===0){var h=x.toString("utf16le",v);if(h){var O=h.charCodeAt(h.length-1);if(O>=55296&&O<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],h.slice(0,-1)}return h}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",v,x.length-1)}function w(x){var v=x&&x.length?this.write(x):"";if(this.lastNeed){var h=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,h)}return v}function E(x,v){var h=(x.length-v)%3;return h===0?x.toString("base64",v):(this.lastNeed=3-h,this.lastTotal=3,h===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",v,x.length-h))}function I(x){var v=x&&x.length?this.write(x):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function _(x){return x.toString(this.encoding)}function T(x){return x&&x.length?this.write(x):""}return zt}var Dn;function Fs(){return Dn||(Dn=1,function(e){(function(t){t.parser=function(N,b){return new n(N,b)},t.SAXParser=n,t.SAXStream=g,t.createStream=d,t.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(N,b){if(!(this instanceof n))return new n(N,b);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=b||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!N,R.noscript=!!(N||R.opt.noscript),R.state=y.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(_)),R.opt.unquotedAttributeValues===void 0&&(R.opt.unquotedAttributeValues=!N),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),j(R,"onready")}Object.create||(Object.create=function(N){function b(){}b.prototype=N;var R=new b;return R}),Object.keys||(Object.keys=function(N){var b=[];for(var R in N)N.hasOwnProperty(R)&&b.push(R);return b});function a(N){for(var b=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,D=0,J=r.length;D<J;D++){var K=N[r[D]].length;if(K>b)switch(r[D]){case"textNode":W(N);break;case"cdata":U(N,"oncdata",N.cdata),N.cdata="";break;case"script":U(N,"onscript",N.script),N.script="";break;default:$(N,"Max buffer length exceeded: "+r[D])}R=Math.max(R,K)}var z=t.MAX_BUFFER_LENGTH-R;N.bufferCheckPosition=z+N.position}function o(N){for(var b=0,R=r.length;b<R;b++)N[r[b]]=""}function i(N){W(N),N.cdata!==""&&(U(N,"oncdata",N.cdata),N.cdata=""),N.script!==""&&(U(N,"onscript",N.script),N.script="")}n.prototype={end:function(){Y(this)},write:Xe,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){i(this)}};var s;try{s=require("stream").Stream}catch{s=function(){}}s||(s=function(){});var l=t.EVENTS.filter(function(N){return N!=="error"&&N!=="end"});function d(N,b){return new g(N,b)}function g(N,b){if(!(this instanceof g))return new g(N,b);s.apply(this),this._parser=new n(N,b),this.writable=!0,this.readable=!0;var R=this;this._parser.onend=function(){R.emit("end")},this._parser.onerror=function(D){R.emit("error",D),R._parser.error=null},this._decoder=null,l.forEach(function(D){Object.defineProperty(R,"on"+D,{get:function(){return R._parser["on"+D]},set:function(J){if(!J)return R.removeAllListeners(D),R._parser["on"+D]=J,J;R.on(D,J)},enumerable:!0,configurable:!1})})}g.prototype=Object.create(s.prototype,{constructor:{value:g}}),g.prototype.write=function(N){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(N)){if(!this._decoder){var b=Ms().StringDecoder;this._decoder=new b("utf8")}N=this._decoder.write(N)}return this._parser.write(N.toString()),this.emit("data",N),!0},g.prototype.end=function(N){return N&&N.length&&this.write(N),this._parser.end(),!0},g.prototype.on=function(N,b){var R=this;return!R._parser["on"+N]&&l.indexOf(N)!==-1&&(R._parser["on"+N]=function(){var D=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);D.splice(0,0,N),R.emit.apply(R,D)}),s.prototype.on.call(R,N,b)};var m="[CDATA[",w="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",I="http://www.w3.org/2000/xmlns/",_={xml:E,xmlns:I},T=/[:_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]/,x=/[:_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-]/,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]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function O(N){return N===" "||N===`
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Char: `+N.c),b=new Error(b),N.error=b,j(N,"onerror",b),N}function Y(N){return N.sawRoot&&!N.closedRoot&&H(N,"Unclosed root tag"),N.state!==y.BEGIN&&N.state!==y.BEGIN_WHITESPACE&&N.state!==y.TEXT&&$(N,"Unexpected end"),W(N),N.c="",N.closed=!0,j(N,"onend"),n.call(N,N.strict,N.opt),N}function H(N,b){if(typeof N!="object"||!(N instanceof n))throw new Error("bad call to strictFail");N.strict&&$(N,b)}function Ue(N){N.strict||(N.tagName=N.tagName[N.looseCase]());var b=N.tags[N.tags.length-1]||N,R=N.tag={name:N.tagName,attributes:{}};N.opt.xmlns&&(R.ns=b.ns),N.attribList.length=0,U(N,"onopentagstart",R)}function Ae(N,b){var R=N.indexOf(":"),D=R<0?["",N]:N.split(":"),J=D[0],K=D[1];return b&&N==="xmlns"&&(J="xmlns",K=""),{prefix:J,local:K}}function xe(N){if(N.strict||(N.attribName=N.attribName[N.looseCase]()),N.attribList.indexOf(N.attribName)!==-1||N.tag.attributes.hasOwnProperty(N.attribName)){N.attribName=N.attribValue="";return}if(N.opt.xmlns){var b=Ae(N.attribName,!0),R=b.prefix,D=b.local;if(R==="xmlns")if(D==="xml"&&N.attribValue!==E)H(N,"xml: prefix must be bound to "+E+`
|
|
78
|
-
Actual: `+N.attribValue);else if(D==="xmlns"&&N.attribValue!==I)H(N,"xmlns: prefix must be bound to "+I+`
|
|
79
|
-
Actual: `+N.attribValue);else{var J=N.tag,K=N.tags[N.tags.length-1]||N;J.ns===K.ns&&(J.ns=Object.create(K.ns)),J.ns[D]=N.attribValue}N.attribList.push([N.attribName,N.attribValue])}else N.tag.attributes[N.attribName]=N.attribValue,U(N,"onattribute",{name:N.attribName,value:N.attribValue});N.attribName=N.attribValue=""}function Z(N,b){if(N.opt.xmlns){var R=N.tag,D=Ae(N.tagName);R.prefix=D.prefix,R.local=D.local,R.uri=R.ns[D.prefix]||"",R.prefix&&!R.uri&&(H(N,"Unbound namespace prefix: "+JSON.stringify(N.tagName)),R.uri=D.prefix);var J=N.tags[N.tags.length-1]||N;R.ns&&J.ns!==R.ns&&Object.keys(R.ns).forEach(function(C){U(N,"onopennamespace",{prefix:C,uri:R.ns[C]})});for(var K=0,z=N.attribList.length;K<z;K++){var oe=N.attribList[K],P=oe[0],f=oe[1],u=Ae(P,!0),c=u.prefix,p=u.local,L=c===""?"":R.ns[c]||"",S={name:P,value:f,prefix:c,local:p,uri:L};c&&c!=="xmlns"&&!L&&(H(N,"Unbound namespace prefix: "+JSON.stringify(c)),S.uri=c),N.tag.attributes[P]=S,U(N,"onattribute",S)}N.attribList.length=0}N.tag.isSelfClosing=!!b,N.sawRoot=!0,N.tags.push(N.tag),U(N,"onopentag",N.tag),b||(!N.noscript&&N.tagName.toLowerCase()==="script"?N.state=y.SCRIPT:N.state=y.TEXT,N.tag=null,N.tagName=""),N.attribName=N.attribValue="",N.attribList.length=0}function te(N){if(!N.tagName){H(N,"Weird empty close tag."),N.textNode+="</>",N.state=y.TEXT;return}if(N.script){if(N.tagName!=="script"){N.script+="</"+N.tagName+">",N.tagName="",N.state=y.SCRIPT;return}U(N,"onscript",N.script),N.script=""}var b=N.tags.length,R=N.tagName;N.strict||(R=R[N.looseCase]());for(var D=R;b--;){var J=N.tags[b];if(J.name!==D)H(N,"Unexpected close tag");else break}if(b<0){H(N,"Unmatched closing tag: "+N.tagName),N.textNode+="</"+N.tagName+">",N.state=y.TEXT;return}N.tagName=R;for(var K=N.tags.length;K-- >b;){var z=N.tag=N.tags.pop();N.tagName=N.tag.name,U(N,"onclosetag",N.tagName);var oe={};for(var P in z.ns)oe[P]=z.ns[P];var f=N.tags[N.tags.length-1]||N;N.opt.xmlns&&z.ns!==f.ns&&Object.keys(z.ns).forEach(function(u){var c=z.ns[u];U(N,"onclosenamespace",{prefix:u,uri:c})})}b===0&&(N.closedRoot=!0),N.tagName=N.attribValue=N.attribName="",N.attribList.length=0,N.state=y.TEXT}function Me(N){var b=N.entity,R=b.toLowerCase(),D,J="";return N.ENTITIES[b]?N.ENTITIES[b]:N.ENTITIES[R]?N.ENTITIES[R]:(b=R,b.charAt(0)==="#"&&(b.charAt(1)==="x"?(b=b.slice(2),D=parseInt(b,16),J=D.toString(16)):(b=b.slice(1),D=parseInt(b,10),J=D.toString(10))),b=b.replace(/^0+/,""),isNaN(D)||J.toLowerCase()!==b||D<0||D>1114111?(H(N,"Invalid character entity"),"&"+N.entity+";"):String.fromCodePoint(D))}function q(N,b){b==="<"?(N.state=y.OPEN_WAKA,N.startTagPosition=N.position):O(b)||(H(N,"Non-whitespace before first tag."),N.textNode=b,N.state=y.TEXT)}function be(N,b){var R="";return b<N.length&&(R=N.charAt(b)),R}function Xe(N){var b=this;if(this.error)throw this.error;if(b.closed)return $(b,"Cannot write after close. Assign an onready handler.");if(N===null)return Y(b);typeof N=="object"&&(N=N.toString());for(var R=0,D="";D=be(N,R++),b.c=D,!!D;)switch(b.trackPosition&&(b.position++,D===`
|
|
80
|
-
`?(b.line++,b.column=0):b.column++),b.state){case y.BEGIN:if(b.state=y.BEGIN_WHITESPACE,D==="\uFEFF")continue;q(b,D);continue;case y.BEGIN_WHITESPACE:q(b,D);continue;case y.TEXT:if(b.sawRoot&&!b.closedRoot){for(var K=R-1;D&&D!=="<"&&D!=="&";)D=be(N,R++),D&&b.trackPosition&&(b.position++,D===`
|
|
81
|
-
`?(b.line++,b.column=0):b.column++);b.textNode+=N.substring(K,R-1)}D==="<"&&!(b.sawRoot&&b.closedRoot&&!b.strict)?(b.state=y.OPEN_WAKA,b.startTagPosition=b.position):(!O(D)&&(!b.sawRoot||b.closedRoot)&&H(b,"Text data outside of root node."),D==="&"?b.state=y.TEXT_ENTITY:b.textNode+=D);continue;case y.SCRIPT:D==="<"?b.state=y.SCRIPT_ENDING:b.script+=D;continue;case y.SCRIPT_ENDING:D==="/"?b.state=y.CLOSE_TAG:(b.script+="<"+D,b.state=y.SCRIPT);continue;case y.OPEN_WAKA:if(D==="!")b.state=y.SGML_DECL,b.sgmlDecl="";else if(!O(D))if(M(T,D))b.state=y.OPEN_TAG,b.tagName=D;else if(D==="/")b.state=y.CLOSE_TAG,b.tagName="";else if(D==="?")b.state=y.PROC_INST,b.procInstName=b.procInstBody="";else{if(H(b,"Unencoded <"),b.startTagPosition+1<b.position){var J=b.position-b.startTagPosition;D=new Array(J).join(" ")+D}b.textNode+="<"+D,b.state=y.TEXT}continue;case y.SGML_DECL:if(b.sgmlDecl+D==="--"){b.state=y.COMMENT,b.comment="",b.sgmlDecl="";continue}b.doctype&&b.doctype!==!0&&b.sgmlDecl?(b.state=y.DOCTYPE_DTD,b.doctype+="<!"+b.sgmlDecl+D,b.sgmlDecl=""):(b.sgmlDecl+D).toUpperCase()===m?(U(b,"onopencdata"),b.state=y.CDATA,b.sgmlDecl="",b.cdata=""):(b.sgmlDecl+D).toUpperCase()===w?(b.state=y.DOCTYPE,(b.doctype||b.sawRoot)&&H(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):D===">"?(U(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=y.TEXT):(A(D)&&(b.state=y.SGML_DECL_QUOTED),b.sgmlDecl+=D);continue;case y.SGML_DECL_QUOTED:D===b.q&&(b.state=y.SGML_DECL,b.q=""),b.sgmlDecl+=D;continue;case y.DOCTYPE:D===">"?(b.state=y.TEXT,U(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=D,D==="["?b.state=y.DOCTYPE_DTD:A(D)&&(b.state=y.DOCTYPE_QUOTED,b.q=D));continue;case y.DOCTYPE_QUOTED:b.doctype+=D,D===b.q&&(b.q="",b.state=y.DOCTYPE);continue;case y.DOCTYPE_DTD:D==="]"?(b.doctype+=D,b.state=y.DOCTYPE):D==="<"?(b.state=y.OPEN_WAKA,b.startTagPosition=b.position):A(D)?(b.doctype+=D,b.state=y.DOCTYPE_DTD_QUOTED,b.q=D):b.doctype+=D;continue;case y.DOCTYPE_DTD_QUOTED:b.doctype+=D,D===b.q&&(b.state=y.DOCTYPE_DTD,b.q="");continue;case y.COMMENT:D==="-"?b.state=y.COMMENT_ENDING:b.comment+=D;continue;case y.COMMENT_ENDING:D==="-"?(b.state=y.COMMENT_ENDED,b.comment=X(b.opt,b.comment),b.comment&&U(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+D,b.state=y.COMMENT);continue;case y.COMMENT_ENDED:D!==">"?(H(b,"Malformed comment"),b.comment+="--"+D,b.state=y.COMMENT):b.doctype&&b.doctype!==!0?b.state=y.DOCTYPE_DTD:b.state=y.TEXT;continue;case y.CDATA:for(var K=R-1;D&&D!=="]";)D=be(N,R++),D&&b.trackPosition&&(b.position++,D===`
|
|
82
|
-
`?(b.line++,b.column=0):b.column++);b.cdata+=N.substring(K,R-1),D==="]"&&(b.state=y.CDATA_ENDING);continue;case y.CDATA_ENDING:D==="]"?b.state=y.CDATA_ENDING_2:(b.cdata+="]"+D,b.state=y.CDATA);continue;case y.CDATA_ENDING_2:D===">"?(b.cdata&&U(b,"oncdata",b.cdata),U(b,"onclosecdata"),b.cdata="",b.state=y.TEXT):D==="]"?b.cdata+="]":(b.cdata+="]]"+D,b.state=y.CDATA);continue;case y.PROC_INST:D==="?"?b.state=y.PROC_INST_ENDING:O(D)?b.state=y.PROC_INST_BODY:b.procInstName+=D;continue;case y.PROC_INST_BODY:if(!b.procInstBody&&O(D))continue;D==="?"?b.state=y.PROC_INST_ENDING:b.procInstBody+=D;continue;case y.PROC_INST_ENDING:D===">"?(U(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=y.TEXT):(b.procInstBody+="?"+D,b.state=y.PROC_INST_BODY);continue;case y.OPEN_TAG:M(x,D)?b.tagName+=D:(Ue(b),D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:(O(D)||H(b,"Invalid character in tag name"),b.state=y.ATTRIB));continue;case y.OPEN_TAG_SLASH:D===">"?(Z(b,!0),te(b)):(H(b,"Forward-slash in opening tag not followed by >"),b.state=y.ATTRIB);continue;case y.ATTRIB:if(O(D))continue;D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:M(T,D)?(b.attribName=D,b.attribValue="",b.state=y.ATTRIB_NAME):H(b,"Invalid attribute name");continue;case y.ATTRIB_NAME:D==="="?b.state=y.ATTRIB_VALUE:D===">"?(H(b,"Attribute without value"),b.attribValue=b.attribName,xe(b),Z(b)):O(D)?b.state=y.ATTRIB_NAME_SAW_WHITE:M(x,D)?b.attribName+=D:H(b,"Invalid attribute name");continue;case y.ATTRIB_NAME_SAW_WHITE:if(D==="=")b.state=y.ATTRIB_VALUE;else{if(O(D))continue;H(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",U(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",D===">"?Z(b):M(T,D)?(b.attribName=D,b.state=y.ATTRIB_NAME):(H(b,"Invalid attribute name"),b.state=y.ATTRIB)}continue;case y.ATTRIB_VALUE:if(O(D))continue;A(D)?(b.q=D,b.state=y.ATTRIB_VALUE_QUOTED):(b.opt.unquotedAttributeValues||$(b,"Unquoted attribute value"),b.state=y.ATTRIB_VALUE_UNQUOTED,b.attribValue=D);continue;case y.ATTRIB_VALUE_QUOTED:if(D!==b.q){D==="&"?b.state=y.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=D;continue}xe(b),b.q="",b.state=y.ATTRIB_VALUE_CLOSED;continue;case y.ATTRIB_VALUE_CLOSED:O(D)?b.state=y.ATTRIB:D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:M(T,D)?(H(b,"No whitespace between attributes"),b.attribName=D,b.attribValue="",b.state=y.ATTRIB_NAME):H(b,"Invalid attribute name");continue;case y.ATTRIB_VALUE_UNQUOTED:if(!F(D)){D==="&"?b.state=y.ATTRIB_VALUE_ENTITY_U:b.attribValue+=D;continue}xe(b),D===">"?Z(b):b.state=y.ATTRIB;continue;case y.CLOSE_TAG:if(b.tagName)D===">"?te(b):M(x,D)?b.tagName+=D:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=y.SCRIPT):(O(D)||H(b,"Invalid tagname in closing tag"),b.state=y.CLOSE_TAG_SAW_WHITE);else{if(O(D))continue;k(T,D)?b.script?(b.script+="</"+D,b.state=y.SCRIPT):H(b,"Invalid tagname in closing tag."):b.tagName=D}continue;case y.CLOSE_TAG_SAW_WHITE:if(O(D))continue;D===">"?te(b):H(b,"Invalid characters in closing tag");continue;case y.TEXT_ENTITY:case y.ATTRIB_VALUE_ENTITY_Q:case y.ATTRIB_VALUE_ENTITY_U:var z,oe;switch(b.state){case y.TEXT_ENTITY:z=y.TEXT,oe="textNode";break;case y.ATTRIB_VALUE_ENTITY_Q:z=y.ATTRIB_VALUE_QUOTED,oe="attribValue";break;case y.ATTRIB_VALUE_ENTITY_U:z=y.ATTRIB_VALUE_UNQUOTED,oe="attribValue";break}if(D===";"){var P=Me(b);b.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(P)?(b.entity="",b.state=z,b.write(P)):(b[oe]+=P,b.entity="",b.state=z)}else M(b.entity.length?h:v,D)?b.entity+=D:(H(b,"Invalid character in entity name"),b[oe]+="&"+b.entity+D,b.entity="",b.state=z);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&a(b),b}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var N=String.fromCharCode,b=Math.floor,R=function(){var D=16384,J=[],K,z,oe=-1,P=arguments.length;if(!P)return"";for(var f="";++oe<P;){var u=Number(arguments[oe]);if(!isFinite(u)||u<0||u>1114111||b(u)!==u)throw RangeError("Invalid code point: "+u);u<=65535?J.push(u):(u-=65536,K=(u>>10)+55296,z=u%1024+56320,J.push(K,z)),(oe+1===P||J.length>D)&&(f+=N.apply(null,J),J.length=0)}return f};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R}()})(e)}(Yt)),Yt}var Jt={},Sn;function Cs(){return Sn||(Sn=1,function(){Jt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(Q)),Jt}var _e={},Mn;function di(){return Mn||(Mn=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),_e.normalize=function(t){return t.toLowerCase()},_e.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},_e.stripPrefix=function(t){return t.replace(e,"")},_e.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},_e.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(Q)),_e}var Fn;function Bs(){return Fn||(Fn=1,function(e){(function(){var t,r,n,a,o,i,s,l,d,g=function(E,I){return function(){return E.apply(I,arguments)}},m=function(E,I){for(var _ in I)w.call(I,_)&&(E[_]=I[_]);function T(){this.constructor=E}return T.prototype=I.prototype,E.prototype=new T,E.__super__=I.prototype,E},w={}.hasOwnProperty;l=Fs(),a=ur,t=Cs(),s=di(),d=Bi.setImmediate,r=cr().defaults,o=function(E){return typeof E=="object"&&E!=null&&Object.keys(E).length===0},i=function(E,I,_){var T,x,v;for(T=0,x=E.length;T<x;T++)v=E[T],I=v(I,_);return I},n=function(E,I,_){var T;return T=Object.create(null),T.value=_,T.writable=!0,T.enumerable=!0,T.configurable=!0,Object.defineProperty(E,I,T)},e.Parser=function(E){m(I,E);function I(_){this.parseStringPromise=g(this.parseStringPromise,this),this.parseString=g(this.parseString,this),this.reset=g(this.reset,this),this.assignOrPush=g(this.assignOrPush,this),this.processAsync=g(this.processAsync,this);var T,x,v;if(!(this instanceof e.Parser))return new e.Parser(_);this.options={},x=r["0.2"];for(T in x)w.call(x,T)&&(v=x[T],this.options[T]=v);for(T in _)w.call(_,T)&&(v=_[T],this.options[T]=v);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(s.normalize)),this.reset()}return I.prototype.processAsync=function(){var _,T;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),d(this.processAsync))}catch(x){if(T=x,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(T)}},I.prototype.assignOrPush=function(_,T,x){return T in _?(_[T]instanceof Array||n(_,T,[_[T]]),_[T].push(x)):this.options.explicitArray?n(_,T,[x]):n(_,T,x)},I.prototype.reset=function(){var _,T,x,v;return this.removeAllListeners(),this.saxParser=l.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(h){return function(O){if(h.saxParser.resume(),!h.saxParser.errThrown)return h.saxParser.errThrown=!0,h.emit("error",O)}}(this),this.saxParser.onend=function(h){return function(){if(!h.saxParser.ended)return h.saxParser.ended=!0,h.emit("end",h.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,v=[],_=this.options.attrkey,T=this.options.charkey,this.saxParser.onopentag=function(h){return function(O){var A,F,M,k,y;if(M={},M[T]="",!h.options.ignoreAttrs){y=O.attributes;for(A in y)w.call(y,A)&&(!(_ in M)&&!h.options.mergeAttrs&&(M[_]={}),F=h.options.attrValueProcessors?i(h.options.attrValueProcessors,O.attributes[A],A):O.attributes[A],k=h.options.attrNameProcessors?i(h.options.attrNameProcessors,A):A,h.options.mergeAttrs?h.assignOrPush(M,k,F):n(M[_],k,F))}return M["#name"]=h.options.tagNameProcessors?i(h.options.tagNameProcessors,O.name):O.name,h.options.xmlns&&(M[h.options.xmlnskey]={uri:O.uri,local:O.local}),v.push(M)}}(this),this.saxParser.onclosetag=function(h){return function(){var O,A,F,M,k,y,B,j,U,W;if(y=v.pop(),k=y["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete y["#name"],y.cdata===!0&&(O=y.cdata,delete y.cdata),U=v[v.length-1],y[T].match(/^\s*$/)&&!O?(A=y[T],delete y[T]):(h.options.trim&&(y[T]=y[T].trim()),h.options.normalize&&(y[T]=y[T].replace(/\s{2,}/g," ").trim()),y[T]=h.options.valueProcessors?i(h.options.valueProcessors,y[T],k):y[T],Object.keys(y).length===1&&T in y&&!h.EXPLICIT_CHARKEY&&(y=y[T])),o(y)&&(typeof h.options.emptyTag=="function"?y=h.options.emptyTag():y=h.options.emptyTag!==""?h.options.emptyTag:A),h.options.validator!=null&&(W="/"+function(){var X,$,Y;for(Y=[],X=0,$=v.length;X<$;X++)M=v[X],Y.push(M["#name"]);return Y}().concat(k).join("/"),function(){var X;try{return y=h.options.validator(W,U&&U[k],y)}catch($){return X=$,h.emit("error",X)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof y=="object"){if(!h.options.preserveChildrenOrder)M={},h.options.attrkey in y&&(M[h.options.attrkey]=y[h.options.attrkey],delete y[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in y&&(M[h.options.charkey]=y[h.options.charkey],delete y[h.options.charkey]),Object.getOwnPropertyNames(y).length>0&&(M[h.options.childkey]=y),y=M;else if(U){U[h.options.childkey]=U[h.options.childkey]||[],B={};for(F in y)w.call(y,F)&&n(B,F,y[F]);U[h.options.childkey].push(B),delete y["#name"],Object.keys(y).length===1&&T in y&&!h.EXPLICIT_CHARKEY&&(y=y[T])}}return v.length>0?h.assignOrPush(U,k,y):(h.options.explicitRoot&&(j=y,y={},n(y,k,j)),h.resultObject=y,h.saxParser.ended=!0,h.emit("end",h.resultObject))}}(this),x=function(h){return function(O){var A,F;if(F=v[v.length-1],F)return F[T]+=O,h.options.explicitChildren&&h.options.preserveChildrenOrder&&h.options.charsAsChildren&&(h.options.includeWhiteChars||O.replace(/\\n/g,"").trim()!=="")&&(F[h.options.childkey]=F[h.options.childkey]||[],A={"#name":"__text__"},A[T]=O,h.options.normalize&&(A[T]=A[T].replace(/\s{2,}/g," ").trim()),F[h.options.childkey].push(A)),F}}(this),this.saxParser.ontext=x,this.saxParser.oncdata=function(h){return function(O){var A;if(A=x(O),A)return A.cdata=!0}}()},I.prototype.parseString=function(_,T){var x;T!=null&&typeof T=="function"&&(this.on("end",function(v){return this.reset(),T(null,v)}),this.on("error",function(v){return this.reset(),T(v)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=t.stripBOM(_),this.options.async?(this.remaining=_,d(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(v){if(x=v,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw x}else return this.emit("error",x),this.saxParser.errThrown=!0}},I.prototype.parseStringPromise=function(_){return new Promise(function(T){return function(x,v){return T.parseString(_,function(h,O){return h?v(h):x(O)})}}(this))},I}(a),e.parseString=function(E,I,_){var T,x,v;return _!=null?(typeof _=="function"&&(T=_),typeof I=="object"&&(x=I)):(typeof I=="function"&&(T=I),x={}),v=new e.Parser(x),v.parseString(E,T)},e.parseStringPromise=function(E,I){var _,T;return typeof I=="object"&&(_=I),T=new e.Parser(_),T.parseStringPromise(E)}}).call(Q)}(Gt)),Gt}var gi;(function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;t=cr(),e=Ls(),r=Bs(),di(),t.defaults,function(o){n(i,o);function i(s){this.message=s}return i}(Error),e.Builder,r.Parser,r.parseString,gi=r.parseStringPromise}).call(Q);class ks{constructor(t,r,n){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=r,this.readPHPFile=n.getPHPFile,this.phpRoot=n.phpRoot||"";for(const a of n.knownScriptUrls)this.scriptIdByUrl.set(a,this.getOrCreateScriptId(a));this.breakOnFirstLine=n.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const r=await gi(t,{explicitArray:!1});await this.handleDbgpMessage(r)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
|
|
66
|
+
*/var it,st,ot;const Mn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Sn=(st=(it=process==null?void 0:process.versions)===null||it===void 0?void 0:it.node)!==null&&st!==void 0?st:(ot=process==null?void 0:process.version)===null||ot===void 0?void 0:ot.slice(1);if(Sn&&Number(Sn.match(/^([^.]+)/)[1])<Mn)throw Error(`yargs parser supports a minimum Node.js version of ${Mn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Js=process?process.env:{};new Ys({cwd:process.cwd,env:()=>Js,format:Er,normalize:pi,resolve:Jt,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Qt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const Zs={fs:{readFileSync:Qt,writeFile:si},format:Er,resolve:Jt,exists:e=>{try{return oi(e).isFile()}catch{return!1}}};let pe;class Ks{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const n=t.shift();let r=function(){};return typeof t[t.length-1]=="function"&&(r=t.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),pe.format.apply(pe.format,[this.cache[this.locale][n]||n].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),n=t.shift(),r=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?n:r;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[s];return~s.indexOf("%d")&&a.push(o),pe.format.apply(pe.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let r="";return t.forEach(function(o,i){const s=n[i+1];r+=o,typeof s<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,n=this.writeQueue[0],r=n.directory,o=n.locale,i=n.cb,s=this._resolveLocaleFile(r,o),a=JSON.stringify(this.cache[o],null,2);pe.fs.writeFile(s,a,"utf-8",function(u){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(u)})}_readLocaleFile(){let t={};const n=this._resolveLocaleFile(this.directory,this.locale);try{pe.fs.readFileSync&&(t=JSON.parse(pe.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")t={};else throw r}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let r=pe.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=pe.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(t){return pe.exists(t)}}function eo(e,t){pe=t;const n=new Ks(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const to=e=>eo(e,Zs);let Xe;try{Xe=bi(import.meta.url)}catch{Xe=process.cwd()}const no=Xe.substring(0,Xe.lastIndexOf("node_modules"));no||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,to({directory:Jt(Xe,"../../../locales"),updateFiles:!1});var at={},Cn;function en(){return Cn||(Cn=1,function(){at.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
|
|
67
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(H)),at}var ut={},ye={},be={},Fn;function Te(){return Fn||(Fn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var l,f,h,d,b,T;if(T=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(l=0,h=b.length;l<h;l++)if(d=b[l],d!=null)for(f in d)u.call(d,f)&&(T[f]=d[f]);return T},o=function(l){return!!l&&Object.prototype.toString.call(l)==="[object Function]"},i=function(l){var f;return!!l&&((f=typeof l)=="function"||f==="object")},n=function(l){return o(Array.isArray)?Array.isArray(l):Object.prototype.toString.call(l)==="[object Array]"},r=function(l){var f;if(n(l))return!l.length;for(f in l)if(u.call(l,f))return!1;return!0},s=function(l){var f,h;return i(l)&&(h=Object.getPrototypeOf(l))&&(f=h.constructor)&&typeof f=="function"&&f instanceof f&&Function.prototype.toString.call(f)===Function.prototype.toString.call(Object)},t=function(l){return o(l.valueOf)?l.valueOf():l},be.assign=e,be.isFunction=o,be.isObject=i,be.isArray=n,be.isEmpty=r,be.isPlainObject=s,be.getValue=t}.call(H)),be}var ct={exports:{}},jn;function Hr(){return jn||(jn=1,function(){ct.exports=function(){function e(){}return e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),ct.exports}var lt={exports:{}},ft={exports:{}},pt={exports:{}},kn;function ro(){return kn||(kn=1,function(){pt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(H)),pt.exports}var ht={exports:{}},Bn;function io(){return Bn||(Bn=1,function(){ht.exports=function(){function e(t){this.arr=t||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e}()}.call(H)),ht.exports}var Rn;function so(){return Rn||(Rn=1,function(){var e,t;e=ro(),t=io(),ft.exports=function(){function n(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(r){return this.params.hasOwnProperty(r)?this.params[r]:null},n.prototype.canSetParameter=function(r,o){return!0},n.prototype.setParameter=function(r,o){return o!=null?this.params[r]=o:delete this.params[r]},n}()}.call(H)),ft.exports}var dt={exports:{}},gt={exports:{}},mt={exports:{}},Xn;function ee(){return Xn||(Xn=1,function(){mt.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(H)),mt.exports}var yt={exports:{}},Un;function Gr(){return Un||(Un=1,function(){var e;e=ee(),fe(),yt.exports=function(){function t(n,r,o){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),r==null)throw new Error("Missing attribute name. "+this.debugInfo(r));this.name=this.stringify.name(r),this.value=this.stringify.attValue(o),this.type=e.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},t.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},t}()}.call(H)),yt.exports}var bt={exports:{}},Vn;function tn(){return Vn||(Vn=1,function(){bt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),bt.exports}var $n;function nn(){return $n||($n=1,function(){var e,t,n,r,o,i,s,a,u=function(f,h){for(var d in h)l.call(h,d)&&(f[d]=h[d]);function b(){this.constructor=f}return b.prototype=h.prototype,f.prototype=new b,f.__super__=h.prototype,f},l={}.hasOwnProperty;a=Te(),s=a.isObject,i=a.isFunction,o=a.getValue,r=fe(),e=ee(),t=Gr(),n=tn(),gt.exports=function(f){u(h,f);function h(d,b,T){var O,y,D,E;if(h.__super__.constructor.call(this,d),b==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(b),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,T!=null&&this.attribute(T),d.type===e.Document&&(this.isRoot=!0,this.documentObject=d,d.rootObject=this,d.children)){for(E=d.children,y=0,D=E.length;y<D;y++)if(O=E[y],O.type===e.DocType){O.name=this.name;break}}}return Object.defineProperty(h.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(h.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(h.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(h.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(h.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(h.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(h.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(h.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),h.prototype.clone=function(){var d,b,T,O;T=Object.create(this),T.isRoot&&(T.documentObject=null),T.attribs={},O=this.attribs;for(b in O)l.call(O,b)&&(d=O[b],T.attribs[b]=d.clone());return T.children=[],this.children.forEach(function(y){var D;return D=y.clone(),D.parent=T,T.children.push(D)}),T},h.prototype.attribute=function(d,b){var T,O;if(d!=null&&(d=o(d)),s(d))for(T in d)l.call(d,T)&&(O=d[T],this.attribute(T,O));else i(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.attribs[d]=new t(this,d,""):b!=null&&(this.attribs[d]=new t(this,d,b));return this},h.prototype.removeAttribute=function(d){var b,T,O;if(d==null)throw new Error("Missing attribute name. "+this.debugInfo());if(d=o(d),Array.isArray(d))for(T=0,O=d.length;T<O;T++)b=d[T],delete this.attribs[b];else delete this.attribs[d];return this},h.prototype.toString=function(d){return this.options.writer.element(this,this.options.writer.filterOptions(d))},h.prototype.att=function(d,b){return this.attribute(d,b)},h.prototype.a=function(d,b){return this.attribute(d,b)},h.prototype.getAttribute=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d].value:null},h.prototype.setAttribute=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getAttributeNode=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d]:null},h.prototype.setAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.removeAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.setAttributeNS=function(d,b,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.removeAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getAttributeNodeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.setAttributeNodeNS=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.hasAttribute=function(d){return this.attribs.hasOwnProperty(d)},h.prototype.hasAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.setIdAttribute=function(d,b){return this.attribs.hasOwnProperty(d)?this.attribs[d].isId:b},h.prototype.setIdAttributeNS=function(d,b,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.setIdAttributeNode=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.isEqualNode=function(d){var b,T,O;if(!h.__super__.isEqualNode.apply(this,arguments).isEqualNode(d)||d.namespaceURI!==this.namespaceURI||d.prefix!==this.prefix||d.localName!==this.localName||d.attribs.length!==this.attribs.length)return!1;for(b=T=0,O=this.attribs.length-1;0<=O?T<=O:T>=O;b=0<=O?++T:--T)if(!this.attribs[b].isEqualNode(d.attribs[b]))return!1;return!0},h}(r)}.call(H)),gt.exports}var wt={exports:{}},Tt={exports:{}},qn;function Qe(){return qn||(qn=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=fe(),Tt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,s,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(e)}.call(H)),Tt.exports}var Wn;function rn(){return Wn||(Wn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),wt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.cdata(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),wt.exports}var Et={exports:{}},Hn;function sn(){return Hn||(Hn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),Et.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.comment(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Et.exports}var Nt={exports:{}},Gn;function on(){return Gn||(Gn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Te().isObject,t=fe(),e=ee(),Nt.exports=function(i){r(s,i);function s(a,u,l,f){var h;s.__super__.constructor.call(this,a),n(u)&&(h=u,u=h.version,l=h.encoding,f=h.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),f!=null&&(this.standalone=this.stringify.xmlStandalone(f))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),Nt.exports}var It={exports:{}},vt={exports:{}},Yn;function an(){return Yn||(Yn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),vt.exports=function(o){n(i,o);function i(s,a,u,l,f,h){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(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!f)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(f.indexOf("#")!==0&&(f="#"+f),!f.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(h&&!f.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(l),h&&(this.defaultValue=this.stringify.dtdAttDefault(h)),this.defaultValueType=f}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),vt.exports}var Ot={exports:{}},zn;function un(){return zn||(zn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Te().isObject,t=fe(),e=ee(),Ot.exports=function(i){r(s,i);function s(a,u,l,f){if(s.__super__.constructor.call(this,a),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(f==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!u,this.name=this.stringify.name(l),this.type=e.EntityDeclaration,!n(f))this.value=this.stringify.dtdEntityValue(f),this.internal=!0;else{if(!f.pubID&&!f.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(f.pubID&&!f.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID)),f.nData!=null&&(this.nData=this.stringify.dtdNData(f.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(s.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(s.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(s.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(s.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlVersion",{get:function(){return null}}),s.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),Ot.exports}var At={exports:{}},Qn;function cn(){return Qn||(Qn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),At.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(u)}return i.prototype.toString=function(s){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),At.exports}var Lt={exports:{}},Jn;function ln(){return Jn||(Jn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Lt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=e.NotationDeclaration,u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(s){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Lt.exports}var Zn;function fn(){return Zn||(Zn=1,function(){var e,t,n,r,o,i,s,a,u=function(f,h){for(var d in h)l.call(h,d)&&(f[d]=h[d]);function b(){this.constructor=f}return b.prototype=h.prototype,f.prototype=new b,f.__super__=h.prototype,f},l={}.hasOwnProperty;a=Te().isObject,s=fe(),e=ee(),t=an(),r=un(),n=cn(),o=ln(),i=tn(),It.exports=function(f){u(h,f);function h(d,b,T){var O,y,D,E,p,w;if(h.__super__.constructor.call(this,d),this.type=e.DocType,d.children){for(E=d.children,y=0,D=E.length;y<D;y++)if(O=E[y],O.type===e.Element){this.name=O.name;break}}this.documentObject=d,a(b)&&(p=b,b=p.pubID,T=p.sysID),T==null&&(w=[b,T],T=w[0],b=w[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),T!=null&&(this.sysID=this.stringify.dtdSysID(T))}return Object.defineProperty(h.prototype,"entities",{get:function(){var d,b,T,O,y;for(O={},y=this.children,b=0,T=y.length;b<T;b++)d=y[b],d.type===e.EntityDeclaration&&!d.pe&&(O[d.name]=d);return new i(O)}}),Object.defineProperty(h.prototype,"notations",{get:function(){var d,b,T,O,y;for(O={},y=this.children,b=0,T=y.length;b<T;b++)d=y[b],d.type===e.NotationDeclaration&&(O[d.name]=d);return new i(O)}}),Object.defineProperty(h.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(h.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(h.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),h.prototype.element=function(d,b){var T;return T=new n(this,d,b),this.children.push(T),this},h.prototype.attList=function(d,b,T,O,y){var D;return D=new t(this,d,b,T,O,y),this.children.push(D),this},h.prototype.entity=function(d,b){var T;return T=new r(this,!1,d,b),this.children.push(T),this},h.prototype.pEntity=function(d,b){var T;return T=new r(this,!0,d,b),this.children.push(T),this},h.prototype.notation=function(d,b){var T;return T=new o(this,d,b),this.children.push(T),this},h.prototype.toString=function(d){return this.options.writer.docType(this,this.options.writer.filterOptions(d))},h.prototype.ele=function(d,b){return this.element(d,b)},h.prototype.att=function(d,b,T,O,y){return this.attList(d,b,T,O,y)},h.prototype.ent=function(d,b){return this.entity(d,b)},h.prototype.pent=function(d,b){return this.pEntity(d,b)},h.prototype.not=function(d,b){return this.notation(d,b)},h.prototype.up=function(){return this.root()||this.documentObject},h.prototype.isEqualNode=function(d){return!(!h.__super__.isEqualNode.apply(this,arguments).isEqualNode(d)||d.name!==this.name||d.publicId!==this.publicId||d.systemId!==this.systemId)},h}(s)}.call(H)),It.exports}var Pt={exports:{}},Kn;function pn(){return Kn||(Kn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=fe(),Pt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.raw(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Pt.exports}var xt={exports:{}},er;function hn(){return er||(er=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),xt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(a)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var s,a,u;for(u="",a=this.previousSibling;a;)u=a.data+u,a=a.previousSibling;for(u+=this.data,s=this.nextSibling;s;)u=u+s.data,s=s.nextSibling;return u}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.text(this,this.options.writer.filterOptions(s))},i.prototype.splitText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(H)),xt.exports}var _t={exports:{}},tr;function dn(){return tr||(tr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),_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 instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,u&&(this.value=this.stringify.insValue(u))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(s))},i.prototype.isEqualNode=function(s){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(s)||s.target!==this.target)},i}(t)}.call(H)),_t.exports}var Dt={exports:{}},nr;function Yr(){return nr||(nr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Dt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=e.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(t)}.call(H)),Dt.exports}var Mt={exports:{}},rr;function oo(){return rr||(rr=1,function(){Mt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e}()}.call(H)),Mt.exports}var St={exports:{}},ir;function ao(){return ir||(ir=1,function(){St.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(H)),St.exports}var sr;function fe(){return sr||(sr=1,function(){var e,t,n,r,o,i,s,a,u,l,f,h,d,b,T,O,y,D={}.hasOwnProperty;y=Te(),O=y.isObject,T=y.isFunction,b=y.isEmpty,d=y.getValue,a=null,n=null,r=null,o=null,i=null,f=null,h=null,l=null,s=null,t=null,u=null,e=null,dt.exports=function(){function E(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=nn(),n=rn(),r=sn(),o=on(),i=fn(),f=pn(),h=hn(),l=dn(),s=Yr(),t=ee(),u=oo(),tn(),e=ao())}return Object.defineProperty(E.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(E.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(E.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(E.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(E.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(E.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(E.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(E.prototype,"previousSibling",{get:function(){var p;return p=this.parent.children.indexOf(this),this.parent.children[p-1]||null}}),Object.defineProperty(E.prototype,"nextSibling",{get:function(){var p;return p=this.parent.children.indexOf(this),this.parent.children[p+1]||null}}),Object.defineProperty(E.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(E.prototype,"textContent",{get:function(){var p,w,I,x,P;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(P="",x=this.children,w=0,I=x.length;w<I;w++)p=x[w],p.textContent&&(P+=p.textContent);return P}else return null},set:function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),E.prototype.setParent=function(p){var w,I,x,P,S;for(this.parent=p,p&&(this.options=p.options,this.stringify=p.stringify),P=this.children,S=[],I=0,x=P.length;I<x;I++)w=P[I],S.push(w.setParent(this));return S},E.prototype.element=function(p,w,I){var x,P,S,c,_,F,k,q,R,V,G;if(F=null,w===null&&I==null&&(R=[{},null],w=R[0],I=R[1]),w==null&&(w={}),w=d(w),O(w)||(V=[w,I],I=V[0],w=V[1]),p!=null&&(p=d(p)),Array.isArray(p))for(S=0,k=p.length;S<k;S++)P=p[S],F=this.element(P);else if(T(p))F=this.element(p.apply());else if(O(p)){for(_ in p)if(D.call(p,_))if(G=p[_],T(G)&&(G=G.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(_.substr(this.stringify.convertAttKey.length),G);else if(!this.options.separateArrayItems&&Array.isArray(G)&&b(G))F=this.dummy();else if(O(G)&&b(G))F=this.element(_);else if(!this.options.keepNullNodes&&G==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(G))for(c=0,q=G.length;c<q;c++)P=G[c],x={},x[_]=P,F=this.element(x);else O(G)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?F=this.element(G):(F=this.element(_),F.element(G)):F=this.element(_,G)}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,w,I);if(F==null)throw new Error("Could not create any elements with: "+p+". "+this.debugInfo());return F},E.prototype.insertBefore=function(p,w,I){var x,P,S,c,_;if(p?.type)return S=p,c=w,S.setParent(this),c?(P=children.indexOf(c),_=children.splice(P),children.push(S),Array.prototype.push.apply(children,_)):children.push(S),S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return P=this.parent.children.indexOf(this),_=this.parent.children.splice(P),x=this.parent.element(p,w,I),Array.prototype.push.apply(this.parent.children,_),x},E.prototype.insertAfter=function(p,w,I){var x,P,S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return P=this.parent.children.indexOf(this),S=this.parent.children.splice(P+1),x=this.parent.element(p,w,I),Array.prototype.push.apply(this.parent.children,S),x},E.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},E.prototype.node=function(p,w,I){var x,P;return p!=null&&(p=d(p)),w||(w={}),w=d(w),O(w)||(P=[w,I],I=P[0],w=P[1]),x=new a(this,p,w),I!=null&&x.text(I),this.children.push(x),x},E.prototype.text=function(p){var w;return O(p)&&this.element(p),w=new h(this,p),this.children.push(w),this},E.prototype.cdata=function(p){var w;return w=new n(this,p),this.children.push(w),this},E.prototype.comment=function(p){var w;return w=new r(this,p),this.children.push(w),this},E.prototype.commentBefore=function(p){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,I),this},E.prototype.commentAfter=function(p){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w+1),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,I),this},E.prototype.raw=function(p){var w;return w=new f(this,p),this.children.push(w),this},E.prototype.dummy=function(){var p;return p=new s(this),p},E.prototype.instruction=function(p,w){var I,x,P,S,c;if(p!=null&&(p=d(p)),w!=null&&(w=d(w)),Array.isArray(p))for(S=0,c=p.length;S<c;S++)I=p[S],this.instruction(I);else if(O(p))for(I in p)D.call(p,I)&&(x=p[I],this.instruction(I,x));else T(w)&&(w=w.apply()),P=new l(this,p,w),this.children.push(P);return this},E.prototype.instructionBefore=function(p,w){var I,x;return I=this.parent.children.indexOf(this),x=this.parent.children.splice(I),this.parent.instruction(p,w),Array.prototype.push.apply(this.parent.children,x),this},E.prototype.instructionAfter=function(p,w){var I,x;return I=this.parent.children.indexOf(this),x=this.parent.children.splice(I+1),this.parent.instruction(p,w),Array.prototype.push.apply(this.parent.children,x),this},E.prototype.declaration=function(p,w,I){var x,P;return x=this.document(),P=new o(x,p,w,I),x.children.length===0?x.children.unshift(P):x.children[0].type===t.Declaration?x.children[0]=P:x.children.unshift(P),x.root()||x},E.prototype.dtd=function(p,w){var I,x,P,S,c,_,F,k,q,R;for(x=this.document(),P=new i(x,p,w),q=x.children,S=c=0,F=q.length;c<F;S=++c)if(I=q[S],I.type===t.DocType)return x.children[S]=P,P;for(R=x.children,S=_=0,k=R.length;_<k;S=++_)if(I=R[S],I.isRoot)return x.children.splice(S,0,P),P;return x.children.push(P),P},E.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},E.prototype.root=function(){var p;for(p=this;p;){if(p.type===t.Document)return p.rootObject;if(p.isRoot)return p;p=p.parent}},E.prototype.document=function(){var p;for(p=this;p;){if(p.type===t.Document)return p;p=p.parent}},E.prototype.end=function(p){return this.document().end(p)},E.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]},E.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]},E.prototype.importDocument=function(p){var w;return w=p.root().clone(),w.parent=this,w.isRoot=!1,this.children.push(w),this},E.prototype.debugInfo=function(p){var w,I;return p=p||this.name,p==null&&!((w=this.parent)!=null&&w.name)?"":p==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+p+">, parent: <"+this.parent.name+">":"node: <"+p+">"},E.prototype.ele=function(p,w,I){return this.element(p,w,I)},E.prototype.nod=function(p,w,I){return this.node(p,w,I)},E.prototype.txt=function(p){return this.text(p)},E.prototype.dat=function(p){return this.cdata(p)},E.prototype.com=function(p){return this.comment(p)},E.prototype.ins=function(p,w){return this.instruction(p,w)},E.prototype.doc=function(){return this.document()},E.prototype.dec=function(p,w,I){return this.declaration(p,w,I)},E.prototype.e=function(p,w,I){return this.element(p,w,I)},E.prototype.n=function(p,w,I){return this.node(p,w,I)},E.prototype.t=function(p){return this.text(p)},E.prototype.d=function(p){return this.cdata(p)},E.prototype.c=function(p){return this.comment(p)},E.prototype.r=function(p){return this.raw(p)},E.prototype.i=function(p,w){return this.instruction(p,w)},E.prototype.u=function(){return this.up()},E.prototype.importXMLBuilder=function(p){return this.importDocument(p)},E.prototype.replaceChild=function(p,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.removeChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.appendChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.hasChildNodes=function(){return this.children.length!==0},E.prototype.cloneNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isSupported=function(p,w){return!0},E.prototype.hasAttributes=function(){return this.attribs.length!==0},E.prototype.compareDocumentPosition=function(p){var w,I;return w=this,w===p?0:this.document()!==p.document()?(I=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?I|=e.Preceding:I|=e.Following,I):w.isAncestor(p)?e.Contains|e.Preceding:w.isDescendant(p)?e.Contains|e.Following:w.isPreceding(p)?e.Preceding:e.Following},E.prototype.isSameNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupPrefix=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isDefaultNamespace=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupNamespaceURI=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isEqualNode=function(p){var w,I,x;if(p.nodeType!==this.nodeType||p.children.length!==this.children.length)return!1;for(w=I=0,x=this.children.length-1;0<=x?I<=x:I>=x;w=0<=x?++I:--I)if(!this.children[w].isEqualNode(p.children[w]))return!1;return!0},E.prototype.getFeature=function(p,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.setUserData=function(p,w,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.getUserData=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.contains=function(p){return p?p===this||this.isDescendant(p):!1},E.prototype.isDescendant=function(p){var w,I,x,P,S;for(S=this.children,x=0,P=S.length;x<P;x++)if(w=S[x],p===w||(I=w.isDescendant(p),I))return!0;return!1},E.prototype.isAncestor=function(p){return p.isDescendant(this)},E.prototype.isPreceding=function(p){var w,I;return w=this.treePosition(p),I=this.treePosition(this),w===-1||I===-1?!1:w<I},E.prototype.isFollowing=function(p){var w,I;return w=this.treePosition(p),I=this.treePosition(this),w===-1||I===-1?!1:w>I},E.prototype.treePosition=function(p){var w,I;return I=0,w=!1,this.foreachTreeNode(this.document(),function(x){if(I++,!w&&x===p)return w=!0}),w?I:-1},E.prototype.foreachTreeNode=function(p,w){var I,x,P,S,c;for(p||(p=this.document()),S=p.children,x=0,P=S.length;x<P;x++){if(I=S[x],c=w(I))return c;if(c=this.foreachTreeNode(I,w),c)return c}},E}()}.call(H)),dt.exports}var Ct={exports:{}},or;function zr(){return or||(or=1,function(){var e=function(n,r){return function(){return n.apply(r,arguments)}},t={}.hasOwnProperty;Ct.exports=function(){function n(r){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var o,i,s;r||(r={}),this.options=r,this.options.version||(this.options.version="1.0"),i=r.stringify||{};for(o in i)t.call(i,o)&&(s=i[o],this[o]=s)}return n.prototype.name=function(r){return this.options.noValidation?r:this.assertLegalName(""+r||"")},n.prototype.text=function(r){return this.options.noValidation?r:this.assertLegalChar(this.textEscape(""+r||""))},n.prototype.cdata=function(r){return this.options.noValidation?r:(r=""+r||"",r=r.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(r))},n.prototype.comment=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+r);return this.assertLegalChar(r)},n.prototype.raw=function(r){return this.options.noValidation?r:""+r||""},n.prototype.attValue=function(r){return this.options.noValidation?r:this.assertLegalChar(this.attEscape(r=""+r||""))},n.prototype.insTarget=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.insValue=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/\?>/))throw new Error("Invalid processing instruction value: "+r);return this.assertLegalChar(r)},n.prototype.xmlVersion=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+r);return r},n.prototype.xmlEncoding=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+r);return this.assertLegalChar(r)},n.prototype.xmlStandalone=function(r){return this.options.noValidation?r:r?"yes":"no"},n.prototype.dtdPubID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdSysID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdElementValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttType=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttDefault=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdEntityValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdNData=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(r){var o,i;if(this.options.noValidation)return r;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o))throw new Error("Invalid character in string: "+r+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o)))throw new Error("Invalid character in string: "+r+" at index "+i.index);return r},n.prototype.assertLegalName=function(r){var o;if(this.options.noValidation)return r;if(this.assertLegalChar(r),o=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!r.match(o))throw new Error("Invalid character in name");return r},n.prototype.textEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&").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(H)),Ct.exports}var Ft={exports:{}},jt={exports:{}},kt={exports:{}},ar;function Je(){return ar||(ar=1,function(){kt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(H)),kt.exports}var ur;function Qr(){return ur||(ur=1,function(){var e,t,n,r={}.hasOwnProperty;n=Te().assign,e=ee(),on(),fn(),rn(),sn(),nn(),pn(),hn(),dn(),Yr(),an(),cn(),un(),ln(),t=Je(),jt.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,l,f,h,d,b;return i||(i={}),i=n({},this.options,i),s={writer:this},s.pretty=i.pretty||!1,s.allowEmpty=i.allowEmpty||!1,s.indent=(a=i.indent)!=null?a:" ",s.newline=(u=i.newline)!=null?u:`
|
|
68
|
+
`,s.offset=(l=i.offset)!=null?l:0,s.dontPrettyTextNodes=(f=(h=i.dontPrettyTextNodes)!=null?h:i.dontprettytextnodes)!=null?f:0,s.spaceBeforeSlash=(d=(b=i.spaceBeforeSlash)!=null?b:i.spacebeforeslash)!=null?d:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=t.None,s},o.prototype.indent=function(i,s,a){var u;return!s.pretty||s.suppressPrettyCount?"":s.pretty&&(u=(a||0)+s.offset+1,u>0)?new Array(u).join(s.indent):""},o.prototype.endline=function(i,s,a){return!s.pretty||s.suppressPrettyCount?"":s.newline},o.prototype.attribute=function(i,s,a){var u;return this.openAttribute(i,s,a),u=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,s,a),u},o.prototype.cdata=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=t.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,l,f,h,d;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,h=this.indent(i,s,a),h+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?h+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(h+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(h+=" [",h+=this.endline(i,s,a),s.state=t.InsideTag,d=i.children,l=0,f=d.length;l<f;l++)u=d[l],h+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,h+="]"}return s.state=t.CloseTag,h+=s.spaceBeforeSlash+">",h+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),h},o.prototype.element=function(i,s,a){var u,l,f,h,d,b,T,O,y,D,E,p,w,I;a||(a=0),D=!1,E="",this.openNode(i,s,a),s.state=t.OpenTag,E+=this.indent(i,s,a)+"<"+i.name,p=i.attribs;for(y in p)r.call(p,y)&&(u=p[y],E+=this.attribute(u,s,a));if(f=i.children.length,h=f===0?null:i.children[0],f===0||i.children.every(function(x){return(x.type===e.Text||x.type===e.Raw)&&x.value===""}))s.allowEmpty?(E+=">",s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,E+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&f===1&&(h.type===e.Text||h.type===e.Raw)&&h.value!=null)E+=">",s.state=t.InsideTag,s.suppressPrettyCount++,D=!0,E+=this.writeChildNode(h,s,a+1),s.suppressPrettyCount--,D=!1,s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(w=i.children,d=0,T=w.length;d<T;d++)if(l=w[d],(l.type===e.Text||l.type===e.Raw)&&l.value!=null){s.suppressPrettyCount++,D=!0;break}}for(E+=">"+this.endline(i,s,a),s.state=t.InsideTag,I=i.children,b=0,O=I.length;b<O;b++)l=I[b],E+=this.writeChildNode(l,s,a+1);s.state=t.CloseTag,E+=this.indent(i,s,a)+"</"+i.name+">",D&&s.suppressPrettyCount--,E+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),E},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case e.CData:return this.cdata(i,s,a);case e.Comment:return this.comment(i,s,a);case e.Element:return this.element(i,s,a);case e.Raw:return this.raw(i,s,a);case e.Text:return this.text(i,s,a);case e.ProcessingInstruction:return this.processingInstruction(i,s,a);case e.Dummy:return"";case e.Declaration:return this.declaration(i,s,a);case e.DocType:return this.docType(i,s,a);case e.AttributeDeclaration:return this.dtdAttList(i,s,a);case e.ElementDeclaration:return this.dtdElement(i,s,a);case e.EntityDeclaration:return this.dtdEntity(i,s,a);case e.NotationDeclaration:return this.dtdNotation(i,s,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?",s.state=t.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=t.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=t.InsideTag,u+=" "+i.name+" "+i.value,s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=t.InsideTag,i.pe&&(u+=" %"),u+=" "+i.name,i.value?u+=' "'+i.value+'"':(i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),i.nData&&(u+=" NDATA "+i.nData)),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=t.InsideTag,u+=" "+i.name,i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?u+=' PUBLIC "'+i.pubID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.openNode=function(i,s,a){},o.prototype.closeNode=function(i,s,a){},o.prototype.openAttribute=function(i,s,a){},o.prototype.closeAttribute=function(i,s,a){},o}()}.call(H)),jt.exports}var cr;function gn(){return cr||(cr=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=Qr(),Ft.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,l,f,h;for(s=this.filterOptions(s),f="",h=i.children,u=0,l=h.length;u<l;u++)a=h[u],f+=this.writeChildNode(a,s,0);return s.pretty&&f.slice(-s.newline.length)===s.newline&&(f=f.slice(0,-s.newline.length)),f},o}(e)}.call(H)),Ft.exports}var lr;function Jr(){return lr||(lr=1,function(){var e,t,n,r,o,i,s,a=function(l,f){for(var h in f)u.call(f,h)&&(l[h]=f[h]);function d(){this.constructor=l}return d.prototype=f.prototype,l.prototype=new d,l.__super__=f.prototype,l},u={}.hasOwnProperty;s=Te().isPlainObject,n=Hr(),t=so(),r=fe(),e=ee(),i=zr(),o=gn(),lt.exports=function(l){a(f,l);function f(h){f.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,h||(h={}),h.writer||(h.writer=new o),this.options=h,this.stringify=new i(h)}return Object.defineProperty(f.prototype,"implementation",{value:new n}),Object.defineProperty(f.prototype,"doctype",{get:function(){var h,d,b,T;for(T=this.children,d=0,b=T.length;d<b;d++)if(h=T[d],h.type===e.DocType)return h;return null}}),Object.defineProperty(f.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(f.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(f.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(f.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(f.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(f.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(f.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(f.prototype,"origin",{get:function(){return null}}),Object.defineProperty(f.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(f.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(f.prototype,"contentType",{get:function(){return null}}),f.prototype.end=function(h){var d;return d={},h?s(h)&&(d=h,h=this.options.writer):h=this.options.writer,h.document(this,h.filterOptions(d))},f.prototype.toString=function(h){return this.options.writer.document(this,this.options.writer.filterOptions(h))},f.prototype.createElement=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createTextNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createComment=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createCDATASection=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createProcessingInstruction=function(h,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createAttribute=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createEntityReference=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.importNode=function(h,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createElementNS=function(h,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createAttributeNS=function(h,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(h,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementById=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.adoptNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.renameNode=function(h,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByClassName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createEvent=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createNodeIterator=function(h,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createTreeWalker=function(h,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f}(r)}.call(H)),lt.exports}var Bt={exports:{}},fr;function uo(){return fr||(fr=1,function(){var e,t,n,r,o,i,s,a,u,l,f,h,d,b,T,O,y,D,E,p,w,I,x,P={}.hasOwnProperty;x=Te(),w=x.isObject,p=x.isFunction,I=x.isPlainObject,E=x.getValue,e=ee(),h=Jr(),d=nn(),r=rn(),o=sn(),T=pn(),D=hn(),b=dn(),l=on(),f=fn(),i=an(),a=un(),s=cn(),u=ln(),n=Gr(),y=zr(),O=gn(),t=Je(),Bt.exports=function(){function S(c,_,F){var k;this.name="?xml",this.type=e.Document,c||(c={}),k={},c.writer?I(c.writer)&&(k=c.writer,c.writer=new O):c.writer=new O,this.options=c,this.writer=c.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new y(c),this.onDataCallback=_||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return S.prototype.createChildNode=function(c){var _,F,k,q,R,V,G,W;switch(c.type){case e.CData:this.cdata(c.value);break;case e.Comment:this.comment(c.value);break;case e.Element:k={},G=c.attribs;for(F in G)P.call(G,F)&&(_=G[F],k[F]=_.value);this.node(c.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(c.value);break;case e.Text:this.text(c.value);break;case e.ProcessingInstruction:this.instruction(c.target,c.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+c.constructor.name)}for(W=c.children,R=0,V=W.length;R<V;R++)q=W[R],this.createChildNode(q),q.type===e.Element&&this.up();return this},S.prototype.dummy=function(){return this},S.prototype.node=function(c,_,F){var k;if(c==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(c));return this.openCurrent(),c=E(c),_==null&&(_={}),_=E(_),w(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new d(this,c,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},S.prototype.element=function(c,_,F){var k,q,R,V,G,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(c)||w(c)||p(c))for(V=this.options.noValidation,this.options.noValidation=!0,W=new h(this.options).element("TEMP_ROOT"),W.element(c),this.options.noValidation=V,G=W.children,q=0,R=G.length;q<R;q++)k=G[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(c,_,F);return this},S.prototype.attribute=function(c,_){var F,k;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(c));if(c!=null&&(c=E(c)),w(c))for(F in c)P.call(c,F)&&(k=c[F],this.attribute(F,k));else p(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[c]=new n(this,c,""):_!=null&&(this.currentNode.attribs[c]=new n(this,c,_));return this},S.prototype.text=function(c){var _;return this.openCurrent(),_=new D(this,c),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.cdata=function(c){var _;return this.openCurrent(),_=new r(this,c),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.comment=function(c){var _;return this.openCurrent(),_=new o(this,c),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.raw=function(c){var _;return this.openCurrent(),_=new T(this,c),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(c,_){var F,k,q,R,V;if(this.openCurrent(),c!=null&&(c=E(c)),_!=null&&(_=E(_)),Array.isArray(c))for(F=0,R=c.length;F<R;F++)k=c[F],this.instruction(k);else if(w(c))for(k in c)P.call(c,k)&&(q=c[k],this.instruction(k,q));else p(_)&&(_=_.apply()),V=new b(this,c,_),this.onData(this.writer.processingInstruction(V,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(c,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new l(this,c,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(c,_,F){if(this.openCurrent(),c==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 f(this,_,F),this.currentNode.rootNodeName=c,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(c,_){var F;return this.openCurrent(),F=new s(this,c,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(c,_,F,k,q){var R;return this.openCurrent(),R=new i(this,c,_,F,k,q),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(c,_){var F;return this.openCurrent(),F=new a(this,!1,c,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(c,_){var F;return this.openCurrent(),F=new a(this,!0,c,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(c,_){var F;return this.openCurrent(),F=new u(this,c,_),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.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},S.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},S.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},S.prototype.openNode=function(c){var _,F,k,q;if(!c.isOpen){if(!this.root&&this.currentLevel===0&&c.type===e.Element&&(this.root=c),F="",c.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<"+c.name,q=c.attribs;for(k in q)P.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(c.children?">":"/>")+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+c.rootNodeName,c.pubID&&c.sysID?F+=' PUBLIC "'+c.pubID+'" "'+c.sysID+'"':c.sysID&&(F+=' SYSTEM "'+c.sysID+'"'),c.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(c,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),c.isOpen=!0}},S.prototype.closeNode=function(c){var _;if(!c.isClosed)return _="",this.writerOptions.state=t.CloseTag,c.type===e.Element?_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"</"+c.name+">"+this.writer.endline(c,this.writerOptions,this.currentLevel):_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),c.isClosed=!0},S.prototype.onData=function(c,_){return this.documentStarted=!0,this.onDataCallback(c,_+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(c){return c==null?"":"node: <"+c+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(c,_,F){return this.node(c,_,F)},S.prototype.txt=function(c){return this.text(c)},S.prototype.dat=function(c){return this.cdata(c)},S.prototype.com=function(c){return this.comment(c)},S.prototype.ins=function(c,_){return this.instruction(c,_)},S.prototype.dec=function(c,_,F){return this.declaration(c,_,F)},S.prototype.dtd=function(c,_,F){return this.doctype(c,_,F)},S.prototype.e=function(c,_,F){return this.element(c,_,F)},S.prototype.n=function(c,_,F){return this.node(c,_,F)},S.prototype.t=function(c){return this.text(c)},S.prototype.d=function(c){return this.cdata(c)},S.prototype.c=function(c){return this.comment(c)},S.prototype.r=function(c){return this.raw(c)},S.prototype.i=function(c,_){return this.instruction(c,_)},S.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.ent=function(c,_){return this.entity(c,_)},S.prototype.pent=function(c,_){return this.pEntity(c,_)},S.prototype.not=function(c,_){return this.notation(c,_)},S}()}.call(H)),Bt.exports}var Rt={exports:{}},pr;function co(){return pr||(pr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;e=ee(),n=Qr(),t=Je(),Rt.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,l){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,l)},s.prototype.document=function(a,u){var l,f,h,d,b,T,O,y,D;for(O=a.children,f=h=0,b=O.length;h<b;f=++h)l=O[f],l.isLastRootNode=f===a.children.length-1;for(u=this.filterOptions(u),y=a.children,D=[],d=0,T=y.length;d<T;d++)l=y[d],D.push(this.writeChildNode(l,u,0));return D},s.prototype.attribute=function(a,u,l){return this.stream.write(s.__super__.attribute.call(this,a,u,l))},s.prototype.cdata=function(a,u,l){return this.stream.write(s.__super__.cdata.call(this,a,u,l))},s.prototype.comment=function(a,u,l){return this.stream.write(s.__super__.comment.call(this,a,u,l))},s.prototype.declaration=function(a,u,l){return this.stream.write(s.__super__.declaration.call(this,a,u,l))},s.prototype.docType=function(a,u,l){var f,h,d,b;if(l||(l=0),this.openNode(a,u,l),u.state=t.OpenTag,this.stream.write(this.indent(a,u,l)),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,l)),u.state=t.InsideTag,b=a.children,h=0,d=b.length;h<d;h++)f=b[h],this.writeChildNode(f,u,l+1);u.state=t.CloseTag,this.stream.write("]")}return u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,l)),u.state=t.None,this.closeNode(a,u,l)},s.prototype.element=function(a,u,l){var f,h,d,b,T,O,y,D,E;l||(l=0),this.openNode(a,u,l),u.state=t.OpenTag,this.stream.write(this.indent(a,u,l)+"<"+a.name),D=a.attribs;for(y in D)o.call(D,y)&&(f=D[y],this.attribute(f,u,l));if(d=a.children.length,b=d===0?null:a.children[0],d===0||a.children.every(function(p){return(p.type===e.Text||p.type===e.Raw)&&p.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=t.CloseTag,this.stream.write("</"+a.name+">")):(u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&d===1&&(b.type===e.Text||b.type===e.Raw)&&b.value!=null)this.stream.write(">"),u.state=t.InsideTag,u.suppressPrettyCount++,this.writeChildNode(b,u,l+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,l)),u.state=t.InsideTag,E=a.children,T=0,O=E.length;T<O;T++)h=E[T],this.writeChildNode(h,u,l+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,l)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,l)),u.state=t.None,this.closeNode(a,u,l)},s.prototype.processingInstruction=function(a,u,l){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,l))},s.prototype.raw=function(a,u,l){return this.stream.write(s.__super__.raw.call(this,a,u,l))},s.prototype.text=function(a,u,l){return this.stream.write(s.__super__.text.call(this,a,u,l))},s.prototype.dtdAttList=function(a,u,l){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,l))},s.prototype.dtdElement=function(a,u,l){return this.stream.write(s.__super__.dtdElement.call(this,a,u,l))},s.prototype.dtdEntity=function(a,u,l){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,l))},s.prototype.dtdNotation=function(a,u,l){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,l))},s}(n)}.call(H)),Rt.exports}var hr;function lo(){return hr||(hr=1,function(){var e,t,n,r,o,i,s,a,u,l;l=Te(),a=l.assign,u=l.isFunction,n=Hr(),r=Jr(),o=uo(),s=gn(),i=co(),e=ee(),t=Je(),ye.create=function(f,h,d,b){var T,O;if(f==null)throw new Error("Root element needs a name.");return b=a({},h,d,b),T=new r(b),O=T.element(f),b.headless||(T.declaration(b),(b.pubID!=null||b.sysID!=null)&&T.dtd(b)),O},ye.begin=function(f,h,d){var b;return u(f)&&(b=[f,h],h=b[0],d=b[1],f={}),h?new o(f,h,d):new r(f)},ye.stringWriter=function(f){return new s(f)},ye.streamWriter=function(f,h){return new i(f,h)},ye.implementation=new n,ye.nodeType=e,ye.writerState=t}.call(H)),ye}var dr;function fo(){return dr||(dr=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=lo(),t=en().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[>")},ut.Builder=function(){function s(a){var u,l,f;this.options={},l=t["0.2"];for(u in l)i.call(l,u)&&(f=l[u],this.options[u]=f);for(u in a)i.call(a,u)&&(f=a[u],this.options[u]=f)}return s.prototype.buildObject=function(a){var u,l,f,h,d;return u=this.options.attrkey,l=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,f=function(b){return function(T,O){var y,D,E,p,w,I;if(typeof O!="object")b.options.cdata&&r(O)?T.raw(o(O)):T.txt(O);else if(Array.isArray(O)){for(p in O)if(i.call(O,p)){D=O[p];for(w in D)E=D[w],T=f(T.ele(w),E).up()}}else for(w in O)if(i.call(O,w))if(D=O[w],w===u){if(typeof D=="object")for(y in D)I=D[y],T=T.att(y,I)}else if(w===l)b.options.cdata&&r(D)?T=T.raw(o(D)):T=T.txt(D);else if(Array.isArray(D))for(p in D)i.call(D,p)&&(E=D[p],typeof E=="string"?b.options.cdata&&r(E)?T=T.ele(w).raw(o(E)).up():T=T.ele(w,E).up():T=f(T.ele(w),E).up());else typeof D=="object"?T=f(T.ele(w),D).up():typeof D=="string"&&b.options.cdata&&r(D)?T=T.ele(w).raw(o(D)).up():(D==null&&(D=""),T=T.ele(w,D.toString()).up());return T}}(this),h=e.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),f(h,a).end(this.options.renderOpts)},s}()}.call(H)),ut}var Xt={},Ut={},gr;function po(){return gr||(gr=1,function(e){(function(t){t.parser=function(m,g){return new r(m,g)},t.SAXParser=r,t.SAXStream=f,t.createStream=l,t.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,g){if(!(this instanceof r))return new r(m,g);var C=this;i(C),C.q=C.c="",C.bufferCheckPosition=t.MAX_BUFFER_LENGTH,C.opt=g||{},C.opt.lowercase=C.opt.lowercase||C.opt.lowercasetags,C.looseCase=C.opt.lowercase?"toLowerCase":"toUpperCase",C.tags=[],C.closed=C.closedRoot=C.sawRoot=!1,C.tag=C.error=null,C.strict=!!m,C.noscript=!!(m||C.opt.noscript),C.state=c.BEGIN,C.strictEntities=C.opt.strictEntities,C.ENTITIES=C.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),C.attribList=[],C.opt.xmlns&&(C.ns=Object.create(O)),C.opt.unquotedAttributeValues===void 0&&(C.opt.unquotedAttributeValues=!m),C.trackPosition=C.opt.position!==!1,C.trackPosition&&(C.position=C.line=C.column=0),F(C,"onready")}Object.create||(Object.create=function(m){function g(){}g.prototype=m;var C=new g;return C}),Object.keys||(Object.keys=function(m){var g=[];for(var C in m)m.hasOwnProperty(C)&&g.push(C);return g});function o(m){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),C=0,v=0,Y=n.length;v<Y;v++){var J=m[n[v]].length;if(J>g)switch(n[v]){case"textNode":q(m);break;case"cdata":k(m,"oncdata",m.cdata),m.cdata="";break;case"script":k(m,"onscript",m.script),m.script="";break;default:V(m,"Max buffer length exceeded: "+n[v])}C=Math.max(C,J)}var z=t.MAX_BUFFER_LENGTH-C;m.bufferCheckPosition=z+m.position}function i(m){for(var g=0,C=n.length;g<C;g++)m[n[g]]=""}function s(m){q(m),m.cdata!==""&&(k(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(k(m,"onscript",m.script),m.script="")}r.prototype={end:function(){G(this)},write:et,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var u=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function l(m,g){return new f(m,g)}function f(m,g){if(!(this instanceof f))return new f(m,g);a.apply(this),this._parser=new r(m,g),this.writable=!0,this.readable=!0;var C=this;this._parser.onend=function(){C.emit("end")},this._parser.onerror=function(v){C.emit("error",v),C._parser.error=null},this._decoder=null,u.forEach(function(v){Object.defineProperty(C,"on"+v,{get:function(){return C._parser["on"+v]},set:function(Y){if(!Y)return C.removeAllListeners(v),C._parser["on"+v]=Y,Y;C.on(v,Y)},enumerable:!0,configurable:!1})})}f.prototype=Object.create(a.prototype,{constructor:{value:f}}),f.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},f.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var g=this._decoder.decode();g&&(this._parser.write(g),this.emit("data",g))}return this._parser.end(),!0},f.prototype.on=function(m,g){var C=this;return!C._parser["on"+m]&&u.indexOf(m)!==-1&&(C._parser["on"+m]=function(){var v=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);v.splice(0,0,m),C.emit.apply(C,v)}),a.prototype.on.call(C,m,g)};var h="[CDATA[",d="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/2000/xmlns/",O={xml:b,xmlns:T},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(m){return m===" "||m===`
|
|
69
|
+
`||m==="\r"||m===" "}function I(m){return m==='"'||m==="'"}function x(m){return m===">"||w(m)}function P(m,g){return m.test(g)}function S(m,g){return!P(m,g)}var c=0;t.STATE={BEGIN:c++,BEGIN_WHITESPACE:c++,TEXT:c++,TEXT_ENTITY:c++,OPEN_WAKA:c++,SGML_DECL:c++,SGML_DECL_QUOTED:c++,DOCTYPE:c++,DOCTYPE_QUOTED:c++,DOCTYPE_DTD:c++,DOCTYPE_DTD_QUOTED:c++,COMMENT_STARTING:c++,COMMENT:c++,COMMENT_ENDING:c++,COMMENT_ENDED:c++,CDATA:c++,CDATA_ENDING:c++,CDATA_ENDING_2:c++,PROC_INST:c++,PROC_INST_BODY:c++,PROC_INST_ENDING:c++,OPEN_TAG:c++,OPEN_TAG_SLASH:c++,ATTRIB:c++,ATTRIB_NAME:c++,ATTRIB_NAME_SAW_WHITE:c++,ATTRIB_VALUE:c++,ATTRIB_VALUE_QUOTED:c++,ATTRIB_VALUE_CLOSED:c++,ATTRIB_VALUE_UNQUOTED:c++,ATTRIB_VALUE_ENTITY_Q:c++,ATTRIB_VALUE_ENTITY_U:c++,CLOSE_TAG:c++,CLOSE_TAG_SAW_WHITE:c++,SCRIPT:c++,SCRIPT_ENDING:c++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var g=t.ENTITIES[m],C=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[m]=C});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;c=t.STATE;function F(m,g,C){m[g]&&m[g](C)}function k(m,g,C){m.textNode&&q(m),F(m,g,C)}function q(m){m.textNode=R(m.opt,m.textNode),m.textNode&&F(m,"ontext",m.textNode),m.textNode=""}function R(m,g){return m.trim&&(g=g.trim()),m.normalize&&(g=g.replace(/\s+/g," ")),g}function V(m,g){return q(m),m.trackPosition&&(g+=`
|
|
70
|
+
Line: `+m.line+`
|
|
71
|
+
Column: `+m.column+`
|
|
72
|
+
Char: `+m.c),g=new Error(g),m.error=g,F(m,"onerror",g),m}function G(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==c.BEGIN&&m.state!==c.BEGIN_WHITESPACE&&m.state!==c.TEXT&&V(m,"Unexpected end"),q(m),m.c="",m.closed=!0,F(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,g){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&V(m,g)}function Ze(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var g=m.tags[m.tags.length-1]||m,C=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(C.ns=g.ns),m.attribList.length=0,k(m,"onopentagstart",C)}function Fe(m,g){var C=m.indexOf(":"),v=C<0?["",m]:m.split(":"),Y=v[0],J=v[1];return g&&m==="xmlns"&&(Y="xmlns",J=""),{prefix:Y,local:J}}function Le(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var g=Fe(m.attribName,!0),C=g.prefix,v=g.local;if(C==="xmlns")if(v==="xml"&&m.attribValue!==b)W(m,"xml: prefix must be bound to "+b+`
|
|
73
|
+
Actual: `+m.attribValue);else if(v==="xmlns"&&m.attribValue!==T)W(m,"xmlns: prefix must be bound to "+T+`
|
|
74
|
+
Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.ns&&(Y.ns=Object.create(J.ns)),Y.ns[v]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,k(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function ue(m,g){if(m.opt.xmlns){var C=m.tag,v=Fe(m.tagName);C.prefix=v.prefix,C.local=v.local,C.uri=C.ns[v.prefix]||"",C.prefix&&!C.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),C.uri=v.prefix);var Y=m.tags[m.tags.length-1]||m;C.ns&&Y.ns!==C.ns&&Object.keys(C.ns).forEach(function(U){k(m,"onopennamespace",{prefix:U,uri:C.ns[U]})});for(var J=0,z=m.attribList.length;J<z;J++){var re=m.attribList[J],N=re[0],L=re[1],j=Fe(N,!0),M=j.prefix,A=j.local,X=M===""?"":C.ns[M]||"",B={name:N,value:L,prefix:M,local:A,uri:X};M&&M!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(M)),B.uri=M),m.tag.attributes[N]=B,k(m,"onattribute",B)}m.attribList.length=0}m.tag.isSelfClosing=!!g,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),g||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=c.SCRIPT:m.state=c.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function ge(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=c.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=c.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var g=m.tags.length,C=m.tagName;m.strict||(C=C[m.looseCase]());for(var v=C;g--;){var Y=m.tags[g];if(Y.name!==v)W(m,"Unexpected close tag");else break}if(g<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=c.TEXT;return}m.tagName=C;for(var J=m.tags.length;J-- >g;){var z=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var re={};for(var N in z.ns)re[N]=z.ns[N];var L=m.tags[m.tags.length-1]||m;m.opt.xmlns&&z.ns!==L.ns&&Object.keys(z.ns).forEach(function(j){var M=z.ns[j];k(m,"onclosenamespace",{prefix:j,uri:M})})}g===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=c.TEXT}function Ke(m){var g=m.entity,C=g.toLowerCase(),v,Y="";return m.ENTITIES[g]?m.ENTITIES[g]:m.ENTITIES[C]?m.ENTITIES[C]:(g=C,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),v=parseInt(g,16),Y=v.toString(16)):(g=g.slice(1),v=parseInt(g,10),Y=v.toString(10))),g=g.replace(/^0+/,""),isNaN(v)||Y.toLowerCase()!==g||v<0||v>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(v))}function $(m,g){g==="<"?(m.state=c.OPEN_WAKA,m.startTagPosition=m.position):w(g)||(W(m,"Non-whitespace before first tag."),m.textNode=g,m.state=c.TEXT)}function Pe(m,g){var C="";return g<m.length&&(C=m.charAt(g)),C}function et(m){var g=this;if(this.error)throw this.error;if(g.closed)return V(g,"Cannot write after close. Assign an onready handler.");if(m===null)return G(g);typeof m=="object"&&(m=m.toString());for(var C=0,v="";v=Pe(m,C++),g.c=v,!!v;)switch(g.trackPosition&&(g.position++,v===`
|
|
75
|
+
`?(g.line++,g.column=0):g.column++),g.state){case c.BEGIN:if(g.state=c.BEGIN_WHITESPACE,v==="\uFEFF")continue;$(g,v);continue;case c.BEGIN_WHITESPACE:$(g,v);continue;case c.TEXT:if(g.sawRoot&&!g.closedRoot){for(var J=C-1;v&&v!=="<"&&v!=="&";)v=Pe(m,C++),v&&g.trackPosition&&(g.position++,v===`
|
|
76
|
+
`?(g.line++,g.column=0):g.column++);g.textNode+=m.substring(J,C-1)}v==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):(!w(v)&&(!g.sawRoot||g.closedRoot)&&W(g,"Text data outside of root node."),v==="&"?g.state=c.TEXT_ENTITY:g.textNode+=v);continue;case c.SCRIPT:v==="<"?g.state=c.SCRIPT_ENDING:g.script+=v;continue;case c.SCRIPT_ENDING:v==="/"?g.state=c.CLOSE_TAG:(g.script+="<"+v,g.state=c.SCRIPT);continue;case c.OPEN_WAKA:if(v==="!")g.state=c.SGML_DECL,g.sgmlDecl="";else if(!w(v))if(P(y,v))g.state=c.OPEN_TAG,g.tagName=v;else if(v==="/")g.state=c.CLOSE_TAG,g.tagName="";else if(v==="?")g.state=c.PROC_INST,g.procInstName=g.procInstBody="";else{if(W(g,"Unencoded <"),g.startTagPosition+1<g.position){var Y=g.position-g.startTagPosition;v=new Array(Y).join(" ")+v}g.textNode+="<"+v,g.state=c.TEXT}continue;case c.SGML_DECL:if(g.sgmlDecl+v==="--"){g.state=c.COMMENT,g.comment="",g.sgmlDecl="";continue}g.doctype&&g.doctype!==!0&&g.sgmlDecl?(g.state=c.DOCTYPE_DTD,g.doctype+="<!"+g.sgmlDecl+v,g.sgmlDecl=""):(g.sgmlDecl+v).toUpperCase()===h?(k(g,"onopencdata"),g.state=c.CDATA,g.sgmlDecl="",g.cdata=""):(g.sgmlDecl+v).toUpperCase()===d?(g.state=c.DOCTYPE,(g.doctype||g.sawRoot)&&W(g,"Inappropriately located doctype declaration"),g.doctype="",g.sgmlDecl=""):v===">"?(k(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=c.TEXT):(I(v)&&(g.state=c.SGML_DECL_QUOTED),g.sgmlDecl+=v);continue;case c.SGML_DECL_QUOTED:v===g.q&&(g.state=c.SGML_DECL,g.q=""),g.sgmlDecl+=v;continue;case c.DOCTYPE:v===">"?(g.state=c.TEXT,k(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=v,v==="["?g.state=c.DOCTYPE_DTD:I(v)&&(g.state=c.DOCTYPE_QUOTED,g.q=v));continue;case c.DOCTYPE_QUOTED:g.doctype+=v,v===g.q&&(g.q="",g.state=c.DOCTYPE);continue;case c.DOCTYPE_DTD:v==="]"?(g.doctype+=v,g.state=c.DOCTYPE):v==="<"?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):I(v)?(g.doctype+=v,g.state=c.DOCTYPE_DTD_QUOTED,g.q=v):g.doctype+=v;continue;case c.DOCTYPE_DTD_QUOTED:g.doctype+=v,v===g.q&&(g.state=c.DOCTYPE_DTD,g.q="");continue;case c.COMMENT:v==="-"?g.state=c.COMMENT_ENDING:g.comment+=v;continue;case c.COMMENT_ENDING:v==="-"?(g.state=c.COMMENT_ENDED,g.comment=R(g.opt,g.comment),g.comment&&k(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+v,g.state=c.COMMENT);continue;case c.COMMENT_ENDED:v!==">"?(W(g,"Malformed comment"),g.comment+="--"+v,g.state=c.COMMENT):g.doctype&&g.doctype!==!0?g.state=c.DOCTYPE_DTD:g.state=c.TEXT;continue;case c.CDATA:for(var J=C-1;v&&v!=="]";)v=Pe(m,C++),v&&g.trackPosition&&(g.position++,v===`
|
|
77
|
+
`?(g.line++,g.column=0):g.column++);g.cdata+=m.substring(J,C-1),v==="]"&&(g.state=c.CDATA_ENDING);continue;case c.CDATA_ENDING:v==="]"?g.state=c.CDATA_ENDING_2:(g.cdata+="]"+v,g.state=c.CDATA);continue;case c.CDATA_ENDING_2:v===">"?(g.cdata&&k(g,"oncdata",g.cdata),k(g,"onclosecdata"),g.cdata="",g.state=c.TEXT):v==="]"?g.cdata+="]":(g.cdata+="]]"+v,g.state=c.CDATA);continue;case c.PROC_INST:v==="?"?g.state=c.PROC_INST_ENDING:w(v)?g.state=c.PROC_INST_BODY:g.procInstName+=v;continue;case c.PROC_INST_BODY:if(!g.procInstBody&&w(v))continue;v==="?"?g.state=c.PROC_INST_ENDING:g.procInstBody+=v;continue;case c.PROC_INST_ENDING:v===">"?(k(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=c.TEXT):(g.procInstBody+="?"+v,g.state=c.PROC_INST_BODY);continue;case c.OPEN_TAG:P(D,v)?g.tagName+=v:(Ze(g),v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:(w(v)||W(g,"Invalid character in tag name"),g.state=c.ATTRIB));continue;case c.OPEN_TAG_SLASH:v===">"?(ue(g,!0),ge(g)):(W(g,"Forward-slash in opening tag not followed by >"),g.state=c.ATTRIB);continue;case c.ATTRIB:if(w(v))continue;v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:P(y,v)?(g.attribName=v,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME:v==="="?g.state=c.ATTRIB_VALUE:v===">"?(W(g,"Attribute without value"),g.attribValue=g.attribName,Le(g),ue(g)):w(v)?g.state=c.ATTRIB_NAME_SAW_WHITE:P(D,v)?g.attribName+=v:W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME_SAW_WHITE:if(v==="=")g.state=c.ATTRIB_VALUE;else{if(w(v))continue;W(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",k(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",v===">"?ue(g):P(y,v)?(g.attribName=v,g.state=c.ATTRIB_NAME):(W(g,"Invalid attribute name"),g.state=c.ATTRIB)}continue;case c.ATTRIB_VALUE:if(w(v))continue;I(v)?(g.q=v,g.state=c.ATTRIB_VALUE_QUOTED):(g.opt.unquotedAttributeValues||V(g,"Unquoted attribute value"),g.state=c.ATTRIB_VALUE_UNQUOTED,g.attribValue=v);continue;case c.ATTRIB_VALUE_QUOTED:if(v!==g.q){v==="&"?g.state=c.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=v;continue}Le(g),g.q="",g.state=c.ATTRIB_VALUE_CLOSED;continue;case c.ATTRIB_VALUE_CLOSED:w(v)?g.state=c.ATTRIB:v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:P(y,v)?(W(g,"No whitespace between attributes"),g.attribName=v,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_VALUE_UNQUOTED:if(!x(v)){v==="&"?g.state=c.ATTRIB_VALUE_ENTITY_U:g.attribValue+=v;continue}Le(g),v===">"?ue(g):g.state=c.ATTRIB;continue;case c.CLOSE_TAG:if(g.tagName)v===">"?ge(g):P(D,v)?g.tagName+=v:g.script?(g.script+="</"+g.tagName+v,g.tagName="",g.state=c.SCRIPT):(w(v)||W(g,"Invalid tagname in closing tag"),g.state=c.CLOSE_TAG_SAW_WHITE);else{if(w(v))continue;S(y,v)?g.script?(g.script+="</"+v,g.state=c.SCRIPT):W(g,"Invalid tagname in closing tag."):g.tagName=v}continue;case c.CLOSE_TAG_SAW_WHITE:if(w(v))continue;v===">"?ge(g):W(g,"Invalid characters in closing tag");continue;case c.TEXT_ENTITY:case c.ATTRIB_VALUE_ENTITY_Q:case c.ATTRIB_VALUE_ENTITY_U:var z,re;switch(g.state){case c.TEXT_ENTITY:z=c.TEXT,re="textNode";break;case c.ATTRIB_VALUE_ENTITY_Q:z=c.ATTRIB_VALUE_QUOTED,re="attribValue";break;case c.ATTRIB_VALUE_ENTITY_U:z=c.ATTRIB_VALUE_UNQUOTED,re="attribValue";break}if(v===";"){var N=Ke(g);g.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(N)?(g.entity="",g.state=z,g.write(N)):(g[re]+=N,g.entity="",g.state=z)}else P(g.entity.length?p:E,v)?g.entity+=v:(W(g,"Invalid character in entity name"),g[re]+="&"+g.entity+v,g.entity="",g.state=z);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&o(g),g}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,g=Math.floor,C=function(){var v=16384,Y=[],J,z,re=-1,N=arguments.length;if(!N)return"";for(var L="";++re<N;){var j=Number(arguments[re]);if(!isFinite(j)||j<0||j>1114111||g(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?Y.push(j):(j-=65536,J=(j>>10)+55296,z=j%1024+56320,Y.push(J,z)),(re+1===N||Y.length>v)&&(L+=m.apply(null,Y),Y.length=0)}return L};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:C,configurable:!0,writable:!0}):String.fromCodePoint=C}()})(e)}(Ut)),Ut}var Vt={},mr;function ho(){return mr||(mr=1,function(){Vt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(H)),Vt}var ve={},yr;function Zr(){return yr||(yr=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),ve.normalize=function(t){return t.toLowerCase()},ve.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},ve.stripPrefix=function(t){return t.replace(e,"")},ve.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},ve.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(H)),ve}var br;function go(){return br||(br=1,function(e){(function(){var t,n,r,o,i,s,a,u,l,f=function(b,T){return function(){return b.apply(T,arguments)}},h=function(b,T){for(var O in T)d.call(T,O)&&(b[O]=T[O]);function y(){this.constructor=b}return y.prototype=T.prototype,b.prototype=new y,b.__super__=T.prototype,b},d={}.hasOwnProperty;u=po(),o=Kt,t=ho(),a=Zr(),l=Ti.setImmediate,n=en().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,T,O){var y,D,E;for(y=0,D=b.length;y<D;y++)E=b[y],T=E(T,O);return T},r=function(b,T,O){var y;return y=Object.create(null),y.value=O,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(b,T,y)},e.Parser=function(b){h(T,b);function T(O){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var y,D,E;if(!(this instanceof e.Parser))return new e.Parser(O);this.options={},D=n["0.2"];for(y in D)d.call(D,y)&&(E=D[y],this.options[y]=E);for(y in O)d.call(O,y)&&(E=O[y],this.options[y]=E);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return T.prototype.processAsync=function(){var O,y;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),l(this.processAsync))}catch(D){if(y=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},T.prototype.assignOrPush=function(O,y,D){return y in O?(O[y]instanceof Array||r(O,y,[O[y]]),O[y].push(D)):this.options.explicitArray?r(O,y,[D]):r(O,y,D)},T.prototype.reset=function(){var O,y,D,E;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(p){return function(w){if(p.saxParser.resume(),!p.saxParser.errThrown)return p.saxParser.errThrown=!0,p.emit("error",w)}}(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,E=[],O=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=function(p){return function(w){var I,x,P,S,c;if(P={},P[y]="",!p.options.ignoreAttrs){c=w.attributes;for(I in c)d.call(c,I)&&(!(O in P)&&!p.options.mergeAttrs&&(P[O]={}),x=p.options.attrValueProcessors?s(p.options.attrValueProcessors,w.attributes[I],I):w.attributes[I],S=p.options.attrNameProcessors?s(p.options.attrNameProcessors,I):I,p.options.mergeAttrs?p.assignOrPush(P,S,x):r(P[O],S,x))}return P["#name"]=p.options.tagNameProcessors?s(p.options.tagNameProcessors,w.name):w.name,p.options.xmlns&&(P[p.options.xmlnskey]={uri:w.uri,local:w.local}),E.push(P)}}(this),this.saxParser.onclosetag=function(p){return function(){var w,I,x,P,S,c,_,F,k,q;if(c=E.pop(),S=c["#name"],(!p.options.explicitChildren||!p.options.preserveChildrenOrder)&&delete c["#name"],c.cdata===!0&&(w=c.cdata,delete c.cdata),k=E[E.length-1],c[y].match(/^\s*$/)&&!w?(I=c[y],delete c[y]):(p.options.trim&&(c[y]=c[y].trim()),p.options.normalize&&(c[y]=c[y].replace(/\s{2,}/g," ").trim()),c[y]=p.options.valueProcessors?s(p.options.valueProcessors,c[y],S):c[y],Object.keys(c).length===1&&y in c&&!p.EXPLICIT_CHARKEY&&(c=c[y])),i(c)&&(typeof p.options.emptyTag=="function"?c=p.options.emptyTag():c=p.options.emptyTag!==""?p.options.emptyTag:I),p.options.validator!=null&&(q="/"+function(){var R,V,G;for(G=[],R=0,V=E.length;R<V;R++)P=E[R],G.push(P["#name"]);return G}().concat(S).join("/"),function(){var R;try{return c=p.options.validator(q,k&&k[S],c)}catch(V){return R=V,p.emit("error",R)}}()),p.options.explicitChildren&&!p.options.mergeAttrs&&typeof c=="object"){if(!p.options.preserveChildrenOrder)P={},p.options.attrkey in c&&(P[p.options.attrkey]=c[p.options.attrkey],delete c[p.options.attrkey]),!p.options.charsAsChildren&&p.options.charkey in c&&(P[p.options.charkey]=c[p.options.charkey],delete c[p.options.charkey]),Object.getOwnPropertyNames(c).length>0&&(P[p.options.childkey]=c),c=P;else if(k){k[p.options.childkey]=k[p.options.childkey]||[],_={};for(x in c)d.call(c,x)&&r(_,x,c[x]);k[p.options.childkey].push(_),delete c["#name"],Object.keys(c).length===1&&y in c&&!p.EXPLICIT_CHARKEY&&(c=c[y])}}return E.length>0?p.assignOrPush(k,S,c):(p.options.explicitRoot&&(F=c,c={},r(c,S,F)),p.resultObject=c,p.saxParser.ended=!0,p.emit("end",p.resultObject))}}(this),D=function(p){return function(w){var I,x;if(x=E[E.length-1],x)return x[y]+=w,p.options.explicitChildren&&p.options.preserveChildrenOrder&&p.options.charsAsChildren&&(p.options.includeWhiteChars||w.replace(/\\n/g,"").trim()!=="")&&(x[p.options.childkey]=x[p.options.childkey]||[],I={"#name":"__text__"},I[y]=w,p.options.normalize&&(I[y]=I[y].replace(/\s{2,}/g," ").trim()),x[p.options.childkey].push(I)),x}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(p){return function(w){var I;if(I=D(w),I)return I.cdata=!0}}()},T.prototype.parseString=function(O,y){var D;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return O=O.toString(),O.trim()===""?(this.emit("end",null),!0):(O=t.stripBOM(O),this.options.async?(this.remaining=O,l(this.processAsync),this.saxParser):this.saxParser.write(O).close())}catch(E){if(D=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw D}else return this.emit("error",D),this.saxParser.errThrown=!0}},T.prototype.parseStringPromise=function(O){return new Promise(function(y){return function(D,E){return y.parseString(O,function(p,w){return p?E(p):D(w)})}}(this))},T}(o),e.parseString=function(b,T,O){var y,D,E;return O!=null?(typeof O=="function"&&(y=O),typeof T=="object"&&(D=T)):(typeof T=="function"&&(y=T),D={}),E=new e.Parser(D),E.parseString(b,y)},e.parseStringPromise=function(b,T){var O,y;return typeof T=="object"&&(O=T),y=new e.Parser(O),y.parseStringPromise(b)}}).call(H)}(Xt)),Xt}var Kr;(function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;t=en(),e=fo(),n=go(),Zr(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,Kr=n.parseStringPromise}).call(H);class mo{constructor(t,n,r){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"";for(const o of r.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o));this.breakOnFirstLine=r.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const n=await Kr(t,{explicitArray:!1});await this.handleDbgpMessage(n)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
|
|
83
78
|
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
84
79
|
|
|
85
80
|
1. Add breakpoints in your files to start step debugging.
|
|
86
81
|
|
|
87
82
|
2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
|
|
88
83
|
|
|
89
|
-
3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[t,
|
|
90
|
-
`),s
|
|
91
|
-
`,`${this.uriFromBridgeToCDPSyntaxHighlight(
|
|
92
|
-
`),
|
|
84
|
+
3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[t,n]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,n)}async sendScriptToCDP(t,n){const r=this.uriFromBridgeToCDPSyntaxHighlight(t),o=this.uriFromBridgeToCDP(t);try{const i=await this.readPHPFile(t),s=i.split(`
|
|
85
|
+
`),a=s.map((h,d)=>d===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},f=`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:f}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let n=this.scriptIdByUrl.get(t);return n||(n=wi("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,n)),n}formatPropertyFullName(t){let n=!1,r="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||t.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(t,n){const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(t){const{id:n,method:r,params:o}=t;let i={},s=!0;switch(r){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:u}=o;if(!a){s=!1;break}const l=this.uriFromCDPToBridge(a),f=this.uriFromBridgeToDBGP(l),h=(typeof u=="number"?u:0)+1,d=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(f)} -n ${h}`,T=this.sendDbgpCommand(b);this.pendingCommands.set(T,{cdpId:n,cdpMethod:r,params:{breakpointId:d,fileUri:l,lineNumber:h}}),s=!1}else this.breakpoints.set(d,{cdpId:d,xdebugId:null,fileUri:l,lineNumber:h}),i={breakpointId:d,locations:[{scriptId:this.getOrCreateScriptId(l),lineNumber:h-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),l=this.breakpoints.get(u);if(l){if(l.xdebugId&&this.xdebugConnected){const f=`breakpoint_remove -d ${l.xdebugId}`,h=this.sendDbgpCommand(f);this.pendingCommands.set(h,{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 l=Buffer.from(a).toString("base64"),f=this.sendDbgpCommand("eval",`-- ${l}`);this.pendingCommands.set(f,{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 l=u.contextId??0,h=`context_get -d ${u.depth} -c ${l} -p 0 -m 32`,d=this.sendDbgpCommand(h),b={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,b),this.pendingCommands.set(d,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const l=u.depth,f=u.fullname,h=this.formatPropertyFullName(f),d=`property_get -d ${l} -n ${h} -p 0 -m 32`,b=this.sendDbgpCommand(d),T={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,T),this.pendingCommands.set(b,{cdpId:n,cdpMethod:r,params:{parentObjectId:a}}),s=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=o.scriptId,u=[...this.scriptIdByUrl.entries()].find(([,f])=>f===a)?.[0],l=[];u&&l.push(`Here's the full path for your convenience:
|
|
86
|
+
`,`${this.uriFromBridgeToCDPSyntaxHighlight(u).replace("file://","")}
|
|
87
|
+
`),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...l,"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:
|
|
93
88
|
`,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
|
|
94
|
-
`)};break}default:
|
|
95
|
-
`),await new Promise(
|
|
96
|
-
`));
|
|
89
|
+
`)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===t.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(t){return ne.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const n=t.indexOf(this.phpRoot);return n!==-1?t.slice(n):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(r=>{this.handleCdpMessage({id:r.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(r.fileUri),lineNumber:r.lineNumber-1}})});const n=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(n,{});return}if(t.response){const n=t.response,r=n.$,o=r.command,i=r.transaction_id,s=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(s&&s.cdpId!==void 0&&s.cdpMethod==="Debugger.setBreakpointByUrl"){const a=r.id,u=s.params;if(u){const{breakpointId:l,fileUri:f,lineNumber:h}=u;this.breakpoints.set(l,{cdpId:l,xdebugId:a,fileUri:f,lineNumber:h});const d=this.getOrCreateScriptId(f),b={breakpointId:l,locations:[{scriptId:d,lineNumber:h-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:b})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=r.status;if(n["xdebug:message"]){const u=this.uriFromDBGPToBridge(n["xdebug:message"].$.filename);u&&!this.scriptIdByUrl.has(u)&&await this.sendScriptToCDP(u,this.getOrCreateScriptId(u))}if(a==="break"){const u=this.sendDbgpCommand("stack_get");this.pendingCommands.set(u,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(s&&s.cdpId!==void 0){let a;if(n.property){const l=n.property,f=l.$.type,h=l.$.encoding;let d=null;if(Object.prototype.hasOwnProperty.call(l,"_")?d=l._:typeof l.$value<"u"&&(d=l.$value),h==="base64"&&d!==null)try{d=Buffer.from(d,"base64").toString()}catch{}if(f==="string")a={type:"string",value:d??""};else if(f==="int"||f==="float"||f==="bool"||f==="boolen"||f==="integer"||f==="double"){let b=d;f.startsWith("int")||f==="integer"?b=parseInt(d||"0",10):f==="float"||f==="double"?b=parseFloat(d||"0"):f.startsWith("bool")&&(b=d==="1"||d==="true"),a={type:"number",value:b}}else if(f==="array"||f==="object"){const b=l.$.classname||(f==="array"?"Array":"Object"),T=String(this.nextObjectId++),O=l.$.fullname||"";this.objectHandles.set(T,{type:"property",depth:0,contextId:0,fullname:O}),a={type:"object",objectId:T,className:b,description:b}}else f==="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,l=n.property?.property??n.property,f=[];if(l){const h=Array.isArray(l)?l:[l];for(const d of h){const b=d.$.name||d.$.fullname||"";let T=d.$.type||"undefined";const O=d.$.children==="1",y=d.$.encoding;let D=null;if(typeof d._<"u"&&(D=d._),y==="base64"&&D!==null)try{D=Buffer.from(D,"base64").toString()}catch{}if(O){const E=d.$.classname||(T==="array"?"Array":"Object"),p=String(this.nextObjectId++),w=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:w,fullname:d.$.fullname||b}),f.push({name:d.$.key||b,value:{type:"object",className:E,description:E,objectId:p},writable:!1,configurable:!1,enumerable:!0})}else{let E,p;T==="string"?E=D??"":T==="int"||T==="integer"?E=parseInt(D||"0",10):T==="float"||T==="double"?E=parseFloat(D||"0"):T==="bool"||T==="boolean"?(E=D==="1"||D==="true",T="boolean"):T==="null"?(E=null,p="null"):E=D;const w={type:T==="integer"?"number":T};p&&(w.subtype=p),w.value=E,f.push({name:d.$.key||b,value:w,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const h=(u.aggregatedProps||[]).concat(f),d=32;if(f.length===d){const T=(u.currentPage||0)+1,O={...u,currentPage:T,aggregatedProps:h};this.objectHandles.set(a,O);let y;if(o==="context_get"){const E=u.contextId??0;y=`context_get -d ${u.depth} -c ${E} -p ${T} -m ${d}`}else{const E=u.depth,p=u.fullname,w=this.formatPropertyFullName(p);y=`property_get -d ${E} -n ${w} -p ${T} -m ${d}`}const D=this.sendDbgpCommand(y);this.pendingCommands.set(D,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const T={result:h};this.cdp.sendMessage({id:s.cdpId,result:T}),this.pendingCommands.delete(i)}}else{const h={result:f};this.cdp.sendMessage({id:s.cdpId,result:h}),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 f of a){const h=this.uriFromDBGPToBridge(f.$.filename),d=this.getOrCreateScriptId(h);this.scriptIdByUrl.has(h)||(this.scriptIdByUrl.set(h,d),await this.sendScriptToCDP(h,d))}for(const f of a){const h=parseInt(f.$.level,10),d=this.uriFromDBGPToBridge(f.$.filename),b=parseInt(f.$.lineno,10),T=f.$.where&&f.$.where!=="{main}"?f.$.where:"(anonymous)",O=`frame:${h}`;this.callFramesMap.set(O,h);const y=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:h}),y.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const E=String(this.nextObjectId++);this.objectHandles.set(E,{type:"context",contextId:1,depth:h}),y.push({type:"global",object:{objectId:E,className:"Object",description:"Global"}}),u.push({callFrameId:O,functionName:T,location:{scriptId:this.getOrCreateScriptId(d),lineNumber:b-1,columnNumber:0},scopeChain:y,this:{type:"object",className:"Object",description:"Object",objectId:E}})}let l="pause";if(a.length>0){const f=a[0];if(f.$.filename&&f.$.lineno){const h=this.uriFromDBGPToBridge(f.$.filename),d=parseInt(f.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===h&&b.lineNumber===d){l="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:l,callFrames:u,hitBreakpoints:l==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const n=t.stream,r=n.$.type,o=n.$.encoding||"none";let i=typeof n._=="string"?n._:"";o==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:r==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function yo(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;de.log("Starting XDebug Bridge...");const s=new $s(t);de.log("Connect Chrome DevTools to CDP at:"),de.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
|
|
90
|
+
`),await new Promise(h=>s.on("clientConnected",h)),await new Promise(h=>setTimeout(h,2e3)),de.log("Chrome connected! Initializing Xdebug receiver...");const a=new qs(n);de.log(`XDebug receiver running on port ${n}`),de.log("Running a PHP script with Xdebug enabled...");async function u(h){const d=[],b=e.phpInstance?await e.phpInstance.listFiles(h):ai(h);for(const T of b){const O=ne.join(h,T);try{(e.phpInstance?await e.phpInstance.isDir(O):ui(O).isDirectory())?d.push(...await u(O)):T.endsWith(".php")&&d.push(O)}catch{}}return d}const l=e.phpInstance?h=>e.phpInstance.readFileAsText(h):e.getPHPFile?e.getPHPFile:h=>Qt(h,"utf-8"),f=await u(o);return new mo(a,s,{knownScriptUrls:f,phpRoot:o,getPHPFile:l,breakOnFirstLine:i})}let oe=process.argv.slice(2);oe.length||(oe=["--help"]);const Me=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,wr=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,bo=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,ei=(import.meta||{}).url,zt=new URL("ca-bundle.crt",ei).pathname;ci(zt)||Tr(zt,fi.join(`
|
|
91
|
+
`));oe.unshift("-d",`openssl.cafile=${zt}`);async function wo(){const e=new URL("php.ini",ei).pathname,t=process.env.PHP||ti;if(!ni.includes(t))throw new Error(`Unsupported PHP version ${t}`);const n=oe.some(d=>d.startsWith("--xdebug"));n&&(oe=oe.filter(d=>d!=="--xdebug"));const r=oe.some(d=>d.startsWith("--experimental-devtools"));r&&(oe=oe.filter(d=>d!=="--experimental-devtools"));const o=oe.filter(d=>d.startsWith("--experimental-unsafe-ide-integration")).map(d=>{const b=d.split("=")[1];return b===void 0?["vscode","phpstorm"]:b.includes(",")?b.split(","):[b]})[0]??!1;o&&(oe=oe.filter(d=>!d.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=mn(ne.join(yn.tmpdir(),"php-wasm-bin"));Tr(`${a}/php`,`#!/bin/sh
|
|
97
92
|
${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
|
|
98
|
-
`),
|
|
93
|
+
`),li(`${a}/php`,493);const u=mn(ne.join(yn.tmpdir(),"php-wasm-sys-tmp")),l=new ri(await hi(t,{emscriptenOptions:{fileLockManager:new di,processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n}));if(l.setSpawnHandler((d,b)=>ii(d,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),gi(l),n&&o)try{const d="PHP.wasm CLI - Listen for Xdebug",b=o;await xs(d,process.cwd());const T=await Ps({name:d,host:"example.com",port:443,ides:b,cwd:process.cwd()}),O=b.includes("vscode"),y=b.includes("phpstorm"),D=Object.values(T);console.log(""),D.length>0?(console.log(Me("Xdebug configured successfully")),console.log(bo("Updated IDE config: ")+D.join(" "))):(console.log(Me("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),O&&T.vscode&&(console.log(Me("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${Me("PHP Debug")} extension by ${Me("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${wr(d)}" from the dropdown`),console.log(' 3. Click "start debugging"'),console.log(" 5. Set a breakpoint."),console.log(" 6. Run your command with PHP.wasm CLI."),y&&console.log("")),y&&T.phpstorm&&(console.log(Me("PhpStorm instructions:")),console.log(` 1. Choose "${wr(d)}" debug configuration in the toolbar`),console.log(" 2. Click the debug button (bug icon)`"),console.log(" 3. Set a breakpoint."),console.log(" 4. Run your command with PHP.wasm CLI.")),console.log("")}catch(d){throw new Error("Could not configure Xdebug",{cause:d})}n&&r&&(await yo({breakOnFirstLine:!0})).start(),oe.some(d=>d.startsWith("-c"))||oe.unshift("-c",e);const h=await l.cli(["php",...oe]);h.stderr.pipeTo(new WritableStream({write(d){process.stderr.write(d)}})),h.stdout.pipeTo(new WritableStream({write(d){process.stdout.write(d)}})),await h.exitCode.catch(d=>{throw d.name==="ExitStatus"&&process.exit(d.status===void 0?1:d.status),d}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}wo();
|
|
99
94
|
//# sourceMappingURL=main.js.map
|