@signalk/freeboard-sk 3.2.0 → 3.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +276 -276
  2. package/package.json +18 -14
  3. package/plugin/vitest.config.mjs +1 -0
  4. package/public/assets/features/anchor-watch-1.jpg +0 -0
  5. package/public/assets/features/anchor-watch-2.jpg +0 -0
  6. package/public/assets/features/anchor-watch-3.jpg +0 -0
  7. package/public/assets/features/collision-alarm-display-1.jpg +0 -0
  8. package/public/assets/features/collision-alarm-display-2.jpg +0 -0
  9. package/public/assets/features/extension-panels-3.jpg +0 -0
  10. package/public/assets/features/radar-guard-zones-1.jpg +0 -0
  11. package/public/assets/features/radar-guard-zones-2.jpg +0 -0
  12. package/public/assets/features/radar-overlay-2.jpg +0 -0
  13. package/public/assets/features/radar-overlay-3.jpg +0 -0
  14. package/public/assets/features/route-planning-3.jpg +0 -0
  15. package/public/assets/features/route-planning-4.jpg +0 -0
  16. package/public/assets/features-corpus.json +1 -1
  17. package/public/assets/help/index.html +53 -124
  18. package/public/{chunk-D4A5NW5G.js → chunk-45ZTFAA5.js} +1 -1
  19. package/public/{chunk-4UBQTQSK.js → chunk-62WHV6CJ.js} +11 -11
  20. package/public/{chunk-6ZXMFU55.js → chunk-67S2RK5V.js} +1 -1
  21. package/public/{chunk-BJKB23AZ.js → chunk-6E2BDKCH.js} +1 -1
  22. package/public/{chunk-VQDXDSU7.js → chunk-AQKT2J2C.js} +1 -1
  23. package/public/chunk-BXGNCKBA.js +1 -0
  24. package/public/chunk-F4EUFUYM.js +4097 -0
  25. package/public/chunk-I33LU6L4.js +1 -0
  26. package/public/{chunk-YB4RBYE2.js → chunk-IGMXHN4X.js} +1 -1
  27. package/public/{chunk-RRYFRHFP.js → chunk-ISXARX6U.js} +1 -1
  28. package/public/chunk-J6MIIPAV.js +1 -0
  29. package/public/{chunk-7OBOGNNY.js → chunk-MX5HWKAH.js} +1 -1
  30. package/public/{chunk-5SYZI253.js → chunk-MYBGWSLC.js} +1 -1
  31. package/public/chunk-OBOT3EYE.js +1 -0
  32. package/public/chunk-OKVIYJ6A.js +1 -0
  33. package/public/{chunk-OVB2ZLN5.js → chunk-PAHYECKY.js} +1 -1
  34. package/public/{chunk-BNCDJR4Z.js → chunk-PD55PKQG.js} +2 -2
  35. package/public/chunk-QIIV7CZB.js +1 -0
  36. package/public/{chunk-BCS6VHKX.js → chunk-RG7WQ7O2.js} +15 -15
  37. package/public/chunk-S2NZQZZH.js +1 -0
  38. package/public/{chunk-R7YVRRY3.js → chunk-T7ZWMXKZ.js} +1 -1
  39. package/public/{chunk-GBMW6IJP.js → chunk-X6D4D6EN.js} +1 -1
  40. package/public/{chunk-USYMWMPO.js → chunk-YSHHABBQ.js} +1 -1
  41. package/public/{chunk-XZM7Q5WP.js → chunk-YZN4NRWW.js} +1 -1
  42. package/public/{chunk-P57WKW3G.js → chunk-Z2D7B2ZG.js} +1 -1
  43. package/public/index.html +2 -2
  44. package/public/main-S6QEWGOY.js +468 -0
  45. package/public/{styles-YRQUZIIZ.css → styles-BRU77GKR.css} +1 -1
  46. package/public/worker-E75PSRY4.js +12 -0
  47. package/public/worker-PCWM7FLK.js +3 -0
  48. package/public/{worker-BFPH3XRP.js → worker-UJD2XPGR.js} +6 -6
  49. package/public/worker-W3UMLYIU.js +12 -0
  50. package/public/chunk-A2UDMCI5.js +0 -1
  51. package/public/chunk-EDKY4MXN.js +0 -1
  52. package/public/chunk-GFDZNVNU.js +0 -4372
  53. package/public/chunk-H54CRRPU.js +0 -1
  54. package/public/chunk-HT6GODHM.js +0 -1
  55. package/public/chunk-RQKGK2KO.js +0 -1
  56. package/public/chunk-UBTZRPVO.js +0 -1
  57. package/public/chunk-XXGLBGHG.js +0 -1
  58. package/public/main-LYWXFV5I.js +0 -468
  59. package/public/worker-5LIQ6F6U.js +0 -12
  60. package/public/worker-DYC3TMVW.js +0 -3
  61. package/public/worker-SUE26ZZI.js +0 -12
