@php-wasm/xdebug-bridge 3.0.43 → 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/cli.cjs +1 -1
- package/cli.js +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +6 -6
- package/run-cli-BPGRvxlC.cjs +123 -0
- package/run-cli-zDgiBumC.js +7256 -0
- package/run-cli-BeUsFBrz.js +0 -8313
- package/run-cli-uj1-xEEL.cjs +0 -128
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";const si=require("assert"),bt=require("path"),Ft=require("fs"),Xn=require("util"),es=require("url"),ns=require("ws"),is=require("net"),rs=require("crypto"),ss=require("timers");var Re=typeof document<"u"?document.currentScript:null;const _r=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(_r==="NODE"){let o=function(e){return new Promise(function(n,s){e.onload=e.onerror=function(i){e.onload=e.onerror=null,i.type==="load"?n(e.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const e=new Uint8Array([1,2,3,4]),s=new File([e],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class e extends Blob{constructor(s,i,r){super(s);let a;r?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=e}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),o(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),o(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let e=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,a=await n.slice(e,e+i.byteLength).arrayBuffer(),c=new Uint8Array(a);new Uint8Array(i.buffer).set(c);const g=c.byteLength;s.byobRequest.respond(g),e+=g,e>=n.size&&s.close()}})})}if(_r==="NODE"&&typeof CustomEvent>"u"){class o extends Event{constructor(e,n={}){super(e,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=o}const os="playground-log",oi=(o,...t)=>{xt.dispatchEvent(new CustomEvent(os,{detail:{log:o,args:t}}))},as=(o,...t)=>{switch(typeof o.message=="string"?Reflect.set(o,"message",Fn(o.message)):o.message.message&&typeof o.message.message=="string"&&Reflect.set(o.message,"message",Fn(o.message.message)),o.severity){case yt.Debug:console.debug(o.message,...t);break;case yt.Info:console.info(o.message,...t);break;case yt.Warn:console.warn(o.message,...t);break;case yt.Error:console.error(o.message,...t);break;case yt.Fatal:console.error(o.message,...t);break;default:console.log(o.message,...t)}},cs=o=>o instanceof Error?[o.message,o.stack].join(`
|
|
2
|
+
`):JSON.stringify(o,null,2),Tr=[],ai=o=>{Tr.push(o)},jn=o=>{if(o.raw===!0)ai(o.message);else{const t=fs(typeof o.message=="object"?cs(o.message):o.message,o.severity,o.prefix??ae.JS);ai(t)}},yt={Fatal:{name:"fatal",level:0},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}},ae={JS:"JavaScript"};class us extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=yt.Info,this.handlers=t}getLogs(){return this.handlers.includes(jn)?[...Tr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
3
|
+
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
4
|
+
`),[])}logMessage(t,...e){const n={...t,severity:t.severity??yt.Log};for(const s of this.handlers)n.severity.level<=this.severity.level&&s(n,...e)}setSeverityFilterLevel(t){this.severity=t}log(t,...e){this.logMessage({message:t,severity:yt.Log,prefix:ae.JS,raw:!1},...e)}debug(t,...e){this.logMessage({message:t,severity:yt.Debug,prefix:ae.JS,raw:!1},...e)}info(t,...e){this.logMessage({message:t,severity:yt.Info,prefix:ae.JS,raw:!1},...e)}warn(t,...e){this.logMessage({message:t,severity:yt.Warn,prefix:ae.JS,raw:!1},...e)}error(t,...e){this.logMessage({message:t,severity:yt.Error,prefix:ae.JS,raw:!1},...e)}}const ls=()=>{try{if(process.env.NODE_ENV==="test")return[jn,oi]}catch{}return[jn,as,oi]},xt=new us(ls()),Fn=o=>o.replace(/\t/g,""),fs=(o,t,e)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),r=s+" "+i;return o=Fn(o),`[${r}] ${e} ${t.name}: ${o}`};var et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$n={exports:{}},ce=typeof Reflect=="object"?Reflect:null,ci=ce&&typeof ce.apply=="function"?ce.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},Pe;ce&&typeof ce.ownKeys=="function"?Pe=ce.ownKeys:Object.getOwnPropertySymbols?Pe=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Pe=function(t){return Object.getOwnPropertyNames(t)};function hs(o){console&&console.warn&&console.warn(o)}var vr=Number.isNaN||function(t){return t!==t};function rt(){rt.init.call(this)}$n.exports=rt;$n.exports.once=gs;rt.EventEmitter=rt;rt.prototype._events=void 0;rt.prototype._eventsCount=0;rt.prototype._maxListeners=void 0;var ui=10;function Se(o){if(typeof o!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof o)}Object.defineProperty(rt,"defaultMaxListeners",{enumerable:!0,get:function(){return ui},set:function(o){if(typeof o!="number"||o<0||vr(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");ui=o}});rt.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};rt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||vr(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 xr(o){return o._maxListeners===void 0?rt.defaultMaxListeners:o._maxListeners}rt.prototype.getMaxListeners=function(){return xr(this)};rt.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var s=t==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var r;if(e.length>0&&(r=e[0]),r instanceof Error)throw r;var a=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw a.context=r,a}var c=i[t];if(c===void 0)return!1;if(typeof c=="function")ci(c,this,e);else for(var g=c.length,p=Lr(c,g),n=0;n<g;++n)ci(p[n],this,e);return!0};function Nr(o,t,e,n){var s,i,r;if(Se(e),i=o._events,i===void 0?(i=o._events=Object.create(null),o._eventsCount=0):(i.newListener!==void 0&&(o.emit("newListener",t,e.listener?e.listener:e),i=o._events),r=i[t]),r===void 0)r=i[t]=e,++o._eventsCount;else if(typeof r=="function"?r=i[t]=n?[e,r]:[r,e]:n?r.unshift(e):r.push(e),s=xr(o),s>0&&r.length>s&&!r.warned){r.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=o,a.type=t,a.count=r.length,hs(a)}return o}rt.prototype.addListener=function(t,e){return Nr(this,t,e,!1)};rt.prototype.on=rt.prototype.addListener;rt.prototype.prependListener=function(t,e){return Nr(this,t,e,!0)};function ps(){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 Pr(o,t,e){var n={fired:!1,wrapFn:void 0,target:o,type:t,listener:e},s=ps.bind(n);return s.listener=e,n.wrapFn=s,s}rt.prototype.once=function(t,e){return Se(e),this.on(t,Pr(this,t,e)),this};rt.prototype.prependOnceListener=function(t,e){return Se(e),this.prependListener(t,Pr(this,t,e)),this};rt.prototype.removeListener=function(t,e){var n,s,i,r,a;if(Se(e),s=this._events,s===void 0)return this;if(n=s[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,r=n.length-1;r>=0;r--)if(n[r]===e||n[r].listener===e){a=n[r].listener,i=r;break}if(i<0)return this;i===0?n.shift():ds(n,i),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,a||e)}return this};rt.prototype.off=rt.prototype.removeListener;rt.prototype.removeAllListeners=function(t){var e,n,s;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var i=Object.keys(n),r;for(s=0;s<i.length;++s)r=i[s],r!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this};function Ar(o,t,e){var n=o._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?e?[s.listener||s]:[s]:e?ms(s):Lr(s,s.length)}rt.prototype.listeners=function(t){return Ar(this,t,!0)};rt.prototype.rawListeners=function(t){return Ar(this,t,!1)};rt.listenerCount=function(o,t){return typeof o.listenerCount=="function"?o.listenerCount(t):Mr.call(o,t)};rt.prototype.listenerCount=Mr;function Mr(o){var t=this._events;if(t!==void 0){var e=t[o];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}rt.prototype.eventNames=function(){return this._eventsCount>0?Pe(this._events):[]};function Lr(o,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=o[n];return e}function ds(o,t){for(;t+1<o.length;t++)o[t]=o[t+1];o.pop()}function ms(o){for(var t=new Array(o.length),e=0;e<t.length;++e)t[e]=o[e].listener||o[e];return t}function gs(o,t){return new Promise(function(e,n){function s(r){o.removeListener(t,i),n(r)}function i(){typeof o.removeListener=="function"&&o.removeListener("error",s),e([].slice.call(arguments))}Sr(o,t,i,{once:!0}),t!=="error"&&ys(o,s,{once:!0})})}function ys(o,t,e){typeof o.on=="function"&&Sr(o,"error",t,e)}function Sr(o,t,e,n){if(typeof o.on=="function")n.once?o.once(t,e):o.on(t,e);else if(typeof o.addEventListener=="function")o.addEventListener(t,function s(i){n.once&&o.removeEventListener(t,s),e(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof o)}var qn=$n.exports;class jr extends qn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new ns.WebSocketServer({port:t}),this.wss.on("connection",e=>{if(this.ws){e.close();return}this.ws=e,this.emit("clientConnected"),e.on("message",n=>{xt.debug("\x1B[1;32m[CDP][received]\x1B[0m",n.toString());let s;try{s=JSON.parse(n.toString())}catch{return}this.connected?this.emit("message",s):this.buffer.push(s)}),e.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.on("newListener",e=>{e==="message"&&process.nextTick(()=>{for(const n of this.buffer)this.emit("message",n);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const e=JSON.stringify(t);xt.debug("\x1B[1;32m[CDP][send]\x1B[0m",e),this.ws.send(e)}close(){this.wss.close()}}class Fr extends qn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=is.createServer(),this.server.on("connection",e=>{if(this.socket){e.destroy();return}this.socket=e,e.setEncoding("utf8"),this.emit("connected"),e.on("data",n=>this.onData(n.toString())),e.on("close",()=>{this.socket=null,this.emit("disconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.server.listen(t)}onData(t){for(xt.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const e=this.buffer.indexOf("\0");if(e===-1)break;const n=this.buffer.substring(0,e),s=parseInt(n,10);if(isNaN(s)){this.buffer="";break}this.expectedLength=s,this.buffer=this.buffer.slice(e+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const e=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const n=e.trim();this.expectedLength=null,this.emit("message",n);continue}break}}sendCommand(t){this.socket&&(xt.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}const bs={right:Is,center:_s},ws=0,Ae=1,Os=2,Me=3;class Es{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){const e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);const e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const e=t.split(`
|
|
5
|
+
`).map(s=>s.split(" "));let n=0;return e.forEach(s=>{s.length>1&&Ct.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ct.stringWidth(s[0])))}),e.forEach(s=>{this.div(...s.map((i,r)=>({text:i.trim(),padding:this.measurePadding(i),width:r===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){const e=Ct.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){const t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
6
|
+
`)}rowToString(t,e){return this.rasterize(t).forEach((n,s)=>{let i="";n.forEach((r,a)=>{const{width:c}=t[a],g=this.negatePadding(t[a]);let p=r;if(g>Ct.stringWidth(r)&&(p+=" ".repeat(g-Ct.stringWidth(r))),t[a].align&&t[a].align!=="left"&&this.wrap){const h=bs[t[a].align];p=h(p,g),Ct.stringWidth(p)<g&&(p+=" ".repeat((c||0)-Ct.stringWidth(p)-1))}const f=t[a].padding||[0,0,0,0];f[Me]&&(i+=" ".repeat(f[Me])),i+=li(t[a],p,"| "),i+=p,i+=li(t[a],p," |"),f[Ae]&&(i+=" ".repeat(f[Ae])),s===0&&e.length>0&&(i=this.renderInline(i,e[e.length-1]))}),e.push({text:i.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){const n=t.match(/^ */),s=n?n[0].length:0,i=e.text,r=Ct.stringWidth(i.trimRight());return e.span?this.wrap?s<r?t:(e.hidden=!0,i.trimRight()+" ".repeat(s-r)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){const e=[],n=this.columnWidths(t);let s;return t.forEach((i,r)=>{i.width=n[r],this.wrap?s=Ct.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
|
|
7
|
+
`):s=i.text.split(`
|
|
8
|
+
`),i.border&&(s.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(s.unshift(...new Array(i.padding[ws]||0).fill("")),s.push(...new Array(i.padding[Os]||0).fill(""))),s.forEach((a,c)=>{e[c]||e.push([]);const g=e[c];for(let p=0;p<r;p++)g[p]===void 0&&g.push("");g.push(a)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[Me]||0)+(t.padding[Ae]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(r=>r.width||Ct.stringWidth(r.text));let e=t.length,n=this.width;const s=t.map(r=>{if(r.width)return e--,n-=r.width,r.width}),i=e?Math.floor(n/e):0;return s.map((r,a)=>r===void 0?Math.max(i,Ds(t[a])):r)}}function li(o,t,e){return o.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function Ds(o){const t=o.padding||[],e=1+(t[Me]||0)+(t[Ae]||0);return o.border?e+4:e}function Cs(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Is(o,t){o=o.trim();const e=Ct.stringWidth(o);return e<t?" ".repeat(t-e)+o:o}function _s(o,t){o=o.trim();const e=Ct.stringWidth(o);return e>=t?o:" ".repeat(t-e>>1)+o}let Ct;function Ts(o,t){return Ct=t,new Es({width:o?.width||Cs(),wrap:o?.wrap})}const Rr=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Br(o){return o.replace(Rr,"")}function vs(o,t){const[e,n]=o.match(Rr)||["",""];o=Br(o);let s="";for(let i=0;i<o.length;i++)i!==0&&i%t===0&&(s+=`
|
|
9
|
+
`),s+=o.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function xs(o){return Ts(o,{stringWidth:t=>[...t].length,stripAnsi:Br,wrap:vs})}function Ns(o,t){let e=bt.resolve(".",o),n;for(Ft.statSync(e).isDirectory()||(e=bt.dirname(e));;){if(n=t(e,Ft.readdirSync(e)),n)return bt.resolve(e,n);if(e=bt.dirname(n=e),n===e)break}}/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright (c) 2016, Contributors
|
|
12
|
+
* SPDX-License-Identifier: ISC
|
|
13
|
+
*/function fe(o){if(o!==o.toLowerCase()&&o!==o.toUpperCase()||(o=o.toLowerCase()),o.indexOf("-")===-1&&o.indexOf("_")===-1)return o;{let e="",n=!1;const s=o.match(/^-+/);for(let i=s?s[0].length:0;i<o.length;i++){let r=o.charAt(i);n&&(n=!1,r=r.toUpperCase()),i!==0&&(r==="-"||r==="_")?n=!0:r!=="-"&&r!=="_"&&(e+=r)}return e}}function Ur(o,t){const e=o.toLowerCase();t=t||"-";let n="";for(let s=0;s<o.length;s++){const i=e.charAt(s),r=o.charAt(s);i!==r&&s>0?n+=`${t}${e.charAt(s)}`:n+=r}return n}function Xr(o){return o==null?!1:typeof o=="number"||/^0x[0-9a-f]+$/i.test(o)?!0:/^0[^.]/.test(o)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(o)}/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright (c) 2016, Contributors
|
|
16
|
+
* SPDX-License-Identifier: ISC
|
|
17
|
+
*/function Ps(o){if(Array.isArray(o))return o.map(r=>typeof r!="string"?r+"":r);o=o.trim();let t=0,e=null,n=null,s=null;const i=[];for(let r=0;r<o.length;r++){if(e=n,n=o.charAt(r),n===" "&&!s){e!==" "&&t++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),i[t]||(i[t]=""),i[t]+=n}return i}/**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright (c) 2016, Contributors
|
|
20
|
+
* SPDX-License-Identifier: ISC
|
|
21
|
+
*/var Mt;(function(o){o.BOOLEAN="boolean",o.STRING="string",o.NUMBER="number",o.ARRAY="array"})(Mt||(Mt={}));/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright (c) 2016, Contributors
|
|
24
|
+
* SPDX-License-Identifier: ISC
|
|
25
|
+
*/let Bt;class As{constructor(t){Bt=t}parse(t,e){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},e),s=Ps(t),i=typeof t=="string",r=Ms(Object.assign(Object.create(null),n.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},n.configuration),c=Object.assign(Object.create(null),n.default),g=n.configObjects||[],p=n.envPrefix,f=a["populate--"],h=f?"--":"_",b=Object.create(null),O=Object.create(null),D=n.__||Bt.format,w={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},A=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,C=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(I){const v=typeof I=="object"?I.key:I,R=Object.keys(I).map(function(S){return{boolean:"bools",string:"strings",number:"numbers"}[S]}).filter(Boolean).pop();R&&(w[R][v]=!0),w.arrays[v]=!0,w.keys.push(v)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(I){w.bools[I]=!0,w.keys.push(I)}),[].concat(n.string||[]).filter(Boolean).forEach(function(I){w.strings[I]=!0,w.keys.push(I)}),[].concat(n.number||[]).filter(Boolean).forEach(function(I){w.numbers[I]=!0,w.keys.push(I)}),[].concat(n.count||[]).filter(Boolean).forEach(function(I){w.counts[I]=!0,w.keys.push(I)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(I){w.normalize[I]=!0,w.keys.push(I)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([I,v])=>{typeof v=="number"&&(w.nargs[I]=v,w.keys.push(I))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([I,v])=>{typeof v=="function"&&(w.coercions[I]=v,w.keys.push(I))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(I){w.configs[I]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([I,v])=>{(typeof v=="boolean"||typeof v=="function")&&(w.configs[I]=v)})),Rt(n.key,r,n.default,w.arrays),Object.keys(c).forEach(function(I){(w.aliases[I]||[]).forEach(function(v){c[v]=c[I]})});let d=null;ht();let E=[];const T=Object.assign(Object.create(null),{_:[]}),F={};for(let I=0;I<s.length;I++){const v=s[I],R=v.replace(/^-{3,}/,"---");let S,x,W,$,z,pt;if(v!=="--"&&/^-/.test(v)&&l(v))U(v);else if(R.match(/^---+(=|$)/)){U(v);continue}else if(v.match(/^--.+=/)||!a["short-option-groups"]&&v.match(/^-.+=/))$=v.match(/^--?([^=]+)=([\s\S]*)$/),$!==null&&Array.isArray($)&&$.length>=3&&(Q($[1],w.arrays)?I=u(I,$[1],s,$[2]):Q($[1],w.nargs)!==!1?I=j(I,$[1],s,$[2]):M($[1],$[2],!0));else if(v.match(C)&&a["boolean-negation"])$=v.match(C),$!==null&&Array.isArray($)&&$.length>=2&&(x=$[1],M(x,Q(x,w.arrays)?[!1]:!1));else if(v.match(/^--.+/)||!a["short-option-groups"]&&v.match(/^-[^-]+/))$=v.match(/^--?(.+)/),$!==null&&Array.isArray($)&&$.length>=2&&(x=$[1],Q(x,w.arrays)?I=u(I,x,s):Q(x,w.nargs)!==!1?I=j(I,x,s):(z=s[I+1],z!==void 0&&(!z.match(/^-/)||z.match(A))&&!Q(x,w.bools)&&!Q(x,w.counts)||/^(true|false)$/.test(z)?(M(x,z),I++):M(x,_(x))));else if(v.match(/^-.\..+=/))$=v.match(/^-([^=]+)=([\s\S]*)$/),$!==null&&Array.isArray($)&&$.length>=3&&M($[1],$[2]);else if(v.match(/^-.\..+/)&&!v.match(A))z=s[I+1],$=v.match(/^-(.\..+)/),$!==null&&Array.isArray($)&&$.length>=2&&(x=$[1],z!==void 0&&!z.match(/^-/)&&!Q(x,w.bools)&&!Q(x,w.counts)?(M(x,z),I++):M(x,_(x)));else if(v.match(/^-[^-]+/)&&!v.match(A)){W=v.slice(1,-1).split(""),S=!1;for(let gt=0;gt<W.length;gt++){if(z=v.slice(gt+2),W[gt+1]&&W[gt+1]==="="){pt=v.slice(gt+3),x=W[gt],Q(x,w.arrays)?I=u(I,x,s,pt):Q(x,w.nargs)!==!1?I=j(I,x,s,pt):M(x,pt),S=!0;break}if(z==="-"){M(W[gt],z);continue}if(/[A-Za-z]/.test(W[gt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(z)&&Q(z,w.bools)===!1){M(W[gt],z),S=!0;break}if(W[gt+1]&&W[gt+1].match(/\W/)){M(W[gt],z),S=!0;break}else M(W[gt],_(W[gt]))}x=v.slice(-1)[0],!S&&x!=="-"&&(Q(x,w.arrays)?I=u(I,x,s):Q(x,w.nargs)!==!1?I=j(I,x,s):(z=s[I+1],z!==void 0&&(!/^(-|--)[^-]/.test(z)||z.match(A))&&!Q(x,w.bools)&&!Q(x,w.counts)||/^(true|false)$/.test(z)?(M(x,z),I++):M(x,_(x))))}else if(v.match(/^-[0-9]$/)&&v.match(A)&&Q(v.slice(1),w.bools))x=v.slice(1),M(x,_(x));else if(v==="--"){E=s.slice(I+1);break}else if(a["halt-at-non-option"]){E=s.slice(I);break}else U(v)}q(T,!0),q(T,!1),X(T),k(),st(T,w.aliases,c,!0),at(T),a["set-placeholder-key"]&&Pt(T),Object.keys(w.counts).forEach(function(I){mt(T,I.split("."))||M(I,0)}),f&&E.length&&(T[h]=[]),E.forEach(function(I){T[h].push(I)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(T).filter(I=>I!=="--"&&I.includes("-")).forEach(I=>{delete T[I]}),a["strip-aliased"]&&[].concat(...Object.keys(r).map(I=>r[I])).forEach(I=>{a["camel-case-expansion"]&&I.includes("-")&&delete T[I.split(".").map(v=>fe(v)).join(".")],delete T[I]});function U(I){const v=B("_",I);(typeof v=="string"||typeof v=="number")&&T._.push(v)}function j(I,v,R,S){let x,W=Q(v,w.nargs);if(W=typeof W!="number"||isNaN(W)?1:W,W===0)return it(S)||(d=Error(D("Argument unexpected for: %s",v))),M(v,_(v)),I;let $=it(S)?0:1;if(a["nargs-eats-options"])R.length-(I+1)+$<W&&(d=Error(D("Not enough arguments following: %s",v))),$=W;else{for(x=I+1;x<R.length&&(!R[x].match(/^-[^0-9]/)||R[x].match(A)||l(R[x]));x++)$++;$<W&&(d=Error(D("Not enough arguments following: %s",v)))}let z=Math.min($,W);for(!it(S)&&z>0&&(M(v,S),z--),x=I+1;x<z+I+1;x++)M(v,R[x]);return I+z}function u(I,v,R,S){let x=[],W=S||R[I+1];const $=Q(v,w.nargs);if(Q(v,w.bools)&&!/^(true|false)$/.test(W))x.push(!0);else if(it(W)||it(S)&&/^-/.test(W)&&!A.test(W)&&!l(W)){if(c[v]!==void 0){const z=c[v];x=Array.isArray(z)?z:[z]}}else{it(S)||x.push(L(v,S,!0));for(let z=I+1;z<R.length&&!(!a["greedy-arrays"]&&x.length>0||$&&typeof $=="number"&&x.length>=$||(W=R[z],/^-/.test(W)&&!A.test(W)&&!l(W)));z++)I=z,x.push(L(v,W,i))}return typeof $=="number"&&($&&x.length<$||isNaN($)&&x.length===0)&&(d=Error(D("Not enough arguments following: %s",v))),M(v,x),I}function M(I,v,R=i){if(/-/.test(I)&&a["camel-case-expansion"]){const W=I.split(".").map(function($){return fe($)}).join(".");N(I,W)}const S=L(I,v,R),x=I.split(".");wt(T,x,S),w.aliases[I]&&w.aliases[I].forEach(function(W){const $=W.split(".");wt(T,$,S)}),x.length>1&&a["dot-notation"]&&(w.aliases[x[0]]||[]).forEach(function(W){let $=W.split(".");const z=[].concat(x);z.shift(),$=$.concat(z),(w.aliases[I]||[]).includes($.join("."))||wt(T,$,S)}),Q(I,w.normalize)&&!Q(I,w.arrays)&&[I].concat(w.aliases[I]||[]).forEach(function($){Object.defineProperty(F,$,{enumerable:!0,get(){return v},set(z){v=typeof z=="string"?Bt.normalize(z):z}})})}function N(I,v){w.aliases[I]&&w.aliases[I].length||(w.aliases[I]=[v],b[v]=!0),w.aliases[v]&&w.aliases[v].length||N(v,I)}function L(I,v,R){R&&(v=Ls(v)),(Q(I,w.bools)||Q(I,w.counts))&&typeof v=="string"&&(v=v==="true");let S=Array.isArray(v)?v.map(function(x){return B(I,x)}):B(I,v);return Q(I,w.counts)&&(it(S)||typeof S=="boolean")&&(S=Be()),Q(I,w.normalize)&&Q(I,w.arrays)&&(Array.isArray(v)?S=v.map(x=>Bt.normalize(x)):S=Bt.normalize(v)),S}function B(I,v){return!a["parse-positional-numbers"]&&I==="_"||!Q(I,w.strings)&&!Q(I,w.bools)&&!Array.isArray(v)&&(Xr(v)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${v}`)))||!it(v)&&Q(I,w.numbers))&&(v=Number(v)),v}function X(I){const v=Object.create(null);st(v,w.aliases,c),Object.keys(w.configs).forEach(function(R){const S=I[R]||v[R];if(S)try{let x=null;const W=Bt.resolve(Bt.cwd(),S),$=w.configs[R];if(typeof $=="function"){try{x=$(W)}catch(z){x=z}if(x instanceof Error){d=x;return}}else x=Bt.require(W);Y(x)}catch(x){x.name==="PermissionDenied"?d=x:I[R]&&(d=Error(D("Invalid JSON config file: %s",S)))}})}function Y(I,v){Object.keys(I).forEach(function(R){const S=I[R],x=v?v+"."+R:R;typeof S=="object"&&S!==null&&!Array.isArray(S)&&a["dot-notation"]?Y(S,x):(!mt(T,x.split("."))||Q(x,w.arrays)&&a["combine-arrays"])&&M(x,S)})}function k(){typeof g<"u"&&g.forEach(function(I){Y(I)})}function q(I,v){if(typeof p>"u")return;const R=typeof p=="string"?p:"",S=Bt.env();Object.keys(S).forEach(function(x){if(R===""||x.lastIndexOf(R,0)===0){const W=x.split("__").map(function($,z){return z===0&&($=$.substring(R.length)),fe($)});(v&&w.configs[W.join(".")]||!v)&&!mt(I,W)&&M(W.join("."),S[x])}})}function at(I){let v;const R=new Set;Object.keys(I).forEach(function(S){if(!R.has(S)&&(v=Q(S,w.coercions),typeof v=="function"))try{const x=B(S,v(I[S]));[].concat(w.aliases[S]||[],S).forEach(W=>{R.add(W),I[W]=x})}catch(x){d=x}})}function Pt(I){return w.keys.forEach(v=>{~v.indexOf(".")||typeof I[v]>"u"&&(I[v]=void 0)}),I}function st(I,v,R,S=!1){Object.keys(R).forEach(function(x){mt(I,x.split("."))||(wt(I,x.split("."),R[x]),S&&(O[x]=!0),(v[x]||[]).forEach(function(W){mt(I,W.split("."))||wt(I,W.split("."),R[x])}))})}function mt(I,v){let R=I;a["dot-notation"]||(v=[v.join(".")]),v.slice(0,-1).forEach(function(x){R=R[x]||{}});const S=v[v.length-1];return typeof R!="object"?!1:S in R}function wt(I,v,R){let S=I;a["dot-notation"]||(v=[v.join(".")]),v.slice(0,-1).forEach(function(pt){pt=fi(pt),typeof S=="object"&&S[pt]===void 0&&(S[pt]={}),typeof S[pt]!="object"||Array.isArray(S[pt])?(Array.isArray(S[pt])?S[pt].push({}):S[pt]=[S[pt],{}],S=S[pt][S[pt].length-1]):S=S[pt]});const x=fi(v[v.length-1]),W=Q(v.join("."),w.arrays),$=Array.isArray(R);let z=a["duplicate-arguments-array"];!z&&Q(x,w.nargs)&&(z=!0,(!it(S[x])&&w.nargs[x]===1||Array.isArray(S[x])&&S[x].length===w.nargs[x])&&(S[x]=void 0)),R===Be()?S[x]=Be(S[x]):Array.isArray(S[x])?z&&W&&$?S[x]=a["flatten-duplicate-arrays"]?S[x].concat(R):(Array.isArray(S[x][0])?S[x]:[S[x]]).concat([R]):!z&&!!W==!!$?S[x]=R:S[x]=S[x].concat([R]):S[x]===void 0&&W?S[x]=$?R:[R]:z&&!(S[x]===void 0||Q(x,w.counts)||Q(x,w.bools))?S[x]=[S[x],R]:S[x]=R}function Rt(...I){I.forEach(function(v){Object.keys(v||{}).forEach(function(R){w.aliases[R]||(w.aliases[R]=[].concat(r[R]||[]),w.aliases[R].concat(R).forEach(function(S){if(/-/.test(S)&&a["camel-case-expansion"]){const x=fe(S);x!==R&&w.aliases[R].indexOf(x)===-1&&(w.aliases[R].push(x),b[x]=!0)}}),w.aliases[R].concat(R).forEach(function(S){if(S.length>1&&/[A-Z]/.test(S)&&a["camel-case-expansion"]){const x=Ur(S,"-");x!==R&&w.aliases[R].indexOf(x)===-1&&(w.aliases[R].push(x),b[x]=!0)}}),w.aliases[R].forEach(function(S){w.aliases[S]=[R].concat(w.aliases[R].filter(function(x){return S!==x}))}))})})}function Q(I,v){const R=[].concat(w.aliases[I]||[],I),S=Object.keys(v),x=R.find(W=>S.includes(W));return x?v[x]:!1}function Ht(I){const v=Object.keys(w);return[].concat(v.map(S=>w[S])).some(function(S){return Array.isArray(S)?S.includes(I):S[I]})}function K(I,...v){return[].concat(...v).some(function(S){const x=I.match(S);return x&&Ht(x[1])})}function m(I){if(I.match(A)||!I.match(/^-[^-]+/))return!1;let v=!0,R;const S=I.slice(1).split("");for(let x=0;x<S.length;x++){if(R=I.slice(x+2),!Ht(S[x])){v=!1;break}if(S[x+1]&&S[x+1]==="="||R==="-"||/[A-Za-z]/.test(S[x])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(R)||S[x+1]&&S[x+1].match(/\W/))break}return v}function l(I){return a["unknown-options-as-args"]&&P(I)}function P(I){return I=I.replace(/^-{3,}/,"--"),I.match(A)||m(I)?!1:!K(I,/^-+([^=]+?)=[\s\S]*$/,C,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function _(I){return!Q(I,w.bools)&&!Q(I,w.counts)&&`${I}`in c?c[I]:J(nt(I))}function J(I){return{[Mt.BOOLEAN]:!0,[Mt.STRING]:"",[Mt.NUMBER]:void 0,[Mt.ARRAY]:[]}[I]}function nt(I){let v=Mt.BOOLEAN;return Q(I,w.strings)?v=Mt.STRING:Q(I,w.numbers)?v=Mt.NUMBER:Q(I,w.bools)?v=Mt.BOOLEAN:Q(I,w.arrays)&&(v=Mt.ARRAY),v}function it(I){return I===void 0}function ht(){Object.keys(w.counts).find(I=>Q(I,w.arrays)?(d=Error(D("Invalid configuration: %s, opts.count excludes opts.array.",I)),!0):Q(I,w.nargs)?(d=Error(D("Invalid configuration: %s, opts.count excludes opts.narg.",I)),!0):!1)}return{aliases:Object.assign({},w.aliases),argv:Object.assign(F,T),configuration:a,defaulted:Object.assign({},O),error:d,newAliases:Object.assign({},b)}}}function Ms(o){const t=[],e=Object.create(null);let n=!0;for(Object.keys(o).forEach(function(s){t.push([].concat(o[s],s))});n;){n=!1;for(let s=0;s<t.length;s++)for(let i=s+1;i<t.length;i++)if(t[s].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[s]=t[s].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(s){s=s.filter(function(r,a,c){return c.indexOf(r)===a});const i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function Be(o){return o!==void 0?o+1:1}function fi(o){return o==="__proto__"?"___proto___":o}function Ls(o){return typeof o=="string"&&(o[0]==="'"||o[0]==='"')&&o[o.length-1]===o[0]?o.substring(1,o.length-1):o}/**
|
|
26
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
27
|
+
* CJS and ESM environments.
|
|
28
|
+
*
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright (c) 2016, Contributors
|
|
31
|
+
* SPDX-License-Identifier: ISC
|
|
32
|
+
*/var Ue,Xe,$e;const hi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,pi=(Xe=(Ue=process==null?void 0:process.versions)===null||Ue===void 0?void 0:Ue.node)!==null&&Xe!==void 0?Xe:($e=process==null?void 0:process.version)===null||$e===void 0?void 0:$e.slice(1);if(pi&&Number(pi.match(/^([^.]+)/)[1])<hi)throw Error(`yargs parser supports a minimum Node.js version of ${hi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ss=process?process.env:{},$r=new As({cwd:process.cwd,env:()=>Ss,format:Xn.format,normalize:bt.normalize,resolve:bt.resolve,require:o=>{if(typeof require<"u")return require(o);if(o.match(/\.json$/))return JSON.parse(Ft.readFileSync(o,"utf8"));throw Error("only .json config files are supported in ESM")}}),we=function(t,e){return $r.parse(t.slice(),e).argv};we.detailed=function(o,t){return $r.parse(o.slice(),t)};we.camelCase=fe;we.decamelize=Ur;we.looksLikeNumber=Xr;function qr(){return js()?0:1}function js(){return Fs()&&!process.defaultApp}function Fs(){return!!process.versions.electron}function Rs(o){return o.slice(qr()+1)}function Bs(){return process.argv[qr()]}class ut extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,ut)}}const Us={fs:{readFileSync:Ft.readFileSync,writeFile:Ft.writeFile},format:Xn.format,resolve:bt.resolve,exists:o=>{try{return Ft.statSync(o).isFile()}catch{return!1}}};let At;class Xs{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 e=t.shift();let n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),At.format.apply(At.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),s=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=s===1?e:n;this.cache[this.locale][e]&&(r=this.cache[this.locale][e][s===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[r];return~r.indexOf("%d")&&a.push(s),At.format.apply(At.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(s,i){const r=e[i+1];n+=s,typeof r<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],n=e.directory,s=e.locale,i=e.cb,r=this._resolveLocaleFile(n,s),a=JSON.stringify(this.cache[s],null,2);At.fs.writeFile(r,a,"utf-8",function(c){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(c)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{At.fs.readFileSync&&(t=JSON.parse(At.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=At.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){const s=At.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return At.exists(t)}}function $s(o,t){At=t;const e=new Xs(o);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}const qs=o=>$s(o,Us),Ws="require is not supported by ESM",di="loading a directory of commands is not supported yet for ESM";let ye;try{ye=es.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:Re&&Re.tagName.toUpperCase()==="SCRIPT"&&Re.src||new URL("run-cli-BPGRvxlC.cjs",document.baseURI).href)}catch{ye=process.cwd()}const Vs=ye.substring(0,ye.lastIndexOf("node_modules")),Hs={assert:{notStrictEqual:si.notStrictEqual,strictEqual:si.strictEqual},cliui:xs,findUp:Ns,getEnv:o=>process.env[o],inspect:Xn.inspect,getCallerFile:()=>{throw new ut(di)},getProcessArgvBin:Bs,mainFilename:Vs||process.cwd(),Parser:we,path:{basename:bt.basename,dirname:bt.dirname,extname:bt.extname,relative:bt.relative,resolve:bt.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(o,t)=>process.emitWarning(o,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Ft.readFileSync,require:()=>{throw new ut(Ws)},requireDirectory:()=>{throw new ut(di)},stringWidth:o=>[...o].length,y18n:qs({directory:bt.resolve(ye,"../../../locales"),updateFiles:!1})};function Lt(o,t,e,n){e.assert.notStrictEqual(o,t,n)}function mi(o,t){t.assert.strictEqual(typeof o,"string")}function Le(o){return Object.keys(o)}function lt(o){return!!o&&!!o.then&&typeof o.then=="function"}function de(o){const e=o.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${o}`);const i={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((r,a)=>{let c=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&a===e.length-1&&(c=!0),/^\[/.test(r)?i.optional.push({cmd:r.replace(n,"").split("|"),variadic:c}):i.demanded.push({cmd:r.replace(n,"").split("|"),variadic:c})}),i}const zs=["first","second","third","fourth","fifth","sixth"];function H(o,t,e){function n(){return typeof o=="object"?[{demanded:[],optional:[]},o,t]:[de(`cmd ${o}`),t,e]}try{let s=0;const[i,r,a]=n(),c=[].slice.call(r);for(;c.length&&c[c.length-1]===void 0;)c.pop();const g=a||c.length;if(g<i.demanded.length)throw new ut(`Not enough arguments provided. Expected ${i.demanded.length} but received ${c.length}.`);const p=i.demanded.length+i.optional.length;if(g>p)throw new ut(`Too many arguments provided. Expected max ${p} but received ${g}.`);i.demanded.forEach(f=>{const h=c.shift(),b=gi(h);f.cmd.filter(D=>D===b||D==="*").length===0&&yi(b,f.cmd,s),s+=1}),i.optional.forEach(f=>{if(c.length===0)return;const h=c.shift(),b=gi(h);f.cmd.filter(D=>D===b||D==="*").length===0&&yi(b,f.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function gi(o){return Array.isArray(o)?"array":o===null?"null":typeof o}function yi(o,t,e){throw new ut(`Invalid ${zs[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${o}.`)}class Gs{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,s=!1){if(H("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");const r=t[i];r.applyBeforeValidation=e,r.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){const i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=s,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{const i=[...n[e]||[],e];return s.option?!i.includes(s.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}}function Ys(o){return o?o.map(t=>(t.applyBeforeValidation=!1,t)):[]}function me(o,t,e,n){return e.reduce((s,i)=>{if(i.applyBeforeValidation!==n)return s;if(i.mutates){if(i.applied)return s;i.applied=!0}if(lt(s))return s.then(r=>Promise.all([r,i(r,t)])).then(([r,a])=>Object.assign(r,a));{const r=i(s,t);return lt(r)?r.then(a=>Object.assign(s,a)):Object.assign(s,r)}},o)}function ge(o,t,e=n=>{throw n}){try{const n=ks(o)?o():o;return lt(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function ks(o){return typeof o=="function"}function Ks(o){if(typeof require>"u")return null;for(let t=0,e=Object.keys(require.cache),n;t<e.length;t++)if(n=require.cache[e[t]],n.exports===o)return n;return null}const ie=/(^\*)|(^\$0)/;class Qs{constructor(t,e,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);const i=typeof s.visit=="function"?s.visit:r=>r;s.visit=(r,a,c)=>{const g=i(r,a,c);if(g){if(this.requireCache.has(a))return g;this.requireCache.add(a),this.addHandler(g)}return g},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,r){let a=[];const c=Ys(i);if(s=s||(()=>{}),Array.isArray(t))if(Zs(t))[t,...a]=t;else for(const g of t)this.addHandler(g);else if(eo(t)){let g=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(g=[].concat(g).concat(t.aliases)),this.addHandler(g,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(bi(n)){this.addHandler([t].concat(a),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){const g=de(t);a=a.map(h=>de(h).cmd);let p=!1;const f=[g.cmd].concat(a).filter(h=>ie.test(h)?(p=!0,!1):!0);f.length===0&&p&&f.push("$0"),p&&(g.cmd=f[0],a=f.slice(1),t=t.replace(ie,g.cmd)),a.forEach(h=>{this.aliasMap[h]=g.cmd}),e!==!1&&this.usage.command(t,e,p,a,r),this.handlers[g.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:c,deprecated:r,demanded:g.demanded,optional:g.optional},p&&(this.defaultCommand=this.handlers[g.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,s,i,r){const a=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,c=e.getInternalMethods().getContext(),g=c.commands.slice(),p=!t;t&&(c.commands.push(t),c.fullCommands.push(a.original));const f=this.applyBuilderUpdateUsageAndParse(p,a,e,n.aliases,g,s,i,r);return lt(f)?f.then(h=>this.applyMiddlewareAndGetResult(p,a,h.innerArgv,c,i,h.aliases,e)):this.applyMiddlewareAndGetResult(p,a,f.innerArgv,c,i,f.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,r,a,c){const g=e.builder;let p=n;if(Rn(g)){n.getInternalMethods().getUsageInstance().freeze();const f=g(n.getInternalMethods().reset(s),c);if(lt(f))return f.then(h=>(p=bo(h)?h:n,this.parseAndUpdateUsage(t,e,p,i,r,a)))}else to(g)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(f=>{p.option(f,g[f])}));return this.parseAndUpdateUsage(t,e,p,i,r,a)}parseAndUpdateUsage(t,e,n,s,i,r){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,e),e.description);const a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return lt(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){const n=ie.test(e.original)?e.original.replace(ie,"").trim():e.original,s=t.filter(i=>!ie.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(t,e,n,s,i,r,a,c){if(!r.getInternalMethods().getHasOutput()){const g=r.getInternalMethods().runValidation(i,c,r.parsed.error,t);n=ge(n,p=>(g(p),p))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const g=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(n,g,!1,!1),n=me(n,r,a,!1),n=ge(n,p=>{const f=e.handler(p);return lt(f)?f.then(()=>p):p}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),lt(n)&&!r.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{r.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return t||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,s,i,r,a){let c={};if(i)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(e,n,s,a));const g=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),p=me(n,a,g,!0);return lt(p)?p.then(f=>this.handleValidationAndGetResult(t,e,f,s,r,a,g,c)):this.handleValidationAndGetResult(t,e,p,s,r,a,g,c)}populatePositionals(t,e,n,s){e._=e._.slice(n.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),a={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const c=i.shift();this.populatePositional(c,e,a)}for(;r.length;){const c=r.shift();this.populatePositional(c,e,a)}return e._=n.commands.concat(e._.map(c=>""+c)),this.postProcessPositionals(e,a,this.cmdToParseOptions(t.original),s),a}populatePositional(t,e,n){const s=t.cmd[0];t.variadic?n[s]=e._.splice(0).map(String):e._.length&&(n[s]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},n=de(t);return n.demanded.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r,e.demand[i]=!0}),n.optional.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r}),e}postProcessPositionals(t,e,n,s){const i=Object.assign({},s.getOptions());i.default=Object.assign(n.default,i.default);for(const g of Object.keys(n.alias))i.alias[g]=(i.alias[g]||[]).concat(n.alias[g]);i.array=i.array.concat(n.array),i.config={};const r=[];if(Object.keys(e).forEach(g=>{e[g].map(p=>{i.configuration["unknown-options-as-args"]&&(i.key[g]=!0),r.push(`--${g}`),r.push(p)})}),!r.length)return;const a=Object.assign({},i.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:a}));if(c.error)s.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{const g=Object.keys(e);Object.keys(e).forEach(p=>{g.push(...c.aliases[p])}),Object.keys(c.argv).forEach(p=>{g.includes(p)&&(e[p]||(e[p]=c.argv[p]),!this.isInConfigs(s,p)&&!this.isDefaulted(s,p)&&Object.prototype.hasOwnProperty.call(t,p)&&Object.prototype.hasOwnProperty.call(c.argv,p)&&(Array.isArray(t[p])||Array.isArray(c.argv[p]))?t[p]=[].concat(t[p],c.argv[p]):t[p]=c.argv[p])})}}isDefaulted(t,e){const{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:n}=t.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,e))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const n=ie.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(Rn(e))return e(t,!0);bi(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){const e=Ks(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(const s of[t,e,n]){if(typeof s=="string"||s===!1)return s;Lt(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();Lt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function Js(o,t,e,n){return new Qs(o,t,e,n)}function bi(o){return typeof o=="object"&&!!o.builder&&typeof o.handler=="function"}function Zs(o){return o.every(t=>typeof t=="string")}function Rn(o){return typeof o=="function"}function to(o){return typeof o=="object"}function eo(o){return typeof o=="object"&&!Array.isArray(o)}function be(o={},t=()=>!0){const e={};return Le(o).forEach(n=>{t(n,o[n])&&(e[n]=o[n])}),e}function he(o){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{const e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(o)})}function no(o){return typeof o=="boolean"}function io(o,t){const e=t.y18n.__,n={},s=[];n.failFn=function(L){s.push(L)};let i=null,r=null,a=!0;n.showHelpOnFail=function(L=!0,B){const[X,Y]=typeof L=="string"?[!0,L]:[L,B];return o.getInternalMethods().isGlobalContext()&&(r=Y),i=Y,a=X,n};let c=!1;n.fail=function(L,B){const X=o.getInternalMethods().getLoggerInstance();if(s.length)for(let Y=s.length-1;Y>=0;--Y){const k=s[Y];if(no(k)){if(B)throw B;if(L)throw Error(L)}else k(L,B,n)}else{if(o.getExitProcess()&&he(!0),!c){c=!0,a&&(o.showHelp("error"),X.error()),(L||B)&&X.error(L||B);const Y=i||r;Y&&((L||B)&&X.error(""),X.error(Y))}if(B=B||new ut(L),o.getExitProcess())return o.exit(1);if(o.getInternalMethods().hasParseCallback())return o.exit(1,B);throw B}};let g=[],p=!1;n.usage=(N,L)=>N===null?(p=!0,g=[],n):(p=!1,g.push([N,L||""]),n),n.getUsage=()=>g,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>e("Positionals:");let f=[];n.example=(N,L)=>{f.push([N,L||""])};let h=[];n.command=function(L,B,X,Y,k=!1){X&&(h=h.map(q=>(q[2]=!1,q))),h.push([L,B||"",X,Y,k])},n.getCommands=()=>h;let b={};n.describe=function(L,B){Array.isArray(L)?L.forEach(X=>{n.describe(X,B)}):typeof L=="object"?Object.keys(L).forEach(X=>{n.describe(X,L[X])}):b[L]=B},n.getDescriptions=()=>b;let O=[];n.epilog=N=>{O.push(N)};let D=!1,w;n.wrap=N=>{D=!0,w=N},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(D||(w=j(),D=!0),w);const A="__yargsString__:";n.deferY18nLookup=N=>A+N,n.help=function(){if(E)return E;d();const L=o.customScriptName?o.$0:t.path.basename(o.$0),B=o.getDemandedOptions(),X=o.getDemandedCommands(),Y=o.getDeprecatedOptions(),k=o.getGroups(),q=o.getOptions();let at=[];at=at.concat(Object.keys(b)),at=at.concat(Object.keys(B)),at=at.concat(Object.keys(X)),at=at.concat(Object.keys(q.default)),at=at.filter(F),at=Object.keys(at.reduce((K,m)=>(m!=="_"&&(K[m]=!0),K),{}));const Pt=n.getWrap(),st=t.cliui({width:Pt,wrap:!!Pt});if(!p){if(g.length)g.forEach(K=>{st.div({text:`${K[0].replace(/\$0/g,L)}`}),K[1]&&st.div({text:`${K[1]}`,padding:[1,0,0,0]})}),st.div();else if(h.length){let K=null;X._?K=`${L} <${e("command")}>
|
|
33
|
+
`:K=`${L} [${e("command")}]
|
|
34
|
+
`,st.div(`${K}`)}}if(h.length>1||h.length===1&&!h[0][2]){st.div(e("Commands:"));const K=o.getInternalMethods().getContext(),m=K.commands.length?`${K.commands.join(" ")} `:"";o.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(h=h.sort((P,_)=>P[0].localeCompare(_[0])));const l=L?`${L} `:"";h.forEach(P=>{const _=`${l}${m}${P[0].replace(/^\$0 ?/,"")}`;st.span({text:_,padding:[0,2,0,2],width:C(h,Pt,`${L}${m}`)+4},{text:P[1]});const J=[];P[2]&&J.push(`[${e("default")}]`),P[3]&&P[3].length&&J.push(`[${e("aliases:")} ${P[3].join(", ")}]`),P[4]&&(typeof P[4]=="string"?J.push(`[${e("deprecated: %s",P[4])}]`):J.push(`[${e("deprecated")}]`)),J.length?st.div({text:J.join(" "),padding:[0,0,0,2],align:"right"}):st.div()}),st.div()}const mt=(Object.keys(q.alias)||[]).concat(Object.keys(o.parsed.newAliases)||[]);at=at.filter(K=>!o.parsed.newAliases[K]&&mt.every(m=>(q.alias[m]||[]).indexOf(K)===-1));const wt=e("Options:");k[wt]||(k[wt]=[]),T(at,q.alias,k,wt);const Rt=K=>/^--/.test(Oe(K)),Q=Object.keys(k).filter(K=>k[K].length>0).map(K=>{const m=k[K].filter(F).map(l=>{if(mt.includes(l))return l;for(let P=0,_;(_=mt[P])!==void 0;P++)if((q.alias[_]||[]).includes(l))return _;return l});return{groupName:K,normalizedKeys:m}}).filter(({normalizedKeys:K})=>K.length>0).map(({groupName:K,normalizedKeys:m})=>{const l=m.reduce((P,_)=>(P[_]=[_].concat(q.alias[_]||[]).map(J=>K===n.getPositionalGroupName()?J:(/^[0-9]$/.test(J)?q.boolean.includes(_)?"-":"--":J.length>1?"--":"-")+J).sort((J,nt)=>Rt(J)===Rt(nt)?0:Rt(J)?1:-1).join(", "),P),{});return{groupName:K,normalizedKeys:m,switches:l}});if(Q.filter(({groupName:K})=>K!==n.getPositionalGroupName()).some(({normalizedKeys:K,switches:m})=>!K.every(l=>Rt(m[l])))&&Q.filter(({groupName:K})=>K!==n.getPositionalGroupName()).forEach(({normalizedKeys:K,switches:m})=>{K.forEach(l=>{Rt(m[l])&&(m[l]=ro(m[l],4))})}),Q.forEach(({groupName:K,normalizedKeys:m,switches:l})=>{st.div(K),m.forEach(P=>{const _=l[P];let J=b[P]||"",nt=null;J.includes(A)&&(J=e(J.substring(A.length))),q.boolean.includes(P)&&(nt=`[${e("boolean")}]`),q.count.includes(P)&&(nt=`[${e("count")}]`),q.string.includes(P)&&(nt=`[${e("string")}]`),q.normalize.includes(P)&&(nt=`[${e("string")}]`),q.array.includes(P)&&(nt=`[${e("array")}]`),q.number.includes(P)&&(nt=`[${e("number")}]`);const it=v=>typeof v=="string"?`[${e("deprecated: %s",v)}]`:`[${e("deprecated")}]`,ht=[P in Y?it(Y[P]):null,nt,P in B?`[${e("required")}]`:null,q.choices&&q.choices[P]?`[${e("choices:")} ${n.stringifiedValues(q.choices[P])}]`:null,U(q.default[P],q.defaultDescription[P])].filter(Boolean).join(" ");st.span({text:Oe(_),padding:[0,2,0,2+wi(_)],width:C(l,Pt)+4},J);const I=o.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;ht&&!I?st.div({text:ht,padding:[0,0,0,2],align:"right"}):st.div()}),st.div()}),f.length&&(st.div(e("Examples:")),f.forEach(K=>{K[0]=K[0].replace(/\$0/g,L)}),f.forEach(K=>{K[1]===""?st.div({text:K[0],padding:[0,2,0,2]}):st.div({text:K[0],padding:[0,2,0,2],width:C(f,Pt)+4},{text:K[1]})}),st.div()),O.length>0){const K=O.map(m=>m.replace(/\$0/g,L)).join(`
|
|
35
|
+
`);st.div(`${K}
|
|
36
|
+
`)}return st.toString().replace(/\s*$/,"")};function C(N,L,B){let X=0;return Array.isArray(N)||(N=Object.values(N).map(Y=>[Y])),N.forEach(Y=>{X=Math.max(t.stringWidth(B?`${B} ${Oe(Y[0])}`:Oe(Y[0]))+wi(Y[0]),X)}),L&&(X=Math.min(X,parseInt((L*.5).toString(),10))),X}function d(){const N=o.getDemandedOptions(),L=o.getOptions();(Object.keys(L.alias)||[]).forEach(B=>{L.alias[B].forEach(X=>{b[X]&&n.describe(B,b[X]),X in N&&o.demandOption(B,N[X]),L.boolean.includes(X)&&o.boolean(B),L.count.includes(X)&&o.count(B),L.string.includes(X)&&o.string(B),L.normalize.includes(X)&&o.normalize(B),L.array.includes(X)&&o.array(B),L.number.includes(X)&&o.number(B)})})}let E;n.cacheHelpMessage=function(){E=this.help()},n.clearCachedHelpMessage=function(){E=void 0},n.hasCachedHelpMessage=function(){return!!E};function T(N,L,B,X){let Y=[],k=null;return Object.keys(B).forEach(q=>{Y=Y.concat(B[q])}),N.forEach(q=>{k=[q].concat(L[q]),k.some(at=>Y.indexOf(at)!==-1)||B[X].push(q)}),Y}function F(N){return o.getOptions().hiddenOptions.indexOf(N)<0||o.parsed.argv[o.getOptions().showHiddenOpt]}n.showHelp=N=>{const L=o.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:L[N])(n.help())},n.functionDescription=N=>["(",N.name?t.Parser.decamelize(N.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(L,B){let X="";const Y=B||", ",k=[].concat(L);return!L||!k.length||k.forEach(q=>{X.length&&(X+=Y),X+=JSON.stringify(q)}),X};function U(N,L){let B=`[${e("default:")} `;if(N===void 0&&!L)return null;if(L)B+=L;else switch(typeof N){case"string":B+=`"${N}"`;break;case"object":B+=JSON.stringify(N);break;default:B+=N}return`${B}]`}function j(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let u=null;n.version=N=>{u=N},n.showVersion=N=>{const L=o.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:L[N])(u)},n.reset=function(L){return i=null,c=!1,g=[],p=!1,O=[],f=[],h=[],b=be(b,B=>!L[B]),n};const M=[];return n.freeze=function(){M.push({failMessage:i,failureOutput:c,usages:g,usageDisabled:p,epilogs:O,examples:f,commands:h,descriptions:b})},n.unfreeze=function(L=!1){const B=M.pop();B&&(L?(b={...B.descriptions,...b},h=[...B.commands,...h],g=[...B.usages,...g],f=[...B.examples,...f],O=[...B.epilogs,...O]):{failMessage:i,failureOutput:c,usages:g,usageDisabled:p,epilogs:O,examples:f,commands:h,descriptions:b}=B)},n}function Wn(o){return typeof o=="object"}function ro(o,t){return Wn(o)?{text:o.text,indentation:o.indentation+t}:{text:o,indentation:t}}function wi(o){return Wn(o)?o.indentation:0}function Oe(o){return Wn(o)?o.text:o}const so=`###-begin-{{app_name}}-completions-###
|
|
37
|
+
#
|
|
38
|
+
# yargs command completion script
|
|
39
|
+
#
|
|
40
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
|
41
|
+
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
|
42
|
+
#
|
|
43
|
+
_{{app_name}}_yargs_completions()
|
|
44
|
+
{
|
|
45
|
+
local cur_word args type_list
|
|
46
|
+
|
|
47
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
48
|
+
args=("\${COMP_WORDS[@]}")
|
|
49
|
+
|
|
50
|
+
# ask yargs to generate completions.
|
|
51
|
+
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
|
52
|
+
|
|
53
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
54
|
+
|
|
55
|
+
# if no match was found, fall back to filename completion
|
|
56
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
57
|
+
COMPREPLY=()
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
return 0
|
|
61
|
+
}
|
|
62
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
63
|
+
###-end-{{app_name}}-completions-###
|
|
64
|
+
`,oo=`#compdef {{app_name}}
|
|
65
|
+
###-begin-{{app_name}}-completions-###
|
|
66
|
+
#
|
|
67
|
+
# yargs command completion script
|
|
68
|
+
#
|
|
69
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
70
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
71
|
+
#
|
|
72
|
+
_{{app_name}}_yargs_completions()
|
|
73
|
+
{
|
|
74
|
+
local reply
|
|
75
|
+
local si=$IFS
|
|
76
|
+
IFS=$'
|
|
77
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
78
|
+
IFS=$si
|
|
79
|
+
_describe 'values' reply
|
|
80
|
+
}
|
|
81
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
82
|
+
###-end-{{app_name}}-completions-###
|
|
83
|
+
`;class ao{constructor(t,e,n,s){var i,r,a;this.yargs=t,this.usage=e,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(a=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.includes("zsh"))||((r=this.shim.getEnv("ZSH_NAME"))===null||r===void 0?void 0:r.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(t,e,n,s){const i=this.command.getCommandHandlers();for(let a=0,c=t.length;a<c;++a)if(i[t[a]]&&i[t[a]].builder){const g=i[t[a]].builder;if(Rn(g)){this.indexAfterLastReset=a+1;const p=this.yargs.getInternalMethods().reset();return g(p,!0),p.argv}}const r=[];this.commandCompletions(r,t,n),this.optionCompletions(r,t,e,n),this.choicesFromOptionsCompletions(r,t,e,n),this.choicesFromPositionalsCompletions(r,t,e,n),s(null,r)}commandCompletions(t,e,n){const s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{const r=de(i[0]).cmd;if(e.indexOf(r)===-1)if(!this.zshShell)t.push(r);else{const a=i[1]||"";t.push(r.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(t,e,n,s){if((s.match(/^-/)||s===""&&t.length===0)&&!this.previousArgHasChoices(e)){const i=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(a=>{const c=!!i.configuration["boolean-negation"]&&i.boolean.includes(a);!r.includes(a)&&!i.hiddenOptions.includes(a)&&!this.argsContainKey(e,a,c)&&this.completeOptionKey(a,t,s,c&&!!i.default[a])})}}choicesFromOptionsCompletions(t,e,n,s){if(this.previousArgHasChoices(e)){const i=this.getPreviousArgChoices(e);i&&i.length>0&&t.push(...i.map(r=>r.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,s){if(s===""&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),a=i[n._.length-r-1];if(!a)return;const c=this.yargs.getOptions().choices[a]||[];for(const g of c)g.startsWith(s)&&t.push(g.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;const s=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[s,...this.yargs.getAliases()[s]||[]];let a;for(const c of r)if(Object.prototype.hasOwnProperty.call(i.key,c)&&Array.isArray(i.choices[c])){a=i.choices[c];break}if(a)return a.filter(c=>!n||c.startsWith(n))}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){const s=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(s(e)||n&&s(`no-${e}`))return!0;if(this.aliases){for(const i of this.aliases[e])if(s(i))return!0}return!1}completeOptionKey(t,e,n,s){var i,r,a,c;let g=t;if(this.zshShell){const b=this.usage.getDescriptions(),O=(r=(i=this===null||this===void 0?void 0:this.aliases)===null||i===void 0?void 0:i[t])===null||r===void 0?void 0:r.find(A=>{const C=b[A];return typeof C=="string"&&C.length>0}),D=O?b[O]:void 0,w=(c=(a=b[t])!==null&&a!==void 0?a:D)!==null&&c!==void 0?c:"";g=`${t.replace(/:/g,"\\:")}:${w.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const p=b=>/^--/.test(b),f=b=>/^[^0-9]$/.test(b),h=!p(n)&&f(t)?"-":"--";e.push(h+g),s&&e.push(h+"no-"+g)}customCompletion(t,e,n,s){if(Lt(this.customCompletionFunction,null,this.shim),uo(this.customCompletionFunction)){const i=this.customCompletionFunction(n,e);return lt(i)?i.then(r=>{this.shim.process.nextTick(()=>{s(null,r)})}).catch(r=>{this.shim.process.nextTick(()=>{s(r,void 0)})}):s(null,i)}else return lo(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=s)=>this.defaultCompletion(t,e,n,i),i=>{s(null,i)}):this.customCompletionFunction(n,e,i=>{s(null,i)})}getCompletion(t,e){const n=t.length?t[t.length-1]:"",s=this.yargs.parse(t,!0),i=this.customCompletionFunction?r=>this.customCompletion(t,r,n,e):r=>this.defaultCompletion(t,r,n,e);return lt(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?oo:so;const s=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function co(o,t,e,n){return new ao(o,t,e,n)}function uo(o){return o.length<3}function lo(o){return o.length>3}function fo(o,t){if(o.length===0)return t.length;if(t.length===0)return o.length;const e=[];let n;for(n=0;n<=t.length;n++)e[n]=[n];let s;for(s=0;s<=o.length;s++)e[0][s]=s;for(n=1;n<=t.length;n++)for(s=1;s<=o.length;s++)t.charAt(n-1)===o.charAt(s-1)?e[n][s]=e[n-1][s-1]:n>1&&s>1&&t.charAt(n-2)===o.charAt(s-1)&&t.charAt(n-1)===o.charAt(s-2)?e[n][s]=e[n-2][s-2]+1:e[n][s]=Math.min(e[n-1][s-1]+1,Math.min(e[n][s-1]+1,e[n-1][s]+1));return e[t.length][o.length]}const Oi=["$0","--","_"];function ho(o,t,e){const n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(f){const h=o.getDemandedCommands(),O=f._.length+(f["--"]?f["--"].length:0)-o.getInternalMethods().getContext().commands.length;h._&&(O<h._.min||O>h._.max)&&(O<h._.min?h._.minMsg!==void 0?t.fail(h._.minMsg?h._.minMsg.replace(/\$0/g,O.toString()).replace(/\$1/,h._.min.toString()):null):t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",O,O.toString(),h._.min.toString())):O>h._.max&&(h._.maxMsg!==void 0?t.fail(h._.maxMsg?h._.maxMsg.replace(/\$0/g,O.toString()).replace(/\$1/,h._.max.toString()):null):t.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",O,O.toString(),h._.max.toString()))))},i.positionalCount=function(f,h){h<f&&t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",h,h+"",f+""))},i.requiredArguments=function(f,h){let b=null;for(const O of Object.keys(h))(!Object.prototype.hasOwnProperty.call(f,O)||typeof f[O]>"u")&&(b=b||{},b[O]=h[O]);if(b){const O=[];for(const w of Object.keys(b)){const A=b[w];A&&O.indexOf(A)<0&&O.push(A)}const D=O.length?`
|
|
84
|
+
${O.join(`
|
|
85
|
+
`)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(b).length,Object.keys(b).join(", ")+D))}},i.unknownArguments=function(f,h,b,O,D=!0){var w;const A=o.getInternalMethods().getCommandInstance().getCommands(),C=[],d=o.getInternalMethods().getContext();if(Object.keys(f).forEach(E=>{!Oi.includes(E)&&!Object.prototype.hasOwnProperty.call(b,E)&&!Object.prototype.hasOwnProperty.call(o.getInternalMethods().getParseContext(),E)&&!i.isValidAndSomeAliasIsNotNew(E,h)&&C.push(E)}),D&&(d.commands.length>0||A.length>0||O)&&f._.slice(d.commands.length).forEach(E=>{A.includes(""+E)||C.push(""+E)}),D){const T=((w=o.getDemandedCommands()._)===null||w===void 0?void 0:w.max)||0,F=d.commands.length+T;F<f._.length&&f._.slice(F).forEach(U=>{U=String(U),!d.commands.includes(U)&&!C.includes(U)&&C.push(U)})}C.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",C.length,C.map(E=>E.trim()?E:`"${E}"`).join(", ")))},i.unknownCommands=function(f){const h=o.getInternalMethods().getCommandInstance().getCommands(),b=[],O=o.getInternalMethods().getContext();return(O.commands.length>0||h.length>0)&&f._.slice(O.commands.length).forEach(D=>{h.includes(""+D)||b.push(""+D)}),b.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",b.length,b.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(f,h){if(!Object.prototype.hasOwnProperty.call(h,f))return!1;const b=o.parsed.newAliases;return[f,...h[f]].some(O=>!Object.prototype.hasOwnProperty.call(b,O)||!b[f])},i.limitedChoices=function(f){const h=o.getOptions(),b={};if(!Object.keys(h.choices).length)return;Object.keys(f).forEach(w=>{Oi.indexOf(w)===-1&&Object.prototype.hasOwnProperty.call(h.choices,w)&&[].concat(f[w]).forEach(A=>{h.choices[w].indexOf(A)===-1&&A!==void 0&&(b[w]=(b[w]||[]).concat(A))})});const O=Object.keys(b);if(!O.length)return;let D=n("Invalid values:");O.forEach(w=>{D+=`
|
|
86
|
+
${n("Argument: %s, Given: %s, Choices: %s",w,t.stringifiedValues(b[w]),t.stringifiedValues(h.choices[w]))}`}),t.fail(D)};let r={};i.implies=function(f,h){H("<string|object> [array|number|string]",[f,h],arguments.length),typeof f=="object"?Object.keys(f).forEach(b=>{i.implies(b,f[b])}):(o.global(f),r[f]||(r[f]=[]),Array.isArray(h)?h.forEach(b=>i.implies(f,b)):(Lt(h,void 0,e),r[f].push(h)))},i.getImplied=function(){return r};function a(p,f){const h=Number(f);return f=isNaN(h)?f:h,typeof f=="number"?f=p._.length>=f:f.match(/^--no-.+/)?(f=f.match(/^--no-(.+)/)[1],f=!Object.prototype.hasOwnProperty.call(p,f)):f=Object.prototype.hasOwnProperty.call(p,f),f}i.implications=function(f){const h=[];if(Object.keys(r).forEach(b=>{const O=b;(r[b]||[]).forEach(D=>{let w=O;const A=D;w=a(f,w),D=a(f,D),w&&!D&&h.push(` ${O} -> ${A}`)})}),h.length){let b=`${n("Implications failed:")}
|
|
87
|
+
`;h.forEach(O=>{b+=O}),t.fail(b)}};let c={};i.conflicts=function(f,h){H("<string|object> [array|string]",[f,h],arguments.length),typeof f=="object"?Object.keys(f).forEach(b=>{i.conflicts(b,f[b])}):(o.global(f),c[f]||(c[f]=[]),Array.isArray(h)?h.forEach(b=>i.conflicts(f,b)):c[f].push(h))},i.getConflicting=()=>c,i.conflicting=function(f){Object.keys(f).forEach(h=>{c[h]&&c[h].forEach(b=>{b&&f[h]!==void 0&&f[b]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,b))})}),o.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(h=>{c[h].forEach(b=>{b&&f[e.Parser.camelCase(h)]!==void 0&&f[e.Parser.camelCase(b)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,b))})})},i.recommendCommands=function(f,h){h=h.sort((w,A)=>A.length-w.length);let O=null,D=1/0;for(let w=0,A;(A=h[w])!==void 0;w++){const C=fo(f,A);C<=3&&C<D&&(D=C,O=A)}O&&t.fail(n("Did you mean %s?",O))},i.reset=function(f){return r=be(r,h=>!f[h]),c=be(c,h=>!f[h]),i};const g=[];return i.freeze=function(){g.push({implied:r,conflicting:c})},i.unfreeze=function(){const f=g.pop();Lt(f,void 0,e),{implied:r,conflicting:c}=f},i}let Bn=[],pe;function Un(o,t,e,n){pe=n;let s={};if(Object.prototype.hasOwnProperty.call(o,"extends")){if(typeof o.extends!="string")return s;const i=/\.json|\..*rc$/.test(o.extends);let r=null;if(i)r=mo(t,o.extends);else try{r=require.resolve(o.extends)}catch{return o}po(r),Bn.push(r),s=i?JSON.parse(pe.readFileSync(r,"utf8")):require(o.extends),delete o.extends,s=Un(s,pe.path.dirname(r),e,pe)}return Bn=[],e?Wr(s,o):Object.assign({},s,o)}function po(o){if(Bn.indexOf(o)>-1)throw new ut(`Circular extended configurations: '${o}'.`)}function mo(o,t){return pe.path.resolve(o,t)}function Wr(o,t){const e={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(e,o);for(const s of Object.keys(t))n(t[s])&&n(e[s])?e[s]=Wr(o[s],t[s]):e[s]=t[s];return e}var V=function(o,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!s:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(o,e):s?s.value=e:t.set(o,e),e},y=function(o,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(o):n?n.value:t.get(o)},ct,zt,ue,It,Ot,Ee,qt,Gt,De,_t,Ce,Tt,St,Et,vt,Ie,re,dt,G,_e,Te,Dt,Yt,se,kt,Wt,ve,Z,Kt,Qt,Jt,tt,xe,jt,ot;function go(o){return(t=[],e=o.process.cwd(),n)=>{const s=new yo(t,e,n,o);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}const Ei=Symbol("copyDoubleDash"),Di=Symbol("copyDoubleDash"),qe=Symbol("deleteFromParserHintObject"),Ci=Symbol("emitWarning"),Ii=Symbol("freeze"),_i=Symbol("getDollarZero"),Zt=Symbol("getParserConfiguration"),Ti=Symbol("getUsageConfiguration"),We=Symbol("guessLocale"),vi=Symbol("guessVersion"),xi=Symbol("parsePositionalNumbers"),Ve=Symbol("pkgUp"),Vt=Symbol("populateParserHintArray"),oe=Symbol("populateParserHintSingleValueDictionary"),He=Symbol("populateParserHintArrayDictionary"),ze=Symbol("populateParserHintDictionary"),Ge=Symbol("sanitizeKey"),Ye=Symbol("setKey"),ke=Symbol("unfreeze"),Ni=Symbol("validateAsync"),Pi=Symbol("getCommandInstance"),Ai=Symbol("getContext"),Mi=Symbol("getHasOutput"),Li=Symbol("getLoggerInstance"),Si=Symbol("getParseContext"),ji=Symbol("getUsageInstance"),Fi=Symbol("getValidationInstance"),Ne=Symbol("hasParseCallback"),Ri=Symbol("isGlobalContext"),te=Symbol("postProcess"),Bi=Symbol("rebase"),Ke=Symbol("reset"),le=Symbol("runYargsParserAndExecuteCommands"),Qe=Symbol("runValidation"),Ui=Symbol("setHasOutput"),ee=Symbol("kTrackManuallySetKeys");class yo{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,ct.set(this,void 0),zt.set(this,void 0),ue.set(this,{commands:[],fullCommands:[]}),It.set(this,null),Ot.set(this,null),Ee.set(this,"show-hidden"),qt.set(this,null),Gt.set(this,!0),De.set(this,{}),_t.set(this,!0),Ce.set(this,[]),Tt.set(this,void 0),St.set(this,{}),Et.set(this,!1),vt.set(this,null),Ie.set(this,!0),re.set(this,void 0),dt.set(this,""),G.set(this,void 0),_e.set(this,void 0),Te.set(this,{}),Dt.set(this,null),Yt.set(this,null),se.set(this,{}),kt.set(this,{}),Wt.set(this,void 0),ve.set(this,!1),Z.set(this,void 0),Kt.set(this,!1),Qt.set(this,!1),Jt.set(this,!1),tt.set(this,void 0),xe.set(this,{}),jt.set(this,null),ot.set(this,void 0),V(this,Z,s,"f"),V(this,Wt,t,"f"),V(this,zt,e,"f"),V(this,_e,n,"f"),V(this,Tt,new Gs(this),"f"),this.$0=this[_i](),this[Ke](),V(this,ct,y(this,ct,"f"),"f"),V(this,tt,y(this,tt,"f"),"f"),V(this,ot,y(this,ot,"f"),"f"),V(this,G,y(this,G,"f"),"f"),y(this,G,"f").showHiddenOpt=y(this,Ee,"f"),V(this,re,this[Di](),"f")}addHelpOpt(t,e){const n="help";return H("[string|boolean] [string]",[t,e],arguments.length),y(this,vt,"f")&&(this[qe](y(this,vt,"f")),V(this,vt,null,"f")),t===!1&&e===void 0?this:(V(this,vt,typeof t=="string"?t:n,"f"),this.boolean(y(this,vt,"f")),this.describe(y(this,vt,"f"),e||y(this,tt,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(H("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;const n=typeof t=="string"?t:y(this,Ee,"f");return this.boolean(n),this.describe(n,e||y(this,tt,"f").deferY18nLookup("Show hidden options")),y(this,G,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return H("<object|string|array> [string|array]",[t,e],arguments.length),this[He](this.alias.bind(this),"alias",t,e),this}array(t){return H("<array|string>",[t],arguments.length),this[Vt]("array",t),this[ee](t),this}boolean(t){return H("<array|string>",[t],arguments.length),this[Vt]("boolean",t),this[ee](t),this}check(t,e){return H("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>ge(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&y(this,tt,"f").fail(i.toString(),i):y(this,tt,"f").fail(y(this,Z,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(y(this,tt,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return H("<object|string|array> [string|array]",[t,e],arguments.length),this[He](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(H("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new ut("coerce callback must be provided");for(const n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(const n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new ut("coerce callback must be provided");return y(this,G,"f").key[t]=!0,y(this,Tt,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?ge(()=>(i=s.getAliases(),e(n[t])),a=>{n[t]=a;const c=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&c!==!0)for(const g of i[t])n[g]=a;return n},a=>{throw new ut(a.message)}):n},t),this}conflicts(t,e){return H("<string|object> [string|array]",[t,e],arguments.length),y(this,ot,"f").conflicts(t,e),this}config(t="config",e,n){return H("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Un(t,y(this,zt,"f"),this[Zt]()["deep-merge-config"]||!1,y(this,Z,"f")),y(this,G,"f").configObjects=(y(this,G,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||y(this,tt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{y(this,G,"f").config[s]=n||!0}),this)}completion(t,e,n){return H("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),V(this,Ot,t||y(this,Ot,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(y(this,Ot,"f"),e),n&&y(this,It,"f").registerFunction(n),this}command(t,e,n,s,i,r){return H("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,s,i,r],arguments.length),y(this,ct,"f").addHandler(t,e,n,s,i,r),this}commands(t,e,n,s,i,r){return this.command(t,e,n,s,i,r)}commandDir(t,e){H("<string> [object]",[t,e],arguments.length);const n=y(this,_e,"f")||y(this,Z,"f").require;return y(this,ct,"f").addDirectory(t,n,y(this,Z,"f").getCallerFile(),e),this}count(t){return H("<array|string>",[t],arguments.length),this[Vt]("count",t),this[ee](t),this}default(t,e,n){return H("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(mi(t,y(this,Z,"f")),y(this,G,"f").defaultDescription[t]=n),typeof e=="function"&&(mi(t,y(this,Z,"f")),y(this,G,"f").defaultDescription[t]||(y(this,G,"f").defaultDescription[t]=y(this,tt,"f").functionDescription(e)),e=e.call()),this[oe](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,s){return H("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,s],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),y(this,G,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{Lt(n,!0,y(this,Z,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(Lt(n,!0,y(this,Z,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{Lt(n,!0,y(this,Z,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return H("<object|string|array> [string]",[t,e],arguments.length),this[oe](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return H("<string> [string|boolean]",[t,e],arguments.length),y(this,G,"f").deprecatedOptions[t]=e,this}describe(t,e){return H("<object|string|array> [string]",[t,e],arguments.length),this[Ye](t,!0),y(this,tt,"f").describe(t,e),this}detectLocale(t){return H("<boolean>",[t],arguments.length),V(this,Gt,t,"f"),this}env(t){return H("[string|boolean]",[t],arguments.length),t===!1?delete y(this,G,"f").envPrefix:y(this,G,"f").envPrefix=t||"",this}epilogue(t){return H("<string>",[t],arguments.length),y(this,tt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return H("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):y(this,tt,"f").example(t,e),this}exit(t,e){V(this,Et,!0,"f"),V(this,qt,e,"f"),y(this,_t,"f")&&y(this,Z,"f").process.exit(t)}exitProcess(t=!0){return H("[boolean]",[t],arguments.length),V(this,_t,t,"f"),this}fail(t){if(H("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new ut("Invalid first argument. Expected function or boolean 'false'");return y(this,tt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return H("<array> [function]",[t,e],arguments.length),e?y(this,It,"f").getCompletion(t,e):new Promise((n,s)=>{y(this,It,"f").getCompletion(t,(i,r)=>{i?s(i):n(r)})})}getDemandedOptions(){return H([],0),y(this,G,"f").demandedOptions}getDemandedCommands(){return H([],0),y(this,G,"f").demandedCommands}getDeprecatedOptions(){return H([],0),y(this,G,"f").deprecatedOptions}getDetectLocale(){return y(this,Gt,"f")}getExitProcess(){return y(this,_t,"f")}getGroups(){return Object.assign({},y(this,St,"f"),y(this,kt,"f"))}getHelp(){if(V(this,Et,!0,"f"),!y(this,tt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[le](y(this,Wt,"f"),void 0,void 0,0,!0);if(lt(e))return e.then(()=>y(this,tt,"f").help())}const t=y(this,ct,"f").runDefaultBuilderOn(this);if(lt(t))return t.then(()=>y(this,tt,"f").help())}return Promise.resolve(y(this,tt,"f").help())}getOptions(){return y(this,G,"f")}getStrict(){return y(this,Kt,"f")}getStrictCommands(){return y(this,Qt,"f")}getStrictOptions(){return y(this,Jt,"f")}global(t,e){return H("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?y(this,G,"f").local=y(this,G,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{y(this,G,"f").local.includes(n)||y(this,G,"f").local.push(n)}),this}group(t,e){H("<string|array> <string>",[t,e],arguments.length);const n=y(this,kt,"f")[e]||y(this,St,"f")[e];y(this,kt,"f")[e]&&delete y(this,kt,"f")[e];const s={};return y(this,St,"f")[e]=(n||[]).concat(t).filter(i=>s[i]?!1:s[i]=!0),this}hide(t){return H("<string>",[t],arguments.length),y(this,G,"f").hiddenOptions.push(t),this}implies(t,e){return H("<string|object> [number|string|array]",[t,e],arguments.length),y(this,ot,"f").implies(t,e),this}locale(t){return H("[string]",[t],arguments.length),t===void 0?(this[We](),y(this,Z,"f").y18n.getLocale()):(V(this,Gt,!1,"f"),y(this,Z,"f").y18n.setLocale(t),this)}middleware(t,e,n){return y(this,Tt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return H("<string|object|array> [number]",[t,e],arguments.length),this[oe](this.nargs.bind(this),"narg",t,e),this}normalize(t){return H("<array|string>",[t],arguments.length),this[Vt]("normalize",t),this}number(t){return H("<array|string>",[t],arguments.length),this[Vt]("number",t),this[ee](t),this}option(t,e){if(H("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[ee](t),y(this,jt,"f")&&(t==="version"||e?.alias==="version")&&this[Ci](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
88
|
+
`),void 0,"versionWarning"),y(this,G,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);const s=e.demand||e.required||e.require;s&&this.demand(t,s),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(y(this,G,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=y(this,tt,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(r,t)||typeof i=="string")&&this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){H("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Ii](),typeof t>"u"&&(t=y(this,Wt,"f")),typeof e=="object"&&(V(this,Yt,e,"f"),e=n),typeof e=="function"&&(V(this,Dt,e,"f"),e=!1),e||V(this,Wt,t,"f"),y(this,Dt,"f")&&V(this,_t,!1,"f");const s=this[le](t,!!e),i=this.parsed;return y(this,It,"f").setParsed(this.parsed),lt(s)?s.then(r=>(y(this,Dt,"f")&&y(this,Dt,"f").call(this,y(this,qt,"f"),r,y(this,dt,"f")),r)).catch(r=>{throw y(this,Dt,"f")&&y(this,Dt,"f")(r,this.parsed.argv,y(this,dt,"f")),r}).finally(()=>{this[ke](),this.parsed=i}):(y(this,Dt,"f")&&y(this,Dt,"f").call(this,y(this,qt,"f"),s,y(this,dt,"f")),this[ke](),this.parsed=i,s)}parseAsync(t,e,n){const s=this.parse(t,e,n);return lt(s)?s:Promise.resolve(s)}parseSync(t,e,n){const s=this.parse(t,e,n);if(lt(s))throw new ut(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return H("<object>",[t],arguments.length),V(this,Te,t,"f"),this}pkgConf(t,e){H("<string> [string]",[t,e],arguments.length);let n=null;const s=this[Ve](e||y(this,zt,"f"));return s[t]&&typeof s[t]=="object"&&(n=Un(s[t],e||y(this,zt,"f"),this[Zt]()["deep-merge-config"]||!1,y(this,Z,"f")),y(this,G,"f").configObjects=(y(this,G,"f").configObjects||[]).concat(n)),this}positional(t,e){H("<string> <object>",[t,e],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=be(e,(r,a)=>r==="type"&&!["string","number","boolean"].includes(a)?!1:n.includes(r));const s=y(this,ue,"f").fullCommands[y(this,ue,"f").fullCommands.length-1],i=s?y(this,ct,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Le(i).forEach(r=>{const a=i[r];Array.isArray(a)?a.indexOf(t)!==-1&&(e[r]=!0):a[t]&&!(r in e)&&(e[r]=a[t])}),this.group(t,y(this,tt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return H("[boolean]",[t],arguments.length),V(this,ve,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return H("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&y(this,G,"f").narg[t]?this:(this[oe](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return H("[string] [string]",[t,e],arguments.length),t=t||this.$0,y(this,re,"f").log(y(this,It,"f").generateCompletionScript(t,e||y(this,Ot,"f")||"completion")),this}showHelp(t){if(H("[string|function]",[t],arguments.length),V(this,Et,!0,"f"),!y(this,tt,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[le](y(this,Wt,"f"),void 0,void 0,0,!0);if(lt(n))return n.then(()=>{y(this,tt,"f").showHelp(t)}),this}const e=y(this,ct,"f").runDefaultBuilderOn(this);if(lt(e))return e.then(()=>{y(this,tt,"f").showHelp(t)}),this}return y(this,tt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return H("[boolean|string] [string]",[t,e],arguments.length),y(this,tt,"f").showHelpOnFail(t,e),this}showVersion(t){return H("[string|function]",[t],arguments.length),y(this,tt,"f").showVersion(t),this}skipValidation(t){return H("<array|string>",[t],arguments.length),this[Vt]("skipValidation",t),this}strict(t){return H("[boolean]",[t],arguments.length),V(this,Kt,t!==!1,"f"),this}strictCommands(t){return H("[boolean]",[t],arguments.length),V(this,Qt,t!==!1,"f"),this}strictOptions(t){return H("[boolean]",[t],arguments.length),V(this,Jt,t!==!1,"f"),this}string(t){return H("<array|string>",[t],arguments.length),this[Vt]("string",t),this[ee](t),this}terminalWidth(){return H([],0),y(this,Z,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return H("<object>",[t],arguments.length),V(this,Gt,!1,"f"),y(this,Z,"f").y18n.updateLocale(t),this}usage(t,e,n,s){if(H("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,s],arguments.length),e!==void 0){if(Lt(t,null,y(this,Z,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,s);throw new ut(".usage() description must start with $0 if being used as alias for .command()")}else return y(this,tt,"f").usage(t),this}usageConfiguration(t){return H("<object>",[t],arguments.length),V(this,xe,t,"f"),this}version(t,e,n){const s="version";if(H("[boolean|string] [string] [string]",[t,e,n],arguments.length),y(this,jt,"f")&&(this[qe](y(this,jt,"f")),y(this,tt,"f").version(void 0),V(this,jt,null,"f")),arguments.length===0)n=this[vi](),t=s;else if(arguments.length===1){if(t===!1)return this;n=t,t=s}else arguments.length===2&&(n=e,e=void 0);return V(this,jt,typeof t=="string"?t:s,"f"),e=e||y(this,tt,"f").deferY18nLookup("Show version number"),y(this,tt,"f").version(n||void 0),this.boolean(y(this,jt,"f")),this.describe(y(this,jt,"f"),e),this}wrap(t){return H("<number|null|undefined>",[t],arguments.length),y(this,tt,"f").wrap(t),this}[(ct=new WeakMap,zt=new WeakMap,ue=new WeakMap,It=new WeakMap,Ot=new WeakMap,Ee=new WeakMap,qt=new WeakMap,Gt=new WeakMap,De=new WeakMap,_t=new WeakMap,Ce=new WeakMap,Tt=new WeakMap,St=new WeakMap,Et=new WeakMap,vt=new WeakMap,Ie=new WeakMap,re=new WeakMap,dt=new WeakMap,G=new WeakMap,_e=new WeakMap,Te=new WeakMap,Dt=new WeakMap,Yt=new WeakMap,se=new WeakMap,kt=new WeakMap,Wt=new WeakMap,ve=new WeakMap,Z=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,tt=new WeakMap,xe=new WeakMap,jt=new WeakMap,ot=new WeakMap,Ei)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Di](){return{log:(...t)=>{this[Ne]()||console.log(...t),V(this,Et,!0,"f"),y(this,dt,"f").length&&V(this,dt,y(this,dt,"f")+`
|
|
89
|
+
`,"f"),V(this,dt,y(this,dt,"f")+t.join(" "),"f")},error:(...t)=>{this[Ne]()||console.error(...t),V(this,Et,!0,"f"),y(this,dt,"f").length&&V(this,dt,y(this,dt,"f")+`
|
|
90
|
+
`,"f"),V(this,dt,y(this,dt,"f")+t.join(" "),"f")}}}[qe](t){Le(y(this,G,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;const n=y(this,G,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete y(this,tt,"f").getDescriptions()[t]}[Ci](t,e,n){y(this,De,"f")[n]||(y(this,Z,"f").process.emitWarning(t,e),y(this,De,"f")[n]=!0)}[Ii](){y(this,Ce,"f").push({options:y(this,G,"f"),configObjects:y(this,G,"f").configObjects.slice(0),exitProcess:y(this,_t,"f"),groups:y(this,St,"f"),strict:y(this,Kt,"f"),strictCommands:y(this,Qt,"f"),strictOptions:y(this,Jt,"f"),completionCommand:y(this,Ot,"f"),output:y(this,dt,"f"),exitError:y(this,qt,"f"),hasOutput:y(this,Et,"f"),parsed:this.parsed,parseFn:y(this,Dt,"f"),parseContext:y(this,Yt,"f")}),y(this,tt,"f").freeze(),y(this,ot,"f").freeze(),y(this,ct,"f").freeze(),y(this,Tt,"f").freeze()}[_i](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(y(this,Z,"f").process.argv()[0])?e=y(this,Z,"f").process.argv().slice(1,2):e=y(this,Z,"f").process.argv().slice(0,1),t=e.map(n=>{const s=this[Bi](y(this,zt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),y(this,Z,"f").getEnv("_")&&y(this,Z,"f").getProcessArgvBin()===y(this,Z,"f").getEnv("_")&&(t=y(this,Z,"f").getEnv("_").replace(`${y(this,Z,"f").path.dirname(y(this,Z,"f").process.execPath())}/`,"")),t}[Zt](){return y(this,Te,"f")}[Ti](){return y(this,xe,"f")}[We](){if(!y(this,Gt,"f"))return;const t=y(this,Z,"f").getEnv("LC_ALL")||y(this,Z,"f").getEnv("LC_MESSAGES")||y(this,Z,"f").getEnv("LANG")||y(this,Z,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[vi](){return this[Ve]().version||"unknown"}[xi](t){const e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)y(this,Z,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[Ve](t){const e=t||"*";if(y(this,se,"f")[e])return y(this,se,"f")[e];let n={};try{let s=t||y(this,Z,"f").mainFilename;!t&&y(this,Z,"f").path.extname(s)&&(s=y(this,Z,"f").path.dirname(s));const i=y(this,Z,"f").findUp(s,(r,a)=>{if(a.includes("package.json"))return"package.json"});Lt(i,void 0,y(this,Z,"f")),n=JSON.parse(y(this,Z,"f").readFileSync(i,"utf8"))}catch{}return y(this,se,"f")[e]=n||{},y(this,se,"f")[e]}[Vt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Ge](n),y(this,G,"f")[t].push(n)})}[oe](t,e,n,s){this[ze](t,e,n,s,(i,r,a)=>{y(this,G,"f")[i][r]=a})}[He](t,e,n,s){this[ze](t,e,n,s,(i,r,a)=>{y(this,G,"f")[i][r]=(y(this,G,"f")[i][r]||[]).concat(a)})}[ze](t,e,n,s,i){if(Array.isArray(n))n.forEach(r=>{t(r,s)});else if((r=>typeof r=="object")(n))for(const r of Le(n))t(r,n[r]);else i(e,this[Ge](n),s)}[Ge](t){return t==="__proto__"?"___proto___":t}[Ye](t,e){return this[oe](this[Ye].bind(this),"key",t,e),this}[ke](){var t,e,n,s,i,r,a,c,g,p,f,h;const b=y(this,Ce,"f").pop();Lt(b,void 0,y(this,Z,"f"));let O;t=this,e=this,n=this,s=this,i=this,r=this,a=this,c=this,g=this,p=this,f=this,h=this,{options:{set value(D){V(t,G,D,"f")}}.value,configObjects:O,exitProcess:{set value(D){V(e,_t,D,"f")}}.value,groups:{set value(D){V(n,St,D,"f")}}.value,output:{set value(D){V(s,dt,D,"f")}}.value,exitError:{set value(D){V(i,qt,D,"f")}}.value,hasOutput:{set value(D){V(r,Et,D,"f")}}.value,parsed:this.parsed,strict:{set value(D){V(a,Kt,D,"f")}}.value,strictCommands:{set value(D){V(c,Qt,D,"f")}}.value,strictOptions:{set value(D){V(g,Jt,D,"f")}}.value,completionCommand:{set value(D){V(p,Ot,D,"f")}}.value,parseFn:{set value(D){V(f,Dt,D,"f")}}.value,parseContext:{set value(D){V(h,Yt,D,"f")}}.value}=b,y(this,G,"f").configObjects=O,y(this,tt,"f").unfreeze(),y(this,ot,"f").unfreeze(),y(this,ct,"f").unfreeze(),y(this,Tt,"f").unfreeze()}[Ni](t,e){return ge(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Pi].bind(this),getContext:this[Ai].bind(this),getHasOutput:this[Mi].bind(this),getLoggerInstance:this[Li].bind(this),getParseContext:this[Si].bind(this),getParserConfiguration:this[Zt].bind(this),getUsageConfiguration:this[Ti].bind(this),getUsageInstance:this[ji].bind(this),getValidationInstance:this[Fi].bind(this),hasParseCallback:this[Ne].bind(this),isGlobalContext:this[Ri].bind(this),postProcess:this[te].bind(this),reset:this[Ke].bind(this),runValidation:this[Qe].bind(this),runYargsParserAndExecuteCommands:this[le].bind(this),setHasOutput:this[Ui].bind(this)}}[Pi](){return y(this,ct,"f")}[Ai](){return y(this,ue,"f")}[Mi](){return y(this,Et,"f")}[Li](){return y(this,re,"f")}[Si](){return y(this,Yt,"f")||{}}[ji](){return y(this,tt,"f")}[Fi](){return y(this,ot,"f")}[Ne](){return!!y(this,Dt,"f")}[Ri](){return y(this,Ie,"f")}[te](t,e,n,s){return n||lt(t)||(e||(t=this[Ei](t)),(this[Zt]()["parse-positional-numbers"]||this[Zt]()["parse-positional-numbers"]===void 0)&&(t=this[xi](t)),s&&(t=me(t,this,y(this,Tt,"f").getMiddleware(),!1))),t}[Ke](t={}){V(this,G,y(this,G,"f")||{},"f");const e={};e.local=y(this,G,"f").local||[],e.configObjects=y(this,G,"f").configObjects||[];const n={};e.local.forEach(r=>{n[r]=!0,(t[r]||[]).forEach(a=>{n[a]=!0})}),Object.assign(y(this,kt,"f"),Object.keys(y(this,St,"f")).reduce((r,a)=>{const c=y(this,St,"f")[a].filter(g=>!(g in n));return c.length>0&&(r[a]=c),r},{})),V(this,St,{},"f");const s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(r=>{e[r]=(y(this,G,"f")[r]||[]).filter(a=>!n[a])}),i.forEach(r=>{e[r]=be(y(this,G,"f")[r],a=>!n[a])}),e.envPrefix=y(this,G,"f").envPrefix,V(this,G,e,"f"),V(this,tt,y(this,tt,"f")?y(this,tt,"f").reset(n):io(this,y(this,Z,"f")),"f"),V(this,ot,y(this,ot,"f")?y(this,ot,"f").reset(n):ho(this,y(this,tt,"f"),y(this,Z,"f")),"f"),V(this,ct,y(this,ct,"f")?y(this,ct,"f").reset():Js(y(this,tt,"f"),y(this,ot,"f"),y(this,Tt,"f"),y(this,Z,"f")),"f"),y(this,It,"f")||V(this,It,co(this,y(this,tt,"f"),y(this,ct,"f"),y(this,Z,"f")),"f"),y(this,Tt,"f").reset(),V(this,Ot,null,"f"),V(this,dt,"","f"),V(this,qt,null,"f"),V(this,Et,!1,"f"),this.parsed=!1,this}[Bi](t,e){return y(this,Z,"f").path.relative(t,e)}[le](t,e,n,s=0,i=!1){let r=!!n||i;t=t||y(this,Wt,"f"),y(this,G,"f").__=y(this,Z,"f").y18n.__,y(this,G,"f").configuration=this[Zt]();const a=!!y(this,G,"f").configuration["populate--"],c=Object.assign({},y(this,G,"f").configuration,{"populate--":!0}),g=y(this,Z,"f").Parser.detailed(t,Object.assign({},y(this,G,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),p=Object.assign(g.argv,y(this,Yt,"f"));let f;const h=g.aliases;let b=!1,O=!1;Object.keys(p).forEach(D=>{D===y(this,vt,"f")&&p[D]?b=!0:D===y(this,jt,"f")&&p[D]&&(O=!0)}),p.$0=this.$0,this.parsed=g,s===0&&y(this,tt,"f").clearCachedHelpMessage();try{if(this[We](),e)return this[te](p,a,!!n,!1);y(this,vt,"f")&&[y(this,vt,"f")].concat(h[y(this,vt,"f")]||[]).filter(d=>d.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),b=!0),V(this,Ie,!1,"f");const D=y(this,ct,"f").getCommands(),w=y(this,It,"f").completionKey in p,A=b||w||i;if(p._.length){if(D.length){let C;for(let d=s||0,E;p._[d]!==void 0;d++)if(E=String(p._[d]),D.includes(E)&&E!==y(this,Ot,"f")){const T=y(this,ct,"f").runCommand(E,this,g,d+1,i,b||O||i);return this[te](T,a,!!n,!1)}else if(!C&&E!==y(this,Ot,"f")){C=E;break}!y(this,ct,"f").hasDefaultCommand()&&y(this,ve,"f")&&C&&!A&&y(this,ot,"f").recommendCommands(C,D)}y(this,Ot,"f")&&p._.includes(y(this,Ot,"f"))&&!w&&(y(this,_t,"f")&&he(!0),this.showCompletionScript(),this.exit(0))}if(y(this,ct,"f").hasDefaultCommand()&&!A){const C=y(this,ct,"f").runCommand(null,this,g,0,i,b||O||i);return this[te](C,a,!!n,!1)}if(w){y(this,_t,"f")&&he(!0),t=[].concat(t);const C=t.slice(t.indexOf(`--${y(this,It,"f").completionKey}`)+1);return y(this,It,"f").getCompletion(C,(d,E)=>{if(d)throw new ut(d.message);(E||[]).forEach(T=>{y(this,re,"f").log(T)}),this.exit(0)}),this[te](p,!a,!!n,!1)}if(y(this,Et,"f")||(b?(y(this,_t,"f")&&he(!0),r=!0,this.showHelp("log"),this.exit(0)):O&&(y(this,_t,"f")&&he(!0),r=!0,y(this,tt,"f").showVersion("log"),this.exit(0))),!r&&y(this,G,"f").skipValidation.length>0&&(r=Object.keys(p).some(C=>y(this,G,"f").skipValidation.indexOf(C)>=0&&p[C]===!0)),!r){if(g.error)throw new ut(g.error.message);if(!w){const C=this[Qe](h,{},g.error);n||(f=me(p,this,y(this,Tt,"f").getMiddleware(),!0)),f=this[Ni](C,f??p),lt(f)&&!n&&(f=f.then(()=>me(p,this,y(this,Tt,"f").getMiddleware(),!1)))}}}catch(D){if(D instanceof ut)y(this,tt,"f").fail(D.message,D);else throw D}return this[te](f??p,a,!!n,!0)}[Qe](t,e,n,s){const i={...this.getDemandedOptions()};return r=>{if(n)throw new ut(n.message);y(this,ot,"f").nonOptionCount(r),y(this,ot,"f").requiredArguments(r,i);let a=!1;y(this,Qt,"f")&&(a=y(this,ot,"f").unknownCommands(r)),y(this,Kt,"f")&&!a?y(this,ot,"f").unknownArguments(r,t,e,!!s):y(this,Jt,"f")&&y(this,ot,"f").unknownArguments(r,t,{},!1,!1),y(this,ot,"f").limitedChoices(r),y(this,ot,"f").implications(r),y(this,ot,"f").conflicting(r)}}[Ui](){V(this,Et,!0,"f")}[ee](t){if(typeof t=="string")y(this,G,"f").key[t]=!0;else for(const e of t)y(this,G,"f").key[e]=!0}}function bo(o){return!!o&&typeof o.getInternalMethods=="function"}const wo=go(Hs);var Je={},Xi;function Vn(){return Xi||(Xi=1,function(){Je.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:`
|
|
91
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(et)),Je}var Ze={},Ut={},Xt={},$i;function $t(){return $i||($i=1,function(){var o,t,e,n,s,i,r,a=[].slice,c={}.hasOwnProperty;o=function(){var g,p,f,h,b,O;if(O=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(g=0,f=b.length;g<f;g++)if(h=b[g],h!=null)for(p in h)c.call(h,p)&&(O[p]=h[p]);return O},s=function(g){return!!g&&Object.prototype.toString.call(g)==="[object Function]"},i=function(g){var p;return!!g&&((p=typeof g)=="function"||p==="object")},e=function(g){return s(Array.isArray)?Array.isArray(g):Object.prototype.toString.call(g)==="[object Array]"},n=function(g){var p;if(e(g))return!g.length;for(p in g)if(c.call(g,p))return!1;return!0},r=function(g){var p,f;return i(g)&&(f=Object.getPrototypeOf(g))&&(p=f.constructor)&&typeof p=="function"&&p instanceof p&&Function.prototype.toString.call(p)===Function.prototype.toString.call(Object)},t=function(g){return s(g.valueOf)?g.valueOf():g},Xt.assign=o,Xt.isFunction=s,Xt.isObject=i,Xt.isArray=e,Xt.isEmpty=n,Xt.isPlainObject=r,Xt.getValue=t}.call(et)),Xt}var tn={exports:{}},qi;function Vr(){return qi||(qi=1,function(){tn.exports=function(){function o(){}return o.prototype.hasFeature=function(t,e){return!0},o.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},o.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},o.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},o.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},o}()}.call(et)),tn.exports}var en={exports:{}},nn={exports:{}},rn={exports:{}},Wi;function Oo(){return Wi||(Wi=1,function(){rn.exports=function(){function o(){}return o.prototype.handleError=function(t){throw new Error(t)},o}()}.call(et)),rn.exports}var sn={exports:{}},Vi;function Eo(){return Vi||(Vi=1,function(){sn.exports=function(){function o(t){this.arr=t||[]}return Object.defineProperty(o.prototype,"length",{get:function(){return this.arr.length}}),o.prototype.item=function(t){return this.arr[t]||null},o.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},o}()}.call(et)),sn.exports}var Hi;function Do(){return Hi||(Hi=1,function(){var o,t;o=Oo(),t=Eo(),nn.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new o,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(e.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},e.prototype.canSetParameter=function(n,s){return!0},e.prototype.setParameter=function(n,s){return s!=null?this.params[n]=s:delete this.params[n]},e}()}.call(et)),nn.exports}var on={exports:{}},an={exports:{}},cn={exports:{}},zi;function ft(){return zi||(zi=1,function(){cn.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(et)),cn.exports}var un={exports:{}},Gi;function Hr(){return Gi||(Gi=1,function(){var o;o=ft(),Nt(),un.exports=function(){function t(e,n,s){if(this.parent=e,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(s),this.type=o.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(e){return this.value=e||""}}),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(e){return this.options.writer.attribute(this,this.options.writer.filterOptions(e))},t.prototype.debugInfo=function(e){return e=e||this.name,e==null?"parent: <"+this.parent.name+">":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(e){return!(e.namespaceURI!==this.namespaceURI||e.prefix!==this.prefix||e.localName!==this.localName||e.value!==this.value)},t}()}.call(et)),un.exports}var ln={exports:{}},Yi;function Hn(){return Yi||(Yi=1,function(){ln.exports=function(){function o(t){this.nodes=t}return Object.defineProperty(o.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),o.prototype.clone=function(){return this.nodes=null},o.prototype.getNamedItem=function(t){return this.nodes[t]},o.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},o.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},o.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},o.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},o.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},o.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},o}()}.call(et)),ln.exports}var ki;function zn(){return ki||(ki=1,function(){var o,t,e,n,s,i,r,a,c=function(p,f){for(var h in f)g.call(f,h)&&(p[h]=f[h]);function b(){this.constructor=p}return b.prototype=f.prototype,p.prototype=new b,p.__super__=f.prototype,p},g={}.hasOwnProperty;a=$t(),r=a.isObject,i=a.isFunction,s=a.getValue,n=Nt(),o=ft(),t=Hr(),e=Hn(),an.exports=function(p){c(f,p);function f(h,b,O){var D,w,A,C;if(f.__super__.constructor.call(this,h),b==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(b),this.type=o.Element,this.attribs={},this.schemaTypeInfo=null,O!=null&&this.attribute(O),h.type===o.Document&&(this.isRoot=!0,this.documentObject=h,h.rootObject=this,h.children)){for(C=h.children,w=0,A=C.length;w<A;w++)if(D=C[w],D.type===o.DocType){D.name=this.name;break}}}return Object.defineProperty(f.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(f.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(f.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new e(this.attribs)),this.attributeMap}}),f.prototype.clone=function(){var h,b,O,D;O=Object.create(this),O.isRoot&&(O.documentObject=null),O.attribs={},D=this.attribs;for(b in D)g.call(D,b)&&(h=D[b],O.attribs[b]=h.clone());return O.children=[],this.children.forEach(function(w){var A;return A=w.clone(),A.parent=O,O.children.push(A)}),O},f.prototype.attribute=function(h,b){var O,D;if(h!=null&&(h=s(h)),r(h))for(O in h)g.call(h,O)&&(D=h[O],this.attribute(O,D));else i(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.attribs[h]=new t(this,h,""):b!=null&&(this.attribs[h]=new t(this,h,b));return this},f.prototype.removeAttribute=function(h){var b,O,D;if(h==null)throw new Error("Missing attribute name. "+this.debugInfo());if(h=s(h),Array.isArray(h))for(O=0,D=h.length;O<D;O++)b=h[O],delete this.attribs[b];else delete this.attribs[h];return this},f.prototype.toString=function(h){return this.options.writer.element(this,this.options.writer.filterOptions(h))},f.prototype.att=function(h,b){return this.attribute(h,b)},f.prototype.a=function(h,b){return this.attribute(h,b)},f.prototype.getAttribute=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h].value:null},f.prototype.setAttribute=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNode=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h]:null},f.prototype.setAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNode=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.getAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNS=function(h,b,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNodeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNodeNS=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.hasAttribute=function(h){return this.attribs.hasOwnProperty(h)},f.prototype.hasAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttribute=function(h,b){return this.attribs.hasOwnProperty(h)?this.attribs[h].isId:b},f.prototype.setIdAttributeNS=function(h,b,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttributeNode=function(h,b){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.getElementsByTagNameNS=function(h,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.isEqualNode=function(h){var b,O,D;if(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.namespaceURI!==this.namespaceURI||h.prefix!==this.prefix||h.localName!==this.localName||h.attribs.length!==this.attribs.length)return!1;for(b=O=0,D=this.attribs.length-1;0<=D?O<=D:O>=D;b=0<=D?++O:--O)if(!this.attribs[b].isEqualNode(h.attribs[b]))return!1;return!0},f}(n)}.call(et)),an.exports}var fn={exports:{}},hn={exports:{}},Ki;function je(){return Ki||(Ki=1,function(){var o,t=function(n,s){for(var i in s)e.call(s,i)&&(n[i]=s[i]);function r(){this.constructor=n}return r.prototype=s.prototype,n.prototype=new r,n.__super__=s.prototype,n},e={}.hasOwnProperty;o=Nt(),hn.exports=function(n){t(s,n);function s(i){s.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(i,r,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(i){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},s}(o)}.call(et)),hn.exports}var Qi;function Gn(){return Qi||(Qi=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=ft(),t=je(),fn.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=o.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.cdata(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),fn.exports}var pn={exports:{}},Ji;function Yn(){return Ji||(Ji=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=ft(),t=je(),pn.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=o.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.comment(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),pn.exports}var dn={exports:{}},Zi;function kn(){return Zi||(Zi=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=$t().isObject,t=Nt(),o=ft(),dn.exports=function(i){n(r,i);function r(a,c,g,p){var f;r.__super__.constructor.call(this,a),e(c)&&(f=c,c=f.version,g=f.encoding,p=f.standalone),c||(c="1.0"),this.type=o.Declaration,this.version=this.stringify.xmlVersion(c),g!=null&&(this.encoding=this.stringify.xmlEncoding(g)),p!=null&&(this.standalone=this.stringify.xmlStandalone(p))}return r.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},r}(t)}.call(et)),dn.exports}var mn={exports:{}},gn={exports:{}},tr;function Kn(){return tr||(tr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=ft(),gn.exports=function(s){e(i,s);function i(r,a,c,g,p,f){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!g)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!p)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(p.indexOf("#")!==0&&(p="#"+p),!p.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(f&&!p.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=o.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(g),f&&(this.defaultValue=this.stringify.dtdAttDefault(f)),this.defaultValueType=p}return i.prototype.toString=function(r){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),gn.exports}var yn={exports:{}},er;function Qn(){return er||(er=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=$t().isObject,t=Nt(),o=ft(),yn.exports=function(i){n(r,i);function r(a,c,g,p){if(r.__super__.constructor.call(this,a),g==null)throw new Error("Missing DTD entity name. "+this.debugInfo(g));if(p==null)throw new Error("Missing DTD entity value. "+this.debugInfo(g));if(this.pe=!!c,this.name=this.stringify.name(g),this.type=o.EntityDeclaration,!e(p))this.value=this.stringify.dtdEntityValue(p),this.internal=!0;else{if(!p.pubID&&!p.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(g));if(p.pubID&&!p.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(g));if(this.internal=!1,p.pubID!=null&&(this.pubID=this.stringify.dtdPubID(p.pubID)),p.sysID!=null&&(this.sysID=this.stringify.dtdSysID(p.sysID)),p.nData!=null&&(this.nData=this.stringify.dtdNData(p.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(g))}}return Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(r.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(r.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlVersion",{get:function(){return null}}),r.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},r}(t)}.call(et)),yn.exports}var bn={exports:{}},nr;function Jn(){return nr||(nr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=ft(),bn.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(a),this.type=o.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return i.prototype.toString=function(r){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),bn.exports}var wn={exports:{}},ir;function Zn(){return ir||(ir=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=ft(),wn.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!c.pubID&&!c.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=o.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.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(r){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),wn.exports}var rr;function ti(){return rr||(rr=1,function(){var o,t,e,n,s,i,r,a,c=function(p,f){for(var h in f)g.call(f,h)&&(p[h]=f[h]);function b(){this.constructor=p}return b.prototype=f.prototype,p.prototype=new b,p.__super__=f.prototype,p},g={}.hasOwnProperty;a=$t().isObject,r=Nt(),o=ft(),t=Kn(),n=Qn(),e=Jn(),s=Zn(),i=Hn(),mn.exports=function(p){c(f,p);function f(h,b,O){var D,w,A,C,d,E;if(f.__super__.constructor.call(this,h),this.type=o.DocType,h.children){for(C=h.children,w=0,A=C.length;w<A;w++)if(D=C[w],D.type===o.Element){this.name=D.name;break}}this.documentObject=h,a(b)&&(d=b,b=d.pubID,O=d.sysID),O==null&&(E=[b,O],O=E[0],b=E[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),O!=null&&(this.sysID=this.stringify.dtdSysID(O))}return Object.defineProperty(f.prototype,"entities",{get:function(){var h,b,O,D,w;for(D={},w=this.children,b=0,O=w.length;b<O;b++)h=w[b],h.type===o.EntityDeclaration&&!h.pe&&(D[h.name]=h);return new i(D)}}),Object.defineProperty(f.prototype,"notations",{get:function(){var h,b,O,D,w;for(D={},w=this.children,b=0,O=w.length;b<O;b++)h=w[b],h.type===o.NotationDeclaration&&(D[h.name]=h);return new i(D)}}),Object.defineProperty(f.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(f.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(f.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),f.prototype.element=function(h,b){var O;return O=new e(this,h,b),this.children.push(O),this},f.prototype.attList=function(h,b,O,D,w){var A;return A=new t(this,h,b,O,D,w),this.children.push(A),this},f.prototype.entity=function(h,b){var O;return O=new n(this,!1,h,b),this.children.push(O),this},f.prototype.pEntity=function(h,b){var O;return O=new n(this,!0,h,b),this.children.push(O),this},f.prototype.notation=function(h,b){var O;return O=new s(this,h,b),this.children.push(O),this},f.prototype.toString=function(h){return this.options.writer.docType(this,this.options.writer.filterOptions(h))},f.prototype.ele=function(h,b){return this.element(h,b)},f.prototype.att=function(h,b,O,D,w){return this.attList(h,b,O,D,w)},f.prototype.ent=function(h,b){return this.entity(h,b)},f.prototype.pent=function(h,b){return this.pEntity(h,b)},f.prototype.not=function(h,b){return this.notation(h,b)},f.prototype.up=function(){return this.root()||this.documentObject},f.prototype.isEqualNode=function(h){return!(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.name!==this.name||h.publicId!==this.publicId||h.systemId!==this.systemId)},f}(r)}.call(et)),mn.exports}var On={exports:{}},sr;function ei(){return sr||(sr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=ft(),t=Nt(),On.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=o.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.raw(this,this.options.writer.filterOptions(r))},i}(t)}.call(et)),On.exports}var En={exports:{}},or;function ni(){return or||(or=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=ft(),t=je(),En.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=o.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 r,a,c;for(c="",a=this.previousSibling;a;)c=a.data+c,a=a.previousSibling;for(c+=this.data,r=this.nextSibling;r;)c=c+r.data,r=r.nextSibling;return c}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.text(this,this.options.writer.filterOptions(r))},i.prototype.splitText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(et)),En.exports}var Dn={exports:{}},ar;function ii(){return ar||(ar=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=ft(),t=je(),Dn.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=o.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(r))},i.prototype.isEqualNode=function(r){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(r)||r.target!==this.target)},i}(t)}.call(et)),Dn.exports}var Cn={exports:{}},cr;function zr(){return cr||(cr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=ft(),Cn.exports=function(s){e(i,s);function i(r){i.__super__.constructor.call(this,r),this.type=o.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return""},i}(t)}.call(et)),Cn.exports}var In={exports:{}},ur;function Co(){return ur||(ur=1,function(){In.exports=function(){function o(t){this.nodes=t}return Object.defineProperty(o.prototype,"length",{get:function(){return this.nodes.length||0}}),o.prototype.clone=function(){return this.nodes=null},o.prototype.item=function(t){return this.nodes[t]||null},o}()}.call(et)),In.exports}var _n={exports:{}},lr;function Io(){return lr||(lr=1,function(){_n.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(et)),_n.exports}var fr;function Nt(){return fr||(fr=1,function(){var o,t,e,n,s,i,r,a,c,g,p,f,h,b,O,D,w,A={}.hasOwnProperty;w=$t(),D=w.isObject,O=w.isFunction,b=w.isEmpty,h=w.getValue,a=null,e=null,n=null,s=null,i=null,p=null,f=null,g=null,r=null,t=null,c=null,o=null,on.exports=function(){function C(d){this.parent=d,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=zn(),e=Gn(),n=Yn(),s=kn(),i=ti(),p=ei(),f=ni(),g=ii(),r=zr(),t=ft(),c=Co(),Hn(),o=Io())}return Object.defineProperty(C.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(C.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(C.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(C.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(C.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new c(this.children)),this.childNodeList}}),Object.defineProperty(C.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(C.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(C.prototype,"previousSibling",{get:function(){var d;return d=this.parent.children.indexOf(this),this.parent.children[d-1]||null}}),Object.defineProperty(C.prototype,"nextSibling",{get:function(){var d;return d=this.parent.children.indexOf(this),this.parent.children[d+1]||null}}),Object.defineProperty(C.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(C.prototype,"textContent",{get:function(){var d,E,T,F,U;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(U="",F=this.children,E=0,T=F.length;E<T;E++)d=F[E],d.textContent&&(U+=d.textContent);return U}else return null},set:function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),C.prototype.setParent=function(d){var E,T,F,U,j;for(this.parent=d,d&&(this.options=d.options,this.stringify=d.stringify),U=this.children,j=[],T=0,F=U.length;T<F;T++)E=U[T],j.push(E.setParent(this));return j},C.prototype.element=function(d,E,T){var F,U,j,u,M,N,L,B,X,Y,k;if(N=null,E===null&&T==null&&(X=[{},null],E=X[0],T=X[1]),E==null&&(E={}),E=h(E),D(E)||(Y=[E,T],T=Y[0],E=Y[1]),d!=null&&(d=h(d)),Array.isArray(d))for(j=0,L=d.length;j<L;j++)U=d[j],N=this.element(U);else if(O(d))N=this.element(d.apply());else if(D(d)){for(M in d)if(A.call(d,M))if(k=d[M],O(k)&&(k=k.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&M.indexOf(this.stringify.convertAttKey)===0)N=this.attribute(M.substr(this.stringify.convertAttKey.length),k);else if(!this.options.separateArrayItems&&Array.isArray(k)&&b(k))N=this.dummy();else if(D(k)&&b(k))N=this.element(M);else if(!this.options.keepNullNodes&&k==null)N=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(k))for(u=0,B=k.length;u<B;u++)U=k[u],F={},F[M]=U,N=this.element(F);else D(k)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&M.indexOf(this.stringify.convertTextKey)===0?N=this.element(k):(N=this.element(M),N.element(k)):N=this.element(M,k)}else!this.options.keepNullNodes&&T===null?N=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&d.indexOf(this.stringify.convertTextKey)===0?N=this.text(T):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&d.indexOf(this.stringify.convertCDataKey)===0?N=this.cdata(T):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&d.indexOf(this.stringify.convertCommentKey)===0?N=this.comment(T):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&d.indexOf(this.stringify.convertRawKey)===0?N=this.raw(T):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&d.indexOf(this.stringify.convertPIKey)===0?N=this.instruction(d.substr(this.stringify.convertPIKey.length),T):N=this.node(d,E,T);if(N==null)throw new Error("Could not create any elements with: "+d+". "+this.debugInfo());return N},C.prototype.insertBefore=function(d,E,T){var F,U,j,u,M;if(d?.type)return j=d,u=E,j.setParent(this),u?(U=children.indexOf(u),M=children.splice(U),children.push(j),Array.prototype.push.apply(children,M)):children.push(j),j;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return U=this.parent.children.indexOf(this),M=this.parent.children.splice(U),F=this.parent.element(d,E,T),Array.prototype.push.apply(this.parent.children,M),F},C.prototype.insertAfter=function(d,E,T){var F,U,j;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return U=this.parent.children.indexOf(this),j=this.parent.children.splice(U+1),F=this.parent.element(d,E,T),Array.prototype.push.apply(this.parent.children,j),F},C.prototype.remove=function(){var d;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return d=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[d,d-d+1].concat([])),this.parent},C.prototype.node=function(d,E,T){var F,U;return d!=null&&(d=h(d)),E||(E={}),E=h(E),D(E)||(U=[E,T],T=U[0],E=U[1]),F=new a(this,d,E),T!=null&&F.text(T),this.children.push(F),F},C.prototype.text=function(d){var E;return D(d)&&this.element(d),E=new f(this,d),this.children.push(E),this},C.prototype.cdata=function(d){var E;return E=new e(this,d),this.children.push(E),this},C.prototype.comment=function(d){var E;return E=new n(this,d),this.children.push(E),this},C.prototype.commentBefore=function(d){var E,T;return E=this.parent.children.indexOf(this),T=this.parent.children.splice(E),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,T),this},C.prototype.commentAfter=function(d){var E,T;return E=this.parent.children.indexOf(this),T=this.parent.children.splice(E+1),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,T),this},C.prototype.raw=function(d){var E;return E=new p(this,d),this.children.push(E),this},C.prototype.dummy=function(){var d;return d=new r(this),d},C.prototype.instruction=function(d,E){var T,F,U,j,u;if(d!=null&&(d=h(d)),E!=null&&(E=h(E)),Array.isArray(d))for(j=0,u=d.length;j<u;j++)T=d[j],this.instruction(T);else if(D(d))for(T in d)A.call(d,T)&&(F=d[T],this.instruction(T,F));else O(E)&&(E=E.apply()),U=new g(this,d,E),this.children.push(U);return this},C.prototype.instructionBefore=function(d,E){var T,F;return T=this.parent.children.indexOf(this),F=this.parent.children.splice(T),this.parent.instruction(d,E),Array.prototype.push.apply(this.parent.children,F),this},C.prototype.instructionAfter=function(d,E){var T,F;return T=this.parent.children.indexOf(this),F=this.parent.children.splice(T+1),this.parent.instruction(d,E),Array.prototype.push.apply(this.parent.children,F),this},C.prototype.declaration=function(d,E,T){var F,U;return F=this.document(),U=new s(F,d,E,T),F.children.length===0?F.children.unshift(U):F.children[0].type===t.Declaration?F.children[0]=U:F.children.unshift(U),F.root()||F},C.prototype.dtd=function(d,E){var T,F,U,j,u,M,N,L,B,X;for(F=this.document(),U=new i(F,d,E),B=F.children,j=u=0,N=B.length;u<N;j=++u)if(T=B[j],T.type===t.DocType)return F.children[j]=U,U;for(X=F.children,j=M=0,L=X.length;M<L;j=++M)if(T=X[j],T.isRoot)return F.children.splice(j,0,U),U;return F.children.push(U),U},C.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},C.prototype.root=function(){var d;for(d=this;d;){if(d.type===t.Document)return d.rootObject;if(d.isRoot)return d;d=d.parent}},C.prototype.document=function(){var d;for(d=this;d;){if(d.type===t.Document)return d;d=d.parent}},C.prototype.end=function(d){return this.document().end(d)},C.prototype.prev=function(){var d;if(d=this.parent.children.indexOf(this),d<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[d-1]},C.prototype.next=function(){var d;if(d=this.parent.children.indexOf(this),d===-1||d===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[d+1]},C.prototype.importDocument=function(d){var E;return E=d.root().clone(),E.parent=this,E.isRoot=!1,this.children.push(E),this},C.prototype.debugInfo=function(d){var E,T;return d=d||this.name,d==null&&!((E=this.parent)!=null&&E.name)?"":d==null?"parent: <"+this.parent.name+">":(T=this.parent)!=null&&T.name?"node: <"+d+">, parent: <"+this.parent.name+">":"node: <"+d+">"},C.prototype.ele=function(d,E,T){return this.element(d,E,T)},C.prototype.nod=function(d,E,T){return this.node(d,E,T)},C.prototype.txt=function(d){return this.text(d)},C.prototype.dat=function(d){return this.cdata(d)},C.prototype.com=function(d){return this.comment(d)},C.prototype.ins=function(d,E){return this.instruction(d,E)},C.prototype.doc=function(){return this.document()},C.prototype.dec=function(d,E,T){return this.declaration(d,E,T)},C.prototype.e=function(d,E,T){return this.element(d,E,T)},C.prototype.n=function(d,E,T){return this.node(d,E,T)},C.prototype.t=function(d){return this.text(d)},C.prototype.d=function(d){return this.cdata(d)},C.prototype.c=function(d){return this.comment(d)},C.prototype.r=function(d){return this.raw(d)},C.prototype.i=function(d,E){return this.instruction(d,E)},C.prototype.u=function(){return this.up()},C.prototype.importXMLBuilder=function(d){return this.importDocument(d)},C.prototype.replaceChild=function(d,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.removeChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.appendChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.hasChildNodes=function(){return this.children.length!==0},C.prototype.cloneNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isSupported=function(d,E){return!0},C.prototype.hasAttributes=function(){return this.attribs.length!==0},C.prototype.compareDocumentPosition=function(d){var E,T;return E=this,E===d?0:this.document()!==d.document()?(T=o.Disconnected|o.ImplementationSpecific,Math.random()<.5?T|=o.Preceding:T|=o.Following,T):E.isAncestor(d)?o.Contains|o.Preceding:E.isDescendant(d)?o.Contains|o.Following:E.isPreceding(d)?o.Preceding:o.Following},C.prototype.isSameNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.lookupPrefix=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isDefaultNamespace=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.lookupNamespaceURI=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isEqualNode=function(d){var E,T,F;if(d.nodeType!==this.nodeType||d.children.length!==this.children.length)return!1;for(E=T=0,F=this.children.length-1;0<=F?T<=F:T>=F;E=0<=F?++T:--T)if(!this.children[E].isEqualNode(d.children[E]))return!1;return!0},C.prototype.getFeature=function(d,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.setUserData=function(d,E,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getUserData=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.contains=function(d){return d?d===this||this.isDescendant(d):!1},C.prototype.isDescendant=function(d){var E,T,F,U,j;for(j=this.children,F=0,U=j.length;F<U;F++)if(E=j[F],d===E||(T=E.isDescendant(d),T))return!0;return!1},C.prototype.isAncestor=function(d){return d.isDescendant(this)},C.prototype.isPreceding=function(d){var E,T;return E=this.treePosition(d),T=this.treePosition(this),E===-1||T===-1?!1:E<T},C.prototype.isFollowing=function(d){var E,T;return E=this.treePosition(d),T=this.treePosition(this),E===-1||T===-1?!1:E>T},C.prototype.treePosition=function(d){var E,T;return T=0,E=!1,this.foreachTreeNode(this.document(),function(F){if(T++,!E&&F===d)return E=!0}),E?T:-1},C.prototype.foreachTreeNode=function(d,E){var T,F,U,j,u;for(d||(d=this.document()),j=d.children,F=0,U=j.length;F<U;F++){if(T=j[F],u=E(T))return u;if(u=this.foreachTreeNode(T,E),u)return u}},C}()}.call(et)),on.exports}var Tn={exports:{}},hr;function Gr(){return hr||(hr=1,function(){var o=function(e,n){return function(){return e.apply(n,arguments)}},t={}.hasOwnProperty;Tn.exports=function(){function e(n){this.assertLegalName=o(this.assertLegalName,this),this.assertLegalChar=o(this.assertLegalChar,this);var s,i,r;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),i=n.stringify||{};for(s in i)t.call(i,s)&&(r=i[s],this[s]=r)}return e.prototype.name=function(n){return this.options.noValidation?n:this.assertLegalName(""+n||"")},e.prototype.text=function(n){return this.options.noValidation?n:this.assertLegalChar(this.textEscape(""+n||""))},e.prototype.cdata=function(n){return this.options.noValidation?n:(n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n))},e.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)},e.prototype.raw=function(n){return this.options.noValidation?n:""+n||""},e.prototype.attValue=function(n){return this.options.noValidation?n:this.assertLegalChar(this.attEscape(n=""+n||""))},e.prototype.insTarget=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.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)},e.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},e.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)},e.prototype.xmlStandalone=function(n){return this.options.noValidation?n:n?"yes":"no"},e.prototype.dtdPubID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdSysID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdElementValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdAttType=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdAttDefault=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdEntityValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdNData=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(n){var s,i;if(this.options.noValidation)return n;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(s))throw new Error("Invalid character in string: "+n+" at index "+i.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(s)))throw new Error("Invalid character in string: "+n+" at index "+i.index);return n},e.prototype.assertLegalName=function(n){var s;if(this.options.noValidation)return n;if(this.assertLegalChar(n),s=/^([: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(s))throw new Error("Invalid character in name");return n},e.prototype.textEscape=function(n){var s;return this.options.noValidation?n:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},e.prototype.attEscape=function(n){var s;return this.options.noValidation?n:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},e}()}.call(et)),Tn.exports}var vn={exports:{}},xn={exports:{}},Nn={exports:{}},pr;function Fe(){return pr||(pr=1,function(){Nn.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(et)),Nn.exports}var dr;function Yr(){return dr||(dr=1,function(){var o,t,e,n={}.hasOwnProperty;e=$t().assign,o=ft(),kn(),ti(),Gn(),Yn(),zn(),ei(),ni(),ii(),zr(),Kn(),Jn(),Qn(),Zn(),t=Fe(),xn.exports=function(){function s(i){var r,a,c;i||(i={}),this.options=i,a=i.writer||{};for(r in a)n.call(a,r)&&(c=a[r],this["_"+r]=this[r],this[r]=c)}return s.prototype.filterOptions=function(i){var r,a,c,g,p,f,h,b;return i||(i={}),i=e({},this.options,i),r={writer:this},r.pretty=i.pretty||!1,r.allowEmpty=i.allowEmpty||!1,r.indent=(a=i.indent)!=null?a:" ",r.newline=(c=i.newline)!=null?c:`
|
|
92
|
+
`,r.offset=(g=i.offset)!=null?g:0,r.dontPrettyTextNodes=(p=(f=i.dontPrettyTextNodes)!=null?f:i.dontprettytextnodes)!=null?p:0,r.spaceBeforeSlash=(h=(b=i.spaceBeforeSlash)!=null?b:i.spacebeforeslash)!=null?h:"",r.spaceBeforeSlash===!0&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=t.None,r},s.prototype.indent=function(i,r,a){var c;return!r.pretty||r.suppressPrettyCount?"":r.pretty&&(c=(a||0)+r.offset+1,c>0)?new Array(c).join(r.indent):""},s.prototype.endline=function(i,r,a){return!r.pretty||r.suppressPrettyCount?"":r.newline},s.prototype.attribute=function(i,r,a){var c;return this.openAttribute(i,r,a),c=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,r,a),c},s.prototype.cdata=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<![CDATA[",r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+="]]>"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.comment=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!-- ",r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=" -->"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.declaration=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<?xml",r.state=t.InsideTag,c+=' version="'+i.version+'"',i.encoding!=null&&(c+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(c+=' standalone="'+i.standalone+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+"?>",c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.docType=function(i,r,a){var c,g,p,f,h;if(a||(a=0),this.openNode(i,r,a),r.state=t.OpenTag,f=this.indent(i,r,a),f+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?f+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(f+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(f+=" [",f+=this.endline(i,r,a),r.state=t.InsideTag,h=i.children,g=0,p=h.length;g<p;g++)c=h[g],f+=this.writeChildNode(c,r,a+1);r.state=t.CloseTag,f+="]"}return r.state=t.CloseTag,f+=r.spaceBeforeSlash+">",f+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),f},s.prototype.element=function(i,r,a){var c,g,p,f,h,b,O,D,w,A,C,d,E,T;a||(a=0),A=!1,C="",this.openNode(i,r,a),r.state=t.OpenTag,C+=this.indent(i,r,a)+"<"+i.name,d=i.attribs;for(w in d)n.call(d,w)&&(c=d[w],C+=this.attribute(c,r,a));if(p=i.children.length,f=p===0?null:i.children[0],p===0||i.children.every(function(F){return(F.type===o.Text||F.type===o.Raw)&&F.value===""}))r.allowEmpty?(C+=">",r.state=t.CloseTag,C+="</"+i.name+">"+this.endline(i,r,a)):(r.state=t.CloseTag,C+=r.spaceBeforeSlash+"/>"+this.endline(i,r,a));else if(r.pretty&&p===1&&(f.type===o.Text||f.type===o.Raw)&&f.value!=null)C+=">",r.state=t.InsideTag,r.suppressPrettyCount++,A=!0,C+=this.writeChildNode(f,r,a+1),r.suppressPrettyCount--,A=!1,r.state=t.CloseTag,C+="</"+i.name+">"+this.endline(i,r,a);else{if(r.dontPrettyTextNodes){for(E=i.children,h=0,O=E.length;h<O;h++)if(g=E[h],(g.type===o.Text||g.type===o.Raw)&&g.value!=null){r.suppressPrettyCount++,A=!0;break}}for(C+=">"+this.endline(i,r,a),r.state=t.InsideTag,T=i.children,b=0,D=T.length;b<D;b++)g=T[b],C+=this.writeChildNode(g,r,a+1);r.state=t.CloseTag,C+=this.indent(i,r,a)+"</"+i.name+">",A&&r.suppressPrettyCount--,C+=this.endline(i,r,a),r.state=t.None}return this.closeNode(i,r,a),C},s.prototype.writeChildNode=function(i,r,a){switch(i.type){case o.CData:return this.cdata(i,r,a);case o.Comment:return this.comment(i,r,a);case o.Element:return this.element(i,r,a);case o.Raw:return this.raw(i,r,a);case o.Text:return this.text(i,r,a);case o.ProcessingInstruction:return this.processingInstruction(i,r,a);case o.Dummy:return"";case o.Declaration:return this.declaration(i,r,a);case o.DocType:return this.docType(i,r,a);case o.AttributeDeclaration:return this.dtdAttList(i,r,a);case o.ElementDeclaration:return this.dtdElement(i,r,a);case o.EntityDeclaration:return this.dtdEntity(i,r,a);case o.NotationDeclaration:return this.dtdNotation(i,r,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},s.prototype.processingInstruction=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<?",r.state=t.InsideTag,c+=i.target,i.value&&(c+=" "+i.value),r.state=t.CloseTag,c+=r.spaceBeforeSlash+"?>",c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.raw=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a),r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.text=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a),r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdAttList=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ATTLIST",r.state=t.InsideTag,c+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(c+=" "+i.defaultValueType),i.defaultValue&&(c+=' "'+i.defaultValue+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdElement=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ELEMENT",r.state=t.InsideTag,c+=" "+i.name+" "+i.value,r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdEntity=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ENTITY",r.state=t.InsideTag,i.pe&&(c+=" %"),c+=" "+i.name,i.value?c+=' "'+i.value+'"':(i.pubID&&i.sysID?c+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(c+=' SYSTEM "'+i.sysID+'"'),i.nData&&(c+=" NDATA "+i.nData)),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdNotation=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!NOTATION",r.state=t.InsideTag,c+=" "+i.name,i.pubID&&i.sysID?c+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?c+=' PUBLIC "'+i.pubID+'"':i.sysID&&(c+=' SYSTEM "'+i.sysID+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.openNode=function(i,r,a){},s.prototype.closeNode=function(i,r,a){},s.prototype.openAttribute=function(i,r,a){},s.prototype.closeAttribute=function(i,r,a){},s}()}.call(et)),xn.exports}var mr;function ri(){return mr||(mr=1,function(){var o,t=function(n,s){for(var i in s)e.call(s,i)&&(n[i]=s[i]);function r(){this.constructor=n}return r.prototype=s.prototype,n.prototype=new r,n.__super__=s.prototype,n},e={}.hasOwnProperty;o=Yr(),vn.exports=function(n){t(s,n);function s(i){s.__super__.constructor.call(this,i)}return s.prototype.document=function(i,r){var a,c,g,p,f;for(r=this.filterOptions(r),p="",f=i.children,c=0,g=f.length;c<g;c++)a=f[c],p+=this.writeChildNode(a,r,0);return r.pretty&&p.slice(-r.newline.length)===r.newline&&(p=p.slice(0,-r.newline.length)),p},s}(o)}.call(et)),vn.exports}var gr;function kr(){return gr||(gr=1,function(){var o,t,e,n,s,i,r,a=function(g,p){for(var f in p)c.call(p,f)&&(g[f]=p[f]);function h(){this.constructor=g}return h.prototype=p.prototype,g.prototype=new h,g.__super__=p.prototype,g},c={}.hasOwnProperty;r=$t().isPlainObject,e=Vr(),t=Do(),n=Nt(),o=ft(),i=Gr(),s=ri(),en.exports=function(g){a(p,g);function p(f){p.__super__.constructor.call(this,null),this.name="#document",this.type=o.Document,this.documentURI=null,this.domConfig=new t,f||(f={}),f.writer||(f.writer=new s),this.options=f,this.stringify=new i(f)}return Object.defineProperty(p.prototype,"implementation",{value:new e}),Object.defineProperty(p.prototype,"doctype",{get:function(){var f,h,b,O;for(O=this.children,h=0,b=O.length;h<b;h++)if(f=O[h],f.type===o.DocType)return f;return null}}),Object.defineProperty(p.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(p.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(p.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(p.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].encoding:null}}),Object.defineProperty(p.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(p.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(p.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(p.prototype,"origin",{get:function(){return null}}),Object.defineProperty(p.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(p.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(p.prototype,"contentType",{get:function(){return null}}),p.prototype.end=function(f){var h;return h={},f?r(f)&&(h=f,f=this.options.writer):f=this.options.writer,f.document(this,f.filterOptions(h))},p.prototype.toString=function(f){return this.options.writer.document(this,this.options.writer.filterOptions(f))},p.prototype.createElement=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTextNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createComment=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createCDATASection=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createProcessingInstruction=function(f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttribute=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEntityReference=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.importNode=function(f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createElementNS=function(f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttributeNS=function(f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementById=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.adoptNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.renameNode=function(f,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEvent=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createNodeIterator=function(f,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTreeWalker=function(f,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p}(n)}.call(et)),en.exports}var Pn={exports:{}},yr;function _o(){return yr||(yr=1,function(){var o,t,e,n,s,i,r,a,c,g,p,f,h,b,O,D,w,A,C,d,E,T,F,U={}.hasOwnProperty;F=$t(),E=F.isObject,d=F.isFunction,T=F.isPlainObject,C=F.getValue,o=ft(),f=kr(),h=zn(),n=Gn(),s=Yn(),O=ei(),A=ni(),b=ii(),g=kn(),p=ti(),i=Kn(),a=Qn(),r=Jn(),c=Zn(),e=Hr(),w=Gr(),D=ri(),t=Fe(),Pn.exports=function(){function j(u,M,N){var L;this.name="?xml",this.type=o.Document,u||(u={}),L={},u.writer?T(u.writer)&&(L=u.writer,u.writer=new D):u.writer=new D,this.options=u,this.writer=u.writer,this.writerOptions=this.writer.filterOptions(L),this.stringify=new w(u),this.onDataCallback=M||function(){},this.onEndCallback=N||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return j.prototype.createChildNode=function(u){var M,N,L,B,X,Y,k,q;switch(u.type){case o.CData:this.cdata(u.value);break;case o.Comment:this.comment(u.value);break;case o.Element:L={},k=u.attribs;for(N in k)U.call(k,N)&&(M=k[N],L[N]=M.value);this.node(u.name,L);break;case o.Dummy:this.dummy();break;case o.Raw:this.raw(u.value);break;case o.Text:this.text(u.value);break;case o.ProcessingInstruction:this.instruction(u.target,u.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+u.constructor.name)}for(q=u.children,X=0,Y=q.length;X<Y;X++)B=q[X],this.createChildNode(B),B.type===o.Element&&this.up();return this},j.prototype.dummy=function(){return this},j.prototype.node=function(u,M,N){var L;if(u==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(u));return this.openCurrent(),u=C(u),M==null&&(M={}),M=C(M),E(M)||(L=[M,N],N=L[0],M=L[1]),this.currentNode=new h(this,u,M),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,N!=null&&this.text(N),this},j.prototype.element=function(u,M,N){var L,B,X,Y,k,q;if(this.currentNode&&this.currentNode.type===o.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(u)||E(u)||d(u))for(Y=this.options.noValidation,this.options.noValidation=!0,q=new f(this.options).element("TEMP_ROOT"),q.element(u),this.options.noValidation=Y,k=q.children,B=0,X=k.length;B<X;B++)L=k[B],this.createChildNode(L),L.type===o.Element&&this.up();else this.node(u,M,N);return this},j.prototype.attribute=function(u,M){var N,L;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(u));if(u!=null&&(u=C(u)),E(u))for(N in u)U.call(u,N)&&(L=u[N],this.attribute(N,L));else d(M)&&(M=M.apply()),this.options.keepNullAttributes&&M==null?this.currentNode.attribs[u]=new e(this,u,""):M!=null&&(this.currentNode.attribs[u]=new e(this,u,M));return this},j.prototype.text=function(u){var M;return this.openCurrent(),M=new A(this,u),this.onData(this.writer.text(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.cdata=function(u){var M;return this.openCurrent(),M=new n(this,u),this.onData(this.writer.cdata(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.comment=function(u){var M;return this.openCurrent(),M=new s(this,u),this.onData(this.writer.comment(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.raw=function(u){var M;return this.openCurrent(),M=new O(this,u),this.onData(this.writer.raw(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.instruction=function(u,M){var N,L,B,X,Y;if(this.openCurrent(),u!=null&&(u=C(u)),M!=null&&(M=C(M)),Array.isArray(u))for(N=0,X=u.length;N<X;N++)L=u[N],this.instruction(L);else if(E(u))for(L in u)U.call(u,L)&&(B=u[L],this.instruction(L,B));else d(M)&&(M=M.apply()),Y=new b(this,u,M),this.onData(this.writer.processingInstruction(Y,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},j.prototype.declaration=function(u,M,N){var L;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return L=new g(this,u,M,N),this.onData(this.writer.declaration(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.doctype=function(u,M,N){if(this.openCurrent(),u==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 p(this,M,N),this.currentNode.rootNodeName=u,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},j.prototype.dtdElement=function(u,M){var N;return this.openCurrent(),N=new r(this,u,M),this.onData(this.writer.dtdElement(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.attList=function(u,M,N,L,B){var X;return this.openCurrent(),X=new i(this,u,M,N,L,B),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.entity=function(u,M){var N;return this.openCurrent(),N=new a(this,!1,u,M),this.onData(this.writer.dtdEntity(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.pEntity=function(u,M){var N;return this.openCurrent(),N=new a(this,!0,u,M),this.onData(this.writer.dtdEntity(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.prototype.notation=function(u,M){var N;return this.openCurrent(),N=new c(this,u,M),this.onData(this.writer.dtdNotation(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},j.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},j.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},j.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},j.prototype.openNode=function(u){var M,N,L,B;if(!u.isOpen){if(!this.root&&this.currentLevel===0&&u.type===o.Element&&(this.root=u),N="",u.type===o.Element){this.writerOptions.state=t.OpenTag,N=this.writer.indent(u,this.writerOptions,this.currentLevel)+"<"+u.name,B=u.attribs;for(L in B)U.call(B,L)&&(M=B[L],N+=this.writer.attribute(M,this.writerOptions,this.currentLevel));N+=(u.children?">":"/>")+this.writer.endline(u,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,N=this.writer.indent(u,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+u.rootNodeName,u.pubID&&u.sysID?N+=' PUBLIC "'+u.pubID+'" "'+u.sysID+'"':u.sysID&&(N+=' SYSTEM "'+u.sysID+'"'),u.children?(N+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,N+=">"),N+=this.writer.endline(u,this.writerOptions,this.currentLevel);return this.onData(N,this.currentLevel),u.isOpen=!0}},j.prototype.closeNode=function(u){var M;if(!u.isClosed)return M="",this.writerOptions.state=t.CloseTag,u.type===o.Element?M=this.writer.indent(u,this.writerOptions,this.currentLevel)+"</"+u.name+">"+this.writer.endline(u,this.writerOptions,this.currentLevel):M=this.writer.indent(u,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(u,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(M,this.currentLevel),u.isClosed=!0},j.prototype.onData=function(u,M){return this.documentStarted=!0,this.onDataCallback(u,M+1)},j.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},j.prototype.debugInfo=function(u){return u==null?"":"node: <"+u+">"},j.prototype.ele=function(){return this.element.apply(this,arguments)},j.prototype.nod=function(u,M,N){return this.node(u,M,N)},j.prototype.txt=function(u){return this.text(u)},j.prototype.dat=function(u){return this.cdata(u)},j.prototype.com=function(u){return this.comment(u)},j.prototype.ins=function(u,M){return this.instruction(u,M)},j.prototype.dec=function(u,M,N){return this.declaration(u,M,N)},j.prototype.dtd=function(u,M,N){return this.doctype(u,M,N)},j.prototype.e=function(u,M,N){return this.element(u,M,N)},j.prototype.n=function(u,M,N){return this.node(u,M,N)},j.prototype.t=function(u){return this.text(u)},j.prototype.d=function(u){return this.cdata(u)},j.prototype.c=function(u){return this.comment(u)},j.prototype.r=function(u){return this.raw(u)},j.prototype.i=function(u,M){return this.instruction(u,M)},j.prototype.att=function(){return this.currentNode&&this.currentNode.type===o.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},j.prototype.a=function(){return this.currentNode&&this.currentNode.type===o.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},j.prototype.ent=function(u,M){return this.entity(u,M)},j.prototype.pent=function(u,M){return this.pEntity(u,M)},j.prototype.not=function(u,M){return this.notation(u,M)},j}()}.call(et)),Pn.exports}var An={exports:{}},br;function To(){return br||(br=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;o=ft(),e=Yr(),t=Fe(),An.exports=function(i){n(r,i);function r(a,c){this.stream=a,r.__super__.constructor.call(this,c)}return r.prototype.endline=function(a,c,g){return a.isLastRootNode&&c.state===t.CloseTag?"":r.__super__.endline.call(this,a,c,g)},r.prototype.document=function(a,c){var g,p,f,h,b,O,D,w,A;for(D=a.children,p=f=0,b=D.length;f<b;p=++f)g=D[p],g.isLastRootNode=p===a.children.length-1;for(c=this.filterOptions(c),w=a.children,A=[],h=0,O=w.length;h<O;h++)g=w[h],A.push(this.writeChildNode(g,c,0));return A},r.prototype.attribute=function(a,c,g){return this.stream.write(r.__super__.attribute.call(this,a,c,g))},r.prototype.cdata=function(a,c,g){return this.stream.write(r.__super__.cdata.call(this,a,c,g))},r.prototype.comment=function(a,c,g){return this.stream.write(r.__super__.comment.call(this,a,c,g))},r.prototype.declaration=function(a,c,g){return this.stream.write(r.__super__.declaration.call(this,a,c,g))},r.prototype.docType=function(a,c,g){var p,f,h,b;if(g||(g=0),this.openNode(a,c,g),c.state=t.OpenTag,this.stream.write(this.indent(a,c,g)),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,c,g)),c.state=t.InsideTag,b=a.children,f=0,h=b.length;f<h;f++)p=b[f],this.writeChildNode(p,c,g+1);c.state=t.CloseTag,this.stream.write("]")}return c.state=t.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(a,c,g)),c.state=t.None,this.closeNode(a,c,g)},r.prototype.element=function(a,c,g){var p,f,h,b,O,D,w,A,C;g||(g=0),this.openNode(a,c,g),c.state=t.OpenTag,this.stream.write(this.indent(a,c,g)+"<"+a.name),A=a.attribs;for(w in A)s.call(A,w)&&(p=A[w],this.attribute(p,c,g));if(h=a.children.length,b=h===0?null:a.children[0],h===0||a.children.every(function(d){return(d.type===o.Text||d.type===o.Raw)&&d.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=t.CloseTag,this.stream.write("</"+a.name+">")):(c.state=t.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&h===1&&(b.type===o.Text||b.type===o.Raw)&&b.value!=null)this.stream.write(">"),c.state=t.InsideTag,c.suppressPrettyCount++,this.writeChildNode(b,c,g+1),c.suppressPrettyCount--,c.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,c,g)),c.state=t.InsideTag,C=a.children,O=0,D=C.length;O<D;O++)f=C[O],this.writeChildNode(f,c,g+1);c.state=t.CloseTag,this.stream.write(this.indent(a,c,g)+"</"+a.name+">")}return this.stream.write(this.endline(a,c,g)),c.state=t.None,this.closeNode(a,c,g)},r.prototype.processingInstruction=function(a,c,g){return this.stream.write(r.__super__.processingInstruction.call(this,a,c,g))},r.prototype.raw=function(a,c,g){return this.stream.write(r.__super__.raw.call(this,a,c,g))},r.prototype.text=function(a,c,g){return this.stream.write(r.__super__.text.call(this,a,c,g))},r.prototype.dtdAttList=function(a,c,g){return this.stream.write(r.__super__.dtdAttList.call(this,a,c,g))},r.prototype.dtdElement=function(a,c,g){return this.stream.write(r.__super__.dtdElement.call(this,a,c,g))},r.prototype.dtdEntity=function(a,c,g){return this.stream.write(r.__super__.dtdEntity.call(this,a,c,g))},r.prototype.dtdNotation=function(a,c,g){return this.stream.write(r.__super__.dtdNotation.call(this,a,c,g))},r}(e)}.call(et)),An.exports}var wr;function vo(){return wr||(wr=1,function(){var o,t,e,n,s,i,r,a,c,g;g=$t(),a=g.assign,c=g.isFunction,e=Vr(),n=kr(),s=_o(),r=ri(),i=To(),o=ft(),t=Fe(),Ut.create=function(p,f,h,b){var O,D;if(p==null)throw new Error("Root element needs a name.");return b=a({},f,h,b),O=new n(b),D=O.element(p),b.headless||(O.declaration(b),(b.pubID!=null||b.sysID!=null)&&O.dtd(b)),D},Ut.begin=function(p,f,h){var b;return c(p)&&(b=[p,f],f=b[0],h=b[1],p={}),f?new s(p,f,h):new n(p)},Ut.stringWriter=function(p){return new r(p)},Ut.streamWriter=function(p,f){return new i(p,f)},Ut.implementation=new e,Ut.nodeType=o,Ut.writerState=t}.call(et)),Ut}var Or;function xo(){return Or||(Or=1,function(){var o,t,e,n,s,i={}.hasOwnProperty;o=vo(),t=Vn().defaults,n=function(r){return typeof r=="string"&&(r.indexOf("&")>=0||r.indexOf(">")>=0||r.indexOf("<")>=0)},s=function(r){return"<![CDATA["+e(r)+"]]>"},e=function(r){return r.replace("]]>","]]]]><![CDATA[>")},Ze.Builder=function(){function r(a){var c,g,p;this.options={},g=t["0.2"];for(c in g)i.call(g,c)&&(p=g[c],this.options[c]=p);for(c in a)i.call(a,c)&&(p=a[c],this.options[c]=p)}return r.prototype.buildObject=function(a){var c,g,p,f,h;return c=this.options.attrkey,g=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,p=function(b){return function(O,D){var w,A,C,d,E,T;if(typeof D!="object")b.options.cdata&&n(D)?O.raw(s(D)):O.txt(D);else if(Array.isArray(D)){for(d in D)if(i.call(D,d)){A=D[d];for(E in A)C=A[E],O=p(O.ele(E),C).up()}}else for(E in D)if(i.call(D,E))if(A=D[E],E===c){if(typeof A=="object")for(w in A)T=A[w],O=O.att(w,T)}else if(E===g)b.options.cdata&&n(A)?O=O.raw(s(A)):O=O.txt(A);else if(Array.isArray(A))for(d in A)i.call(A,d)&&(C=A[d],typeof C=="string"?b.options.cdata&&n(C)?O=O.ele(E).raw(s(C)).up():O=O.ele(E,C).up():O=p(O.ele(E),C).up());else typeof A=="object"?O=p(O.ele(E),A).up():typeof A=="string"&&b.options.cdata&&n(A)?O=O.ele(E).raw(s(A)).up():(A==null&&(A=""),O=O.ele(E,A.toString()).up());return O}}(this),f=o.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),p(f,a).end(this.options.renderOpts)},r}()}.call(et)),Ze}var Mn={},Ln={},Er;function No(){return Er||(Er=1,function(o){(function(t){t.parser=function(m,l){return new n(m,l)},t.SAXParser=n,t.SAXStream=p,t.createStream=g,t.MAX_BUFFER_LENGTH=64*1024;var e=["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(m,l){if(!(this instanceof n))return new n(m,l);var P=this;i(P),P.q=P.c="",P.bufferCheckPosition=t.MAX_BUFFER_LENGTH,P.opt=l||{},P.opt.lowercase=P.opt.lowercase||P.opt.lowercasetags,P.looseCase=P.opt.lowercase?"toLowerCase":"toUpperCase",P.tags=[],P.closed=P.closedRoot=P.sawRoot=!1,P.tag=P.error=null,P.strict=!!m,P.noscript=!!(m||P.opt.noscript),P.state=u.BEGIN,P.strictEntities=P.opt.strictEntities,P.ENTITIES=P.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),P.attribList=[],P.opt.xmlns&&(P.ns=Object.create(D)),P.opt.unquotedAttributeValues===void 0&&(P.opt.unquotedAttributeValues=!m),P.trackPosition=P.opt.position!==!1,P.trackPosition&&(P.position=P.line=P.column=0),N(P,"onready")}Object.create||(Object.create=function(m){function l(){}l.prototype=m;var P=new l;return P}),Object.keys||(Object.keys=function(m){var l=[];for(var P in m)m.hasOwnProperty(P)&&l.push(P);return l});function s(m){for(var l=Math.max(t.MAX_BUFFER_LENGTH,10),P=0,_=0,J=e.length;_<J;_++){var nt=m[e[_]].length;if(nt>l)switch(e[_]){case"textNode":B(m);break;case"cdata":L(m,"oncdata",m.cdata),m.cdata="";break;case"script":L(m,"onscript",m.script),m.script="";break;default:Y(m,"Max buffer length exceeded: "+e[_])}P=Math.max(P,nt)}var it=t.MAX_BUFFER_LENGTH-P;m.bufferCheckPosition=it+m.position}function i(m){for(var l=0,P=e.length;l<P;l++)m[e[l]]=""}function r(m){B(m),m.cdata!==""&&(L(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(L(m,"onscript",m.script),m.script="")}n.prototype={end:function(){k(this)},write:K,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){r(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var c=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function g(m,l){return new p(m,l)}function p(m,l){if(!(this instanceof p))return new p(m,l);a.apply(this),this._parser=new n(m,l),this.writable=!0,this.readable=!0;var P=this;this._parser.onend=function(){P.emit("end")},this._parser.onerror=function(_){P.emit("error",_),P._parser.error=null},this._decoder=null,c.forEach(function(_){Object.defineProperty(P,"on"+_,{get:function(){return P._parser["on"+_]},set:function(J){if(!J)return P.removeAllListeners(_),P._parser["on"+_]=J,J;P.on(_,J)},enumerable:!0,configurable:!1})})}p.prototype=Object.create(a.prototype,{constructor:{value:p}}),p.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},p.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var l=this._decoder.decode();l&&(this._parser.write(l),this.emit("data",l))}return this._parser.end(),!0},p.prototype.on=function(m,l){var P=this;return!P._parser["on"+m]&&c.indexOf(m)!==-1&&(P._parser["on"+m]=function(){var _=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);_.splice(0,0,m),P.emit.apply(P,_)}),a.prototype.on.call(P,m,l)};var f="[CDATA[",h="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",D={xml:b,xmlns:O},w=/[:_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]/,A=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,C=/[#:_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-]/;function E(m){return m===" "||m===`
|
|
93
|
+
`||m==="\r"||m===" "}function T(m){return m==='"'||m==="'"}function F(m){return m===">"||E(m)}function U(m,l){return m.test(l)}function j(m,l){return!U(m,l)}var u=0;t.STATE={BEGIN:u++,BEGIN_WHITESPACE:u++,TEXT:u++,TEXT_ENTITY:u++,OPEN_WAKA:u++,SGML_DECL:u++,SGML_DECL_QUOTED:u++,DOCTYPE:u++,DOCTYPE_QUOTED:u++,DOCTYPE_DTD:u++,DOCTYPE_DTD_QUOTED:u++,COMMENT_STARTING:u++,COMMENT:u++,COMMENT_ENDING:u++,COMMENT_ENDED:u++,CDATA:u++,CDATA_ENDING:u++,CDATA_ENDING_2:u++,PROC_INST:u++,PROC_INST_BODY:u++,PROC_INST_ENDING:u++,OPEN_TAG:u++,OPEN_TAG_SLASH:u++,ATTRIB:u++,ATTRIB_NAME:u++,ATTRIB_NAME_SAW_WHITE:u++,ATTRIB_VALUE:u++,ATTRIB_VALUE_QUOTED:u++,ATTRIB_VALUE_CLOSED:u++,ATTRIB_VALUE_UNQUOTED:u++,ATTRIB_VALUE_ENTITY_Q:u++,ATTRIB_VALUE_ENTITY_U:u++,CLOSE_TAG:u++,CLOSE_TAG_SAW_WHITE:u++,SCRIPT:u++,SCRIPT_ENDING:u++},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 l=t.ENTITIES[m],P=typeof l=="number"?String.fromCharCode(l):l;t.ENTITIES[m]=P});for(var M in t.STATE)t.STATE[t.STATE[M]]=M;u=t.STATE;function N(m,l,P){m[l]&&m[l](P)}function L(m,l,P){m.textNode&&B(m),N(m,l,P)}function B(m){m.textNode=X(m.opt,m.textNode),m.textNode&&N(m,"ontext",m.textNode),m.textNode=""}function X(m,l){return m.trim&&(l=l.trim()),m.normalize&&(l=l.replace(/\s+/g," ")),l}function Y(m,l){return B(m),m.trackPosition&&(l+=`
|
|
94
|
+
Line: `+m.line+`
|
|
95
|
+
Column: `+m.column+`
|
|
96
|
+
Char: `+m.c),l=new Error(l),m.error=l,N(m,"onerror",l),m}function k(m){return m.sawRoot&&!m.closedRoot&&q(m,"Unclosed root tag"),m.state!==u.BEGIN&&m.state!==u.BEGIN_WHITESPACE&&m.state!==u.TEXT&&Y(m,"Unexpected end"),B(m),m.c="",m.closed=!0,N(m,"onend"),n.call(m,m.strict,m.opt),m}function q(m,l){if(typeof m!="object"||!(m instanceof n))throw new Error("bad call to strictFail");m.strict&&Y(m,l)}function at(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var l=m.tags[m.tags.length-1]||m,P=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(P.ns=l.ns),m.attribList.length=0,L(m,"onopentagstart",P)}function Pt(m,l){var P=m.indexOf(":"),_=P<0?["",m]:m.split(":"),J=_[0],nt=_[1];return l&&m==="xmlns"&&(J="xmlns",nt=""),{prefix:J,local:nt}}function st(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 l=Pt(m.attribName,!0),P=l.prefix,_=l.local;if(P==="xmlns")if(_==="xml"&&m.attribValue!==b)q(m,"xml: prefix must be bound to "+b+`
|
|
97
|
+
Actual: `+m.attribValue);else if(_==="xmlns"&&m.attribValue!==O)q(m,"xmlns: prefix must be bound to "+O+`
|
|
98
|
+
Actual: `+m.attribValue);else{var J=m.tag,nt=m.tags[m.tags.length-1]||m;J.ns===nt.ns&&(J.ns=Object.create(nt.ns)),J.ns[_]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,L(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function mt(m,l){if(m.opt.xmlns){var P=m.tag,_=Pt(m.tagName);P.prefix=_.prefix,P.local=_.local,P.uri=P.ns[_.prefix]||"",P.prefix&&!P.uri&&(q(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),P.uri=_.prefix);var J=m.tags[m.tags.length-1]||m;P.ns&&J.ns!==P.ns&&Object.keys(P.ns).forEach(function(z){L(m,"onopennamespace",{prefix:z,uri:P.ns[z]})});for(var nt=0,it=m.attribList.length;nt<it;nt++){var ht=m.attribList[nt],I=ht[0],v=ht[1],R=Pt(I,!0),S=R.prefix,x=R.local,W=S===""?"":P.ns[S]||"",$={name:I,value:v,prefix:S,local:x,uri:W};S&&S!=="xmlns"&&!W&&(q(m,"Unbound namespace prefix: "+JSON.stringify(S)),$.uri=S),m.tag.attributes[I]=$,L(m,"onattribute",$)}m.attribList.length=0}m.tag.isSelfClosing=!!l,m.sawRoot=!0,m.tags.push(m.tag),L(m,"onopentag",m.tag),l||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=u.SCRIPT:m.state=u.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function wt(m){if(!m.tagName){q(m,"Weird empty close tag."),m.textNode+="</>",m.state=u.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=u.SCRIPT;return}L(m,"onscript",m.script),m.script=""}var l=m.tags.length,P=m.tagName;m.strict||(P=P[m.looseCase]());for(var _=P;l--;){var J=m.tags[l];if(J.name!==_)q(m,"Unexpected close tag");else break}if(l<0){q(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=u.TEXT;return}m.tagName=P;for(var nt=m.tags.length;nt-- >l;){var it=m.tag=m.tags.pop();m.tagName=m.tag.name,L(m,"onclosetag",m.tagName);var ht={};for(var I in it.ns)ht[I]=it.ns[I];var v=m.tags[m.tags.length-1]||m;m.opt.xmlns&&it.ns!==v.ns&&Object.keys(it.ns).forEach(function(R){var S=it.ns[R];L(m,"onclosenamespace",{prefix:R,uri:S})})}l===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=u.TEXT}function Rt(m){var l=m.entity,P=l.toLowerCase(),_,J="";return m.ENTITIES[l]?m.ENTITIES[l]:m.ENTITIES[P]?m.ENTITIES[P]:(l=P,l.charAt(0)==="#"&&(l.charAt(1)==="x"?(l=l.slice(2),_=parseInt(l,16),J=_.toString(16)):(l=l.slice(1),_=parseInt(l,10),J=_.toString(10))),l=l.replace(/^0+/,""),isNaN(_)||J.toLowerCase()!==l||_<0||_>1114111?(q(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(_))}function Q(m,l){l==="<"?(m.state=u.OPEN_WAKA,m.startTagPosition=m.position):E(l)||(q(m,"Non-whitespace before first tag."),m.textNode=l,m.state=u.TEXT)}function Ht(m,l){var P="";return l<m.length&&(P=m.charAt(l)),P}function K(m){var l=this;if(this.error)throw this.error;if(l.closed)return Y(l,"Cannot write after close. Assign an onready handler.");if(m===null)return k(l);typeof m=="object"&&(m=m.toString());for(var P=0,_="";_=Ht(m,P++),l.c=_,!!_;)switch(l.trackPosition&&(l.position++,_===`
|
|
99
|
+
`?(l.line++,l.column=0):l.column++),l.state){case u.BEGIN:if(l.state=u.BEGIN_WHITESPACE,_==="\uFEFF")continue;Q(l,_);continue;case u.BEGIN_WHITESPACE:Q(l,_);continue;case u.TEXT:if(l.sawRoot&&!l.closedRoot){for(var nt=P-1;_&&_!=="<"&&_!=="&";)_=Ht(m,P++),_&&l.trackPosition&&(l.position++,_===`
|
|
100
|
+
`?(l.line++,l.column=0):l.column++);l.textNode+=m.substring(nt,P-1)}_==="<"&&!(l.sawRoot&&l.closedRoot&&!l.strict)?(l.state=u.OPEN_WAKA,l.startTagPosition=l.position):(!E(_)&&(!l.sawRoot||l.closedRoot)&&q(l,"Text data outside of root node."),_==="&"?l.state=u.TEXT_ENTITY:l.textNode+=_);continue;case u.SCRIPT:_==="<"?l.state=u.SCRIPT_ENDING:l.script+=_;continue;case u.SCRIPT_ENDING:_==="/"?l.state=u.CLOSE_TAG:(l.script+="<"+_,l.state=u.SCRIPT);continue;case u.OPEN_WAKA:if(_==="!")l.state=u.SGML_DECL,l.sgmlDecl="";else if(!E(_))if(U(w,_))l.state=u.OPEN_TAG,l.tagName=_;else if(_==="/")l.state=u.CLOSE_TAG,l.tagName="";else if(_==="?")l.state=u.PROC_INST,l.procInstName=l.procInstBody="";else{if(q(l,"Unencoded <"),l.startTagPosition+1<l.position){var J=l.position-l.startTagPosition;_=new Array(J).join(" ")+_}l.textNode+="<"+_,l.state=u.TEXT}continue;case u.SGML_DECL:if(l.sgmlDecl+_==="--"){l.state=u.COMMENT,l.comment="",l.sgmlDecl="";continue}l.doctype&&l.doctype!==!0&&l.sgmlDecl?(l.state=u.DOCTYPE_DTD,l.doctype+="<!"+l.sgmlDecl+_,l.sgmlDecl=""):(l.sgmlDecl+_).toUpperCase()===f?(L(l,"onopencdata"),l.state=u.CDATA,l.sgmlDecl="",l.cdata=""):(l.sgmlDecl+_).toUpperCase()===h?(l.state=u.DOCTYPE,(l.doctype||l.sawRoot)&&q(l,"Inappropriately located doctype declaration"),l.doctype="",l.sgmlDecl=""):_===">"?(L(l,"onsgmldeclaration",l.sgmlDecl),l.sgmlDecl="",l.state=u.TEXT):(T(_)&&(l.state=u.SGML_DECL_QUOTED),l.sgmlDecl+=_);continue;case u.SGML_DECL_QUOTED:_===l.q&&(l.state=u.SGML_DECL,l.q=""),l.sgmlDecl+=_;continue;case u.DOCTYPE:_===">"?(l.state=u.TEXT,L(l,"ondoctype",l.doctype),l.doctype=!0):(l.doctype+=_,_==="["?l.state=u.DOCTYPE_DTD:T(_)&&(l.state=u.DOCTYPE_QUOTED,l.q=_));continue;case u.DOCTYPE_QUOTED:l.doctype+=_,_===l.q&&(l.q="",l.state=u.DOCTYPE);continue;case u.DOCTYPE_DTD:_==="]"?(l.doctype+=_,l.state=u.DOCTYPE):_==="<"?(l.state=u.OPEN_WAKA,l.startTagPosition=l.position):T(_)?(l.doctype+=_,l.state=u.DOCTYPE_DTD_QUOTED,l.q=_):l.doctype+=_;continue;case u.DOCTYPE_DTD_QUOTED:l.doctype+=_,_===l.q&&(l.state=u.DOCTYPE_DTD,l.q="");continue;case u.COMMENT:_==="-"?l.state=u.COMMENT_ENDING:l.comment+=_;continue;case u.COMMENT_ENDING:_==="-"?(l.state=u.COMMENT_ENDED,l.comment=X(l.opt,l.comment),l.comment&&L(l,"oncomment",l.comment),l.comment=""):(l.comment+="-"+_,l.state=u.COMMENT);continue;case u.COMMENT_ENDED:_!==">"?(q(l,"Malformed comment"),l.comment+="--"+_,l.state=u.COMMENT):l.doctype&&l.doctype!==!0?l.state=u.DOCTYPE_DTD:l.state=u.TEXT;continue;case u.CDATA:for(var nt=P-1;_&&_!=="]";)_=Ht(m,P++),_&&l.trackPosition&&(l.position++,_===`
|
|
101
|
+
`?(l.line++,l.column=0):l.column++);l.cdata+=m.substring(nt,P-1),_==="]"&&(l.state=u.CDATA_ENDING);continue;case u.CDATA_ENDING:_==="]"?l.state=u.CDATA_ENDING_2:(l.cdata+="]"+_,l.state=u.CDATA);continue;case u.CDATA_ENDING_2:_===">"?(l.cdata&&L(l,"oncdata",l.cdata),L(l,"onclosecdata"),l.cdata="",l.state=u.TEXT):_==="]"?l.cdata+="]":(l.cdata+="]]"+_,l.state=u.CDATA);continue;case u.PROC_INST:_==="?"?l.state=u.PROC_INST_ENDING:E(_)?l.state=u.PROC_INST_BODY:l.procInstName+=_;continue;case u.PROC_INST_BODY:if(!l.procInstBody&&E(_))continue;_==="?"?l.state=u.PROC_INST_ENDING:l.procInstBody+=_;continue;case u.PROC_INST_ENDING:_===">"?(L(l,"onprocessinginstruction",{name:l.procInstName,body:l.procInstBody}),l.procInstName=l.procInstBody="",l.state=u.TEXT):(l.procInstBody+="?"+_,l.state=u.PROC_INST_BODY);continue;case u.OPEN_TAG:U(A,_)?l.tagName+=_:(at(l),_===">"?mt(l):_==="/"?l.state=u.OPEN_TAG_SLASH:(E(_)||q(l,"Invalid character in tag name"),l.state=u.ATTRIB));continue;case u.OPEN_TAG_SLASH:_===">"?(mt(l,!0),wt(l)):(q(l,"Forward-slash in opening tag not followed by >"),l.state=u.ATTRIB);continue;case u.ATTRIB:if(E(_))continue;_===">"?mt(l):_==="/"?l.state=u.OPEN_TAG_SLASH:U(w,_)?(l.attribName=_,l.attribValue="",l.state=u.ATTRIB_NAME):q(l,"Invalid attribute name");continue;case u.ATTRIB_NAME:_==="="?l.state=u.ATTRIB_VALUE:_===">"?(q(l,"Attribute without value"),l.attribValue=l.attribName,st(l),mt(l)):E(_)?l.state=u.ATTRIB_NAME_SAW_WHITE:U(A,_)?l.attribName+=_:q(l,"Invalid attribute name");continue;case u.ATTRIB_NAME_SAW_WHITE:if(_==="=")l.state=u.ATTRIB_VALUE;else{if(E(_))continue;q(l,"Attribute without value"),l.tag.attributes[l.attribName]="",l.attribValue="",L(l,"onattribute",{name:l.attribName,value:""}),l.attribName="",_===">"?mt(l):U(w,_)?(l.attribName=_,l.state=u.ATTRIB_NAME):(q(l,"Invalid attribute name"),l.state=u.ATTRIB)}continue;case u.ATTRIB_VALUE:if(E(_))continue;T(_)?(l.q=_,l.state=u.ATTRIB_VALUE_QUOTED):(l.opt.unquotedAttributeValues||Y(l,"Unquoted attribute value"),l.state=u.ATTRIB_VALUE_UNQUOTED,l.attribValue=_);continue;case u.ATTRIB_VALUE_QUOTED:if(_!==l.q){_==="&"?l.state=u.ATTRIB_VALUE_ENTITY_Q:l.attribValue+=_;continue}st(l),l.q="",l.state=u.ATTRIB_VALUE_CLOSED;continue;case u.ATTRIB_VALUE_CLOSED:E(_)?l.state=u.ATTRIB:_===">"?mt(l):_==="/"?l.state=u.OPEN_TAG_SLASH:U(w,_)?(q(l,"No whitespace between attributes"),l.attribName=_,l.attribValue="",l.state=u.ATTRIB_NAME):q(l,"Invalid attribute name");continue;case u.ATTRIB_VALUE_UNQUOTED:if(!F(_)){_==="&"?l.state=u.ATTRIB_VALUE_ENTITY_U:l.attribValue+=_;continue}st(l),_===">"?mt(l):l.state=u.ATTRIB;continue;case u.CLOSE_TAG:if(l.tagName)_===">"?wt(l):U(A,_)?l.tagName+=_:l.script?(l.script+="</"+l.tagName+_,l.tagName="",l.state=u.SCRIPT):(E(_)||q(l,"Invalid tagname in closing tag"),l.state=u.CLOSE_TAG_SAW_WHITE);else{if(E(_))continue;j(w,_)?l.script?(l.script+="</"+_,l.state=u.SCRIPT):q(l,"Invalid tagname in closing tag."):l.tagName=_}continue;case u.CLOSE_TAG_SAW_WHITE:if(E(_))continue;_===">"?wt(l):q(l,"Invalid characters in closing tag");continue;case u.TEXT_ENTITY:case u.ATTRIB_VALUE_ENTITY_Q:case u.ATTRIB_VALUE_ENTITY_U:var it,ht;switch(l.state){case u.TEXT_ENTITY:it=u.TEXT,ht="textNode";break;case u.ATTRIB_VALUE_ENTITY_Q:it=u.ATTRIB_VALUE_QUOTED,ht="attribValue";break;case u.ATTRIB_VALUE_ENTITY_U:it=u.ATTRIB_VALUE_UNQUOTED,ht="attribValue";break}if(_===";"){var I=Rt(l);l.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(I)?(l.entity="",l.state=it,l.write(I)):(l[ht]+=I,l.entity="",l.state=it)}else U(l.entity.length?d:C,_)?l.entity+=_:(q(l,"Invalid character in entity name"),l[ht]+="&"+l.entity+_,l.entity="",l.state=it);continue;default:throw new Error(l,"Unknown state: "+l.state)}return l.position>=l.bufferCheckPosition&&s(l),l}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,l=Math.floor,P=function(){var _=16384,J=[],nt,it,ht=-1,I=arguments.length;if(!I)return"";for(var v="";++ht<I;){var R=Number(arguments[ht]);if(!isFinite(R)||R<0||R>1114111||l(R)!==R)throw RangeError("Invalid code point: "+R);R<=65535?J.push(R):(R-=65536,nt=(R>>10)+55296,it=R%1024+56320,J.push(nt,it)),(ht+1===I||J.length>_)&&(v+=m.apply(null,J),J.length=0)}return v};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:P,configurable:!0,writable:!0}):String.fromCodePoint=P}()})(o)}(Ln)),Ln}var Sn={},Dr;function Po(){return Dr||(Dr=1,function(){Sn.stripBOM=function(o){return o[0]==="\uFEFF"?o.substring(1):o}}.call(et)),Sn}var ne={},Cr;function Kr(){return Cr||(Cr=1,function(){var o;o=new RegExp(/(?!xmlns)^.*:/),ne.normalize=function(t){return t.toLowerCase()},ne.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},ne.stripPrefix=function(t){return t.replace(o,"")},ne.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},ne.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(et)),ne}var Ir;function Ao(){return Ir||(Ir=1,function(o){(function(){var t,e,n,s,i,r,a,c,g,p=function(b,O){return function(){return b.apply(O,arguments)}},f=function(b,O){for(var D in O)h.call(O,D)&&(b[D]=O[D]);function w(){this.constructor=b}return w.prototype=O.prototype,b.prototype=new w,b.__super__=O.prototype,b},h={}.hasOwnProperty;c=No(),s=qn,t=Po(),a=Kr(),g=ss.setImmediate,e=Vn().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},r=function(b,O,D){var w,A,C;for(w=0,A=b.length;w<A;w++)C=b[w],O=C(O,D);return O},n=function(b,O,D){var w;return w=Object.create(null),w.value=D,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(b,O,w)},o.Parser=function(b){f(O,b);function O(D){this.parseStringPromise=p(this.parseStringPromise,this),this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var w,A,C;if(!(this instanceof o.Parser))return new o.Parser(D);this.options={},A=e["0.2"];for(w in A)h.call(A,w)&&(C=A[w],this.options[w]=C);for(w in D)h.call(D,w)&&(C=D[w],this.options[w]=C);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 O.prototype.processAsync=function(){var D,w;try{return this.remaining.length<=this.options.chunkSize?(D=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(D),this.saxParser.close()):(D=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(D),g(this.processAsync))}catch(A){if(w=A,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},O.prototype.assignOrPush=function(D,w,A){return w in D?(D[w]instanceof Array||n(D,w,[D[w]]),D[w].push(A)):this.options.explicitArray?n(D,w,[A]):n(D,w,A)},O.prototype.reset=function(){var D,w,A,C;return this.removeAllListeners(),this.saxParser=c.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(d){return function(E){if(d.saxParser.resume(),!d.saxParser.errThrown)return d.saxParser.errThrown=!0,d.emit("error",E)}}(this),this.saxParser.onend=function(d){return function(){if(!d.saxParser.ended)return d.saxParser.ended=!0,d.emit("end",d.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,C=[],D=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=function(d){return function(E){var T,F,U,j,u;if(U={},U[w]="",!d.options.ignoreAttrs){u=E.attributes;for(T in u)h.call(u,T)&&(!(D in U)&&!d.options.mergeAttrs&&(U[D]={}),F=d.options.attrValueProcessors?r(d.options.attrValueProcessors,E.attributes[T],T):E.attributes[T],j=d.options.attrNameProcessors?r(d.options.attrNameProcessors,T):T,d.options.mergeAttrs?d.assignOrPush(U,j,F):n(U[D],j,F))}return U["#name"]=d.options.tagNameProcessors?r(d.options.tagNameProcessors,E.name):E.name,d.options.xmlns&&(U[d.options.xmlnskey]={uri:E.uri,local:E.local}),C.push(U)}}(this),this.saxParser.onclosetag=function(d){return function(){var E,T,F,U,j,u,M,N,L,B;if(u=C.pop(),j=u["#name"],(!d.options.explicitChildren||!d.options.preserveChildrenOrder)&&delete u["#name"],u.cdata===!0&&(E=u.cdata,delete u.cdata),L=C[C.length-1],u[w].match(/^\s*$/)&&!E?(T=u[w],delete u[w]):(d.options.trim&&(u[w]=u[w].trim()),d.options.normalize&&(u[w]=u[w].replace(/\s{2,}/g," ").trim()),u[w]=d.options.valueProcessors?r(d.options.valueProcessors,u[w],j):u[w],Object.keys(u).length===1&&w in u&&!d.EXPLICIT_CHARKEY&&(u=u[w])),i(u)&&(typeof d.options.emptyTag=="function"?u=d.options.emptyTag():u=d.options.emptyTag!==""?d.options.emptyTag:T),d.options.validator!=null&&(B="/"+function(){var X,Y,k;for(k=[],X=0,Y=C.length;X<Y;X++)U=C[X],k.push(U["#name"]);return k}().concat(j).join("/"),function(){var X;try{return u=d.options.validator(B,L&&L[j],u)}catch(Y){return X=Y,d.emit("error",X)}}()),d.options.explicitChildren&&!d.options.mergeAttrs&&typeof u=="object"){if(!d.options.preserveChildrenOrder)U={},d.options.attrkey in u&&(U[d.options.attrkey]=u[d.options.attrkey],delete u[d.options.attrkey]),!d.options.charsAsChildren&&d.options.charkey in u&&(U[d.options.charkey]=u[d.options.charkey],delete u[d.options.charkey]),Object.getOwnPropertyNames(u).length>0&&(U[d.options.childkey]=u),u=U;else if(L){L[d.options.childkey]=L[d.options.childkey]||[],M={};for(F in u)h.call(u,F)&&n(M,F,u[F]);L[d.options.childkey].push(M),delete u["#name"],Object.keys(u).length===1&&w in u&&!d.EXPLICIT_CHARKEY&&(u=u[w])}}return C.length>0?d.assignOrPush(L,j,u):(d.options.explicitRoot&&(N=u,u={},n(u,j,N)),d.resultObject=u,d.saxParser.ended=!0,d.emit("end",d.resultObject))}}(this),A=function(d){return function(E){var T,F;if(F=C[C.length-1],F)return F[w]+=E,d.options.explicitChildren&&d.options.preserveChildrenOrder&&d.options.charsAsChildren&&(d.options.includeWhiteChars||E.replace(/\\n/g,"").trim()!=="")&&(F[d.options.childkey]=F[d.options.childkey]||[],T={"#name":"__text__"},T[w]=E,d.options.normalize&&(T[w]=T[w].replace(/\s{2,}/g," ").trim()),F[d.options.childkey].push(T)),F}}(this),this.saxParser.ontext=A,this.saxParser.oncdata=function(d){return function(E){var T;if(T=A(E),T)return T.cdata=!0}}()},O.prototype.parseString=function(D,w){var A;w!=null&&typeof w=="function"&&(this.on("end",function(C){return this.reset(),w(null,C)}),this.on("error",function(C){return this.reset(),w(C)}));try{return D=D.toString(),D.trim()===""?(this.emit("end",null),!0):(D=t.stripBOM(D),this.options.async?(this.remaining=D,g(this.processAsync),this.saxParser):this.saxParser.write(D).close())}catch(C){if(A=C,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw A}else return this.emit("error",A),this.saxParser.errThrown=!0}},O.prototype.parseStringPromise=function(D){return new Promise(function(w){return function(A,C){return w.parseString(D,function(d,E){return d?C(d):A(E)})}}(this))},O}(s),o.parseString=function(b,O,D){var w,A,C;return D!=null?(typeof D=="function"&&(w=D),typeof O=="object"&&(A=O)):(typeof O=="function"&&(w=O),A={}),C=new o.Parser(A),C.parseString(b,w)},o.parseStringPromise=function(b,O){var D,w;return typeof O=="object"&&(D=O),w=new o.Parser(D),w.parseStringPromise(b)}}).call(et)}(Mn)),Mn}var Qr;(function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;t=Vn(),o=xo(),e=Ao(),Kr(),t.defaults,function(i){n(r,i);function r(a){this.message=a}return r}(Error),o.Builder,e.Parser,e.parseString,Qr=e.parseStringPromise}).call(et);class Jr{constructor(t,e,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=e,this.readPHPFile=n.getPHPFile,this.phpRoot=n.phpRoot||"";for(const s of n.knownScriptUrls)this.scriptIdByUrl.set(s,this.getOrCreateScriptId(s));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 e=await Qr(t,{explicitArray:!1});await this.handleDbgpMessage(e)}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! 🎉
|
|
102
|
+
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
103
|
+
|
|
104
|
+
1. Add breakpoints in your files to start step debugging.
|
|
105
|
+
|
|
106
|
+
2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
|
|
107
|
+
|
|
108
|
+
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,e]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,e)}async sendScriptToCDP(t,e){const n=this.uriFromBridgeToCDPSyntaxHighlight(t),s=this.uriFromBridgeToCDP(t);try{const i=await this.readPHPFile(t),r=i.split(`
|
|
109
|
+
`),a=r.map((f,h)=>h===0?"AAAA":"AACA").join(";"),c={version:3,file:s,sources:[n],sourcesContent:[i],mappings:a},p=`data:application/json;base64,${Buffer.from(JSON.stringify(c),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:e,url:s,startLine:0,startColumn:0,endLine:r.length,endColumn:0,executionContextId:1,sourceMapURL:p}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let e=this.scriptIdByUrl.get(t);return e||(e=rs.createHash("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,e)),e}formatPropertyFullName(t){let e=!1,n="";for(const s of t)s==='"'||s==="\\"||s==="\0"?(n+="\\"+s,e=!0):s===" "?(n+=s,e=!0):n+=s;return(e||t.includes("'"))&&(n=`"${n}"`),n}sendDbgpCommand(t,e){const s=(this.nextTxnId++).toString();let i=`${t} -i ${s}`;return e!==void 0&&(i+=` ${e}`),this.dbgp.sendCommand(i),s}async handleCdpMessage(t){const{id:e,method:n,params:s}=t;let i={},r=!0;switch(n){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:c}=s;if(!a){r=!1;break}const g=this.uriFromCDPToBridge(a),p=this.uriFromBridgeToDBGP(g),f=(typeof c=="number"?c:0)+1,h=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(p)} -n ${f}`,O=this.sendDbgpCommand(b);this.pendingCommands.set(O,{cdpId:e,cdpMethod:n,params:{breakpointId:h,fileUri:g,lineNumber:f}}),r=!1}else this.breakpoints.set(h,{cdpId:h,xdebugId:null,fileUri:g,lineNumber:f}),i={breakpointId:h,locations:[{scriptId:this.getOrCreateScriptId(g),lineNumber:f-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=s,c=String(a),g=this.breakpoints.get(c);if(g){if(g.xdebugId&&this.xdebugConnected){const p=`breakpoint_remove -d ${g.xdebugId}`,f=this.sendDbgpCommand(p);this.pendingCommands.set(f,{cdpId:e,cdpMethod:n}),r=!1}this.breakpoints.delete(c)}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=s.expression||"",c=s.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(c===void 0||!this.callFramesMap.has(c)){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(c)!==0){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const g=Buffer.from(a).toString("base64"),p=this.sendDbgpCommand("eval",`-- ${g}`);this.pendingCommands.set(p,{cdpId:e,cdpMethod:n}),r=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=s,c=this.objectHandles.get(a);if(c&&this.xdebugConnected)if(c.type==="context"){const g=c.contextId??0,f=`context_get -d ${c.depth} -c ${g} -p 0 -m 32`,h=this.sendDbgpCommand(f),b={...c,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,b),this.pendingCommands.set(h,{cdpId:e,cdpMethod:n,params:{objectId:a}}),r=!1}else if(c.type==="property"){const g=c.depth,p=c.fullname,f=this.formatPropertyFullName(p),h=`property_get -d ${g} -n ${f} -p 0 -m 32`,b=this.sendDbgpCommand(h),O={...c,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,O),this.pendingCommands.set(b,{cdpId:e,cdpMethod:n,params:{parentObjectId:a}}),r=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=s.scriptId,c=[...this.scriptIdByUrl.entries()].find(([,p])=>p===a)?.[0],g=[];c&&g.push(`Here's the full path for your convenience:
|
|
110
|
+
`,`${this.uriFromBridgeToCDPSyntaxHighlight(c).replace("file://","")}
|
|
111
|
+
`),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...g,"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:
|
|
112
|
+
`,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
|
|
113
|
+
`)};break}default:i={};break}r&&this.cdp.sendMessage({id:e,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const e="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,n])=>n===t.slice(e.length))?.[0]??""}uriFromBridgeToDBGP(t){return bt.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const e=t.indexOf(this.phpRoot);return e!==-1?t.slice(e):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(n=>{this.handleCdpMessage({id:n.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(n.fileUri),lineNumber:n.lineNumber-1}})});const e=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(e,{});return}if(t.response){const e=t.response,n=e.$,s=n.command,i=n.transaction_id,r=this.pendingCommands.get(i);switch(s){case"breakpoint_set":{if(r&&r.cdpId!==void 0&&r.cdpMethod==="Debugger.setBreakpointByUrl"){const a=n.id,c=r.params;if(c){const{breakpointId:g,fileUri:p,lineNumber:f}=c;this.breakpoints.set(g,{cdpId:g,xdebugId:a,fileUri:p,lineNumber:f});const h=this.getOrCreateScriptId(p),b={breakpointId:g,locations:[{scriptId:h,lineNumber:f-1,columnNumber:0}]};this.cdp.sendMessage({id:r.cdpId,result:b})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=n.status;if(e["xdebug:message"]){const c=this.uriFromDBGPToBridge(e["xdebug:message"].$.filename);c&&!this.scriptIdByUrl.has(c)&&await this.sendScriptToCDP(c,this.getOrCreateScriptId(c))}if(a==="break"){const c=this.sendDbgpCommand("stack_get");this.pendingCommands.set(c,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(r&&r.cdpId!==void 0){let a;if(e.property){const g=e.property,p=g.$.type,f=g.$.encoding;let h=null;if(Object.prototype.hasOwnProperty.call(g,"_")?h=g._:typeof g.$value<"u"&&(h=g.$value),f==="base64"&&h!==null)try{h=Buffer.from(h,"base64").toString()}catch{}if(p==="string")a={type:"string",value:h??""};else if(p==="int"||p==="float"||p==="bool"||p==="boolen"||p==="integer"||p==="double"){let b=h;p.startsWith("int")||p==="integer"?b=parseInt(h||"0",10):p==="float"||p==="double"?b=parseFloat(h||"0"):p.startsWith("bool")&&(b=h==="1"||h==="true"),a={type:"number",value:b}}else if(p==="array"||p==="object"){const b=g.$.classname||(p==="array"?"Array":"Object"),O=String(this.nextObjectId++),D=g.$.fullname||"";this.objectHandles.set(O,{type:"property",depth:0,contextId:0,fullname:D}),a={type:"object",objectId:O,className:b,description:b}}else p==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const c={result:a};this.cdp.sendMessage({id:r.cdpId,result:c}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(r&&r.cdpId!==void 0){const a=r.params?.objectId||r.params?.parentObjectId,c=a?this.objectHandles.get(a):null,g=e.property?.property??e.property,p=[];if(g){const f=Array.isArray(g)?g:[g];for(const h of f){const b=h.$.name||h.$.fullname||"";let O=h.$.type||"undefined";const D=h.$.children==="1",w=h.$.encoding;let A=null;if(typeof h._<"u"&&(A=h._),w==="base64"&&A!==null)try{A=Buffer.from(A,"base64").toString()}catch{}if(D){const C=h.$.classname||(O==="array"?"Array":"Object"),d=String(this.nextObjectId++),E=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.contextId||0,T=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.depth||0;this.objectHandles.set(d,{type:"property",depth:T,contextId:E,fullname:h.$.fullname||b}),p.push({name:h.$.key||b,value:{type:"object",className:C,description:C,objectId:d},writable:!1,configurable:!1,enumerable:!0})}else{let C,d;O==="string"?C=A??"":O==="int"||O==="integer"?C=parseInt(A||"0",10):O==="float"||O==="double"?C=parseFloat(A||"0"):O==="bool"||O==="boolean"?(C=A==="1"||A==="true",O="boolean"):O==="null"?(C=null,d="null"):C=A;const E={type:O==="integer"?"number":O};d&&(E.subtype=d),E.value=C,p.push({name:h.$.key||b,value:E,writable:!1,configurable:!1,enumerable:!0})}}}if(c){const f=(c.aggregatedProps||[]).concat(p),h=32;if(p.length===h){const O=(c.currentPage||0)+1,D={...c,currentPage:O,aggregatedProps:f};this.objectHandles.set(a,D);let w;if(s==="context_get"){const C=c.contextId??0;w=`context_get -d ${c.depth} -c ${C} -p ${O} -m ${h}`}else{const C=c.depth,d=c.fullname,E=this.formatPropertyFullName(d);w=`property_get -d ${C} -n ${E} -p ${O} -m ${h}`}const A=this.sendDbgpCommand(w);this.pendingCommands.set(A,{cdpId:r.cdpId,cdpMethod:r.cdpMethod,params:r.params}),this.pendingCommands.delete(i);return}else{const O={result:f};this.cdp.sendMessage({id:r.cdpId,result:O}),this.pendingCommands.delete(i)}}else{const f={result:p};this.cdp.sendMessage({id:r.cdpId,result:f}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(e.stack){const a=Array.isArray(e.stack)?e.stack:[e.stack],c=[];this.callFramesMap.clear();for(const p of a){const f=this.uriFromDBGPToBridge(p.$.filename),h=this.getOrCreateScriptId(f);this.scriptIdByUrl.has(f)||(this.scriptIdByUrl.set(f,h),await this.sendScriptToCDP(f,h))}for(const p of a){const f=parseInt(p.$.level,10),h=this.uriFromDBGPToBridge(p.$.filename),b=parseInt(p.$.lineno,10),O=p.$.where&&p.$.where!=="{main}"?p.$.where:"(anonymous)",D=`frame:${f}`;this.callFramesMap.set(D,f);const w=[],A=String(this.nextObjectId++);this.objectHandles.set(A,{type:"context",contextId:0,depth:f}),w.push({type:"local",object:{objectId:A,className:"Object",description:"Local"}});const C=String(this.nextObjectId++);this.objectHandles.set(C,{type:"context",contextId:1,depth:f}),w.push({type:"global",object:{objectId:C,className:"Object",description:"Global"}}),c.push({callFrameId:D,functionName:O,location:{scriptId:this.getOrCreateScriptId(h),lineNumber:b-1,columnNumber:0},scopeChain:w,this:{type:"object",className:"Object",description:"Object",objectId:C}})}let g="pause";if(a.length>0){const p=a[0];if(p.$.filename&&p.$.lineno){const f=this.uriFromDBGPToBridge(p.$.filename),h=parseInt(p.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===f&&b.lineNumber===h){g="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:g,callFrames:c,hitBreakpoints:g==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const e=t.stream,n=e.$.type,s=e.$.encoding||"none";let i=typeof e._=="string"?e._:"";s==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:n==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function Zr(o){const t=o.cdpPort??9229,e=o.dbgpPort??9003,n=o.cdpHost??"localhost",s=o.phpRoot??process.cwd(),i=o.breakOnFirstLine??!1;xt.log("Starting XDebug Bridge...");const r=new jr(t);xt.log("Connect Chrome DevTools to CDP at:"),xt.log(`devtools://devtools/bundled/inspector.html?ws=${n}:${t}
|
|
114
|
+
`),await new Promise(f=>r.on("clientConnected",f)),await new Promise(f=>setTimeout(f,2e3)),xt.log("Chrome connected! Initializing Xdebug receiver...");const a=new Fr(e);xt.log(`XDebug receiver running on port ${e}`),xt.log("Running a PHP script with Xdebug enabled...");async function c(f){const h=[],b=o.phpInstance?await o.phpInstance.listFiles(f):Ft.readdirSync(f);for(const O of b){const D=bt.join(f,O);try{(o.phpInstance?await o.phpInstance.isDir(D):Ft.lstatSync(D).isDirectory())?h.push(...await c(D)):O.endsWith(".php")&&h.push(D)}catch{}}return h}const g=o.phpInstance?f=>o.phpInstance.readFileAsText(f):o.getPHPFile?o.getPHPFile:f=>Ft.readFileSync(f,"utf-8"),p=await c(s);return new Jr(a,r,{knownScriptUrls:p,phpRoot:s,getPHPFile:g,breakOnFirstLine:i})}const ts={Quiet:{name:"quiet",severity:yt.Fatal},Normal:{name:"normal",severity:yt.Info},Debug:{name:"debug",severity:yt.Debug}};function Mo(){return wo(Rs(process.argv)).usage(`
|
|
115
|
+
XDebug Bridge Server CLI
|
|
116
|
+
|
|
117
|
+
Usage: xdebug-bridge [options]
|
|
118
|
+
`).option("port",{alias:"p",type:"number",description:"Xdebug port to listen on",default:9003}).option("host",{alias:"h",type:"string",description:"Xdebug host to bind to",default:"localhost"}).option("php-root",{type:"string",description:"Path to PHP root directory"}).option("verbosity",{type:"string",describe:"Output logs",choices:Object.values(ts).map(o=>o.name),default:"normal"}).help().epilog(`
|
|
119
|
+
Examples:
|
|
120
|
+
xdebug-bridge # Start with default settings
|
|
121
|
+
xdebug-bridge --port 9000 --verbosity debug # Custom port with debug logs
|
|
122
|
+
xdebug-bridge --php-root /path/to/php/files # Specify PHP root directory
|
|
123
|
+
`).wrap(null).strict().parseSync()}async function Lo(){const o=Mo();if(o.help)return;if(o.verbosity){const e=Object.values(ts).find(n=>n.name===o.verbosity).severity;xt.setSeverityFilterLevel(e)}(await Zr({cdpPort:9229,cdpHost:o.host,dbgpPort:o.port,phpRoot:o.phpRoot})).start()}exports.CDPServer=jr;exports.DbgpSession=Fr;exports.XdebugCDPBridge=Jr;exports.main=Lo;exports.startBridge=Zr;
|