@@ -1,12 +0,0 @@
1
- var sn=Object.create;var se=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var un=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,ln=Object.prototype.hasOwnProperty;var F=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(u){throw e=0,u}};var fn=(t,e,u,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of un(e))!ln.call(t,n)&&n!==u&&se(t,n,{get:()=>e[n],enumerable:!(d=an(e,n))||d.enumerable});return t};var hn=(t,e,u)=>(u=t!=null?sn(cn(t)):{},fn(e||!t||!t.__esModule?se(u,"default",{value:t,enumerable:!0}):u,t));var gt=F(Ut=>{(function(){Ut.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:`
2
- `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(Ut)});var tt=F((ae,st)=>{(function(){var t,e,u,d,n,l,a,f=[].slice,h={}.hasOwnProperty;t=function(){var w,D,O,b,y,T;if(T=arguments[0],y=2<=arguments.length?f.call(arguments,1):[],n(Object.assign))Object.assign.apply(null,arguments);else for(w=0,O=y.length;w<O;w++)if(b=y[w],b!=null)for(D in b)h.call(b,D)&&(T[D]=b[D]);return T},n=function(w){return!!w&&Object.prototype.toString.call(w)==="[object Function]"},l=function(w){var D;return!!w&&((D=typeof w)=="function"||D==="object")},u=function(w){return n(Array.isArray)?Array.isArray(w):Object.prototype.toString.call(w)==="[object Array]"},d=function(w){var D;if(u(w))return!w.length;for(D in w)if(h.call(w,D))return!1;return!0},a=function(w){var D,O;return l(w)&&(O=Object.getPrototypeOf(w))&&(D=O.constructor)&&typeof D=="function"&&D instanceof D&&Function.prototype.toString.call(D)===Function.prototype.toString.call(Object)},e=function(w){return n(w.valueOf)?w.valueOf():w},st.exports.assign=t,st.exports.isFunction=n,st.exports.isObject=l,st.exports.isArray=u,st.exports.isEmpty=d,st.exports.isPlainObject=a,st.exports.getValue=e}).call(ae)});var Wt=F((ue,ce)=>{(function(){var t;ce.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(u,d){return!0},e.prototype.createDocumentType=function(u,d,n){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(u,d,n){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(u){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(u,d){throw new Error("This DOM method is not implemented.")},e})()}).call(ue)});var he=F((le,fe)=>{(function(){var t;fe.exports=t=(function(){function e(){}return e.prototype.handleError=function(u){throw new Error(u)},e})()}).call(le)});var me=F((pe,de)=>{(function(){var t;de.exports=t=(function(){function e(u){this.arr=u||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(u){return this.arr[u]||null},e.prototype.contains=function(u){return this.arr.indexOf(u)!==-1},e})()}).call(pe)});var we=F((ye,ge)=>{(function(){var t,e,u;e=he(),u=me(),ge.exports=t=(function(){function d(){var n;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=n=Object.create(this.defaultParams)}return Object.defineProperty(d.prototype,"parameterNames",{get:function(){return new u(Object.keys(this.defaultParams))}}),d.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},d.prototype.canSetParameter=function(n,l){return!0},d.prototype.setParameter=function(n,l){return l!=null?this.params[n]=l:delete this.params[n]},d})()}).call(ye)});var k=F((Te,be)=>{(function(){be.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(Te)});var Vt=F((De,Ee)=>{(function(){var t,e,u;t=k(),u=K(),Ee.exports=e=(function(){function d(n,l,a){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),l==null)throw new Error("Missing attribute name. "+this.debugInfo(l));this.name=this.stringify.name(l),this.value=this.stringify.attValue(a),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(d.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(d.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(d.prototype,"textContent",{get:function(){return this.value},set:function(n){return this.value=n||""}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"specified",{get:function(){return!0}}),d.prototype.clone=function(){return Object.create(this)},d.prototype.toString=function(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},d.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},d.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},d})()}).call(De)});var wt=F((Ne,Oe)=>{(function(){var t;Oe.exports=t=(function(){function e(u){this.nodes=u}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(u){return this.nodes[u]},e.prototype.setNamedItem=function(u){var d;return d=this.nodes[u.nodeName],this.nodes[u.nodeName]=u,d||null},e.prototype.removeNamedItem=function(u){var d;return d=this.nodes[u],delete this.nodes[u],d||null},e.prototype.item=function(u){return this.nodes[Object.keys(this.nodes)[u]]||null},e.prototype.getNamedItemNS=function(u,d){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(u){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(u,d){throw new Error("This DOM method is not implemented.")},e})()}).call(Ne)});var Tt=F((Ie,Ce)=>{(function(){var t,e,u,d,n,l,a,f,h,w=function(O,b){for(var y in b)D.call(b,y)&&(O[y]=b[y]);function T(){this.constructor=O}return T.prototype=b.prototype,O.prototype=new T,O.__super__=b.prototype,O},D={}.hasOwnProperty;h=tt(),f=h.isObject,a=h.isFunction,l=h.getValue,n=K(),t=k(),e=Vt(),d=wt(),Ce.exports=u=(function(O){w(b,O);function b(y,T,N){var x,v,L,m;if(b.__super__.constructor.call(this,y),T==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(T),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,N!=null&&this.attribute(N),y.type===t.Document&&(this.isRoot=!0,this.documentObject=y,y.rootObject=this,y.children)){for(m=y.children,v=0,L=m.length;v<L;v++)if(x=m[v],x.type===t.DocType){x.name=this.name;break}}}return Object.defineProperty(b.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(b.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(b.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(b.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(b.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(b.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(b.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(b.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new d(this.attribs)),this.attributeMap}}),b.prototype.clone=function(){var y,T,N,x;N=Object.create(this),N.isRoot&&(N.documentObject=null),N.attribs={},x=this.attribs;for(T in x)D.call(x,T)&&(y=x[T],N.attribs[T]=y.clone());return N.children=[],this.children.forEach(function(v){var L;return L=v.clone(),L.parent=N,N.children.push(L)}),N},b.prototype.attribute=function(y,T){var N,x;if(y!=null&&(y=l(y)),f(y))for(N in y)D.call(y,N)&&(x=y[N],this.attribute(N,x));else a(T)&&(T=T.apply()),this.options.keepNullAttributes&&T==null?this.attribs[y]=new e(this,y,""):T!=null&&(this.attribs[y]=new e(this,y,T));return this},b.prototype.removeAttribute=function(y){var T,N,x;if(y==null)throw new Error("Missing attribute name. "+this.debugInfo());if(y=l(y),Array.isArray(y))for(N=0,x=y.length;N<x;N++)T=y[N],delete this.attribs[T];else delete this.attribs[y];return this},b.prototype.toString=function(y){return this.options.writer.element(this,this.options.writer.filterOptions(y))},b.prototype.att=function(y,T){return this.attribute(y,T)},b.prototype.a=function(y,T){return this.attribute(y,T)},b.prototype.getAttribute=function(y){return this.attribs.hasOwnProperty(y)?this.attribs[y].value:null},b.prototype.setAttribute=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getAttributeNode=function(y){return this.attribs.hasOwnProperty(y)?this.attribs[y]:null},b.prototype.setAttributeNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.removeAttributeNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getElementsByTagName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getAttributeNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.setAttributeNS=function(y,T,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.removeAttributeNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getAttributeNodeNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.setAttributeNodeNS=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getElementsByTagNameNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.hasAttribute=function(y){return this.attribs.hasOwnProperty(y)},b.prototype.hasAttributeNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.setIdAttribute=function(y,T){return this.attribs.hasOwnProperty(y)?this.attribs[y].isId:T},b.prototype.setIdAttributeNS=function(y,T,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.setIdAttributeNode=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getElementsByTagName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getElementsByTagNameNS=function(y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.getElementsByClassName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.isEqualNode=function(y){var T,N,x;if(!b.__super__.isEqualNode.apply(this,arguments).isEqualNode(y)||y.namespaceURI!==this.namespaceURI||y.prefix!==this.prefix||y.localName!==this.localName||y.attribs.length!==this.attribs.length)return!1;for(T=N=0,x=this.attribs.length-1;0<=x?N<=x:N>=x;T=0<=x?++N:--N)if(!this.attribs[T].isEqualNode(y.attribs[T]))return!1;return!0},b})(n)}).call(Ie)});var dt=F((Le,_e)=>{(function(){var t,e,u=function(n,l){for(var a in l)d.call(l,a)&&(n[a]=l[a]);function f(){this.constructor=n}return f.prototype=l.prototype,n.prototype=new f,n.__super__=l.prototype,n},d={}.hasOwnProperty;e=K(),_e.exports=t=(function(n){u(l,n);function l(a){l.__super__.constructor.call(this,a),this.value=""}return Object.defineProperty(l.prototype,"data",{get:function(){return this.value},set:function(a){return this.value=a||""}}),Object.defineProperty(l.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(l.prototype,"textContent",{get:function(){return this.value},set:function(a){return this.value=a||""}}),l.prototype.clone=function(){return Object.create(this)},l.prototype.substringData=function(a,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.appendData=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.insertData=function(a,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.deleteData=function(a,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.replaceData=function(a,f,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.isEqualNode=function(a){return!(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.data!==this.data)},l})(e)}).call(Le)});var bt=F((Me,ve)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;t=k(),u=dt(),ve.exports=e=(function(l){d(a,l);function a(f,h){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(h)}return a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return this.options.writer.cdata(this,this.options.writer.filterOptions(f))},a})(u)}).call(Me)});var Dt=F((xe,Ae)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;t=k(),e=dt(),Ae.exports=u=(function(l){d(a,l);function a(f,h){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(h)}return a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return this.options.writer.comment(this,this.options.writer.filterOptions(f))},a})(e)}).call(xe)});var Et=F((Pe,Se)=>{(function(){var t,e,u,d,n=function(a,f){for(var h in f)l.call(f,h)&&(a[h]=f[h]);function w(){this.constructor=a}return w.prototype=f.prototype,a.prototype=new w,a.__super__=f.prototype,a},l={}.hasOwnProperty;d=tt().isObject,u=K(),t=k(),Se.exports=e=(function(a){n(f,a);function f(h,w,D,O){var b;f.__super__.constructor.call(this,h),d(w)&&(b=w,w=b.version,D=b.encoding,O=b.standalone),w||(w="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(w),D!=null&&(this.encoding=this.stringify.xmlEncoding(D)),O!=null&&(this.standalone=this.stringify.xmlStandalone(O))}return f.prototype.toString=function(h){return this.options.writer.declaration(this,this.options.writer.filterOptions(h))},f})(u)}).call(Pe)});var Nt=F((Fe,Re)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;u=K(),t=k(),Re.exports=e=(function(l){d(a,l);function a(f,h,w,D,O,b){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(w==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(h));if(!D)throw new Error("Missing DTD attribute type. "+this.debugInfo(h));if(!O)throw new Error("Missing DTD attribute default. "+this.debugInfo(h));if(O.indexOf("#")!==0&&(O="#"+O),!O.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(h));if(b&&!O.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(h));this.elementName=this.stringify.name(h),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(w),this.attributeType=this.stringify.dtdAttType(D),b&&(this.defaultValue=this.stringify.dtdAttDefault(b)),this.defaultValueType=O}return a.prototype.toString=function(f){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(f))},a})(u)}).call(Fe)});var Ot=F((Xe,qe)=>{(function(){var t,e,u,d,n=function(a,f){for(var h in f)l.call(f,h)&&(a[h]=f[h]);function w(){this.constructor=a}return w.prototype=f.prototype,a.prototype=new w,a.__super__=f.prototype,a},l={}.hasOwnProperty;d=tt().isObject,u=K(),t=k(),qe.exports=e=(function(a){n(f,a);function f(h,w,D,O){if(f.__super__.constructor.call(this,h),D==null)throw new Error("Missing DTD entity name. "+this.debugInfo(D));if(O==null)throw new Error("Missing DTD entity value. "+this.debugInfo(D));if(this.pe=!!w,this.name=this.stringify.name(D),this.type=t.EntityDeclaration,!d(O))this.value=this.stringify.dtdEntityValue(O),this.internal=!0;else{if(!O.pubID&&!O.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(D));if(O.pubID&&!O.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(D));if(this.internal=!1,O.pubID!=null&&(this.pubID=this.stringify.dtdPubID(O.pubID)),O.sysID!=null&&(this.sysID=this.stringify.dtdSysID(O.sysID)),O.nData!=null&&(this.nData=this.stringify.dtdNData(O.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(D))}}return Object.defineProperty(f.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(f.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(f.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(f.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(f.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(f.prototype,"xmlVersion",{get:function(){return null}}),f.prototype.toString=function(h){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(h))},f})(u)}).call(Xe)});var It=F((je,Be)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;u=K(),t=k(),Be.exports=e=(function(l){d(a,l);function a(f,h,w){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing DTD element name. "+this.debugInfo());w||(w="(#PCDATA)"),Array.isArray(w)&&(w="("+w.join(",")+")"),this.name=this.stringify.name(h),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(w)}return a.prototype.toString=function(f){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(f))},a})(u)}).call(je)});var Ct=F((Ue,We)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;u=K(),t=k(),We.exports=e=(function(l){d(a,l);function a(f,h,w){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing DTD notation name. "+this.debugInfo(h));if(!w.pubID&&!w.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(h));this.name=this.stringify.name(h),this.type=t.NotationDeclaration,w.pubID!=null&&(this.pubID=this.stringify.dtdPubID(w.pubID)),w.sysID!=null&&(this.sysID=this.stringify.dtdSysID(w.sysID))}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),a.prototype.toString=function(f){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(f))},a})(u)}).call(Ue)});var Lt=F((Ve,ke)=>{(function(){var t,e,u,d,n,l,a,f,h,w=function(O,b){for(var y in b)D.call(b,y)&&(O[y]=b[y]);function T(){this.constructor=O}return T.prototype=b.prototype,O.prototype=new T,O.__super__=b.prototype,O},D={}.hasOwnProperty;h=tt().isObject,f=K(),t=k(),e=Nt(),d=Ot(),u=It(),n=Ct(),a=wt(),ke.exports=l=(function(O){w(b,O);function b(y,T,N){var x,v,L,m,o,i;if(b.__super__.constructor.call(this,y),this.type=t.DocType,y.children){for(m=y.children,v=0,L=m.length;v<L;v++)if(x=m[v],x.type===t.Element){this.name=x.name;break}}this.documentObject=y,h(T)&&(o=T,T=o.pubID,N=o.sysID),N==null&&(i=[T,N],N=i[0],T=i[1]),T!=null&&(this.pubID=this.stringify.dtdPubID(T)),N!=null&&(this.sysID=this.stringify.dtdSysID(N))}return Object.defineProperty(b.prototype,"entities",{get:function(){var y,T,N,x,v;for(x={},v=this.children,T=0,N=v.length;T<N;T++)y=v[T],y.type===t.EntityDeclaration&&!y.pe&&(x[y.name]=y);return new a(x)}}),Object.defineProperty(b.prototype,"notations",{get:function(){var y,T,N,x,v;for(x={},v=this.children,T=0,N=v.length;T<N;T++)y=v[T],y.type===t.NotationDeclaration&&(x[y.name]=y);return new a(x)}}),Object.defineProperty(b.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(b.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(b.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),b.prototype.element=function(y,T){var N;return N=new u(this,y,T),this.children.push(N),this},b.prototype.attList=function(y,T,N,x,v){var L;return L=new e(this,y,T,N,x,v),this.children.push(L),this},b.prototype.entity=function(y,T){var N;return N=new d(this,!1,y,T),this.children.push(N),this},b.prototype.pEntity=function(y,T){var N;return N=new d(this,!0,y,T),this.children.push(N),this},b.prototype.notation=function(y,T){var N;return N=new n(this,y,T),this.children.push(N),this},b.prototype.toString=function(y){return this.options.writer.docType(this,this.options.writer.filterOptions(y))},b.prototype.ele=function(y,T){return this.element(y,T)},b.prototype.att=function(y,T,N,x,v){return this.attList(y,T,N,x,v)},b.prototype.ent=function(y,T){return this.entity(y,T)},b.prototype.pent=function(y,T){return this.pEntity(y,T)},b.prototype.not=function(y,T){return this.notation(y,T)},b.prototype.up=function(){return this.root()||this.documentObject},b.prototype.isEqualNode=function(y){return!(!b.__super__.isEqualNode.apply(this,arguments).isEqualNode(y)||y.name!==this.name||y.publicId!==this.publicId||y.systemId!==this.systemId)},b})(f)}).call(Ve)});var _t=F((Ge,Ye)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;t=k(),e=K(),Ye.exports=u=(function(l){d(a,l);function a(f,h){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(h)}return a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return this.options.writer.raw(this,this.options.writer.filterOptions(f))},a})(e)}).call(Ge)});var Mt=F((He,$e)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;t=k(),e=dt(),$e.exports=u=(function(l){d(a,l);function a(f,h){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(h)}return Object.defineProperty(a.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(a.prototype,"wholeText",{get:function(){var f,h,w;for(w="",h=this.previousSibling;h;)w=h.data+w,h=h.previousSibling;for(w+=this.data,f=this.nextSibling;f;)w=w+f.data,f=f.nextSibling;return w}}),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return this.options.writer.text(this,this.options.writer.filterOptions(f))},a.prototype.splitText=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.replaceWholeText=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},a})(e)}).call(He)});var vt=F((ze,Ke)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;t=k(),e=dt(),Ke.exports=u=(function(l){d(a,l);function a(f,h,w){if(a.__super__.constructor.call(this,f),h==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(h),this.name=this.target,w&&(this.value=this.stringify.insValue(w))}return a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(f))},a.prototype.isEqualNode=function(f){return!(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.target!==this.target)},a})(e)}).call(ze)});var kt=F((Qe,Ze)=>{(function(){var t,e,u,d=function(l,a){for(var f in a)n.call(a,f)&&(l[f]=a[f]);function h(){this.constructor=l}return h.prototype=a.prototype,l.prototype=new h,l.__super__=a.prototype,l},n={}.hasOwnProperty;u=K(),t=k(),Ze.exports=e=(function(l){d(a,l);function a(f){a.__super__.constructor.call(this,f),this.type=t.Dummy}return a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(f){return""},a})(u)}).call(Qe)});var er=F((Je,tr)=>{(function(){var t;tr.exports=t=(function(){function e(u){this.nodes=u}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(u){return this.nodes[u]||null},e})()}).call(Je)});var ir=F((rr,nr)=>{(function(){nr.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(rr)});var K=F((or,sr)=>{(function(){var t,e,u,d,n,l,a,f,h,w,D,O,b,y,T,N,x,v,L,m={}.hasOwnProperty;L=tt(),v=L.isObject,x=L.isFunction,N=L.isEmpty,T=L.getValue,f=null,u=null,d=null,n=null,l=null,b=null,y=null,O=null,a=null,e=null,D=null,h=null,t=null,sr.exports=w=(function(){function o(i){this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,f||(f=Tt(),u=bt(),d=Dt(),n=Et(),l=Lt(),b=_t(),y=Mt(),O=vt(),a=kt(),e=k(),D=er(),h=wt(),t=ir())}return Object.defineProperty(o.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(o.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(o.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(o.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(o.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new D(this.children)),this.childNodeList}}),Object.defineProperty(o.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(o.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(o.prototype,"previousSibling",{get:function(){var i;return i=this.parent.children.indexOf(this),this.parent.children[i-1]||null}}),Object.defineProperty(o.prototype,"nextSibling",{get:function(){var i;return i=this.parent.children.indexOf(this),this.parent.children[i+1]||null}}),Object.defineProperty(o.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(o.prototype,"textContent",{get:function(){var i,p,C,I,c;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(c="",I=this.children,p=0,C=I.length;p<C;p++)i=I[p],i.textContent&&(c+=i.textContent);return c}else return null},set:function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),o.prototype.setParent=function(i){var p,C,I,c,g;for(this.parent=i,i&&(this.options=i.options,this.stringify=i.stringify),c=this.children,g=[],C=0,I=c.length;C<I;C++)p=c[C],g.push(p.setParent(this));return g},o.prototype.element=function(i,p,C){var I,c,g,M,A,P,R,X,S,W,q;if(P=null,p===null&&C==null&&(S=[{},null],p=S[0],C=S[1]),p==null&&(p={}),p=T(p),v(p)||(W=[p,C],C=W[0],p=W[1]),i!=null&&(i=T(i)),Array.isArray(i))for(g=0,R=i.length;g<R;g++)c=i[g],P=this.element(c);else if(x(i))P=this.element(i.apply());else if(v(i)){for(A in i)if(m.call(i,A))if(q=i[A],x(q)&&(q=q.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&A.indexOf(this.stringify.convertAttKey)===0)P=this.attribute(A.substr(this.stringify.convertAttKey.length),q);else if(!this.options.separateArrayItems&&Array.isArray(q)&&N(q))P=this.dummy();else if(v(q)&&N(q))P=this.element(A);else if(!this.options.keepNullNodes&&q==null)P=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(q))for(M=0,X=q.length;M<X;M++)c=q[M],I={},I[A]=c,P=this.element(I);else v(q)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&A.indexOf(this.stringify.convertTextKey)===0?P=this.element(q):(P=this.element(A),P.element(q)):P=this.element(A,q)}else!this.options.keepNullNodes&&C===null?P=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&i.indexOf(this.stringify.convertTextKey)===0?P=this.text(C):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&i.indexOf(this.stringify.convertCDataKey)===0?P=this.cdata(C):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&i.indexOf(this.stringify.convertCommentKey)===0?P=this.comment(C):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&i.indexOf(this.stringify.convertRawKey)===0?P=this.raw(C):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&i.indexOf(this.stringify.convertPIKey)===0?P=this.instruction(i.substr(this.stringify.convertPIKey.length),C):P=this.node(i,p,C);if(P==null)throw new Error("Could not create any elements with: "+i+". "+this.debugInfo());return P},o.prototype.insertBefore=function(i,p,C){var I,c,g,M,A;if(i?.type)return g=i,M=p,g.setParent(this),M?(c=children.indexOf(M),A=children.splice(c),children.push(g),Array.prototype.push.apply(children,A)):children.push(g),g;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(i));return c=this.parent.children.indexOf(this),A=this.parent.children.splice(c),I=this.parent.element(i,p,C),Array.prototype.push.apply(this.parent.children,A),I},o.prototype.insertAfter=function(i,p,C){var I,c,g;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(i));return c=this.parent.children.indexOf(this),g=this.parent.children.splice(c+1),I=this.parent.element(i,p,C),Array.prototype.push.apply(this.parent.children,g),I},o.prototype.remove=function(){var i,p;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return i=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[i,i-i+1].concat(p=[])),this.parent},o.prototype.node=function(i,p,C){var I,c;return i!=null&&(i=T(i)),p||(p={}),p=T(p),v(p)||(c=[p,C],C=c[0],p=c[1]),I=new f(this,i,p),C!=null&&I.text(C),this.children.push(I),I},o.prototype.text=function(i){var p;return v(i)&&this.element(i),p=new y(this,i),this.children.push(p),this},o.prototype.cdata=function(i){var p;return p=new u(this,i),this.children.push(p),this},o.prototype.comment=function(i){var p;return p=new d(this,i),this.children.push(p),this},o.prototype.commentBefore=function(i){var p,C,I;return C=this.parent.children.indexOf(this),I=this.parent.children.splice(C),p=this.parent.comment(i),Array.prototype.push.apply(this.parent.children,I),this},o.prototype.commentAfter=function(i){var p,C,I;return C=this.parent.children.indexOf(this),I=this.parent.children.splice(C+1),p=this.parent.comment(i),Array.prototype.push.apply(this.parent.children,I),this},o.prototype.raw=function(i){var p;return p=new b(this,i),this.children.push(p),this},o.prototype.dummy=function(){var i;return i=new a(this),i},o.prototype.instruction=function(i,p){var C,I,c,g,M;if(i!=null&&(i=T(i)),p!=null&&(p=T(p)),Array.isArray(i))for(g=0,M=i.length;g<M;g++)C=i[g],this.instruction(C);else if(v(i))for(C in i)m.call(i,C)&&(I=i[C],this.instruction(C,I));else x(p)&&(p=p.apply()),c=new O(this,i,p),this.children.push(c);return this},o.prototype.instructionBefore=function(i,p){var C,I,c;return I=this.parent.children.indexOf(this),c=this.parent.children.splice(I),C=this.parent.instruction(i,p),Array.prototype.push.apply(this.parent.children,c),this},o.prototype.instructionAfter=function(i,p){var C,I,c;return I=this.parent.children.indexOf(this),c=this.parent.children.splice(I+1),C=this.parent.instruction(i,p),Array.prototype.push.apply(this.parent.children,c),this},o.prototype.declaration=function(i,p,C){var I,c;return I=this.document(),c=new n(I,i,p,C),I.children.length===0?I.children.unshift(c):I.children[0].type===e.Declaration?I.children[0]=c:I.children.unshift(c),I.root()||I},o.prototype.dtd=function(i,p){var C,I,c,g,M,A,P,R,X,S;for(I=this.document(),c=new l(I,i,p),X=I.children,g=M=0,P=X.length;M<P;g=++M)if(C=X[g],C.type===e.DocType)return I.children[g]=c,c;for(S=I.children,g=A=0,R=S.length;A<R;g=++A)if(C=S[g],C.isRoot)return I.children.splice(g,0,c),c;return I.children.push(c),c},o.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},o.prototype.root=function(){var i;for(i=this;i;){if(i.type===e.Document)return i.rootObject;if(i.isRoot)return i;i=i.parent}},o.prototype.document=function(){var i;for(i=this;i;){if(i.type===e.Document)return i;i=i.parent}},o.prototype.end=function(i){return this.document().end(i)},o.prototype.prev=function(){var i;if(i=this.parent.children.indexOf(this),i<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[i-1]},o.prototype.next=function(){var i;if(i=this.parent.children.indexOf(this),i===-1||i===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[i+1]},o.prototype.importDocument=function(i){var p;return p=i.root().clone(),p.parent=this,p.isRoot=!1,this.children.push(p),this},o.prototype.debugInfo=function(i){var p,C;return i=i||this.name,i==null&&!((p=this.parent)!=null&&p.name)?"":i==null?"parent: <"+this.parent.name+">":(C=this.parent)!=null&&C.name?"node: <"+i+">, parent: <"+this.parent.name+">":"node: <"+i+">"},o.prototype.ele=function(i,p,C){return this.element(i,p,C)},o.prototype.nod=function(i,p,C){return this.node(i,p,C)},o.prototype.txt=function(i){return this.text(i)},o.prototype.dat=function(i){return this.cdata(i)},o.prototype.com=function(i){return this.comment(i)},o.prototype.ins=function(i,p){return this.instruction(i,p)},o.prototype.doc=function(){return this.document()},o.prototype.dec=function(i,p,C){return this.declaration(i,p,C)},o.prototype.e=function(i,p,C){return this.element(i,p,C)},o.prototype.n=function(i,p,C){return this.node(i,p,C)},o.prototype.t=function(i){return this.text(i)},o.prototype.d=function(i){return this.cdata(i)},o.prototype.c=function(i){return this.comment(i)},o.prototype.r=function(i){return this.raw(i)},o.prototype.i=function(i,p){return this.instruction(i,p)},o.prototype.u=function(){return this.up()},o.prototype.importXMLBuilder=function(i){return this.importDocument(i)},o.prototype.replaceChild=function(i,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.removeChild=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendChild=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.hasChildNodes=function(){return this.children.length!==0},o.prototype.cloneNode=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isSupported=function(i,p){return!0},o.prototype.hasAttributes=function(){return this.attribs.length!==0},o.prototype.compareDocumentPosition=function(i){var p,C;return p=this,p===i?0:this.document()!==i.document()?(C=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?C|=t.Preceding:C|=t.Following,C):p.isAncestor(i)?t.Contains|t.Preceding:p.isDescendant(i)?t.Contains|t.Following:p.isPreceding(i)?t.Preceding:t.Following},o.prototype.isSameNode=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.lookupPrefix=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isDefaultNamespace=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.lookupNamespaceURI=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){var p,C,I;if(i.nodeType!==this.nodeType||i.children.length!==this.children.length)return!1;for(p=C=0,I=this.children.length-1;0<=I?C<=I:C>=I;p=0<=I?++C:--C)if(!this.children[p].isEqualNode(i.children[p]))return!1;return!0},o.prototype.getFeature=function(i,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.setUserData=function(i,p,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.getUserData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.contains=function(i){return i?i===this||this.isDescendant(i):!1},o.prototype.isDescendant=function(i){var p,C,I,c,g;for(g=this.children,I=0,c=g.length;I<c;I++)if(p=g[I],i===p||(C=p.isDescendant(i),C))return!0;return!1},o.prototype.isAncestor=function(i){return i.isDescendant(this)},o.prototype.isPreceding=function(i){var p,C;return p=this.treePosition(i),C=this.treePosition(this),p===-1||C===-1?!1:p<C},o.prototype.isFollowing=function(i){var p,C;return p=this.treePosition(i),C=this.treePosition(this),p===-1||C===-1?!1:p>C},o.prototype.treePosition=function(i){var p,C;return C=0,p=!1,this.foreachTreeNode(this.document(),function(I){if(C++,!p&&I===i)return p=!0}),p?C:-1},o.prototype.foreachTreeNode=function(i,p){var C,I,c,g,M;for(i||(i=this.document()),g=i.children,I=0,c=g.length;I<c;I++){if(C=g[I],M=p(C))return M;if(M=this.foreachTreeNode(C,p),M)return M}},o})()}).call(or)});var Gt=F((ar,ur)=>{(function(){var t,e=function(d,n){return function(){return d.apply(n,arguments)}},u={}.hasOwnProperty;ur.exports=t=(function(){function d(n){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var l,a,f;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),a=n.stringify||{};for(l in a)u.call(a,l)&&(f=a[l],this[l]=f)}return d.prototype.name=function(n){return this.options.noValidation?n:this.assertLegalName(""+n||"")},d.prototype.text=function(n){return this.options.noValidation?n:this.assertLegalChar(this.textEscape(""+n||""))},d.prototype.cdata=function(n){return this.options.noValidation?n:(n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n))},d.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)},d.prototype.raw=function(n){return this.options.noValidation?n:""+n||""},d.prototype.attValue=function(n){return this.options.noValidation?n:this.assertLegalChar(this.attEscape(n=""+n||""))},d.prototype.insTarget=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.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)},d.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},d.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)},d.prototype.xmlStandalone=function(n){return this.options.noValidation?n:n?"yes":"no"},d.prototype.dtdPubID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdSysID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdElementValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdAttType=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdAttDefault=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdEntityValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.dtdNData=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},d.prototype.convertAttKey="@",d.prototype.convertPIKey="?",d.prototype.convertTextKey="#text",d.prototype.convertCDataKey="#cdata",d.prototype.convertCommentKey="#comment",d.prototype.convertRawKey="#raw",d.prototype.assertLegalChar=function(n){var l,a;if(this.options.noValidation)return n;if(l="",this.options.version==="1.0"){if(l=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=n.match(l))throw new Error("Invalid character in string: "+n+" at index "+a.index)}else if(this.options.version==="1.1"&&(l=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=n.match(l)))throw new Error("Invalid character in string: "+n+" at index "+a.index);return n},d.prototype.assertLegalName=function(n){var l;if(this.options.noValidation)return n;if(this.assertLegalChar(n),l=/^([: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(l))throw new Error("Invalid character in name");return n},d.prototype.textEscape=function(n){var l;return this.options.noValidation?n:(l=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(l,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},d.prototype.attEscape=function(n){var l;return this.options.noValidation?n:(l=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(l,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},d})()}).call(ar)});var mt=F((cr,lr)=>{(function(){lr.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(cr)});var Yt=F((fr,hr)=>{(function(){var t,e,u,d,n,l,a,f,h,w,D,O,b,y,T,N,x,v={}.hasOwnProperty;x=tt().assign,t=k(),h=Et(),w=Lt(),u=bt(),d=Dt(),O=Tt(),y=_t(),T=Mt(),b=vt(),D=kt(),n=Nt(),l=It(),a=Ot(),f=Ct(),e=mt(),hr.exports=N=(function(){function L(m){var o,i,p;m||(m={}),this.options=m,i=m.writer||{};for(o in i)v.call(i,o)&&(p=i[o],this["_"+o]=this[o],this[o]=p)}return L.prototype.filterOptions=function(m){var o,i,p,C,I,c,g,M;return m||(m={}),m=x({},this.options,m),o={writer:this},o.pretty=m.pretty||!1,o.allowEmpty=m.allowEmpty||!1,o.indent=(i=m.indent)!=null?i:" ",o.newline=(p=m.newline)!=null?p:`
3
- `,o.offset=(C=m.offset)!=null?C:0,o.dontPrettyTextNodes=(I=(c=m.dontPrettyTextNodes)!=null?c:m.dontprettytextnodes)!=null?I:0,o.spaceBeforeSlash=(g=(M=m.spaceBeforeSlash)!=null?M:m.spacebeforeslash)!=null?g:"",o.spaceBeforeSlash===!0&&(o.spaceBeforeSlash=" "),o.suppressPrettyCount=0,o.user={},o.state=e.None,o},L.prototype.indent=function(m,o,i){var p;return!o.pretty||o.suppressPrettyCount?"":o.pretty&&(p=(i||0)+o.offset+1,p>0)?new Array(p).join(o.indent):""},L.prototype.endline=function(m,o,i){return!o.pretty||o.suppressPrettyCount?"":o.newline},L.prototype.attribute=function(m,o,i){var p;return this.openAttribute(m,o,i),p=" "+m.name+'="'+m.value+'"',this.closeAttribute(m,o,i),p},L.prototype.cdata=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<![CDATA[",o.state=e.InsideTag,p+=m.value,o.state=e.CloseTag,p+="]]>"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.comment=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<!-- ",o.state=e.InsideTag,p+=m.value,o.state=e.CloseTag,p+=" -->"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.declaration=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<?xml",o.state=e.InsideTag,p+=' version="'+m.version+'"',m.encoding!=null&&(p+=' encoding="'+m.encoding+'"'),m.standalone!=null&&(p+=' standalone="'+m.standalone+'"'),o.state=e.CloseTag,p+=o.spaceBeforeSlash+"?>",p+=this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.docType=function(m,o,i){var p,C,I,c,g;if(i||(i=0),this.openNode(m,o,i),o.state=e.OpenTag,c=this.indent(m,o,i),c+="<!DOCTYPE "+m.root().name,m.pubID&&m.sysID?c+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.sysID&&(c+=' SYSTEM "'+m.sysID+'"'),m.children.length>0){for(c+=" [",c+=this.endline(m,o,i),o.state=e.InsideTag,g=m.children,C=0,I=g.length;C<I;C++)p=g[C],c+=this.writeChildNode(p,o,i+1);o.state=e.CloseTag,c+="]"}return o.state=e.CloseTag,c+=o.spaceBeforeSlash+">",c+=this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),c},L.prototype.element=function(m,o,i){var p,C,I,c,g,M,A,P,R,X,S,W,q,J;i||(i=0),X=!1,S="",this.openNode(m,o,i),o.state=e.OpenTag,S+=this.indent(m,o,i)+"<"+m.name,W=m.attribs;for(R in W)v.call(W,R)&&(p=W[R],S+=this.attribute(p,o,i));if(I=m.children.length,c=I===0?null:m.children[0],I===0||m.children.every(function(ht){return(ht.type===t.Text||ht.type===t.Raw)&&ht.value===""}))o.allowEmpty?(S+=">",o.state=e.CloseTag,S+="</"+m.name+">"+this.endline(m,o,i)):(o.state=e.CloseTag,S+=o.spaceBeforeSlash+"/>"+this.endline(m,o,i));else if(o.pretty&&I===1&&(c.type===t.Text||c.type===t.Raw)&&c.value!=null)S+=">",o.state=e.InsideTag,o.suppressPrettyCount++,X=!0,S+=this.writeChildNode(c,o,i+1),o.suppressPrettyCount--,X=!1,o.state=e.CloseTag,S+="</"+m.name+">"+this.endline(m,o,i);else{if(o.dontPrettyTextNodes){for(q=m.children,g=0,A=q.length;g<A;g++)if(C=q[g],(C.type===t.Text||C.type===t.Raw)&&C.value!=null){o.suppressPrettyCount++,X=!0;break}}for(S+=">"+this.endline(m,o,i),o.state=e.InsideTag,J=m.children,M=0,P=J.length;M<P;M++)C=J[M],S+=this.writeChildNode(C,o,i+1);o.state=e.CloseTag,S+=this.indent(m,o,i)+"</"+m.name+">",X&&o.suppressPrettyCount--,S+=this.endline(m,o,i),o.state=e.None}return this.closeNode(m,o,i),S},L.prototype.writeChildNode=function(m,o,i){switch(m.type){case t.CData:return this.cdata(m,o,i);case t.Comment:return this.comment(m,o,i);case t.Element:return this.element(m,o,i);case t.Raw:return this.raw(m,o,i);case t.Text:return this.text(m,o,i);case t.ProcessingInstruction:return this.processingInstruction(m,o,i);case t.Dummy:return"";case t.Declaration:return this.declaration(m,o,i);case t.DocType:return this.docType(m,o,i);case t.AttributeDeclaration:return this.dtdAttList(m,o,i);case t.ElementDeclaration:return this.dtdElement(m,o,i);case t.EntityDeclaration:return this.dtdEntity(m,o,i);case t.NotationDeclaration:return this.dtdNotation(m,o,i);default:throw new Error("Unknown XML node type: "+m.constructor.name)}},L.prototype.processingInstruction=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<?",o.state=e.InsideTag,p+=m.target,m.value&&(p+=" "+m.value),o.state=e.CloseTag,p+=o.spaceBeforeSlash+"?>",p+=this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.raw=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i),o.state=e.InsideTag,p+=m.value,o.state=e.CloseTag,p+=this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.text=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i),o.state=e.InsideTag,p+=m.value,o.state=e.CloseTag,p+=this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.dtdAttList=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<!ATTLIST",o.state=e.InsideTag,p+=" "+m.elementName+" "+m.attributeName+" "+m.attributeType,m.defaultValueType!=="#DEFAULT"&&(p+=" "+m.defaultValueType),m.defaultValue&&(p+=' "'+m.defaultValue+'"'),o.state=e.CloseTag,p+=o.spaceBeforeSlash+">"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.dtdElement=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<!ELEMENT",o.state=e.InsideTag,p+=" "+m.name+" "+m.value,o.state=e.CloseTag,p+=o.spaceBeforeSlash+">"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.dtdEntity=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<!ENTITY",o.state=e.InsideTag,m.pe&&(p+=" %"),p+=" "+m.name,m.value?p+=' "'+m.value+'"':(m.pubID&&m.sysID?p+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.sysID&&(p+=' SYSTEM "'+m.sysID+'"'),m.nData&&(p+=" NDATA "+m.nData)),o.state=e.CloseTag,p+=o.spaceBeforeSlash+">"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.dtdNotation=function(m,o,i){var p;return this.openNode(m,o,i),o.state=e.OpenTag,p=this.indent(m,o,i)+"<!NOTATION",o.state=e.InsideTag,p+=" "+m.name,m.pubID&&m.sysID?p+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.pubID?p+=' PUBLIC "'+m.pubID+'"':m.sysID&&(p+=' SYSTEM "'+m.sysID+'"'),o.state=e.CloseTag,p+=o.spaceBeforeSlash+">"+this.endline(m,o,i),o.state=e.None,this.closeNode(m,o,i),p},L.prototype.openNode=function(m,o,i){},L.prototype.closeNode=function(m,o,i){},L.prototype.openAttribute=function(m,o,i){},L.prototype.closeAttribute=function(m,o,i){},L})()}).call(fr)});var xt=F((pr,dr)=>{(function(){var t,e,u=function(n,l){for(var a in l)d.call(l,a)&&(n[a]=l[a]);function f(){this.constructor=n}return f.prototype=l.prototype,n.prototype=new f,n.__super__=l.prototype,n},d={}.hasOwnProperty;e=Yt(),dr.exports=t=(function(n){u(l,n);function l(a){l.__super__.constructor.call(this,a)}return l.prototype.document=function(a,f){var h,w,D,O,b;for(f=this.filterOptions(f),O="",b=a.children,w=0,D=b.length;w<D;w++)h=b[w],O+=this.writeChildNode(h,f,0);return f.pretty&&O.slice(-f.newline.length)===f.newline&&(O=O.slice(0,-f.newline.length)),O},l})(e)}).call(pr)});var Ht=F((mr,yr)=>{(function(){var t,e,u,d,n,l,a,f,h=function(D,O){for(var b in O)w.call(O,b)&&(D[b]=O[b]);function y(){this.constructor=D}return y.prototype=O.prototype,D.prototype=new y,D.__super__=O.prototype,D},w={}.hasOwnProperty;f=tt().isPlainObject,u=Wt(),e=we(),n=K(),t=k(),a=Gt(),l=xt(),yr.exports=d=(function(D){h(O,D);function O(b){O.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,b||(b={}),b.writer||(b.writer=new l),this.options=b,this.stringify=new a(b)}return Object.defineProperty(O.prototype,"implementation",{value:new u}),Object.defineProperty(O.prototype,"doctype",{get:function(){var b,y,T,N;for(N=this.children,y=0,T=N.length;y<T;y++)if(b=N[y],b.type===t.DocType)return b;return null}}),Object.defineProperty(O.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(O.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(O.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(O.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(O.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(O.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(O.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(O.prototype,"origin",{get:function(){return null}}),Object.defineProperty(O.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(O.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(O.prototype,"contentType",{get:function(){return null}}),O.prototype.end=function(b){var y;return y={},b?f(b)&&(y=b,b=this.options.writer):b=this.options.writer,b.document(this,b.filterOptions(y))},O.prototype.toString=function(b){return this.options.writer.document(this,this.options.writer.filterOptions(b))},O.prototype.createElement=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createTextNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createComment=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createCDATASection=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createProcessingInstruction=function(b,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createAttribute=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createEntityReference=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByTagName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.importNode=function(b,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createElementNS=function(b,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createAttributeNS=function(b,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByTagNameNS=function(b,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementById=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.adoptNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.renameNode=function(b,y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByClassName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createEvent=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createNodeIterator=function(b,y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createTreeWalker=function(b,y,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O})(n)}).call(mr)});var Tr=F((gr,wr)=>{(function(){var t,e,u,d,n,l,a,f,h,w,D,O,b,y,T,N,x,v,L,m,o,i,p,C,I={}.hasOwnProperty;C=tt(),i=C.isObject,o=C.isFunction,p=C.isPlainObject,m=C.getValue,t=k(),O=Ht(),y=Tt(),d=bt(),n=Dt(),N=_t(),L=Mt(),T=vt(),w=Et(),D=Lt(),l=Nt(),f=Ot(),a=It(),h=Ct(),u=Vt(),v=Gt(),x=xt(),e=mt(),wr.exports=b=(function(){function c(g,M,A){var P;this.name="?xml",this.type=t.Document,g||(g={}),P={},g.writer?p(g.writer)&&(P=g.writer,g.writer=new x):g.writer=new x,this.options=g,this.writer=g.writer,this.writerOptions=this.writer.filterOptions(P),this.stringify=new v(g),this.onDataCallback=M||function(){},this.onEndCallback=A||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return c.prototype.createChildNode=function(g){var M,A,P,R,X,S,W,q;switch(g.type){case t.CData:this.cdata(g.value);break;case t.Comment:this.comment(g.value);break;case t.Element:P={},W=g.attribs;for(A in W)I.call(W,A)&&(M=W[A],P[A]=M.value);this.node(g.name,P);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(g.value);break;case t.Text:this.text(g.value);break;case t.ProcessingInstruction:this.instruction(g.target,g.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+g.constructor.name)}for(q=g.children,X=0,S=q.length;X<S;X++)R=q[X],this.createChildNode(R),R.type===t.Element&&this.up();return this},c.prototype.dummy=function(){return this},c.prototype.node=function(g,M,A){var P;if(g==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(g));return this.openCurrent(),g=m(g),M==null&&(M={}),M=m(M),i(M)||(P=[M,A],A=P[0],M=P[1]),this.currentNode=new y(this,g,M),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,A!=null&&this.text(A),this},c.prototype.element=function(g,M,A){var P,R,X,S,W,q;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(g)||i(g)||o(g))for(S=this.options.noValidation,this.options.noValidation=!0,q=new O(this.options).element("TEMP_ROOT"),q.element(g),this.options.noValidation=S,W=q.children,R=0,X=W.length;R<X;R++)P=W[R],this.createChildNode(P),P.type===t.Element&&this.up();else this.node(g,M,A);return this},c.prototype.attribute=function(g,M){var A,P;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(g));if(g!=null&&(g=m(g)),i(g))for(A in g)I.call(g,A)&&(P=g[A],this.attribute(A,P));else o(M)&&(M=M.apply()),this.options.keepNullAttributes&&M==null?this.currentNode.attribs[g]=new u(this,g,""):M!=null&&(this.currentNode.attribs[g]=new u(this,g,M));return this},c.prototype.text=function(g){var M;return this.openCurrent(),M=new L(this,g),this.onData(this.writer.text(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.cdata=function(g){var M;return this.openCurrent(),M=new d(this,g),this.onData(this.writer.cdata(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.comment=function(g){var M;return this.openCurrent(),M=new n(this,g),this.onData(this.writer.comment(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.raw=function(g){var M;return this.openCurrent(),M=new N(this,g),this.onData(this.writer.raw(M,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.instruction=function(g,M){var A,P,R,X,S;if(this.openCurrent(),g!=null&&(g=m(g)),M!=null&&(M=m(M)),Array.isArray(g))for(A=0,X=g.length;A<X;A++)P=g[A],this.instruction(P);else if(i(g))for(P in g)I.call(g,P)&&(R=g[P],this.instruction(P,R));else o(M)&&(M=M.apply()),S=new T(this,g,M),this.onData(this.writer.processingInstruction(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},c.prototype.declaration=function(g,M,A){var P;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return P=new w(this,g,M,A),this.onData(this.writer.declaration(P,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.doctype=function(g,M,A){if(this.openCurrent(),g==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 D(this,M,A),this.currentNode.rootNodeName=g,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},c.prototype.dtdElement=function(g,M){var A;return this.openCurrent(),A=new a(this,g,M),this.onData(this.writer.dtdElement(A,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.attList=function(g,M,A,P,R){var X;return this.openCurrent(),X=new l(this,g,M,A,P,R),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.entity=function(g,M){var A;return this.openCurrent(),A=new f(this,!1,g,M),this.onData(this.writer.dtdEntity(A,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.pEntity=function(g,M){var A;return this.openCurrent(),A=new f(this,!0,g,M),this.onData(this.writer.dtdEntity(A,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.notation=function(g,M){var A;return this.openCurrent(),A=new h(this,g,M),this.onData(this.writer.dtdNotation(A,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},c.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},c.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},c.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},c.prototype.openNode=function(g){var M,A,P,R;if(!g.isOpen){if(!this.root&&this.currentLevel===0&&g.type===t.Element&&(this.root=g),A="",g.type===t.Element){this.writerOptions.state=e.OpenTag,A=this.writer.indent(g,this.writerOptions,this.currentLevel)+"<"+g.name,R=g.attribs;for(P in R)I.call(R,P)&&(M=R[P],A+=this.writer.attribute(M,this.writerOptions,this.currentLevel));A+=(g.children?">":"/>")+this.writer.endline(g,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,A=this.writer.indent(g,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+g.rootNodeName,g.pubID&&g.sysID?A+=' PUBLIC "'+g.pubID+'" "'+g.sysID+'"':g.sysID&&(A+=' SYSTEM "'+g.sysID+'"'),g.children?(A+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,A+=">"),A+=this.writer.endline(g,this.writerOptions,this.currentLevel);return this.onData(A,this.currentLevel),g.isOpen=!0}},c.prototype.closeNode=function(g){var M;if(!g.isClosed)return M="",this.writerOptions.state=e.CloseTag,g.type===t.Element?M=this.writer.indent(g,this.writerOptions,this.currentLevel)+"</"+g.name+">"+this.writer.endline(g,this.writerOptions,this.currentLevel):M=this.writer.indent(g,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(g,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(M,this.currentLevel),g.isClosed=!0},c.prototype.onData=function(g,M){return this.documentStarted=!0,this.onDataCallback(g,M+1)},c.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},c.prototype.debugInfo=function(g){return g==null?"":"node: <"+g+">"},c.prototype.ele=function(){return this.element.apply(this,arguments)},c.prototype.nod=function(g,M,A){return this.node(g,M,A)},c.prototype.txt=function(g){return this.text(g)},c.prototype.dat=function(g){return this.cdata(g)},c.prototype.com=function(g){return this.comment(g)},c.prototype.ins=function(g,M){return this.instruction(g,M)},c.prototype.dec=function(g,M,A){return this.declaration(g,M,A)},c.prototype.dtd=function(g,M,A){return this.doctype(g,M,A)},c.prototype.e=function(g,M,A){return this.element(g,M,A)},c.prototype.n=function(g,M,A){return this.node(g,M,A)},c.prototype.t=function(g){return this.text(g)},c.prototype.d=function(g){return this.cdata(g)},c.prototype.c=function(g){return this.comment(g)},c.prototype.r=function(g){return this.raw(g)},c.prototype.i=function(g,M){return this.instruction(g,M)},c.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},c.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},c.prototype.ent=function(g,M){return this.entity(g,M)},c.prototype.pent=function(g,M){return this.pEntity(g,M)},c.prototype.not=function(g,M){return this.notation(g,M)},c})()}).call(gr)});var Er=F((br,Dr)=>{(function(){var t,e,u,d,n=function(a,f){for(var h in f)l.call(f,h)&&(a[h]=f[h]);function w(){this.constructor=a}return w.prototype=f.prototype,a.prototype=new w,a.__super__=f.prototype,a},l={}.hasOwnProperty;t=k(),d=Yt(),e=mt(),Dr.exports=u=(function(a){n(f,a);function f(h,w){this.stream=h,f.__super__.constructor.call(this,w)}return f.prototype.endline=function(h,w,D){return h.isLastRootNode&&w.state===e.CloseTag?"":f.__super__.endline.call(this,h,w,D)},f.prototype.document=function(h,w){var D,O,b,y,T,N,x,v,L;for(x=h.children,O=b=0,T=x.length;b<T;O=++b)D=x[O],D.isLastRootNode=O===h.children.length-1;for(w=this.filterOptions(w),v=h.children,L=[],y=0,N=v.length;y<N;y++)D=v[y],L.push(this.writeChildNode(D,w,0));return L},f.prototype.attribute=function(h,w,D){return this.stream.write(f.__super__.attribute.call(this,h,w,D))},f.prototype.cdata=function(h,w,D){return this.stream.write(f.__super__.cdata.call(this,h,w,D))},f.prototype.comment=function(h,w,D){return this.stream.write(f.__super__.comment.call(this,h,w,D))},f.prototype.declaration=function(h,w,D){return this.stream.write(f.__super__.declaration.call(this,h,w,D))},f.prototype.docType=function(h,w,D){var O,b,y,T;if(D||(D=0),this.openNode(h,w,D),w.state=e.OpenTag,this.stream.write(this.indent(h,w,D)),this.stream.write("<!DOCTYPE "+h.root().name),h.pubID&&h.sysID?this.stream.write(' PUBLIC "'+h.pubID+'" "'+h.sysID+'"'):h.sysID&&this.stream.write(' SYSTEM "'+h.sysID+'"'),h.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(h,w,D)),w.state=e.InsideTag,T=h.children,b=0,y=T.length;b<y;b++)O=T[b],this.writeChildNode(O,w,D+1);w.state=e.CloseTag,this.stream.write("]")}return w.state=e.CloseTag,this.stream.write(w.spaceBeforeSlash+">"),this.stream.write(this.endline(h,w,D)),w.state=e.None,this.closeNode(h,w,D)},f.prototype.element=function(h,w,D){var O,b,y,T,N,x,v,L,m,o;D||(D=0),this.openNode(h,w,D),w.state=e.OpenTag,this.stream.write(this.indent(h,w,D)+"<"+h.name),m=h.attribs;for(v in m)l.call(m,v)&&(O=m[v],this.attribute(O,w,D));if(y=h.children.length,T=y===0?null:h.children[0],y===0||h.children.every(function(i){return(i.type===t.Text||i.type===t.Raw)&&i.value===""}))w.allowEmpty?(this.stream.write(">"),w.state=e.CloseTag,this.stream.write("</"+h.name+">")):(w.state=e.CloseTag,this.stream.write(w.spaceBeforeSlash+"/>"));else if(w.pretty&&y===1&&(T.type===t.Text||T.type===t.Raw)&&T.value!=null)this.stream.write(">"),w.state=e.InsideTag,w.suppressPrettyCount++,L=!0,this.writeChildNode(T,w,D+1),w.suppressPrettyCount--,L=!1,w.state=e.CloseTag,this.stream.write("</"+h.name+">");else{for(this.stream.write(">"+this.endline(h,w,D)),w.state=e.InsideTag,o=h.children,N=0,x=o.length;N<x;N++)b=o[N],this.writeChildNode(b,w,D+1);w.state=e.CloseTag,this.stream.write(this.indent(h,w,D)+"</"+h.name+">")}return this.stream.write(this.endline(h,w,D)),w.state=e.None,this.closeNode(h,w,D)},f.prototype.processingInstruction=function(h,w,D){return this.stream.write(f.__super__.processingInstruction.call(this,h,w,D))},f.prototype.raw=function(h,w,D){return this.stream.write(f.__super__.raw.call(this,h,w,D))},f.prototype.text=function(h,w,D){return this.stream.write(f.__super__.text.call(this,h,w,D))},f.prototype.dtdAttList=function(h,w,D){return this.stream.write(f.__super__.dtdAttList.call(this,h,w,D))},f.prototype.dtdElement=function(h,w,D){return this.stream.write(f.__super__.dtdElement.call(this,h,w,D))},f.prototype.dtdEntity=function(h,w,D){return this.stream.write(f.__super__.dtdEntity.call(this,h,w,D))},f.prototype.dtdNotation=function(h,w,D){return this.stream.write(f.__super__.dtdNotation.call(this,h,w,D))},f})(d)}).call(br)});var Or=F((Nr,at)=>{(function(){var t,e,u,d,n,l,a,f,h,w;w=tt(),f=w.assign,h=w.isFunction,u=Wt(),d=Ht(),n=Tr(),a=xt(),l=Er(),t=k(),e=mt(),at.exports.create=function(D,O,b,y){var T,N;if(D==null)throw new Error("Root element needs a name.");return y=f({},O,b,y),T=new d(y),N=T.element(D),y.headless||(T.declaration(y),(y.pubID!=null||y.sysID!=null)&&T.dtd(y)),N},at.exports.begin=function(D,O,b){var y;return h(D)&&(y=[D,O],O=y[0],b=y[1],D={}),O?new n(D,O,b):new d(D)},at.exports.stringWriter=function(D){return new a(D)},at.exports.streamWriter=function(D,O){return new l(D,O)},at.exports.implementation=new u,at.exports.nodeType=t,at.exports.writerState=e}).call(Nr)});var Ir=F($t=>{(function(){"use strict";var t,e,u,d,n,l={}.hasOwnProperty;t=Or(),e=gt().defaults,d=function(a){return typeof a=="string"&&(a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0)},n=function(a){return"<![CDATA["+u(a)+"]]>"},u=function(a){return a.replace("]]>","]]]]><![CDATA[>")},$t.Builder=(function(){function a(f){var h,w,D;this.options={},w=e["0.2"];for(h in w)l.call(w,h)&&(D=w[h],this.options[h]=D);for(h in f)l.call(f,h)&&(D=f[h],this.options[h]=D)}return a.prototype.buildObject=function(f){var h,w,D,O,b;return h=this.options.attrkey,w=this.options.charkey,Object.keys(f).length===1&&this.options.rootName===e["0.2"].rootName?(b=Object.keys(f)[0],f=f[b]):b=this.options.rootName,D=(function(y){return function(T,N){var x,v,L,m,o,i;if(typeof N!="object")y.options.cdata&&d(N)?T.raw(n(N)):T.txt(N);else if(Array.isArray(N)){for(m in N)if(l.call(N,m)){v=N[m];for(o in v)L=v[o],T=D(T.ele(o),L).up()}}else for(o in N)if(l.call(N,o))if(v=N[o],o===h){if(typeof v=="object")for(x in v)i=v[x],T=T.att(x,i)}else if(o===w)y.options.cdata&&d(v)?T=T.raw(n(v)):T=T.txt(v);else if(Array.isArray(v))for(m in v)l.call(v,m)&&(L=v[m],typeof L=="string"?y.options.cdata&&d(L)?T=T.ele(o).raw(n(L)).up():T=T.ele(o,L).up():T=D(T.ele(o),L).up());else typeof v=="object"?T=D(T.ele(o),v).up():typeof v=="string"&&y.options.cdata&&d(v)?T=T.ele(o).raw(n(v)).up():(v==null&&(v=""),T=T.ele(o,v.toString()).up());return T}})(this),O=t.create(b,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),D(O,f).end(this.options.renderOpts)},a})()}).call($t)});var Cr=F((Un,zt)=>{function H(t){if(t)return mn(t);this._callbacks=new Map}function mn(t){return Object.assign(t,H.prototype),t._callbacks=new Map,t}H.prototype.on=function(t,e){let u=this._callbacks.get(t)??[];return u.push(e),this._callbacks.set(t,u),this};H.prototype.once=function(t,e){let u=(...d)=>{this.off(t,u),e.apply(this,d)};return u.fn=e,this.on(t,u),this};H.prototype.off=function(t,e){if(t===void 0&&e===void 0)return this._callbacks.clear(),this;if(e===void 0)return this._callbacks.delete(t),this;let u=this._callbacks.get(t);if(u){for(let[d,n]of u.entries())if(n===e||n.fn===e){u.splice(d,1);break}u.length===0?this._callbacks.delete(t):this._callbacks.set(t,u)}return this};H.prototype.emit=function(t,...e){let u=this._callbacks.get(t);if(u){let d=[...u];for(let n of d)n.apply(this,e)}return this};H.prototype.listeners=function(t){return this._callbacks.get(t)??[]};H.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let e=0;for(let u of this._callbacks.values())e+=u.length;return e};H.prototype.hasListeners=function(t){return this.listenerCount(t)>0};H.prototype.addEventListener=H.prototype.on;H.prototype.removeListener=H.prototype.off;H.prototype.removeEventListener=H.prototype.off;H.prototype.removeAllListeners=H.prototype.off;typeof zt<"u"&&(zt.exports=H)});var Mr=F((Wn,_r)=>{var Lr=Cr();function yt(){Lr.call(this)}yt.prototype=new Lr;_r.exports=yt;yt.Stream=yt;yt.prototype.pipe=function(t,e){var u=this;function d(D){t.writable&&t.write(D)===!1&&u.pause&&u.pause()}u.on("data",d);function n(){u.readable&&u.resume&&u.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(u.on("end",a),u.on("close",f));var l=!1;function a(){l||(l=!0,t.end())}function f(){l||(l=!0,typeof t.destroy=="function"&&t.destroy())}function h(D){if(w(),!this.hasListeners("error"))throw D}u.on("error",h),t.on("error",h);function w(){u.off("data",d),t.off("drain",n),u.off("end",a),u.off("close",f),u.off("error",h),t.off("error",h),u.off("end",w),u.off("close",w),t.off("end",w),t.off("close",w)}return u.on("end",w),u.on("close",w),t.on("end",w),t.on("close",w),t.emit("pipe",u),t}});var vr=F(At=>{(function(t){t.parser=function(s,r){return new u(s,r)},t.SAXParser=u,t.SAXStream=D,t.createStream=h,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 u(s,r){if(!(this instanceof u))return new u(s,r);var _=this;n(_),_.q=_.c="",_.bufferCheckPosition=t.MAX_BUFFER_LENGTH,_.encoding=null,_.opt=r||{},_.opt.lowercase=_.opt.lowercase||_.opt.lowercasetags,_.looseCase=_.opt.lowercase?"toLowerCase":"toUpperCase",_.opt.maxEntityCount=_.opt.maxEntityCount||512,_.opt.maxEntityDepth=_.opt.maxEntityDepth||4,_.entityCount=_.entityDepth=0,_.tags=[],_.closed=_.closedRoot=_.sawRoot=!1,_.tag=_.error=null,_.strict=!!s,_.noscript=!!(s||_.opt.noscript),_.state=c.BEGIN,_.strictEntities=_.opt.strictEntities,_.ENTITIES=_.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),_.attribList=[],_.opt.xmlns&&(_.ns=Object.create(N)),_.opt.unquotedAttributeValues===void 0&&(_.opt.unquotedAttributeValues=!s),_.trackPosition=_.opt.position!==!1,_.trackPosition&&(_.position=_.line=_.column=0),M(_,"onready")}Object.create||(Object.create=function(s){function r(){}r.prototype=s;var _=new r;return _}),Object.keys||(Object.keys=function(s){var r=[];for(var _ in s)s.hasOwnProperty(_)&&r.push(_);return r});function d(s){for(var r=Math.max(t.MAX_BUFFER_LENGTH,10),_=0,E=0,j=e.length;E<j;E++){var V=s[e[E]].length;if(V>r)switch(e[E]){case"textNode":W(s);break;case"cdata":S(s,"oncdata",s.cdata),s.cdata="";break;case"script":S(s,"onscript",s.script),s.script="";break;default:J(s,"Max buffer length exceeded: "+e[E])}_=Math.max(_,V)}var G=t.MAX_BUFFER_LENGTH-_;s.bufferCheckPosition=G+s.position}function n(s){for(var r=0,_=e.length;r<_;r++)s[e[r]]=""}function l(s){W(s),s.cdata!==""&&(S(s,"oncdata",s.cdata),s.cdata=""),s.script!==""&&(S(s,"onscript",s.script),s.script="")}u.prototype={end:function(){ht(this)},write:nn,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){l(this)}};var a;try{a=Mr().Stream}catch{a=function(){}}a||(a=function(){});var f=t.EVENTS.filter(function(s){return s!=="error"&&s!=="end"});function h(s,r){return new D(s,r)}function w(s,r){if(s.length>=2){if(s[0]===255&&s[1]===254)return"utf-16le";if(s[0]===254&&s[1]===255)return"utf-16be"}return s.length>=3&&s[0]===239&&s[1]===187&&s[2]===191?"utf8":s.length>=4?s[0]===60&&s[1]===0&&s[2]===63&&s[3]===0?"utf-16le":s[0]===0&&s[1]===60&&s[2]===0&&s[3]===63?"utf-16be":"utf8":r?"utf8":null}function D(s,r){if(!(this instanceof D))return new D(s,r);a.apply(this),this._parser=new u(s,r),this.writable=!0,this.readable=!0;var _=this;this._parser.onend=function(){_.emit("end")},this._parser.onerror=function(E){_.emit("error",E),_._parser.error=null},this._decoder=null,this._decoderBuffer=null,f.forEach(function(E){Object.defineProperty(_,"on"+E,{get:function(){return _._parser["on"+E]},set:function(j){if(!j)return _.removeAllListeners(E),_._parser["on"+E]=j,j;_.on(E,j)},enumerable:!0,configurable:!1})})}D.prototype=Object.create(a.prototype,{constructor:{value:D}}),D.prototype._decodeBuffer=function(s,r){if(this._decoderBuffer&&(s=Buffer.concat([this._decoderBuffer,s]),this._decoderBuffer=null),!this._decoder){var _=w(s,r);if(!_)return this._decoderBuffer=s,"";this._parser.encoding=_,this._decoder=new TextDecoder(_)}return this._decoder.decode(s,{stream:!r})},D.prototype.write=function(s){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(s))s=this._decodeBuffer(s,!1);else if(this._decoderBuffer){var r=this._decodeBuffer(Buffer.alloc(0),!0);r&&(this._parser.write(r),this.emit("data",r))}return this._parser.write(s.toString()),this.emit("data",s),!0},D.prototype.end=function(s){if(s&&s.length&&this.write(s),this._decoderBuffer){var r=this._decodeBuffer(Buffer.alloc(0),!0);r&&(this._parser.write(r),this.emit("data",r))}else if(this._decoder){var _=this._decoder.decode();_&&(this._parser.write(_),this.emit("data",_))}return this._parser.end(),!0},D.prototype.on=function(s,r){var _=this;return!_._parser["on"+s]&&f.indexOf(s)!==-1&&(_._parser["on"+s]=function(){var E=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);E.splice(0,0,s),_.emit.apply(_,E)}),a.prototype.on.call(_,s,r)};var O="[CDATA[",b="DOCTYPE",y="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/2000/xmlns/",N={xml:y,xmlns:T},x=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,L=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function o(s){return s===" "||s===`
4
- `||s==="\r"||s===" "}function i(s){return s==='"'||s==="'"}function p(s){return s===">"||o(s)}function C(s,r){return s.test(r)}function I(s,r){return!C(s,r)}var c=0;t.STATE={BEGIN:c++,BEGIN_WHITESPACE:c++,TEXT:c++,TEXT_ENTITY:c++,OPEN_WAKA:c++,SGML_DECL:c++,SGML_DECL_QUOTED:c++,DOCTYPE:c++,DOCTYPE_QUOTED:c++,DOCTYPE_DTD:c++,DOCTYPE_DTD_QUOTED:c++,COMMENT_STARTING:c++,COMMENT:c++,COMMENT_ENDING:c++,COMMENT_ENDED:c++,CDATA:c++,CDATA_ENDING:c++,CDATA_ENDING_2:c++,PROC_INST:c++,PROC_INST_BODY:c++,PROC_INST_ENDING:c++,OPEN_TAG:c++,OPEN_TAG_SLASH:c++,ATTRIB:c++,ATTRIB_NAME:c++,ATTRIB_NAME_SAW_WHITE:c++,ATTRIB_VALUE:c++,ATTRIB_VALUE_QUOTED:c++,ATTRIB_VALUE_CLOSED:c++,ATTRIB_VALUE_UNQUOTED:c++,ATTRIB_VALUE_ENTITY_Q:c++,ATTRIB_VALUE_ENTITY_U:c++,CLOSE_TAG:c++,CLOSE_TAG_SAW_WHITE:c++,SCRIPT:c++,SCRIPT_ENDING:c++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(s){var r=t.ENTITIES[s],_=typeof r=="number"?String.fromCharCode(r):r;t.ENTITIES[s]=_});for(var g in t.STATE)t.STATE[t.STATE[g]]=g;c=t.STATE;function M(s,r,_){s[r]&&s[r](_)}function A(s){var r=s&&s.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return r?r[2]:null}function P(s){return s?s.toLowerCase().replace(/[^a-z0-9]/g,""):null}function R(s,r){let _=P(s),E=P(r);return!_||!E?!0:E==="utf16"?_==="utf16le"||_==="utf16be":_===E}function X(s,r){if(!(!s.strict||!s.encoding||!r||r.name!=="xml")){var _=A(r.body);_&&!R(s.encoding,_)&&B(s,"XML declaration encoding "+_+" does not match detected stream encoding "+s.encoding.toUpperCase())}}function S(s,r,_){s.textNode&&W(s),M(s,r,_)}function W(s){s.textNode=q(s.opt,s.textNode),s.textNode&&M(s,"ontext",s.textNode),s.textNode=""}function q(s,r){return s.trim&&(r=r.trim()),s.normalize&&(r=r.replace(/\s+/g," ")),r}function J(s,r){return W(s),s.trackPosition&&(r+=`
5
- Line: `+s.line+`
6
- Column: `+s.column+`
7
- Char: `+s.c),r=new Error(r),s.error=r,M(s,"onerror",r),s}function ht(s){return s.sawRoot&&!s.closedRoot&&B(s,"Unclosed root tag"),s.state!==c.BEGIN&&s.state!==c.BEGIN_WHITESPACE&&s.state!==c.TEXT&&J(s,"Unexpected end"),W(s),s.c="",s.closed=!0,M(s,"onend"),u.call(s,s.strict,s.opt),s}function B(s,r){if(typeof s!="object"||!(s instanceof u))throw new Error("bad call to strictFail");s.strict&&J(s,r)}function en(s){s.strict||(s.tagName=s.tagName[s.looseCase]());var r=s.tags[s.tags.length-1]||s,_=s.tag={name:s.tagName,attributes:{}};s.opt.xmlns&&(_.ns=r.ns),s.attribList.length=0,S(s,"onopentagstart",_)}function Ft(s,r){var _=s.indexOf(":"),E=_<0?["",s]:s.split(":"),j=E[0],V=E[1];return r&&s==="xmlns"&&(j="xmlns",V=""),{prefix:j,local:V}}function Rt(s){if(s.strict||(s.attribName=s.attribName[s.looseCase]()),s.attribList.indexOf(s.attribName)!==-1||s.tag.attributes.hasOwnProperty(s.attribName)){s.attribName=s.attribValue="";return}if(s.opt.xmlns){var r=Ft(s.attribName,!0),_=r.prefix,E=r.local;if(_==="xmlns")if(E==="xml"&&s.attribValue!==y)B(s,"xml: prefix must be bound to "+y+`
8
- Actual: `+s.attribValue);else if(E==="xmlns"&&s.attribValue!==T)B(s,"xmlns: prefix must be bound to "+T+`
9
- Actual: `+s.attribValue);else{var j=s.tag,V=s.tags[s.tags.length-1]||s;j.ns===V.ns&&(j.ns=Object.create(V.ns)),j.ns[E]=s.attribValue}s.attribList.push([s.attribName,s.attribValue])}else s.tag.attributes[s.attribName]=s.attribValue,S(s,"onattribute",{name:s.attribName,value:s.attribValue});s.attribName=s.attribValue=""}function ut(s,r){if(s.opt.xmlns){var _=s.tag,E=Ft(s.tagName);_.prefix=E.prefix,_.local=E.local,_.uri=_.ns[E.prefix]||"",_.prefix&&!_.uri&&(B(s,"Unbound namespace prefix: "+JSON.stringify(s.tagName)),_.uri=E.prefix);var j=s.tags[s.tags.length-1]||s;_.ns&&j.ns!==_.ns&&Object.keys(_.ns).forEach(function(oe){S(s,"onopennamespace",{prefix:oe,uri:_.ns[oe]})});for(var V=0,G=s.attribList.length;V<G;V++){var $=s.attribList[V],z=$[0],et=$[1],Y=Ft(z,!0),rt=Y.prefix,on=Y.local,ie=rt===""?"":_.ns[rt]||"",jt={name:z,value:et,prefix:rt,local:on,uri:ie};rt&&rt!=="xmlns"&&!ie&&(B(s,"Unbound namespace prefix: "+JSON.stringify(rt)),jt.uri=rt),s.tag.attributes[z]=jt,S(s,"onattribute",jt)}s.attribList.length=0}s.tag.isSelfClosing=!!r,s.sawRoot=!0,s.tags.push(s.tag),S(s,"onopentag",s.tag),r||(!s.noscript&&s.tagName.toLowerCase()==="script"?s.state=c.SCRIPT:s.state=c.TEXT,s.tag=null,s.tagName=""),s.attribName=s.attribValue="",s.attribList.length=0}function Xt(s){if(!s.tagName){B(s,"Weird empty close tag."),s.textNode+="</>",s.state=c.TEXT;return}if(s.script){if(s.tagName!=="script"){s.script+="</"+s.tagName+">",s.tagName="",s.state=c.SCRIPT;return}S(s,"onscript",s.script),s.script=""}var r=s.tags.length,_=s.tagName;s.strict||(_=_[s.looseCase]());for(var E=_;r--;){var j=s.tags[r];if(j.name!==E)B(s,"Unexpected close tag");else break}if(r<0){B(s,"Unmatched closing tag: "+s.tagName),s.textNode+="</"+s.tagName+">",s.state=c.TEXT;return}s.tagName=_;for(var V=s.tags.length;V-- >r;){var G=s.tag=s.tags.pop();s.tagName=s.tag.name,S(s,"onclosetag",s.tagName);var $={};for(var z in G.ns)$[z]=G.ns[z];var et=s.tags[s.tags.length-1]||s;s.opt.xmlns&&G.ns!==et.ns&&Object.keys(G.ns).forEach(function(Y){var rt=G.ns[Y];S(s,"onclosenamespace",{prefix:Y,uri:rt})})}r===0&&(s.closedRoot=!0),s.tagName=s.attribValue=s.attribName="",s.attribList.length=0,s.state=c.TEXT}function rn(s){var r=s.entity,_=r.toLowerCase(),E,j="";return s.ENTITIES[r]?s.ENTITIES[r]:s.ENTITIES[_]?s.ENTITIES[_]:(r=_,r.charAt(0)==="#"&&(r.charAt(1)==="x"?(r=r.slice(2),E=parseInt(r,16),j=E.toString(16)):(r=r.slice(1),E=parseInt(r,10),j=E.toString(10))),r=r.replace(/^0+/,""),isNaN(E)||j.toLowerCase()!==r||E<0||E>1114111?(B(s,"Invalid character entity"),"&"+s.entity+";"):String.fromCodePoint(E))}function ne(s,r){r==="<"?(s.state=c.OPEN_WAKA,s.startTagPosition=s.position):o(r)||(B(s,"Non-whitespace before first tag."),s.textNode=r,s.state=c.TEXT)}function qt(s,r){var _="";return r<s.length&&(_=s.charAt(r)),_}function nn(s){var r=this;if(this.error)throw this.error;if(r.closed)return J(r,"Cannot write after close. Assign an onready handler.");if(s===null)return ht(r);typeof s=="object"&&(s=s.toString());for(var _=0,E="";E=qt(s,_++),r.c=E,!!E;)switch(r.trackPosition&&(r.position++,E===`
10
- `?(r.line++,r.column=0):r.column++),r.state){case c.BEGIN:if(r.state=c.BEGIN_WHITESPACE,E==="\uFEFF")continue;ne(r,E);continue;case c.BEGIN_WHITESPACE:ne(r,E);continue;case c.TEXT:if(r.sawRoot&&!r.closedRoot){for(var V=_-1;E&&E!=="<"&&E!=="&";)E=qt(s,_++),E&&r.trackPosition&&(r.position++,E===`
11
- `?(r.line++,r.column=0):r.column++);r.textNode+=s.substring(V,_-1)}E==="<"&&!(r.sawRoot&&r.closedRoot&&!r.strict)?(r.state=c.OPEN_WAKA,r.startTagPosition=r.position):(!o(E)&&(!r.sawRoot||r.closedRoot)&&B(r,"Text data outside of root node."),E==="&"?r.state=c.TEXT_ENTITY:r.textNode+=E);continue;case c.SCRIPT:E==="<"?r.state=c.SCRIPT_ENDING:r.script+=E;continue;case c.SCRIPT_ENDING:E==="/"?r.state=c.CLOSE_TAG:(r.script+="<"+E,r.state=c.SCRIPT);continue;case c.OPEN_WAKA:if(E==="!")r.state=c.SGML_DECL,r.sgmlDecl="";else if(!o(E))if(C(x,E))r.state=c.OPEN_TAG,r.tagName=E;else if(E==="/")r.state=c.CLOSE_TAG,r.tagName="";else if(E==="?")r.state=c.PROC_INST,r.procInstName=r.procInstBody="";else{if(B(r,"Unencoded <"),r.startTagPosition+1<r.position){var j=r.position-r.startTagPosition;E=new Array(j).join(" ")+E}r.textNode+="<"+E,r.state=c.TEXT}continue;case c.SGML_DECL:if(r.sgmlDecl+E==="--"){r.state=c.COMMENT,r.comment="",r.sgmlDecl="";continue}r.doctype&&r.doctype!==!0&&r.sgmlDecl?(r.state=c.DOCTYPE_DTD,r.doctype+="<!"+r.sgmlDecl+E,r.sgmlDecl=""):(r.sgmlDecl+E).toUpperCase()===O?(S(r,"onopencdata"),r.state=c.CDATA,r.sgmlDecl="",r.cdata=""):(r.sgmlDecl+E).toUpperCase()===b?(r.state=c.DOCTYPE,(r.doctype||r.sawRoot)&&B(r,"Inappropriately located doctype declaration"),r.doctype="",r.sgmlDecl=""):E===">"?(S(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=c.TEXT):(i(E)&&(r.state=c.SGML_DECL_QUOTED),r.sgmlDecl+=E);continue;case c.SGML_DECL_QUOTED:E===r.q&&(r.state=c.SGML_DECL,r.q=""),r.sgmlDecl+=E;continue;case c.DOCTYPE:E===">"?(r.state=c.TEXT,S(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=E,E==="["?r.state=c.DOCTYPE_DTD:i(E)&&(r.state=c.DOCTYPE_QUOTED,r.q=E));continue;case c.DOCTYPE_QUOTED:r.doctype+=E,E===r.q&&(r.q="",r.state=c.DOCTYPE);continue;case c.DOCTYPE_DTD:E==="]"?(r.doctype+=E,r.state=c.DOCTYPE):E==="<"?(r.state=c.OPEN_WAKA,r.startTagPosition=r.position):i(E)?(r.doctype+=E,r.state=c.DOCTYPE_DTD_QUOTED,r.q=E):r.doctype+=E;continue;case c.DOCTYPE_DTD_QUOTED:r.doctype+=E,E===r.q&&(r.state=c.DOCTYPE_DTD,r.q="");continue;case c.COMMENT:E==="-"?r.state=c.COMMENT_ENDING:r.comment+=E;continue;case c.COMMENT_ENDING:E==="-"?(r.state=c.COMMENT_ENDED,r.comment=q(r.opt,r.comment),r.comment&&S(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+E,r.state=c.COMMENT);continue;case c.COMMENT_ENDED:E!==">"?(B(r,"Malformed comment"),r.comment+="--"+E,r.state=c.COMMENT):r.doctype&&r.doctype!==!0?r.state=c.DOCTYPE_DTD:r.state=c.TEXT;continue;case c.CDATA:for(var V=_-1;E&&E!=="]";)E=qt(s,_++),E&&r.trackPosition&&(r.position++,E===`
12
- `?(r.line++,r.column=0):r.column++);r.cdata+=s.substring(V,_-1),E==="]"&&(r.state=c.CDATA_ENDING);continue;case c.CDATA_ENDING:E==="]"?r.state=c.CDATA_ENDING_2:(r.cdata+="]"+E,r.state=c.CDATA);continue;case c.CDATA_ENDING_2:E===">"?(r.cdata&&S(r,"oncdata",r.cdata),S(r,"onclosecdata"),r.cdata="",r.state=c.TEXT):E==="]"?r.cdata+="]":(r.cdata+="]]"+E,r.state=c.CDATA);continue;case c.PROC_INST:E==="?"?r.state=c.PROC_INST_ENDING:o(E)?r.state=c.PROC_INST_BODY:r.procInstName+=E;continue;case c.PROC_INST_BODY:if(!r.procInstBody&&o(E))continue;E==="?"?r.state=c.PROC_INST_ENDING:r.procInstBody+=E;continue;case c.PROC_INST_ENDING:if(E===">"){let et={name:r.procInstName,body:r.procInstBody};X(r,et),S(r,"onprocessinginstruction",et),r.procInstName=r.procInstBody="",r.state=c.TEXT}else r.procInstBody+="?"+E,r.state=c.PROC_INST_BODY;continue;case c.OPEN_TAG:C(v,E)?r.tagName+=E:(en(r),E===">"?ut(r):E==="/"?r.state=c.OPEN_TAG_SLASH:(o(E)||B(r,"Invalid character in tag name"),r.state=c.ATTRIB));continue;case c.OPEN_TAG_SLASH:E===">"?(ut(r,!0),Xt(r)):(B(r,"Forward-slash in opening tag not followed by >"),r.state=c.ATTRIB);continue;case c.ATTRIB:if(o(E))continue;E===">"?ut(r):E==="/"?r.state=c.OPEN_TAG_SLASH:C(x,E)?(r.attribName=E,r.attribValue="",r.state=c.ATTRIB_NAME):B(r,"Invalid attribute name");continue;case c.ATTRIB_NAME:E==="="?r.state=c.ATTRIB_VALUE:E===">"?(B(r,"Attribute without value"),r.attribValue=r.attribName,Rt(r),ut(r)):o(E)?r.state=c.ATTRIB_NAME_SAW_WHITE:C(v,E)?r.attribName+=E:B(r,"Invalid attribute name");continue;case c.ATTRIB_NAME_SAW_WHITE:if(E==="=")r.state=c.ATTRIB_VALUE;else{if(o(E))continue;B(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",S(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",E===">"?ut(r):C(x,E)?(r.attribName=E,r.state=c.ATTRIB_NAME):(B(r,"Invalid attribute name"),r.state=c.ATTRIB)}continue;case c.ATTRIB_VALUE:if(o(E))continue;i(E)?(r.q=E,r.state=c.ATTRIB_VALUE_QUOTED):(r.opt.unquotedAttributeValues||J(r,"Unquoted attribute value"),r.state=c.ATTRIB_VALUE_UNQUOTED,r.attribValue=E);continue;case c.ATTRIB_VALUE_QUOTED:if(E!==r.q){E==="&"?r.state=c.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=E;continue}Rt(r),r.q="",r.state=c.ATTRIB_VALUE_CLOSED;continue;case c.ATTRIB_VALUE_CLOSED:o(E)?r.state=c.ATTRIB:E===">"?ut(r):E==="/"?r.state=c.OPEN_TAG_SLASH:C(x,E)?(B(r,"No whitespace between attributes"),r.attribName=E,r.attribValue="",r.state=c.ATTRIB_NAME):B(r,"Invalid attribute name");continue;case c.ATTRIB_VALUE_UNQUOTED:if(!p(E)){E==="&"?r.state=c.ATTRIB_VALUE_ENTITY_U:r.attribValue+=E;continue}Rt(r),E===">"?ut(r):r.state=c.ATTRIB;continue;case c.CLOSE_TAG:if(r.tagName)E===">"?Xt(r):C(v,E)?r.tagName+=E:r.script?(r.script+="</"+r.tagName+E,r.tagName="",r.state=c.SCRIPT):(o(E)||B(r,"Invalid tagname in closing tag"),r.state=c.CLOSE_TAG_SAW_WHITE);else{if(o(E))continue;I(x,E)?r.script?(r.script+="</"+E,r.state=c.SCRIPT):B(r,"Invalid tagname in closing tag."):r.tagName=E}continue;case c.CLOSE_TAG_SAW_WHITE:if(o(E))continue;E===">"?Xt(r):B(r,"Invalid characters in closing tag");continue;case c.TEXT_ENTITY:case c.ATTRIB_VALUE_ENTITY_Q:case c.ATTRIB_VALUE_ENTITY_U:var G,$;switch(r.state){case c.TEXT_ENTITY:G=c.TEXT,$="textNode";break;case c.ATTRIB_VALUE_ENTITY_Q:G=c.ATTRIB_VALUE_QUOTED,$="attribValue";break;case c.ATTRIB_VALUE_ENTITY_U:G=c.ATTRIB_VALUE_UNQUOTED,$="attribValue";break}if(E===";"){var z=rn(r);r.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(z)?((r.entityCount+=1)>r.opt.maxEntityCount&&J(r,"Parsed entity count exceeds max entity count"),(r.entityDepth+=1)>r.opt.maxEntityDepth&&J(r,"Parsed entity depth exceeds max entity depth"),r.entity="",r.state=G,r.write(z),r.entityDepth-=1):(r[$]+=z,r.entity="",r.state=G)}else C(r.entity.length?m:L,E)?r.entity+=E:(B(r,"Invalid character in entity name"),r[$]+="&"+r.entity+E,r.entity="",r.state=G);continue;default:throw new Error(r,"Unknown state: "+r.state)}return r.position>=r.bufferCheckPosition&&d(r),r}String.fromCodePoint||(function(){var s=String.fromCharCode,r=Math.floor,_=function(){var E=16384,j=[],V,G,$=-1,z=arguments.length;if(!z)return"";for(var et="";++$<z;){var Y=Number(arguments[$]);if(!isFinite(Y)||Y<0||Y>1114111||r(Y)!==Y)throw RangeError("Invalid code point: "+Y);Y<=65535?j.push(Y):(Y-=65536,V=(Y>>10)+55296,G=Y%1024+56320,j.push(V,G)),($+1===z||j.length>E)&&(et+=s.apply(null,j),j.length=0)}return et};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:_,configurable:!0,writable:!0}):String.fromCodePoint=_})()})(typeof At>"u"?At.sax={}:At)});var Ur=F((kn,Kt)=>{"use strict";var pt=typeof Reflect=="object"?Reflect:null,xr=pt&&typeof pt.apply=="function"?pt.apply:function(e,u,d){return Function.prototype.apply.call(e,u,d)},Pt;pt&&typeof pt.ownKeys=="function"?Pt=pt.ownKeys:Object.getOwnPropertySymbols?Pt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Pt=function(e){return Object.getOwnPropertyNames(e)};function yn(t){console&&console.warn&&console.warn(t)}var Pr=Number.isNaN||function(e){return e!==e};function U(){U.init.call(this)}Kt.exports=U;Kt.exports.once=bn;U.EventEmitter=U;U.prototype._events=void 0;U.prototype._eventsCount=0;U.prototype._maxListeners=void 0;var Ar=10;function St(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(U,"defaultMaxListeners",{enumerable:!0,get:function(){return Ar},set:function(t){if(typeof t!="number"||t<0||Pr(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ar=t}});U.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};U.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Pr(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Sr(t){return t._maxListeners===void 0?U.defaultMaxListeners:t._maxListeners}U.prototype.getMaxListeners=function(){return Sr(this)};U.prototype.emit=function(e){for(var u=[],d=1;d<arguments.length;d++)u.push(arguments[d]);var n=e==="error",l=this._events;if(l!==void 0)n=n&&l.error===void 0;else if(!n)return!1;if(n){var a;if(u.length>0&&(a=u[0]),a instanceof Error)throw a;var f=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw f.context=a,f}var h=l[e];if(h===void 0)return!1;if(typeof h=="function")xr(h,this,u);else for(var w=h.length,D=jr(h,w),d=0;d<w;++d)xr(D[d],this,u);return!0};function Fr(t,e,u,d){var n,l,a;if(St(u),l=t._events,l===void 0?(l=t._events=Object.create(null),t._eventsCount=0):(l.newListener!==void 0&&(t.emit("newListener",e,u.listener?u.listener:u),l=t._events),a=l[e]),a===void 0)a=l[e]=u,++t._eventsCount;else if(typeof a=="function"?a=l[e]=d?[u,a]:[a,u]:d?a.unshift(u):a.push(u),n=Sr(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=a.length,yn(f)}return t}U.prototype.addListener=function(e,u){return Fr(this,e,u,!1)};U.prototype.on=U.prototype.addListener;U.prototype.prependListener=function(e,u){return Fr(this,e,u,!0)};function gn(){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 Rr(t,e,u){var d={fired:!1,wrapFn:void 0,target:t,type:e,listener:u},n=gn.bind(d);return n.listener=u,d.wrapFn=n,n}U.prototype.once=function(e,u){return St(u),this.on(e,Rr(this,e,u)),this};U.prototype.prependOnceListener=function(e,u){return St(u),this.prependListener(e,Rr(this,e,u)),this};U.prototype.removeListener=function(e,u){var d,n,l,a,f;if(St(u),n=this._events,n===void 0)return this;if(d=n[e],d===void 0)return this;if(d===u||d.listener===u)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,d.listener||u));else if(typeof d!="function"){for(l=-1,a=d.length-1;a>=0;a--)if(d[a]===u||d[a].listener===u){f=d[a].listener,l=a;break}if(l<0)return this;l===0?d.shift():wn(d,l),d.length===1&&(n[e]=d[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||u)}return this};U.prototype.off=U.prototype.removeListener;U.prototype.removeAllListeners=function(e){var u,d,n;if(d=this._events,d===void 0)return this;if(d.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):d[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete d[e]),this;if(arguments.length===0){var l=Object.keys(d),a;for(n=0;n<l.length;++n)a=l[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(u=d[e],typeof u=="function")this.removeListener(e,u);else if(u!==void 0)for(n=u.length-1;n>=0;n--)this.removeListener(e,u[n]);return this};function Xr(t,e,u){var d=t._events;if(d===void 0)return[];var n=d[e];return n===void 0?[]:typeof n=="function"?u?[n.listener||n]:[n]:u?Tn(n):jr(n,n.length)}U.prototype.listeners=function(e){return Xr(this,e,!0)};U.prototype.rawListeners=function(e){return Xr(this,e,!1)};U.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):qr.call(t,e)};U.prototype.listenerCount=qr;function qr(t){var e=this._events;if(e!==void 0){var u=e[t];if(typeof u=="function")return 1;if(u!==void 0)return u.length}return 0}U.prototype.eventNames=function(){return this._eventsCount>0?Pt(this._events):[]};function jr(t,e){for(var u=new Array(e),d=0;d<e;++d)u[d]=t[d];return u}function wn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Tn(t){for(var e=new Array(t.length),u=0;u<e.length;++u)e[u]=t[u].listener||t[u];return e}function bn(t,e){return new Promise(function(u,d){function n(a){t.removeListener(e,l),d(a)}function l(){typeof t.removeListener=="function"&&t.removeListener("error",n),u([].slice.call(arguments))}Br(t,e,l,{once:!0}),e!=="error"&&Dn(t,n,{once:!0})})}function Dn(t,e,u){typeof t.on=="function"&&Br(t,"error",e,u)}function Br(t,e,u,d){if(typeof t.on=="function")d.once?t.once(e,u):t.on(e,u);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(l){d.once&&t.removeEventListener(e,n),u(l)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Wr=F(Qt=>{(function(){"use strict";Qt.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Qt)});var Zt=F(ct=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),ct.normalize=function(e){return e.toLowerCase()},ct.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},ct.stripPrefix=function(e){return e.replace(t,"")},ct.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},ct.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(ct)});var kr=F(Vr=>{Vr.every=function(t){return new Jt(t)};var nt={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5};for(lt in nt)lt==="millisecond"?nt.ms=nt[lt]:nt[lt.charAt(0)]=nt[lt],nt[lt+"s"]=nt[lt];var lt;function Jt(t){this.count=0;var e=Nn(t);e&&(this.time=Number(e[0])*nt[e[1]],this.type=e[1])}Jt.prototype.do=function(t){this.time&&(this.interval=setInterval(u,this.time));var e=this;function u(){e.count++,t.call(e)}return this};Jt.prototype.stop=function(){return this.interval&&(clearInterval(this.interval),delete this.interval),this};var En=/^\s*(\d+(?:\.\d+)?)\s*([a-z]+)\s*$/;function Nn(t){var e=t.match(En);return e&&nt[e[2]]?e.slice(1):null}});var Gr=F(it=>{(function(){"use strict";var t,e,u,d,n,l,a,f,h,w=function(b,y){return function(){return b.apply(y,arguments)}},D=function(b,y){for(var T in y)O.call(y,T)&&(b[T]=y[T]);function N(){this.constructor=b}return N.prototype=y.prototype,b.prototype=new N,b.__super__=y.prototype,b},O={}.hasOwnProperty;f=vr(),d=Ur(),t=Wr(),a=Zt(),h=kr().setImmediate,e=gt().defaults,n=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},l=function(b,y,T){var N,x,v;for(N=0,x=b.length;N<x;N++)v=b[N],y=v(y,T);return y},u=function(b,y,T){var N;return N=Object.create(null),N.value=T,N.writable=!0,N.enumerable=!0,N.configurable=!0,Object.defineProperty(b,y,N)},it.Parser=(function(b){D(y,b);function y(T){this.parseStringPromise=w(this.parseStringPromise,this),this.parseString=w(this.parseString,this),this.reset=w(this.reset,this),this.assignOrPush=w(this.assignOrPush,this),this.processAsync=w(this.processAsync,this);var N,x,v;if(!(this instanceof it.Parser))return new it.Parser(T);this.options={},x=e["0.2"];for(N in x)O.call(x,N)&&(v=x[N],this.options[N]=v);for(N in T)O.call(T,N)&&(v=T[N],this.options[N]=v);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 y.prototype.processAsync=function(){var T,N;try{return this.remaining.length<=this.options.chunkSize?(T=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(T),this.saxParser.close()):(T=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(T),h(this.processAsync))}catch(x){if(N=x,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(N)}},y.prototype.assignOrPush=function(T,N,x){return N in T?(T[N]instanceof Array||u(T,N,[T[N]]),T[N].push(x)):this.options.explicitArray?u(T,N,[x]):u(T,N,x)},y.prototype.reset=function(){var T,N,x,v;return this.removeAllListeners(),this.saxParser=f.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(L){return function(m){if(L.saxParser.resume(),!L.saxParser.errThrown)return L.saxParser.errThrown=!0,L.emit("error",m)}})(this),this.saxParser.onend=(function(L){return function(){if(!L.saxParser.ended)return L.saxParser.ended=!0,L.emit("end",L.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,v=[],T=this.options.attrkey,N=this.options.charkey,this.saxParser.onopentag=(function(L){return function(m){var o,i,p,C,I;if(p={},p[N]="",!L.options.ignoreAttrs){I=m.attributes;for(o in I)O.call(I,o)&&(!(T in p)&&!L.options.mergeAttrs&&(p[T]={}),i=L.options.attrValueProcessors?l(L.options.attrValueProcessors,m.attributes[o],o):m.attributes[o],C=L.options.attrNameProcessors?l(L.options.attrNameProcessors,o):o,L.options.mergeAttrs?L.assignOrPush(p,C,i):u(p[T],C,i))}return p["#name"]=L.options.tagNameProcessors?l(L.options.tagNameProcessors,m.name):m.name,L.options.xmlns&&(p[L.options.xmlnskey]={uri:m.uri,local:m.local}),v.push(p)}})(this),this.saxParser.onclosetag=(function(L){return function(){var m,o,i,p,C,I,c,g,M,A;if(I=v.pop(),C=I["#name"],(!L.options.explicitChildren||!L.options.preserveChildrenOrder)&&delete I["#name"],I.cdata===!0&&(m=I.cdata,delete I.cdata),M=v[v.length-1],I[N].match(/^\s*$/)&&!m?(o=I[N],delete I[N]):(L.options.trim&&(I[N]=I[N].trim()),L.options.normalize&&(I[N]=I[N].replace(/\s{2,}/g," ").trim()),I[N]=L.options.valueProcessors?l(L.options.valueProcessors,I[N],C):I[N],Object.keys(I).length===1&&N in I&&!L.EXPLICIT_CHARKEY&&(I=I[N])),n(I)&&(typeof L.options.emptyTag=="function"?I=L.options.emptyTag():I=L.options.emptyTag!==""?L.options.emptyTag:o),L.options.validator!=null&&(A="/"+(function(){var P,R,X;for(X=[],P=0,R=v.length;P<R;P++)p=v[P],X.push(p["#name"]);return X})().concat(C).join("/"),(function(){var P;try{return I=L.options.validator(A,M&&M[C],I)}catch(R){return P=R,L.emit("error",P)}})()),L.options.explicitChildren&&!L.options.mergeAttrs&&typeof I=="object"){if(!L.options.preserveChildrenOrder)p={},L.options.attrkey in I&&(p[L.options.attrkey]=I[L.options.attrkey],delete I[L.options.attrkey]),!L.options.charsAsChildren&&L.options.charkey in I&&(p[L.options.charkey]=I[L.options.charkey],delete I[L.options.charkey]),Object.getOwnPropertyNames(I).length>0&&(p[L.options.childkey]=I),I=p;else if(M){M[L.options.childkey]=M[L.options.childkey]||[],c={};for(i in I)O.call(I,i)&&u(c,i,I[i]);M[L.options.childkey].push(c),delete I["#name"],Object.keys(I).length===1&&N in I&&!L.EXPLICIT_CHARKEY&&(I=I[N])}}return v.length>0?L.assignOrPush(M,C,I):(L.options.explicitRoot&&(g=I,I={},u(I,C,g)),L.resultObject=I,L.saxParser.ended=!0,L.emit("end",L.resultObject))}})(this),x=(function(L){return function(m){var o,i;if(i=v[v.length-1],i)return i[N]+=m,L.options.explicitChildren&&L.options.preserveChildrenOrder&&L.options.charsAsChildren&&(L.options.includeWhiteChars||m.replace(/\\n/g,"").trim()!=="")&&(i[L.options.childkey]=i[L.options.childkey]||[],o={"#name":"__text__"},o[N]=m,L.options.normalize&&(o[N]=o[N].replace(/\s{2,}/g," ").trim()),i[L.options.childkey].push(o)),i}})(this),this.saxParser.ontext=x,this.saxParser.oncdata=(function(L){return function(m){var o;if(o=x(m),o)return o.cdata=!0}})(this)},y.prototype.parseString=function(T,N){var x;N!=null&&typeof N=="function"&&(this.on("end",function(v){return this.reset(),N(null,v)}),this.on("error",function(v){return this.reset(),N(v)}));try{return T=T.toString(),T.trim()===""?(this.emit("end",null),!0):(T=t.stripBOM(T),this.options.async?(this.remaining=T,h(this.processAsync),this.saxParser):this.saxParser.write(T).close())}catch(v){if(x=v,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw x}else return this.emit("error",x),this.saxParser.errThrown=!0}},y.prototype.parseStringPromise=function(T){return new Promise((function(N){return function(x,v){return N.parseString(T,function(L,m){return L?v(L):x(m)})}})(this))},y})(d),it.parseString=function(b,y,T){var N,x,v;return T!=null?(typeof T=="function"&&(N=T),typeof y=="object"&&(x=y)):(typeof y=="function"&&(N=y),x={}),v=new it.Parser(x),v.parseString(b,N)},it.parseStringPromise=function(b,y){var T,N;return typeof y=="object"&&(T=y),N=new it.Parser(T),N.parseStringPromise(b)}}).call(it)});var Yr=F(ot=>{(function(){"use strict";var t,e,u,d,n=function(a,f){for(var h in f)l.call(f,h)&&(a[h]=f[h]);function w(){this.constructor=a}return w.prototype=f.prototype,a.prototype=new w,a.__super__=f.prototype,a},l={}.hasOwnProperty;e=gt(),t=Ir(),u=Gr(),d=Zt(),ot.defaults=e.defaults,ot.processors=d,ot.ValidationError=(function(a){n(f,a);function f(h){this.message=h}return f})(Error),ot.Builder=t.Builder,ot.Parser=u.Parser,ot.parseString=u.parseString,ot.parseStringPromise=u.parseStringPromise}).call(ot)});var Pn=31*864e5;var pn=t=>{let e=t.trim().split("#")[0],u=e.indexOf("?");return u===-1?{base:e,params:new URLSearchParams}:{base:e.slice(0,u),params:new URLSearchParams(e.slice(u+1))}},dn=(t,e)=>{let u=e.map(n=>n.toLowerCase()),d=new URLSearchParams;return t.forEach((n,l)=>{u.includes(l.toLowerCase())||d.append(l,n)}),d};var Bt=(t,e)=>{let{base:u,params:d}=pn(t??""),n=dn(d,Object.keys(e));return Object.entries(e).forEach(([l,a])=>n.append(l,a)),`${u}?${n.toString()}`};var ee=hn(Yr()),Zr=8e3;self.onmessage=async t=>{let{sourceType:e}=t.data;try{let u;if(e==="wms"){let{url:d,options:n}=t.data;u=await On(d,n)}else if(e==="wmts"){let{url:d,options:n}=t.data;u=await Cn(d,n)}else u=null;self.postMessage(u)}catch(u){self.postMessage({error:u?.message??String(u)})}};var Jr=async t=>{let e=`(${t.status}) Error fetching capabilities.. ${t.statusText}`;try{return re(await t.text())??e}catch{return e}},re=t=>{if(!/<(ServiceExceptionReport|(ows:)?ExceptionReport)[\s>/]/.test(t))return;let u=(/<ServiceException(?![A-Za-z])[^>]*>([\s\S]*?)<\/ServiceException>/.exec(t)??/<(?:ows:)?ExceptionText[^>]*>([\s\S]*?)<\/(?:ows:)?ExceptionText>/.exec(t))?.[1]?.replace(/\s+/g," ").trim();return u?`Service reported: ${u}`:"Service reported an error."},On=async(t,e)=>{let u=Bt(t,{service:"WMS",request:"GetCapabilities"}),d=new AbortController,n=setTimeout(()=>d.abort(),Zr);try{let l=await fetch(u,{signal:d.signal});if(!l.ok)throw new Error(await Jr(l));let a=await l.text();return await In(a,u,e)}finally{clearTimeout(n)}},In=async(t,e,u)=>{let d=0,n=(D,O,b=null,y=0)=>{if(d>=u.maxNodes||y>u.maxDepth)return;d+=1;let T={name:D.Name?Q(D.Name[0]):"",description:D.Abstract?Q(D.Abstract[0]):"",selected:!1,parent:b,time:null};if(D.Title&&(T.title=Q(D.Title[0])),Array.isArray(D.Dimension)){for(let N of D.Dimension)if(N.$?.name.toLowerCase()==="time"&&N.$?.units==="ISO8601"){T.time=Object.assign({current:N.$?.default??null},tn(N._,N.$?.default));break}}D.Layer&&(T.children=[],D.Layer.forEach(N=>n(N,T.children,T,y+1))),O.push(T)},l=re(t);if(l)throw new Error(l);if(t.indexOf("<Capability")===-1)throw new Error("Error: Invalid response received!");let a=await(0,ee.parseStringPromise)(t);if(!a.WMS_Capabilities&&!a.WMT_MS_Capabilities)throw new Error("Error: No Capabilities found!");let f=a.WMS_Capabilities?a.WMS_Capabilities:a.WMT_MS_Capabilities?a.WMT_MS_Capabilities:void 0;if(!f?.Capability[0].Layer)throw new Error("Error: No layer information found!");let h={name:"",description:"",type:"WMS",url:e,layers:[]};if(Z(f?.Service)){let D=f?.Service[0];h.name=Z(D.Title)?Q(D.Title[0]):Z(D.Name)?Q(D.Name[0]):"WMS",h.description=Z(D.Abstract)?Q(D.Abstract[0]):""}let w=[];return f.Capability[0].Layer.forEach(D=>{n(D,w)}),w.sort((D,O)=>D.name<O.name?-1:1),h.layers=w,h},Cn=async(t,e)=>{let u=Bt(t,{service:"WMTS",request:"GetCapabilities"}),d=new AbortController,n=setTimeout(()=>d.abort(),Zr);try{let l=await fetch(u,{signal:d.signal});if(!l.ok)throw new Error(await Jr(l));let a=await l.text();return await Ln(a,u,e)}finally{clearTimeout(n)}},Ln=async(t,e,u)=>{let d=h=>{if(!Z(h["ows:Identifier"]))return null;let w={name:Z(h["ows:Title"])?Q(h["ows:Title"][0]):"",description:Z(h["ows:Abstract"])?Q(h["ows:Abstract"][0]):"",id:Q(h["ows:Identifier"][0]),format:"png"};if(Z(h["ows:WGS84BoundingBox"])&&(w.bounds=[Number(h["ows:WGS84BoundingBox"][0]["ows:LowerCorner"][0].split(" ")[0]),Number(h["ows:WGS84BoundingBox"][0]["ows:LowerCorner"][0].split(" ")[1]),Number(h["ows:WGS84BoundingBox"][0]["ows:UpperCorner"][0].split(" ")[0]),Number(h["ows:WGS84BoundingBox"][0]["ows:UpperCorner"][0].split(" ")[1])]),Z(h.Format)){let D=Q(h.Format[0]);w.format=D.indexOf("jpg")!==-1?"jpg":"png"}return Z(h.Dimension)&&h.Dimension.forEach(D=>{Q(D["ows:Identifier"][0]).toLowerCase()==="time"&&(w.time=Object.assign({current:ft(Q(D.Default[0]))??null},tn(D.Value,Q(D.Default[0]))))}),w},n=re(t);if(n)throw new Error(n);if(t.indexOf("<Capabilities")===-1)throw new Error("Error: Invalid response received!");let l=await(0,ee.parseStringPromise)(t);if(!Z(l.Capabilities?.Contents))throw new Error("Error: No Capabilities found!");if(!Z(l.Capabilities.Contents[0].Layer))throw new Error("Error: No layer information found!");let a={name:"",description:"",type:"WMTS",url:e,layers:[]},f=0;for(let h of l.Capabilities.Contents[0].Layer){if(f>=u.maxNodes)break;let w=d(h);w&&a.layers.push(w),f++}return a.layers.sort((h,w)=>h.name<w.name?-1:1),a},Z=t=>Array.isArray(t)&&t.length!==0,Q=t=>typeof t=="string"?t:t._??"",te=t=>{let e=/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/,u=t.match(e);return u?{years:parseInt(u[1]??"0"),months:parseInt(u[2]??"0"),weeks:parseInt(u[3]??"0"),days:parseInt(u[4]??"0"),hours:parseInt(u[5]??"0"),minutes:parseInt(u[6]??"0"),seconds:parseFloat(u[7]??"0")}:{years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0}},_n=t=>{let e=te(t);return e.weeks*(3600*1e3*24*7)+e.days*(3600*1e3*24)+e.hours*(3600*1e3)+e.minutes*(60*1e3)+e.seconds*1e3},Hr=(t,e,u)=>{let d={y:new Date(t).getFullYear(),m:new Date(t).getMonth(),d:new Date(t).getDate()},n={y:u?d.y+e.years:d.y-e.years,m:u?d.m+e.months:d.m-e.months,d:u?d.d+e.days:d.d-e.days};if(e.weeks){let f=e.weeks*7;n.d=u?n.d+f:n.d-f}let l=new Date(t);l.setFullYear(n.y,n.m,n.d);let a=e.hours*(1e3*3600)+e.minutes*(1e3*60)+e.seconds*1e3;return a=u?a:0-a,l.setTime(l.getTime()+a),l.toISOString()},$r=t=>t.startsWith("P"),zr=t=>!t.includes("-")&&!t.includes(":"),Kr=t=>t.split("-").length===2&&!t.includes("T"),Mn=t=>t.split("-").length===3&&!t.includes("T"),vn=t=>t.length===8&&!t.startsWith("P"),xn=t=>t.includes("T")&&!t.includes(":"),Qr=t=>t.includes("/"),ft=t=>{try{return t.toLocaleLowerCase()==="current"||t.toLocaleLowerCase()==="present"?new Date().toISOString():(vn(t)?t=`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6)}`:xn(t)&&(t+=":00:00.000Z"),new Date(t).toISOString())}catch(e){throw new Error(`Unhandled Date format (${t})`,{cause:e})}},tn=(t,e)=>{let u=n=>{if(zr(n))return`${n}-12-31T23:59:59.999Z`;if(Kr(n)){let l=n.split("-").map(f=>parseInt(f)),a=new Date(l[0],l[1],0).getDate();return`${n}-${a}T23:59:59.999Z`}else return Mn(n)?`${n}T23:59:59.999Z`:ft(n)},d=n=>{let l={from:null,to:null};if((n[0].toLocaleLowerCase()==="present"||n[0].toLocaleLowerCase()==="current")&&(n[0]=new Date().toISOString()),(n[1].toLocaleLowerCase()==="present"||n[1].toLocaleLowerCase()==="current")&&(n[1]=new Date().toISOString()),$r(n[0])?l.from=Hr(n[1],te(n[0]),!1):l.from=ft(n[0]),$r(n[1])?l.to=Hr(n[0],te(n[1]),!0):l.to=u(n[1]),n.length===3){let a=_n(n[2]);a&&(l.interval=a)}return l};try{if(Array.isArray(t)){let n=[];if(t.forEach(a=>{if(Qr(a)){let f=d(a.split("/"));f&&n.push(f)}}),n.length){let a=new Date(e).valueOf();for(let f=0;f<n.length;f++)if(a>=new Date(n[f].from).valueOf()&&a<=new Date(n[f].to).valueOf())return n[f];return n[n.length-1]}let l=t.map(a=>ft(a));if(l.length>1)return{from:l[0]??null,to:l[l.length-1]??null,values:l};t=l[0]}if(t.includes(",")){let n=t.split(",").map(l=>ft(l));return{from:n[0]??null,to:n[n.length-1]??null,values:n}}else if(typeof t=="string"){if(Qr(t))return d(t.split("/"));if(zr(t)){let n=new Date(t),l=n.getFullYear();return n.setFullYear(l+1),{from:ft(t),to:n.toISOString()}}else if(Kr(t)){let n=new Date(t),l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setFullYear(n.getFullYear(),n.getMonth(),l),n.setUTCHours(23),n.setUTCMinutes(59),n.setUTCSeconds(59,999),{from:ft(t),to:n.toISOString()}}else return{from:null,to:null}}}catch{return{from:null,to:null}}};export{re as ogcExceptionMessage,In as parseWMSCapabilities,Ln as parseWMTSCapabilities,On as wmsGetInfo};