@signalk/freeboard-sk 2.24.0 → 2.24.2

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/CHANGELOG.md +19 -0
  2. package/assets/icons/icon-192x192.png +0 -0
  3. package/docs/screenshots/1_freeboard-sk.png +0 -0
  4. package/docs/screenshots/README.md +31 -0
  5. package/package.json +26 -7
  6. package/public/3rdpartylicenses.txt +9 -361
  7. package/public/chunk-2AF4T5IB.js +1 -0
  8. package/public/chunk-346FAZUS.js +1 -0
  9. package/public/{chunk-BTVNOQ7K.js → chunk-3GHIRJ3C.js} +2 -2
  10. package/public/chunk-4SHFYAXK.js +1 -0
  11. package/public/{chunk-2LV2AYBP.js → chunk-64QDJX7X.js} +1 -1
  12. package/public/chunk-A4TULHTL.js +1 -0
  13. package/public/chunk-AEB5DG3B.js +1 -0
  14. package/public/chunk-AFVK3UQJ.js +5482 -0
  15. package/public/chunk-AX3UMUXB.js +1 -0
  16. package/public/{chunk-TLBNKF2R.js → chunk-EFVTFEXB.js} +1 -1
  17. package/public/chunk-FALIRPMH.js +1035 -0
  18. package/public/{chunk-A7QJNGJ7.js → chunk-FEIJMPL7.js} +2 -2
  19. package/public/chunk-G4GM24WE.js +1 -0
  20. package/public/{chunk-DPEXDGKO.js → chunk-GQXHMDKV.js} +1 -1
  21. package/public/chunk-KFWFMRV7.js +1 -0
  22. package/public/chunk-LXUTMJYP.js +1145 -0
  23. package/public/chunk-NTIQMWPW.js +2718 -0
  24. package/public/chunk-QIOZNURQ.js +1 -0
  25. package/public/chunk-RWJHAOI2.js +1 -0
  26. package/public/chunk-SBFXQ3G7.js +1 -0
  27. package/public/chunk-TAJAMNLU.js +1 -0
  28. package/public/chunk-UEUVGTXJ.js +1 -0
  29. package/public/{chunk-WUXY5N7A.js → chunk-WA2ENVQZ.js} +1 -1
  30. package/public/index.html +2 -2
  31. package/public/main-AZEF35BN.js +466 -0
  32. package/public/polyfills-RV3JTMEC.js +2 -0
  33. package/public/styles-FMJMFQ5P.css +1 -0
  34. package/public/worker-AUTVLQL7.js +3 -0
  35. package/public/worker-FRXPLBUO.js +12 -0
  36. package/public/worker-T4RJR7DG.js +12 -0
  37. package/public/worker-Y35X2QU7.js +26 -0
  38. package/public/chunk-3MOH2GUU.js +0 -1
  39. package/public/chunk-3ZBG3EOD.js +0 -1
  40. package/public/chunk-4SN3Q6K3.js +0 -1
  41. package/public/chunk-5KDMJ54F.js +0 -1
  42. package/public/chunk-67IVDHNW.js +0 -1
  43. package/public/chunk-AZK5ODAA.js +0 -1
  44. package/public/chunk-GMWUHE7S.js +0 -131
  45. package/public/chunk-GQRIAFM6.js +0 -1
  46. package/public/chunk-HQSHA6SH.js +0 -13
  47. package/public/chunk-LXWUCH7T.js +0 -1
  48. package/public/chunk-QPQHN5VS.js +0 -22
  49. package/public/chunk-RBFFWNLA.js +0 -1
  50. package/public/chunk-TQPGRJVE.js +0 -19
  51. package/public/chunk-V3DD3MHN.js +0 -1
  52. package/public/chunk-Y6FV7FIU.js +0 -1
  53. package/public/chunk-YPACWLLV.js +0 -1
  54. package/public/chunk-YUTPR5Z4.js +0 -1
  55. package/public/main-SF5NH7GR.js +0 -11
  56. package/public/polyfills-5CFQRCPP.js +0 -2
  57. package/public/styles-N7HVRSAT.css +0 -1
  58. package/public/worker-42LKK6ER.js +0 -26
  59. package/public/worker-FPJG6QKK.js +0 -5
  60. package/public/worker-UZNU4LIJ.js +0 -12
  61. package/public/worker-WYOFLVNH.js +0 -12
@@ -0,0 +1,3 @@
1
+ var Oi=Object.create;var Hr=Object.defineProperty;var wi=Object.getOwnPropertyDescriptor;var Ai=Object.getOwnPropertyNames;var Di=Object.getPrototypeOf,Ri=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Li=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ai(t))!Ri.call(e,i)&&i!==r&&Hr(e,i,{get:()=>t[i],enumerable:!(n=wi(t,i))||n.enumerable});return e};var Gr=(e,t,r)=>(r=e!=null?Oi(Di(e)):{},Li(t||!e||!e.__esModule?Hr(r,"default",{value:e,enumerable:!0}):r,e));var x=u(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.timeConversion=p.sexagesimalPattern=p.longitudeKeys=p.latitudeKeys=p.earthRadius=p.distanceConversion=p.areaConversion=p.altitudeKeys=p.RAD_TO_DEG=p.MINLON=p.MINLAT=p.MAXLON=p.MAXLAT=p.DEG_TO_RAD=void 0;var Ju=p.sexagesimalPattern=/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/,Qu=p.earthRadius=6378137,el=p.MINLAT=-90,tl=p.MAXLAT=90,rl=p.MINLON=-180,nl=p.MAXLON=180,il=p.DEG_TO_RAD=Math.PI/180,al=p.RAD_TO_DEG=180/Math.PI,ol=p.longitudeKeys=["lng","lon","longitude",0],sl=p.latitudeKeys=["lat","latitude",1],ul=p.altitudeKeys=["alt","altitude","elevation","elev",2],ll=p.distanceConversion={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},fl=p.timeConversion={m:60,h:3600,d:86400},I=p.areaConversion={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};I.sqm=I.m2;I.sqkm=I.km2;I.sqft=I.ft2;I.sqyd=I.yd2;I.sqin=I.in2});var ce=u(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.default=void 0;var Ui=(e,t)=>{if(e==null)throw new Error(`'${e}' is no valid coordinate.`);return t.reduce((r,n)=>Object.prototype.hasOwnProperty.call(e,n)&&n!==void 0&&r===void 0?(r=n,n):r,void 0)},dl=je.default=Ui});var de=u(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.default=void 0;var Vi=e=>{let t=e.toString().trim();return isNaN(parseFloat(t))?!1:parseFloat(t)===Number(t)},pl=Ne.default=Vi});var me=u(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.default=void 0;var Wi=x(),Ki=e=>Wi.sexagesimalPattern.test(e.toString().trim()),hl=Fe.default=Ki});var pe=u(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.default=void 0;var Bi=x(),$i=e=>{let t=new RegExp(Bi.sexagesimalPattern).exec(e.toString().trim());if(t===null)throw new Error("Given value is not in sexagesimal format");let r=Number(t[2])/60||0,n=Number(t[4])/3600||0,i=parseFloat(t[1])+r+n;return["S","W"].includes(t[7])?-i:i},yl=Ue.default=$i});var We=u(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.default=void 0;var nr=x(),ir=Hi(ce());function Hi(e){return e&&e.__esModule?e:{default:e}}var Gi=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{longitude:nr.longitudeKeys,latitude:nr.latitudeKeys,altitude:nr.altitudeKeys},r=(0,ir.default)(e,t.longitude),n=(0,ir.default)(e,t.latitude),i=(0,ir.default)(e,t.altitude);return{latitude:n,longitude:r,...i?{altitude:i}:{}}},vl=Ve.default=Gi});var or=u(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.default=void 0;var zi=ar(de()),Xi=ar(me()),Zi=ar(pe()),sn=x();function ar(e){return e&&e.__esModule?e:{default:e}}var un=e=>{if((0,zi.default)(e)){let t=parseFloat(e);return!(t>sn.MAXLAT||t<sn.MINLAT)}return(0,Xi.default)(e)?un((0,Zi.default)(e)):!1},Ml=Ke.default=un});var ur=u(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.default=void 0;var Yi=sr(de()),Ji=sr(me()),Qi=sr(pe()),ln=x();function sr(e){return e&&e.__esModule?e:{default:e}}var fn=e=>{if((0,Yi.default)(e)){let t=parseFloat(e);return!(t>ln.MAXLON||t<ln.MINLON)}return(0,Ji.default)(e)?fn((0,Qi.default)(e)):!1},Sl=Be.default=fn});var fr=u($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.default=void 0;var ea=lr(We()),cn=lr(or()),dn=lr(ur());function lr(e){return e&&e.__esModule?e:{default:e}}var ta=e=>{let{latitude:t,longitude:r}=(0,ea.default)(e);if(Array.isArray(e)&&e.length>=2)return(0,dn.default)(e[0])&&(0,cn.default)(e[1]);if(t===void 0||r===void 0)return!1;let n=e[r],i=e[t];return i===void 0||n===void 0?!1:(0,cn.default)(i)&&(0,dn.default)(n)},wl=$e.default=ta});var Ge=u(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.default=void 0;var ra=he(de()),na=he(me()),ia=he(pe()),mn=he(fr()),aa=he(We());function he(e){return e&&e.__esModule?e:{default:e}}var ge=e=>{if((0,ra.default)(e))return Number(e);if((0,na.default)(e))return(0,ia.default)(e);if((0,mn.default)(e)){let t=(0,aa.default)(e);return Array.isArray(e)?e.map((r,n)=>[0,1].includes(n)?ge(r):r):{...e,...t.latitude&&{[t.latitude]:ge(e[t.latitude])},...t.longitude&&{[t.longitude]:ge(e[t.longitude])}}}return Array.isArray(e)?e.map(t=>(0,mn.default)(t)?ge(t):t):e},Dl=He.default=ge});var R=u(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.default=void 0;var oa=x(),sa=pn(ce()),ua=pn(Ge());function pn(e){return e&&e.__esModule?e:{default:e}}var la=(e,t)=>{let r=(0,sa.default)(e,oa.latitudeKeys);if(r==null)return;let n=e[r];return t===!0?n:(0,ua.default)(n)},Ll=ze.default=la});var L=u(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.default=void 0;var fa=x(),ca=gn(ce()),da=gn(Ge());function gn(e){return e&&e.__esModule?e:{default:e}}var ma=(e,t)=>{let r=(0,ca.default)(e,fa.longitudeKeys);if(r==null)return;let n=e[r];return t===!0?n:(0,da.default)(n)},kl=Xe.default=ma});var j=u(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=void 0;var pa=x(),ga=e=>e*pa.DEG_TO_RAD,Cl=Ze.default=ga});var G=u(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.default=void 0;var ha=x(),ba=e=>e*ha.RAD_TO_DEG,Il=Ye.default=ba});var bn=u(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.default=void 0;var ya=Je(R()),_a=Je(L()),cr=Je(j()),dr=Je(G()),hn=x();function Je(e){return e&&e.__esModule?e:{default:e}}var va=function(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:6371e3,i=(0,ya.default)(e),a=(0,_a.default)(e),o=t/n,s=(0,cr.default)(r),c=(0,cr.default)(i),v=(0,cr.default)(a),g=Math.asin(Math.sin(c)*Math.cos(o)+Math.cos(c)*Math.sin(o)*Math.cos(s)),h=v+Math.atan2(Math.sin(s)*Math.sin(o)*Math.cos(c),Math.cos(o)-Math.sin(c)*Math.sin(g)),m=(0,dr.default)(h);return(m<hn.MINLON||m>hn.MAXLON)&&(h=(h+3*Math.PI)%(2*Math.PI)-Math.PI,m=(0,dr.default)(h)),{latitude:(0,dr.default)(g),longitude:m}},Nl=Qe.default=va});var yn=u(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.default=void 0;var xa=x(),Ma=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"m",r=xa.areaConversion[t];if(r)return e*r;throw new Error("Invalid unit used for area conversion.")},Ul=et.default=Ma});var _n=u(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.default=void 0;var Pa=x(),Sa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"m",r=Pa.distanceConversion[t];if(r)return e*r;throw new Error("Invalid unit used for distance conversion.")},Wl=tt.default=Sa});var vn=u(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.default=void 0;var rt=x(),Oa=function(e){switch(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"kmh"){case"kmh":return e*rt.timeConversion.h*rt.distanceConversion.km;case"mph":return e*rt.timeConversion.h*rt.distanceConversion.mi;default:return e}},Bl=nt.default=Oa});var xn=u(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.default=void 0;var wa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4,r=Math.pow(10,t);return Math.round(e*r)/r},Aa=e=>{let[t,r]=e.toString().split("."),n=Math.abs(Number(t)),i=+("0."+(r||0))*60,a=i.toString().split("."),o=Math.floor(i),s=wa(+("0."+(a[1]||0))*60).toString(),[c,v="0"]=s.split(".");return n+"\xB0 "+o.toString().padStart(2,"0")+"' "+c.padStart(2,"0")+"."+v.padEnd(1,"0")+'"'},Hl=it.default=Aa});var mr=u(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.default=void 0;var Da=e=>e>1?1:e<-1?-1:e,zl=at.default=Da});var K=u(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.default=void 0;var Mn=ot(R()),Pn=ot(L()),pr=ot(j()),Ra=ot(mr()),La=x();function ot(e){return e&&e.__esModule?e:{default:e}}var qa=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;r=isNaN(r)?1:r;let n=(0,pr.default)((0,Mn.default)(e)),i=(0,pr.default)((0,Mn.default)(t)),a=(0,pr.default)((0,Pn.default)(e)-(0,Pn.default)(t)),o=Math.acos((0,Ra.default)(Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos(a)))*La.earthRadius;return Math.round(o/r)*r},Zl=st.default=qa});var gr=u(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.default=void 0;var Sn=ka(K());function ka(e){return e&&e.__esModule?e:{default:e}}var Ta=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sn.default;return r=typeof r=="function"?r:Sn.default,t.slice().sort((n,i)=>r(e,n)-r(e,i))},Jl=ut.default=Ta});var On=u(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.default=void 0;var Ca=Ea(gr());function Ea(e){return e&&e.__esModule?e:{default:e}}var Ia=(e,t)=>(0,Ca.default)(e,t)[0],ef=lt.default=Ia});var Dn=u(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.default=void 0;var hr=br(j()),ja=br(R()),wn=br(L()),An=x();function br(e){return e&&e.__esModule?e:{default:e}}var Na=e=>{let t=0;if(e.length>2){let r,n,i;for(let a=0;a<e.length;a++){a===e.length-2?(r=e.length-2,n=e.length-1,i=0):a===e.length-1?(r=e.length-1,n=0,i=1):(r=a,n=a+1,i=a+2);let o=(0,wn.default)(e[r]),s=(0,ja.default)(e[n]),c=(0,wn.default)(e[i]);t+=((0,hr.default)(c)-(0,hr.default)(o))*Math.sin((0,hr.default)(s))}t=t*An.earthRadius*An.earthRadius/2}return Math.abs(t)},rf=ft.default=Na});var yr=u(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.default=void 0;var Fa=Rn(R()),Ua=Rn(L());function Rn(e){return e&&e.__esModule?e:{default:e}}var Va=e=>{if(Array.isArray(e)===!1||e.length===0)throw new Error("No points were given.");return e.reduce((t,r)=>{let n=(0,Fa.default)(r),i=(0,Ua.default)(r);return{maxLat:Math.max(n,t.maxLat),minLat:Math.min(n,t.minLat),maxLng:Math.max(i,t.maxLng),minLng:Math.min(i,t.minLng)}},{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})},af=ct.default=Va});var Ln=u(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.default=void 0;var Wa=mt(R()),Ka=mt(L()),ne=mt(j()),dt=mt(G()),be=x();function mt(e){return e&&e.__esModule?e:{default:e}}var Ba=(e,t)=>{let r=(0,Wa.default)(e),n=(0,Ka.default)(e),i=(0,ne.default)(r),a=(0,ne.default)(n),o=t/be.earthRadius,s=i-o,c=i+o,v=(0,ne.default)(be.MAXLAT),g=(0,ne.default)(be.MINLAT),h=(0,ne.default)(be.MAXLON),m=(0,ne.default)(be.MINLON),P,y;if(s>g&&c<v){let A=Math.asin(Math.sin(o)/Math.cos(i));P=a-A,P<m&&(P+=Math.PI*2),y=a+A,y>h&&(y-=Math.PI*2)}else s=Math.max(s,g),c=Math.min(c,v),P=m,y=h;return[{latitude:(0,dt.default)(s),longitude:(0,dt.default)(P)},{latitude:(0,dt.default)(c),longitude:(0,dt.default)(y)}]},sf=pt.default=Ba});var Tn=u(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.default=void 0;var $a=gt(R()),Ha=gt(L()),qn=gt(j()),kn=gt(G());function gt(e){return e&&e.__esModule?e:{default:e}}var Ga=e=>{if(Array.isArray(e)===!1||e.length===0)return!1;let t=e.length,r=e.reduce((o,s)=>{let c=(0,qn.default)((0,$a.default)(s)),v=(0,qn.default)((0,Ha.default)(s));return{X:o.X+Math.cos(c)*Math.cos(v),Y:o.Y+Math.cos(c)*Math.sin(v),Z:o.Z+Math.sin(c)}},{X:0,Y:0,Z:0}),n=r.X/t,i=r.Y/t,a=r.Z/t;return{longitude:(0,kn.default)(Math.atan2(i,n)),latitude:(0,kn.default)(Math.atan2(a,Math.sqrt(n*n+i*i)))}},lf=ht.default=Ga});var Cn=u(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.default=void 0;var za=Xa(yr());function Xa(e){return e&&e.__esModule?e:{default:e}}var Za=e=>{let t=(0,za.default)(e),r=t.minLat+(t.maxLat-t.minLat)/2,n=t.minLng+(t.maxLng-t.minLng)/2;return{latitude:parseFloat(r.toFixed(6)),longitude:parseFloat(n.toFixed(6))}},cf=bt.default=Za});var _r=u(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.default=void 0;var En=_t(R()),In=_t(L()),yt=_t(j()),Ya=_t(G());function _t(e){return e&&e.__esModule?e:{default:e}}var Ja=(e,t)=>{let r=(0,yt.default)((0,In.default)(t))-(0,yt.default)((0,In.default)(e)),n=Math.log(Math.tan((0,yt.default)((0,En.default)(t))/2+Math.PI/4)/Math.tan((0,yt.default)((0,En.default)(e))/2+Math.PI/4));return Math.abs(r)>Math.PI&&(r>0?r=(Math.PI*2-r)*-1:r=Math.PI*2+r),((0,Ya.default)(Math.atan2(r,n))+360)%360},mf=vt.default=Ja});var Nn=u(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.default=void 0;var jn=Qa(_r());function Qa(e){return e&&e.__esModule?e:{default:e}}var eo=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jn.default,n=typeof r=="function"?r(e,t):(0,jn.default)(e,t);if(isNaN(n))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(n/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}},gf=xt.default=eo});var xr=u(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.default=void 0;var vr=Un(K()),Fn=Un(mr());function Un(e){return e&&e.__esModule?e:{default:e}}var to=function(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,i=(0,vr.default)(t,e,n),a=(0,vr.default)(e,r,n),o=(0,vr.default)(t,r,n),s=Math.acos((0,Fn.default)((i*i+o*o-a*a)/(2*i*o))),c=Math.acos((0,Fn.default)((a*a+o*o-i*i)/(2*a*o)));return i===0||a===0?0:o===0||s>Math.PI/2?i:c>Math.PI/2?a:Math.sin(s)*i},bf=Mt.default=to});var Kn=u(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.default=void 0;var Vn=Pt(R()),Wn=Pt(L()),F=Pt(j()),ro=Pt(G());function Pt(e){return e&&e.__esModule?e:{default:e}}var no=(e,t)=>{let r=(0,Vn.default)(t),n=(0,Wn.default)(t),i=(0,Vn.default)(e),a=(0,Wn.default)(e);return((0,ro.default)(Math.atan2(Math.sin((0,F.default)(n)-(0,F.default)(a))*Math.cos((0,F.default)(r)),Math.cos((0,F.default)(i))*Math.sin((0,F.default)(r))-Math.sin((0,F.default)(i))*Math.cos((0,F.default)(r))*Math.cos((0,F.default)(n)-(0,F.default)(a))))+360)%360},_f=St.default=no});var Bn=u(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=void 0;var io=ao(K());function ao(e){return e&&e.__esModule?e:{default:e}}var oo=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:io.default;return e.reduce((r,n)=>(typeof r=="object"&&r.last!==null&&(r.distance+=t(n,r.last)),r.last=n,r),{last:null,distance:0}).distance},xf=Ot.default=oo});var zn=u(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.default=void 0;var $n=Pr(R()),Hn=Pr(L()),Mr=Pr(j()),Gn=x();function Pr(e){return e&&e.__esModule?e:{default:e}}var so=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;r=isNaN(r)?1:r;let n=(0,$n.default)(e),i=(0,Hn.default)(e),a=(0,$n.default)(t),o=(0,Hn.default)(t),s=6356752314245e-6,c=1/298.257223563,v=(0,Mr.default)(o-i),g,h,m,P,y,A,Wr=Math.atan((1-c)*Math.tan((0,Mr.default)(parseFloat(n)))),Kr=Math.atan((1-c)*Math.tan((0,Mr.default)(parseFloat(a)))),Se=Math.sin(Wr),Oe=Math.cos(Wr),we=Math.sin(Kr),Y=Math.cos(Kr),ae=v,Br,$r=100;do{let Kt=Math.sin(ae),Bt=Math.cos(ae);if(A=Math.sqrt(Y*Kt*(Y*Kt)+(Oe*we-Se*Y*Bt)*(Oe*we-Se*Y*Bt)),A===0)return 0;g=Se*we+Oe*Y*Bt,h=Math.atan2(A,g),m=Oe*Y*Kt/A,P=1-m*m,y=g-2*Se*we/P,isNaN(y)&&(y=0);let $t=c/16*P*(4+c*(4-3*P));Br=ae,ae=v+(1-$t)*c*m*(h+$t*A*(y+$t*g*(-1+2*y*y)))}while(Math.abs(ae-Br)>1e-12&&--$r>0);if($r===0)return NaN;let W=P*(Gn.earthRadius*Gn.earthRadius-s*s)/(s*s),Mi=1+W/16384*(4096+W*(-768+W*(320-175*W))),Wt=W/1024*(256+W*(-128+W*(74-47*W))),Pi=Wt*A*(y+Wt/4*(g*(-1+2*y*y)-Wt/6*y*(-3+4*A*A)*(-3+4*y*y))),Si=s*Mi*(h-Pi);return Math.round(Si/r)*r},Pf=wt.default=so});var Xn=u(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.default=void 0;var uo=e=>{if(/^(NNE|NE|NNW|N)$/.test(e))return"N";if(/^(ENE|E|ESE|SE)$/.test(e))return"E";if(/^(SSE|S|SSW|SW)$/.test(e))return"S";if(/^(WSW|W|WNW|NW)$/.test(e))return"W"},Of=At.default=uo});var Zn=u(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.default=void 0;var lo=fo(K());function fo(e){return e&&e.__esModule?e:{default:e}}var co=function(e,t){let n=(arguments.length>2&&arguments[2]!==void 0?arguments[2]:lo.default)(e,t),i=Number(t.time)-Number(e.time);return n/i*1e3},Af=Dt.default=co});var Yn=u(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.default=void 0;var Sr=mo(K());function mo(e){return e&&e.__esModule?e:{default:e}}var po=(e,t,r)=>(0,Sr.default)(t,e)+(0,Sr.default)(e,r)===(0,Sr.default)(t,r),Rf=Rt.default=po});var Qn=u(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.default=void 0;var Lt=Jn(R()),q=Jn(L());function Jn(e){return e&&e.__esModule?e:{default:e}}var go=(e,t)=>{let r=!1,n=t.length;for(let i=-1,a=n-1;++i<n;a=i)((0,q.default)(t[i])<=(0,q.default)(e)&&(0,q.default)(e)<(0,q.default)(t[a])||(0,q.default)(t[a])<=(0,q.default)(e)&&(0,q.default)(e)<(0,q.default)(t[i]))&&(0,Lt.default)(e)<((0,Lt.default)(t[a])-(0,Lt.default)(t[i]))*((0,q.default)(e)-(0,q.default)(t[i]))/((0,q.default)(t[a])-(0,q.default)(t[i]))+(0,Lt.default)(t[i])&&(r=!r);return r},qf=qt.default=go});var ei=u(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.default=void 0;var ho=bo(xr());function bo(e){return e&&e.__esModule?e:{default:e}}var yo=(e,t,r,n)=>(0,ho.default)(e,t,r)<n,Tf=kt.default=yo});var ti=u(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.default=void 0;var _o=vo(K());function vo(e){return e&&e.__esModule?e:{default:e}}var xo=(e,t,r)=>(0,_o.default)(e,t,.01)<r,Ef=Tt.default=xo});var ri=u(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.default=void 0;var Mo=e=>{if(!e.startsWith("POLYGON"))throw new Error("Invalid wkt.");return e.slice(e.indexOf("(")+2,e.indexOf(")")).split(", ").map(n=>{let[i,a]=n.split(" ");return{longitude:parseFloat(i),latitude:parseFloat(a)}})},jf=Ct.default=Mo});var ni=u(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});var Po={computeDestinationPoint:!0,convertArea:!0,convertDistance:!0,convertSpeed:!0,decimalToSexagesimal:!0,findNearest:!0,getAreaOfPolygon:!0,getBounds:!0,getBoundsOfDistance:!0,getCenter:!0,getCenterOfBounds:!0,getCompassDirection:!0,getCoordinateKey:!0,getCoordinateKeys:!0,getDistance:!0,getDistanceFromLine:!0,getGreatCircleBearing:!0,getLatitude:!0,getLongitude:!0,getPathLength:!0,getPreciseDistance:!0,getRhumbLineBearing:!0,getRoughCompassDirection:!0,getSpeed:!0,isDecimal:!0,isPointInLine:!0,isPointInPolygon:!0,isPointNearLine:!0,isPointWithinRadius:!0,isSexagesimal:!0,isValidCoordinate:!0,isValidLatitude:!0,isValidLongitude:!0,orderByDistance:!0,sexagesimalToDecimal:!0,toDecimal:!0,toRad:!0,toDeg:!0,wktToPolygon:!0};Object.defineProperty(l,"computeDestinationPoint",{enumerable:!0,get:function(){return So.default}});Object.defineProperty(l,"convertArea",{enumerable:!0,get:function(){return Oo.default}});Object.defineProperty(l,"convertDistance",{enumerable:!0,get:function(){return wo.default}});Object.defineProperty(l,"convertSpeed",{enumerable:!0,get:function(){return Ao.default}});Object.defineProperty(l,"decimalToSexagesimal",{enumerable:!0,get:function(){return Do.default}});Object.defineProperty(l,"findNearest",{enumerable:!0,get:function(){return Ro.default}});Object.defineProperty(l,"getAreaOfPolygon",{enumerable:!0,get:function(){return Lo.default}});Object.defineProperty(l,"getBounds",{enumerable:!0,get:function(){return qo.default}});Object.defineProperty(l,"getBoundsOfDistance",{enumerable:!0,get:function(){return ko.default}});Object.defineProperty(l,"getCenter",{enumerable:!0,get:function(){return To.default}});Object.defineProperty(l,"getCenterOfBounds",{enumerable:!0,get:function(){return Co.default}});Object.defineProperty(l,"getCompassDirection",{enumerable:!0,get:function(){return Eo.default}});Object.defineProperty(l,"getCoordinateKey",{enumerable:!0,get:function(){return Io.default}});Object.defineProperty(l,"getCoordinateKeys",{enumerable:!0,get:function(){return jo.default}});Object.defineProperty(l,"getDistance",{enumerable:!0,get:function(){return No.default}});Object.defineProperty(l,"getDistanceFromLine",{enumerable:!0,get:function(){return Fo.default}});Object.defineProperty(l,"getGreatCircleBearing",{enumerable:!0,get:function(){return Uo.default}});Object.defineProperty(l,"getLatitude",{enumerable:!0,get:function(){return Vo.default}});Object.defineProperty(l,"getLongitude",{enumerable:!0,get:function(){return Wo.default}});Object.defineProperty(l,"getPathLength",{enumerable:!0,get:function(){return Ko.default}});Object.defineProperty(l,"getPreciseDistance",{enumerable:!0,get:function(){return Bo.default}});Object.defineProperty(l,"getRhumbLineBearing",{enumerable:!0,get:function(){return $o.default}});Object.defineProperty(l,"getRoughCompassDirection",{enumerable:!0,get:function(){return Ho.default}});Object.defineProperty(l,"getSpeed",{enumerable:!0,get:function(){return Go.default}});Object.defineProperty(l,"isDecimal",{enumerable:!0,get:function(){return zo.default}});Object.defineProperty(l,"isPointInLine",{enumerable:!0,get:function(){return Xo.default}});Object.defineProperty(l,"isPointInPolygon",{enumerable:!0,get:function(){return Zo.default}});Object.defineProperty(l,"isPointNearLine",{enumerable:!0,get:function(){return Yo.default}});Object.defineProperty(l,"isPointWithinRadius",{enumerable:!0,get:function(){return Jo.default}});Object.defineProperty(l,"isSexagesimal",{enumerable:!0,get:function(){return Qo.default}});Object.defineProperty(l,"isValidCoordinate",{enumerable:!0,get:function(){return es.default}});Object.defineProperty(l,"isValidLatitude",{enumerable:!0,get:function(){return ts.default}});Object.defineProperty(l,"isValidLongitude",{enumerable:!0,get:function(){return rs.default}});Object.defineProperty(l,"orderByDistance",{enumerable:!0,get:function(){return ns.default}});Object.defineProperty(l,"sexagesimalToDecimal",{enumerable:!0,get:function(){return is.default}});Object.defineProperty(l,"toDecimal",{enumerable:!0,get:function(){return as.default}});Object.defineProperty(l,"toDeg",{enumerable:!0,get:function(){return ss.default}});Object.defineProperty(l,"toRad",{enumerable:!0,get:function(){return os.default}});Object.defineProperty(l,"wktToPolygon",{enumerable:!0,get:function(){return us.default}});var So=d(bn()),Oo=d(yn()),wo=d(_n()),Ao=d(vn()),Do=d(xn()),Ro=d(On()),Lo=d(Dn()),qo=d(yr()),ko=d(Ln()),To=d(Tn()),Co=d(Cn()),Eo=d(Nn()),Io=d(ce()),jo=d(We()),No=d(K()),Fo=d(xr()),Uo=d(Kn()),Vo=d(R()),Wo=d(L()),Ko=d(Bn()),Bo=d(zn()),$o=d(_r()),Ho=d(Xn()),Go=d(Zn()),zo=d(de()),Xo=d(Yn()),Zo=d(Qn()),Yo=d(ei()),Jo=d(ti()),Qo=d(me()),es=d(fr()),ts=d(or()),rs=d(ur()),ns=d(gr()),is=d(pe()),as=d(Ge()),os=d(j()),ss=d(G()),us=d(ri()),Or=x();Object.keys(Or).forEach(function(e){e==="default"||e==="__esModule"||Object.prototype.hasOwnProperty.call(Po,e)||e in l&&l[e]===Or[e]||Object.defineProperty(l,e,{enumerable:!0,get:function(){return Or[e]}})});function d(e){return e&&e.__esModule?e:{default:e}}});var ii=u(Rr=>{"use strict";Rr.__esModule=!0;function Ar(e,t){return e*e+t*t}function ls(e,t){return Ar(e[0]-t[0],e[1]-t[1])}function fs(e,t,r){var n=t[0],i=t[1],a=r[0]-n,o=r[1]-i;if(a!==0||o!==0){var s=((e[0]-n)*a+(e[1]-i)*o)/Ar(a,o);s>1?(n=r[0],i=r[1]):s>0&&(n+=a*s,i+=o*s)}return Ar(e[0]-n,e[1]-i)}function cs(e,t){for(var r=e[0],n,i=[r],a=1,o=e.length;a<o;a++)n=e[a],ls(n,r)>t&&(i.push(n),r=n);return r!==n&&i.push(n),i}function Dr(e,t,r,n,i){for(var a=n,o,s=t+1;s<r;s++){var c=fs(e[s],e[t],e[r]);c>a&&(o=s,a=c)}a>n&&(o-t>1&&Dr(e,t,o,n,i),i.push(e[o]),r-o>1&&Dr(e,o,r,n,i))}function ds(e,t){var r=e.length-1,n=[e[0]];return Dr(e,0,r,t,n),n.push(e[r]),n}function ms(e,t,r){if(t===void 0&&(t=1),r===void 0&&(r=!1),e.length<=2)return e;var n=t*t;return e=r?e:cs(e,n),e=ds(e,n),e}Rr.SimplifyAP=ms});var ai=u(kr=>{"use strict";kr.__esModule=!0;function Lr(e,t){return e*e+t*t}function ps(e,t){return Lr(e.longitude-t.longitude,e.latitude-t.latitude)}function gs(e,t,r){var n=t.longitude,i=t.latitude,a=r.longitude-n,o=r.latitude-i;if(a!==0||o!==0){var s=((e.longitude-n)*a+(e.latitude-i)*o)/Lr(a,o);s>1?(n=r.longitude,i=r.latitude):s>0&&(n+=a*s,i+=o*s)}return Lr(e.longitude-n,e.latitude-i)}function hs(e,t){for(var r=e[0],n,i=[r],a=1,o=e.length;a<o;a++)n=e[a],ps(n,r)>t&&(i.push(n),r=n);return r!==n&&i.push(n),i}function qr(e,t,r,n,i){for(var a=n,o,s=t+1;s<r;s++){var c=gs(e[s],e[t],e[r]);c>a&&(o=s,a=c)}a>n&&(o-t>1&&qr(e,t,o,n,i),i.push(e[o]),r-o>1&&qr(e,o,r,n,i))}function bs(e,t){var r=e.length-1,n=[e[0]];return qr(e,0,r,t,n),n.push(e[r]),n}function ys(e,t,r){if(t===void 0&&(t=1),r===void 0&&(r=!1),e.length<=2)return e;var n=t*t;return e=r?e:hs(e,n),e=bs(e,n),e}kr.SimplifyLL=ys});var oi=u(Er=>{"use strict";Er.__esModule=!0;function Tr(e,t){return e*e+t*t}function _s(e,t){return Tr(e.x-t.x,e.y-t.y)}function vs(e,t,r){var n=t.x,i=t.y,a=r.x-n,o=r.y-i;if(a!==0||o!==0){var s=((e.x-n)*a+(e.y-i)*o)/Tr(a,o);s>1?(n=r.x,i=r.y):s>0&&(n+=a*s,i+=o*s)}return Tr(e.x-n,e.y-i)}function xs(e,t){for(var r=e[0],n,i=[r],a=1,o=e.length;a<o;a++)n=e[a],_s(n,r)>t&&(i.push(n),r=n);return r!==n&&i.push(n),i}function Cr(e,t,r,n,i){for(var a=n,o,s=t+1;s<r;s++){var c=vs(e[s],e[t],e[r]);c>a&&(o=s,a=c)}a>n&&(o-t>1&&Cr(e,t,o,n,i),i.push(e[o]),r-o>1&&Cr(e,o,r,n,i))}function Ms(e,t){var r=e.length-1,n=[e[0]];return Cr(e,0,r,t,n),n.push(e[r]),n}function Ps(e,t,r){if(t===void 0&&(t=1),r===void 0&&(r=!1),e.length<=2)return e;var n=t*t;return e=r?e:xs(e,n),e=Ms(e,n),e}Er.Simplify=Ps});var si=u(ye=>{"use strict";ye.__esModule=!0;var Ss=ii();ye.SimplifyAP=Ss.SimplifyAP;var Os=ai();ye.SimplifyLL=Os.SimplifyLL;var ws=oi();ye.Simplify=ws.Simplify});function D(e){return typeof e=="function"}function Ae(e){let r=e(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var De=Ae(e=>function(r){e(this),this.message=r?`${r.length} errors occurred during unsubscription:
2
+ ${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
3
+ `)}`:"",this.name="UnsubscriptionError",this.errors=r});function oe(e,t){if(e){let r=e.indexOf(t);0<=r&&e.splice(r,1)}}var C=class e{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let a of r)a.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(D(n))try{n()}catch(a){t=a instanceof De?a.errors:[a]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let a of i)try{zr(a)}catch(o){t=t??[],o instanceof De?t=[...t,...o.errors]:t.push(o)}}if(t)throw new De(t)}}add(t){var r;if(t&&t!==this)if(this.closed)zr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}}_hasParent(t){let{_parentage:r}=this;return r===t||Array.isArray(r)&&r.includes(t)}_addParent(t){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t}_removeParent(t){let{_parentage:r}=this;r===t?this._parentage=null:Array.isArray(r)&&oe(r,t)}remove(t){let{_finalizers:r}=this;r&&oe(r,t),t instanceof e&&t._removeParent(this)}};C.EMPTY=(()=>{let e=new C;return e.closed=!0,e})();var Ht=C.EMPTY;function Re(e){return e instanceof C||e&&"closed"in e&&D(e.remove)&&D(e.add)&&D(e.unsubscribe)}function zr(e){D(e)?e():e.unsubscribe()}var k={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var J={setTimeout(e,t,...r){let{delegate:n}=J;return n?.setTimeout?n.setTimeout(e,t,...r):setTimeout(e,t,...r)},clearTimeout(e){let{delegate:t}=J;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Xr(e){J.setTimeout(()=>{let{onUnhandledError:t}=k;if(t)t(e);else throw e})}function Gt(){}var Zr=zt("C",void 0,void 0);function Yr(e){return zt("E",void 0,e)}function Jr(e){return zt("N",e,void 0)}function zt(e,t,r){return{kind:e,value:t,error:r}}var B=null;function Q(e){if(k.useDeprecatedSynchronousErrorHandling){let t=!B;if(t&&(B={errorThrown:!1,error:null}),e(),t){let{errorThrown:r,error:n}=B;if(B=null,r)throw n}}else e()}function Qr(e){k.useDeprecatedSynchronousErrorHandling&&B&&(B.errorThrown=!0,B.error=e)}var se=class extends C{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Re(t)&&t.add(this)):this.destination=Ti}static create(t,r,n){return new ee(t,r,n)}next(t){this.isStopped?Zt(Jr(t),this):this._next(t)}error(t){this.isStopped?Zt(Yr(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?Zt(Zr,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},qi=Function.prototype.bind;function Xt(e,t){return qi.call(e,t)}var Yt=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:r}=this;if(r.next)try{r.next(t)}catch(n){Le(n)}}error(t){let{partialObserver:r}=this;if(r.error)try{r.error(t)}catch(n){Le(n)}else Le(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(r){Le(r)}}},ee=class extends se{constructor(t,r,n){super();let i;if(D(t)||!t)i={next:t??void 0,error:r??void 0,complete:n??void 0};else{let a;this&&k.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=()=>this.unsubscribe(),i={next:t.next&&Xt(t.next,a),error:t.error&&Xt(t.error,a),complete:t.complete&&Xt(t.complete,a)}):i=t}this.destination=new Yt(i)}};function Le(e){k.useDeprecatedSynchronousErrorHandling?Qr(e):Xr(e)}function ki(e){throw e}function Zt(e,t){let{onStoppedNotification:r}=k;r&&J.setTimeout(()=>r(e,t))}var Ti={closed:!0,next:Gt,error:ki,complete:Gt};var en=typeof Symbol=="function"&&Symbol.observable||"@@observable";function tn(e){return e}function rn(e){return e.length===0?tn:e.length===1?e[0]:function(r){return e.reduce((n,i)=>i(n),r)}}var $=class e{constructor(t){t&&(this._subscribe=t)}lift(t){let r=new e;return r.source=this,r.operator=t,r}subscribe(t,r,n){let i=Ei(t)?t:new ee(t,r,n);return Q(()=>{let{operator:a,source:o}=this;i.add(a?a.call(i,o):o?this._subscribe(i):this._trySubscribe(i))}),i}_trySubscribe(t){try{return this._subscribe(t)}catch(r){t.error(r)}}forEach(t,r){return r=nn(r),new r((n,i)=>{let a=new ee({next:o=>{try{t(o)}catch(s){i(s),a.unsubscribe()}},error:i,complete:n});this.subscribe(a)})}_subscribe(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)}[en](){return this}pipe(...t){return rn(t)(this)}toPromise(t){return t=nn(t),new t((r,n)=>{let i;this.subscribe(a=>i=a,a=>n(a),()=>r(i))})}};$.create=e=>new $(e);function nn(e){var t;return(t=e??k.Promise)!==null&&t!==void 0?t:Promise}function Ci(e){return e&&D(e.next)&&D(e.error)&&D(e.complete)}function Ei(e){return e&&e instanceof se||Ci(e)&&Re(e)}var an=Ae(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var E=class extends ${constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){let r=new qe(this,this);return r.operator=t,r}_throwIfClosed(){if(this.closed)throw new an}next(t){Q(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let r of this.currentObservers)r.next(t)}})}error(t){Q(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;let{observers:r}=this;for(;r.length;)r.shift().error(t)}})}complete(){Q(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:t}=this;for(;t.length;)t.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){let{hasError:r,isStopped:n,observers:i}=this;return r||n?Ht:(this.currentObservers=null,i.push(t),new C(()=>{this.currentObservers=null,oe(i,t)}))}_checkFinalizedStatuses(t){let{hasError:r,thrownError:n,isStopped:i}=this;r?t.error(n):i&&t.complete()}asObservable(){let t=new $;return t.source=this,t}};E.create=(e,t)=>new qe(e,t);var qe=class extends E{constructor(t,r){super(),this.destination=t,this.source=r}next(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,t)}error(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,t)}complete(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)}_subscribe(t){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&n!==void 0?n:Ht}};var S=[];for(let e=0;e<256;++e)S.push((e+256).toString(16).slice(1));function on(e,t=0){return(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]).toLowerCase()}var Jt,Ii=new Uint8Array(16);function Qt(){if(!Jt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Jt=crypto.getRandomValues.bind(crypto)}return Jt(Ii)}var ji=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),er={randomUUID:ji};function Ni(e,t,r){if(er.randomUUID&&!t&&!e)return er.randomUUID();e=e||{};let n=e.random??e.rng?.()??Qt();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return on(n)}var tr=Ni;var ke=class{_connect;_close;_error;_message;ws;_filter="";_wsTimeout=2e4;_token="";_playbackMode=!1;onConnect;onClose;onError;onMessage;version=1;endpoint="";selfId="";_source=null;set source(t){this._source||(this._source={}),this._source.label=t}set authToken(t){this._token=t}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(t){this._wsTimeout=t<3e3?3e3:t>6e4?6e4:t}get isOpen(){return!!(this.ws&&this.ws.readyState!=1&&this.ws.readyState!=3)}get filter(){return this._filter}set filter(t){t&&t.indexOf("self")!=-1?this._filter=this.selfId?this.selfId:"":this._filter=t}get playbackMode(){return this._playbackMode}constructor(){this._connect=new E,this.onConnect=this._connect.asObservable(),this._close=new E,this.onClose=this._close.asObservable(),this._error=new E,this.onError=this._error.asObservable(),this._message=new E,this.onMessage=this._message.asObservable()}close(){this.ws&&(this.ws.close(),this.ws=null)}open(t,r,n){if(t=t||this.endpoint,!t)return;let i=t.indexOf("?")==-1?"?":"&";r&&(t+=`${i}subscribe=${r}`),(this._token||n)&&(t+=`${r?"&":"?"}token=${this._token||n}`),this.close(),this.ws=new WebSocket(t),setTimeout(()=>{this.ws&&this.ws.readyState!=1&&this.ws.readyState!=3&&(console.warn(`Connection watchdog expired (${this._wsTimeout/1e3} sec): ${this.ws.readyState}... aborting connection...`),this.close())},this._wsTimeout),this.ws.onopen=a=>{this._connect.next(a)},this.ws.onclose=a=>{this._close.next(a)},this.ws.onerror=a=>{this._error.next(a)},this.ws.onmessage=a=>{this.parseOnMessage(a)}}parseOnMessage(t){let r;if(typeof t.data=="string")try{r=JSON.parse(t.data)}catch{return}this.isHello(r)?(this.selfId=r.self,this._playbackMode=typeof r.startTime<"u",this._message.next(r)):this.isResponse(r)?(typeof r.login<"u"&&typeof r.login.token<"u"&&(this._token=r.login.token),this._message.next(r)):this._filter&&this.isDelta(r)?r.context==this._filter&&this._message.next(r):this._message.next(r)}sendRequest(t){if(typeof t!="object")return"";let r=te.request();return typeof t.login>"u"&&this._token&&(r.token=this._token),Object.keys(t).forEach(i=>{r[i]=t[i]}),this.send(r),r.requestId}put(t,r,n){let i={context:t=="self"?"vessels.self":t,put:{path:r,value:n}};return this.sendRequest(i)}login(t,r){let n={login:{username:t,password:r}};return this.sendRequest(n)}send(t){this.ws&&(typeof t=="object"&&(t=JSON.stringify(t)),this.ws.send(t))}sendUpdate(t="self",r,n){let i=te.updates();this._token&&(i.token=this._token),i.context=t=="self"?"vessels.self":t,this._token&&(i.token=this._token);let a=[];typeof r=="string"&&a.push({path:r,value:n}),typeof r=="object"&&Array.isArray(r)&&(a=r);let o={timestamp:new Date().toISOString(),values:a};this._source&&(o.source=this._source),i.updates.push(o),this.send(i)}subscribe(t="*",r="*",n){let i=te.subscribe();if(this._token&&(i.token=this._token),i.context=t=="self"?"vessels.self":t,this._token&&(i.token=this._token),typeof r=="object"&&Array.isArray(r)&&(i.subscribe=r),typeof r=="string"){let a={};a.path=r,n&&typeof n=="object"&&(n.period&&(a.period=n.period),n.minPeriod&&(a.minPeriod=n.period),n.format&&(n.format=="delta"||n.format=="full")&&(a.format=n.format),n.policy&&(n.policy=="instant"||n.policy=="ideal"||n.policy=="fixed")&&(a.policy=n.policy)),i.subscribe.push(a)}this.send(i)}unsubscribe(t="*",r="*"){let n=te.unsubscribe();this._token&&(n.token=this._token),n.context=t=="self"?"vessels.self":t,this._token&&(n.token=this._token),typeof r=="object"&&Array.isArray(r)&&(n.unsubscribe=r),typeof r=="string"&&n.unsubscribe.push({path:r}),this.send(n)}raiseAlarm(t="*",r,n){let i;typeof r=="string"?i=r.indexOf("notifications.")==-1?`notifications.${r}`:r:i=r,this.put(t,i,n.value)}clearAlarm(t="*",r){let n=r.indexOf("notifications.")==-1?`notifications.${r}`:r;this.put(t,n,null)}isSelf(t){return t.context==this.selfId}isDelta(t){return typeof t.context<"u"}isHello(t){return typeof t.version<"u"&&typeof t.self<"u"}isResponse(t){return typeof t.requestId<"u"}},te=class{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:tr()}}},Te=class{_state;_method=[];_message="";constructor(t,r,n,i){this._message=typeof t<"u"?t:"",this._state=typeof r<"u"?r:"alarm",n&&this._method.push("visual"),i&&this._method.push("sound")}get value(){return{message:this._message,state:this._state,method:this._method}}};var re=class{id;name;mmsi;position=[0,0];positionReceived=!1;positionTimestamp="";state;type={id:-1,name:""};properties={};lastUpdated=new Date;callsignVhf;callsignHf;orientation=0;virtual},ue=class extends re{anchor={maxRadius:null,radius:null,position:null};autopilot={state:null,mode:null,target:null,enabled:!1,default:null,availableActions:[]};buddy=!1;closestApproach={distance:null,timeTo:null};cog;cogTrue=null;cogMagnetic=null;courseApi={arrivalCircle:0,activeRoute:{},nextPoint:{},previousPoint:{}};courseCalcs={};distanceToSelf;environment={mode:null,sun:null};heading;headingTrue=null;headingMagnetic=null;performance={beatAngle:null,gybeAngle:null};racing;radars={};registrations={};resourceUpdates=[];sog;track=[];vectors={cog:[]};wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null};design={airHeight:null,beam:null,draft:{current:null,maximum:null},length:null};destination={name:null,eta:null};flag;port},Ce=class extends re{constructor(){super()}},Ee=class extends re{sog=0;track=[];constructor(){super()}},le=class extends re{constructor(){super()}},Ie=class extends le{twd;tws;temperature;constructor(){super()}};var rr={K:{C:e=>e-273.15,F:e=>(e-273.15)*9/5+32},rad:{degree:e=>e*180/Math.PI},deg:{radian:e=>e*.0174532925199433},ratio:{percent:e=>e*100},"m/s":{kn:e=>e*1.94384,"km/h":e=>e*3.6,mph:e=>e*2.2369362920544025,Bf:e=>e/.836^.6666666666666666,fps:e=>e*3.280839895013124},"rad/s":{"deg/s":e=>e*57.2958,rpm:e=>e*9.549296585513723},Hz:{rpm:e=>e*60},m:{fathom:e=>e*.5467468562055768,league:e=>e*.0002071251035625518,kilometer:e=>e*.001,mile:e=>e*.000621371192237334,"naut-mile":e=>e*.0005399568034557236,foot:e=>e*3.280839895013124,yard:e=>e*1.0936132983377078},s:{hour:e=>e*.0002777777777777778,minute:e=>e*.016666666666666666,day:e=>e*11574074074074073e-21,year:e=>e*3168876461541279e-23},foot:{m:e=>e/3.280839895013124}},fe={degree:{symbol:"\xBA",name:"Degrees"},radian:{symbol:"rad",name:"Radians"},percent:{symbol:"%",name:"Percent"},kilometer:{symbol:"km",name:"Kilometer"},"naut-mile":{symbol:"nmi",name:"Nautical Mile"},foot:{symbol:"ft",name:"Feet"},yard:{symbol:"yd",name:"Yard"},fathom:{symbol:"fm",name:"Fathom"},hour:{symbol:"hr",name:"Hour"},minute:{symbol:"min",name:"Minute"},F:{symbol:"\xBAF",name:"Fahrenheit"},C:{symbol:"\xBAC",name:"Celcius"}},H=class{static transform(t,r,n){if(!Number.isFinite(t))return null;if(r===n)return t;try{return rr[r][n](t)}catch{throw new Error("Transformation not found!")}}static setSymbol(t,r){t in fe&&(fe[t].symbol=r??fe[t].symbol)}static getSymbol(t){return t in fe?fe[t].symbol:t}static degreesToRadians(t){return rr.deg.radian(t)}static radiansToDegrees(t=0){return rr.rad.degree(t)}static nauticalMilesToKm(t=0){return t*1.852}static angleToDirection(t,r){let n=Math.PI*2;if(r||(r=0),t||(t=0),!Number.isFinite(r)||!Number.isFinite(t))return null;let i=r+t;return i>n?i-n:i<0?n+i:i}static directionToAngle(t,r){let n=Math.PI*2;if(r||(r=0),t||(t=0),!Number.isFinite(r)||!Number.isFinite(t))return null;let i=r-t,a;if(i>0)a=i>Math.PI?n-i:0-i;else if(i<0){let o=Math.abs(i);a=o>Math.PI?o-n:o}else a=i;return a}};var w=Gr(ni()),N=class e{static R=6371e3;static rhumbDestination(t,r,n){let i=e.R,a=n/i,o=t[1]*Math.PI/180,s=t[0]*Math.PI/180,c=r,v=a*Math.cos(c),g=o+v,h=a,m=89*Math.PI/180;g>m&&o<m?(h=a*(m-o)/v,g=m):g<-m&&o>-m&&(h=a*(-m-o)/v,g=-m);let P=Math.log(Math.tan(Math.PI/4+g/2)/Math.tan(Math.PI/4+o/2)),y=Math.abs(P)>1e-12?(g-o)/P:Math.cos(o),A=h*Math.sin(c)/y;return[(s+A)*180/Math.PI,g*180/Math.PI]}static destCoordinate(t,r,n){let i=(0,w.computeDestinationPoint)(t,n,H.radiansToDegrees(r));return[i.longitude,i.latitude]}static distanceTo(t,r){return(0,w.getDistance)(t,r)}static routeLength(t){return(0,w.getPathLength)(t)}static routeLegs(t,r){if(t.length<2)return[];let n=[];r?n.push({bearing:(0,w.getGreatCircleBearing)(r,t[0]),distance:e.distanceTo(r,t[0])}):n.push({bearing:0,distance:0});for(let i=1;i<t.length;++i){let a={bearing:(0,w.getGreatCircleBearing)(t[i-1],t[i]),distance:e.distanceTo(t[i-1],t[i])};n.push(a)}return n}static closestForwardPoint(t,r,n){if(t.length<2||!r)return-1;let i={index:-1,distance:-1};for(let a=0;a<t.length;++a){let o=(0,w.getGreatCircleBearing)(r,t[a]),s=wr.difference(n,o);if(s>-90&&s<90){let c=e.distanceTo(r,t[a]);(i.distance===-1||c<i.distance)&&(i.distance=c,i.index=a)}}return i.index}static centreOfPolygon(t){let r=(0,w.getCenter)(t);return[r.longitude,r.latitude]}static inDLCrossingZone(t,r=170){return Math.abs(t[0])>=r}static inBounds(t,r){return(0,w.isPointInPolygon)(t,[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]])}static calcMapifiedExtent(t,r){let i=111111*Math.cos(H.degreesToRadians(t[1])),a=[0,0,0,0];return a[1]=t[1]+(0-Math.abs(r))/111111,a[3]=t[1]+Math.abs(r)/111111,a[0]=t[0]+(0-Math.abs(r))/i,a[2]=t[0]+Math.abs(r)/i,a}static normaliseCoords(t){if(!Array.isArray(t))return[0,0];if(typeof t[0]=="number"){if(t[0]>180)for(;t[0]>180;)t[0]=t[0]-360;else if(t[0]<-180)for(;t[0]<-180;)t[0]=360+t[0];return t}else if(Array.isArray(t[0]))return t.forEach(r=>r=this.normaliseCoords(r)),t}},wr=class e{static difference(t,r){let n=360-r,i=t+n,a=e.normalise(i);return a<180?0-a:360-a}static add(t,r){return e.normalise(t+r)}static normalise(t){return t<0?t+360:t>=360?t-360:t}};var Et=class{action="notification";playback=!1;result=null;self=null;timestamp=new Date().toISOString();sourceRef},z=class{action;playback=!1;result=null;timestamp;self=null;watchDogAlarm;constructor(){this.action="update"}},It=class extends z{constructor(){super(),this.action="resource"}},jt=class extends z{constructor(){super(),this.action="radar"}},Nt=class extends z{constructor(){super(),this.action="trail"}};var ci=Gr(si());var As=["environment.wind.speedTrue","environment.wind.speedOverGround","environment.wind.angleTrueGround","environment.wind.angleTrueWater","environment.wind.directionTrue","environment.wind.directionMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"],b={active:!1,maxMsgIntervals:18,intervalCount:0,msgCount:0,alarm:!1},f,M,di,Me=[],Vt=[],Ir=!1,Ur,jr=!1,_={signalk:{},aisState:[]},mi=[0,0,0,0],pi=60,_e=0,O,X={},Z=500,T=!1,gi,U={maxAge:54e4,staleAge:36e4,lastTick:new Date().valueOf(),maxTrack:20},Nr={selfLines:{cog:{length:10}},aisCogLine:10},ve={trailDuration:24,trailResolution:{lastHour:"5s",next23:"10s",beyond24:"1m"}},V,hi,ie="freeboard-sk";function Ds(){f={self:new ue,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map,meteo:new Map},f.self.positionReceived=!1,bi()}function bi(){O={updated:{},stale:{},expired:{}}}function Ft({action:e,msg:t}){switch(e){case"onConnect":postMessage({action:"open",playback:T,result:t.target.readyState}),b.msgCount=0,b.intervalCount=0,b.alarm=!1,b.active=!0;break;case"onClose":yi(!1),b.active=!1;break;case"onError":postMessage({action:"error",playback:T,result:"Connection error!"}),b.msgCount=0,b.intervalCount=0,b.active=!1;break;case"onMessage":b.msgCount++,Ts(t);break}}addEventListener("message",({data:e})=>{Rs(e)});function Rs(e){if(e.cmd)switch(e.cmd){case"open":ui(e.options),qs(e.options);break;case"close":yi(!0);break;case"subscribe":M.subscribe(e.options.context,e.options.path);break;case"settings":ui(e.options);break;case"alarm":ks(e.options);break;case"vessel":if(e.options){let t;e.options.context==="self"?t=f.self:t=f.aisTargets.get(e.options.context),t&&e.options.name&&(t.name=e.options.name)}break;case"auth":e.options&&typeof e.options.token<"u"&&(di=e.options.token);break;case"trail":e.options&&(ve.trailDuration=e.options.trailDuration??24,e.options.trailResolution&&(ve.trailResolution.lastHour=e.options.trailResolution.lastHour??"5s",ve.trailResolution.next23=e.options.trailResolution.next23??"1m",ve.trailResolution.beyond24=e.options.trailResolution.beyond24??"5m")),Ls(ve);break}}function ui(e={config:{}}){e.interval&&typeof e.interval=="number"&&(Z=e.interval,xi(),vi(),pi=1/(Z/1e3)*60),T=!!e.playback,e.config&&(typeof e.config.units.preferredPaths<"u"&&(X=e.config.units.preferredPaths),e.config.vessels.aisMaxAge&&typeof e.config.vessels.aisMaxAge=="number"&&(U.maxAge=e.config.vessels.aisMaxAge),e.config.vessels.aisStaleAge&&typeof e.config.vessels.aisStaleAge=="number"&&(U.staleAge=e.config.vessels.aisStaleAge),typeof e.config.signalk.maxRadius=="number"&&(_.signalk=e.config.signalk),typeof e.config.selections.aisState<"u"&&Array.isArray(e.config.selections.aisState)&&(_.aisState=e.config.selections.aisState),Nr=e.config.vessels)}function yi(e=!1){xi(),Me.forEach(t=>t.unsubscribe()),M&&e&&M.close(),M=null,postMessage({action:"close",result:e,playback:T})}var Ut=!1;function Pe(e){if(!Ut)return new Promise((t,r)=>{Ut=!0,fetch(`${e}`).then(n=>{Ut=!1,n.json().then(i=>t(i)).catch(i=>r(i))}).catch(n=>{Ut=!1,r(n)})})}function _i(){let e=_&&_.signalk&&_.signalk.maxRadius?`?radius=${_.signalk.maxRadius}`:"?radius=10000";Pe(Ur+"/tracks"+e).then(t=>{jr=!0,Object.entries(t).forEach(r=>{if(f.aisTargets.has(r[0])){let n=f.aisTargets.get(r[0]);n.track=r[1].coordinates,Vr(n)}})}).catch(()=>{jr=!1})}function Ls(e){let t=Ur+"/self/track?",r=[],n=5e-4,i=!0;e.trailDuration>24&&(r.push(Pe(`${t}timespan=${e.trailDuration-24}h&resolution=${e.trailResolution.beyond24}&timespanOffset=24`)),r.push(Pe(`${t}timespan=23h&resolution=${e.trailResolution.next23}&timespanOffset=1`))),e.trailDuration>1&&e.trailDuration<25&&r.push(Pe(`${t}timespan=${e.trailDuration-1}h&resolution=${e.trailResolution.next23}&timespanOffset=1`)),r.push(Pe(`${t}timespan=1h&resolution=${e.trailResolution.lastHour}`));let a=[],o=new Nt;o.playback=T,Promise.all(r).then(s=>{let c=0,v=r.length-1,g=60;s.forEach(h=>{if(h.type&&h.type==="MultiLineString"&&h.coordinates&&Array.isArray(h.coordinates))if(c!==v){let m=[];for(h.coordinates.forEach(P=>{m=m.concat(P)}),m=(0,ci.SimplifyAP)(m,n,i);m.length>g;){let P=m.slice(0,g);a.push(P),m=m.slice(g-1),m[0]=[m[0][0]+5e-9,m[0][1]+5e-9]}m.length!==0&&a.push(m)}else a=a.concat(h.coordinates);c++}),o.result=a,postMessage(o)}).catch(()=>{o.result=null,postMessage(o)})}function qs(e){if(M)return;if(!e.url){postMessage({action:"error",result:"Valid options not provided!"});return}let t=e.url.split("/");if(t.pop(),t.push("api"),t[0]=t[0]==="wss:"?"https:":"http:",Ur=t.join("/"),Ds(),M=new ke,Me.push(M.onConnect.subscribe(r=>Ft({action:"onConnect",msg:r}))),Me.push(M.onClose.subscribe(r=>Ft({action:"onClose",msg:r}))),Me.push(M.onError.subscribe(r=>Ft({action:"onError",msg:r}))),Me.push(M.onMessage.subscribe(r=>Ft({action:"onMessage",msg:r}))),M.authToken=di,e.playback){let r=e.playbackOptions.startTime?`?startTime=${e.playbackOptions.startTime}`:null,n=e.playbackOptions.playbackRate?`playbackRate=${e.playbackOptions.playbackRate}`:null;n=n?r?"&"+n:"?"+n:null;let i=`${e.url}${r||""}${n||""}`;M.open(i,e.playbackOptions.subscribe,e.token)}else M.open(e.url,e.subscribe,e.token),_i()}function ks(e){let t=e.type.indexOf("notifications.")===-1?`notifications.${e.type}`:e.type;e.raise?M.raiseAlarm("self",t,new Te(e.message,e.state,!0,!0)):M.clearAlarm("self",t)}function Ts(e){M.isHello(e)?(postMessage({action:"hello",result:e,self:e.self,playback:T}),Z&&vi()):M.isDelta(e)?(Ir=!0,e.updates.forEach(t=>{t.values&&(V=t.$source,hi=t.timestamp,t.values.forEach(r=>{if(gi=t.timestamp,!!e.context)switch(e.context.split(".")[0]){case"shore":case"atons":_?.signalk.atons&&Ns(e.context,r),xe(e.context,f.atons,_?.signalk.atons);break;case"sar":_?.signalk.sar&&Fs(e.context,r),xe(e.context,f.sar,_?.signalk.sar);break;case"aircraft":_?.signalk.aircraft&&Vs(e.context,r),xe(e.context,f.aircraft,_?.signalk.aircraft);break;case"meteo":_?.signalk.meteo&&(Us(e.context,r),fi(r)),xe(e.context,f.meteo,_?.signalk.meteo);break;case"vessels":if(M.isSelf(e))f.self.id||(f.self.id=e.context),li(f.self,r,!0),fi(r);else{if(_?.signalk.vessels){let n=Cs(e.context);li(n,r)}xe(e.context,f.aisTargets,_?.signalk.vessels,_?.aisState)}break}}))}),Fr()):M.isResponse(e)&&postMessage({action:"response",result:e})}function xe(e,t,r=!0,n=[]){if(r){let i=t.get(e);i&&n.includes(i?.state)&&(O.expired[e]=!0,i=null),i&&_.signalk.maxRadius?i.positionReceived&&N.inBounds(i.position,mi)?O.updated[e]=!0:(t.delete(e),O.expired[e]=!0):O.updated[e]=!0}else t.size!==0&&(t.forEach((i,a)=>{O.expired[a]=!0}),t.clear())}function Fr(e=!1){if(!Z||e){let t=new z;t.watchDogAlarm=b.alarm,t.playback=T,f.aisStatus.updated=Object.keys(O.updated),f.aisStatus.stale=Object.keys(O.stale),f.aisStatus.expired=Object.keys(O.expired),t.result=f,t.timestamp=T?gi:f.self.lastUpdated.toISOString(),postMessage(t),bi(),f.self.resourceUpdates=[],js(),_e===0&&f.self.positionReceived&&_?.signalk.maxRadius&&(mi=N.calcMapifiedExtent(f.self.position,_.signalk.maxRadius),_e++),_e=_e>=pi?0:_e+1}}function vi(){Z&&typeof Z=="number"&&Vt.push(setInterval(()=>{b.active&&!b.msgCount?(b.intervalCount=b.intervalCount+1,b.intervalCount>=b.maxMsgIntervals&&(b.intervalCount=0,b.alarm=!0,Fr(!0))):(b.intervalCount=0,b.msgCount=0,b.alarm=!1),Ir&&(Fr(!0),Ir=!1)},Z)),Vt.push(setInterval(()=>{jr&&_i()},6e4))}function xi(){Vt.forEach(e=>clearInterval(e)),Vt=[]}function Cs(e){if(!f.aisTargets.has(e)){let t=new ue;t.id=e,t.position=null,f.aisTargets.set(e,t)}return f.aisTargets.get(e)}function li(e,t,r=!1){if(r){if(e.lastUpdated=new Date,t.path.startsWith("resources."))e.resourceUpdates.push(t),Is(t);else if(t.path.startsWith("radars"))Es(t);else if(t.path.startsWith("navigation.racing"))e.properties[t.path]=t.value;else if(t.path==="performance.beatAngle")e.performance.beatAngle=t.value;else if(t.path==="performance.gybeAngle")e.performance.gybeAngle=t.value;else if(t.path.startsWith("navigation.course."))if(t.path.startsWith("navigation.course.calcValues.")){let a=t.path.split(".").slice(3).join(".");e.courseCalcs[a]=t.value}else t.path.includes("activeRoute")?e.courseApi.activeRoute=t.value:t.path.includes("nextPoint")?e.courseApi.nextPoint=t.value:t.path.includes("previousPoint")?e.courseApi.previousPoint=t.value:t.path.includes("arrivalCircle")&&(e.courseApi.arrivalCircle=t.value);else if(t.path.startsWith("radars.")){let a=t.path.split("."),o=a.slice(2).join(".");e.radars[a[1]]||(e.radars[a[1]]={}),e.radars[a[1]][o]=t.value}let i=t.path.indexOf("course")!==-1?t.path.split(".").slice(0,2).join("."):t.path;As.indexOf(i)!==-1&&(f.paths[i]=null)}else t.path==="navigation.distanceToSelf"&&(e.distanceToSelf=t.value),t.path==="navigation.closestApproach"&&(e.closestApproach=t.value);if(t.path==="")typeof t.value.name<"u"&&(e.name=t.value.name),typeof t.value.mmsi<"u"&&(e.mmsi=t.value.mmsi,e.lastUpdated=new Date),typeof t.value.registrations<"u"&&(e.registrations=t.value.registrations),typeof t.value.buddy<"u"&&(e.buddy=t.value.buddy),typeof t.value.communication<"u"&&(e.callsignVhf=t.value.communication.callsignVhf??"",e.callsignHf=t.value.communication.callsignHf??"");else if(t.path==="communication.callsignVhf")e.callsignVhf=t.value;else if(t.path==="communication.callsignHf")e.callsignHf=t.value;else if(t.path==="design.aisShipType")e.type=t.value;else if(t.path==="navigation.position"&&t.value){if(typeof t.value.latitude>"u"||typeof t.value.longitude>"u")return;e.position=N.normaliseCoords([t.value.longitude,t.value.latitude]),e.positionReceived=!0,e.positionTimestamp=hi??"",e.lastUpdated=new Date,r||Vr(e)}else t.path==="navigation.state"?e.state=t.value:t.path==="navigation.speedOverGround"?e.sog=t.value:t.path==="environment.mode"?e.environment.mode=t.value:t.path==="environment.sun"?e.environment.sun=t.value:t.path==="environment.wind.angleApparent"?e.wind.awa=t.value:t.path==="environment.wind.speedApparent"?e.wind.aws=t.value:t.path==="environment.wind.speedTrue"?e.wind.speedTrue=t.value:t.path==="environment.wind.speedOverGround"?e.wind.sog=t.value:t.path==="environment.wind.directionTrue"?e.wind.twd=t.value:t.path==="environment.wind.directionMagnetic"?e.wind.mwd=t.value:t.path==="navigation.anchor.position"?e.anchor.position=t.value:t.path==="navigation.anchor.maxRadius"?e.anchor.maxRadius=t.value:t.path==="navigation.anchor.currentRadius"?e.anchor.radius=t.value:t.path==="steering.autopilot.state"&&V===ie?e.autopilot.state=t.value:t.path==="steering.autopilot.mode"&&V===ie?e.autopilot.mode=t.value:t.path==="steering.autopilot.target"&&V===ie?e.autopilot.target=t.value:t.path==="steering.autopilot.engaged"&&V===ie?e.autopilot.enabled=t.value:t.path==="steering.autopilot.defaultPilot"?(e.autopilot.default=t.value,ie=t.value):t.path==="steering.autopilot.availableActions"&&V===ie?e.autopilot.availableActions=t.value??[]:t.path==="navigation.courseOverGroundTrue"?e.cogTrue=t.value:t.path==="navigation.courseOverGroundMagnetic"?e.cogMagnetic=t.value:t.path==="navigation.headingTrue"?e.headingTrue=t.value:t.path==="navigation.headingMagnetic"&&(e.headingMagnetic=t.value);typeof X.heading<"u"&&t.path===X.heading&&(e.orientation=t.value),typeof X.tws<"u"&&t.path===X.tws&&(e.wind.tws=t.value),typeof X.twd<"u"&&t.path===X.twd&&(e.wind.direction=t.path==="environment.wind.angleTrueGround"||t.path==="environment.wind.angleTrueWater"?H.angleToDirection(t.value,e.orientation??0):t.value);let n=e.cogTrue??e.cogMagnetic??void 0;if(typeof n<"u"&&e.position){let i=r?Nr.selfLines.cog.length:Nr.aisCogLine,a=(e.sog??0)*(i*60);e.vectors.cog=[e.position,N.rhumbDestination(e.position,n,a)]}}function Es(e){let t=new jt;t.playback=T,t.result={path:e.path,value:e.value,sourceRef:V},postMessage(t)}function Is(e){let t=new It;t.playback=T,t.result={path:e.path,value:e.value,sourceRef:V},postMessage(t)}function fi(e){if(e.path.includes("notifications.")){let t=new Et;t.playback=T,t.result={path:e.path,value:e.value,sourceRef:V},postMessage(t)}}function js(){let e=new Date().valueOf();f.aisTargets.forEach((t,r)=>{t.lastUpdated.valueOf()<e-U.maxAge?(O.expired[r]=!0,f.aisTargets.delete(r)):t.lastUpdated.valueOf()<e-U.staleAge&&(O.stale[r]=!0)}),f.aircraft.forEach((t,r)=>{t.lastUpdated.valueOf()<e-U.maxAge?(O.expired[r]=!0,f.aircraft.delete(r)):t.lastUpdated.valueOf()<e-U.staleAge&&(O.stale[r]=!0)}),f.sar.forEach((t,r)=>{t.lastUpdated.valueOf()<e-U.maxAge?(O.expired[r]=!0,f.sar.delete(r)):t.lastUpdated.valueOf()<e-U.staleAge&&(O.stale[r]=!0)})}function Ns(e,t){let r=!1;if(e.indexOf("shore.basestations")!==-1&&(r=!0),!f.atons.has(e)){let i=new le;i.id=e,i.position=null,i.type.id=null,r&&(i.type.id=-2,i.type.name="Basestation"),f.atons.set(e,i)}let n=f.atons.get(e);return t.path===""?(typeof t.value.name<"u"&&(n.name=t.value.name),typeof t.value.mmsi<"u"&&(n.mmsi=t.value.mmsi),typeof t.value.atonType<"u"&&(n.type=t.value.atonType)):t.path==="atonType"?n.type=t.value:t.path==="virtual"?n.virtual=t.value:t.path==="navigation.position"?(n.position=[t.value.longitude,t.value.latitude],n.positionReceived=!0):n.properties[t.path]=t.value,e}function Fs(e,t){if(!f.sar.has(e)){let n=new Ce;n.id=e,n.position=null,n.type.id=-1,n.type.name="SaR Beacon",f.sar.set(e,n)}let r=f.sar.get(e);t.path===""?(typeof t.value.name<"u"&&(r.name=t.value.name),typeof t.value.mmsi<"u"&&(r.mmsi=t.value.mmsi),typeof t.value.communication<"u"&&(r.callsignVhf=t.value.communication.callsignVhf??"",r.callsignHf=t.value.communication.callsignHf??"")):t.path==="communication.callsignVhf"?r.callsignVhf=t.value:t.path==="communication.callsignHf"?r.callsignHf=t.value:t.path==="navigation.position"&&t.value&&(r.position=N.normaliseCoords([t.value.longitude,t.value.latitude]),r.positionReceived=!0)}function Us(e,t){if(!f.meteo.has(e)){let n=new Ie;n.id=e,n.position=null,n.type.id=-1,n.type.name="Weather Station",f.meteo.set(e,n)}let r=f.meteo.get(e);if(t.path===""){if(typeof t.value.name<"u"&&(r.name=t.value.name),typeof t.value.mmsi<"u"){let n=e.split(":").slice(-2);r.mmsi=n.length===2?`${n[0]}:${n[1]}`:t.value.mmsi}typeof t.value.communication<"u"&&(r.callsignVhf=t.value.communication.callsignVhf??"",r.callsignHf=t.value.communication.callsignHf??"")}else t.path==="communication.callsignVhf"?r.callsignVhf=t.value:t.path==="communication.callsignHf"?r.callsignHf=t.value:t.path==="environment.outside.temperature"?r.temperature=t.value:t.path==="environment.wind.directionTrue"?r.twd=t.value:t.path==="environment.wind.averageSpeed"?r.tws=t.value:t.path==="navigation.position"&&t.value&&(r.position=N.normaliseCoords([t.value.longitude,t.value.latitude]),r.positionReceived=!0)}function Vs(e,t){if(!f.aircraft.has(e)){let n=new Ee;n.id=e,n.position=null,f.aircraft.set(e,n)}let r=f.aircraft.get(e);t.path===""?(typeof t.value.name<"u"&&(r.name=t.value.name),typeof t.value.mmsi<"u"&&(r.mmsi=t.value.mmsi),typeof t.value.communication<"u"&&(r.callsignVhf=t.value.communication.callsignVhf??"",r.callsignHf=t.value.communication.callsignHf??"")):t.path==="communication.callsignVhf"?r.callsignVhf=t.value:t.path==="communication.callsignHf"?r.callsignHf=t.value:t.path==="navigation.position"&&t.value?(r.position=N.normaliseCoords([t.value.longitude,t.value.latitude]),r.positionReceived=!0,Vr(r)):t.path==="navigation.courseOverGroundTrue"?r.orientation=t.value:t.path==="navigation.speedOverGround"&&(r.sog=t.value)}function Vr(e){if(e.track&&e.track.length===0)e.track.push([e.position]);else{let t=e.track[e.track.length-1].length,r=e.track[e.track.length-1][t-1];r[0]!==e.position[0]&&r[1]!==e.position[1]&&e.track[e.track.length-1].push(e.position)}e.track[e.track.length-1]=e.track[e.track.length-1].slice(0-U.maxTrack)}
@@ -0,0 +1,12 @@
1
+ var rn=Object.create;var ie=Object.defineProperty;var nn=Object.getOwnPropertyDescriptor;var on=Object.getOwnPropertyNames;var sn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var F=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var an=(t,r,c,y)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of on(r))!un.call(t,i)&&i!==c&&ie(t,i,{get:()=>r[i],enumerable:!(y=nn(r,i))||y.enumerable});return t};var cn=(t,r,c)=>(c=t!=null?rn(sn(t)):{},an(r||!t||!t.__esModule?ie(c,"default",{value:t,enumerable:!0}):c,t));var gt=F(Bt=>{(function(){Bt.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(Bt)});var tt=F((oe,st)=>{(function(){var t,r,c,y,i,f,u,l=[].slice,m={}.hasOwnProperty;t=function(){var g,N,O,D,p,T;if(T=arguments[0],p=2<=arguments.length?l.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(g=0,O=p.length;g<O;g++)if(D=p[g],D!=null)for(N in D)m.call(D,N)&&(T[N]=D[N]);return T},i=function(g){return!!g&&Object.prototype.toString.call(g)==="[object Function]"},f=function(g){var N;return!!g&&((N=typeof g)=="function"||N==="object")},c=function(g){return i(Array.isArray)?Array.isArray(g):Object.prototype.toString.call(g)==="[object Array]"},y=function(g){var N;if(c(g))return!g.length;for(N in g)if(m.call(g,N))return!1;return!0},u=function(g){var N,O;return f(g)&&(O=Object.getPrototypeOf(g))&&(N=O.constructor)&&typeof N=="function"&&N instanceof N&&Function.prototype.toString.call(N)===Function.prototype.toString.call(Object)},r=function(g){return i(g.valueOf)?g.valueOf():g},st.exports.assign=t,st.exports.isFunction=i,st.exports.isObject=f,st.exports.isArray=c,st.exports.isEmpty=y,st.exports.isPlainObject=u,st.exports.getValue=r}).call(oe)});var Ut=F((se,ue)=>{(function(){var t;ue.exports=t=(function(){function r(){}return r.prototype.hasFeature=function(c,y){return!0},r.prototype.createDocumentType=function(c,y,i){throw new Error("This DOM method is not implemented.")},r.prototype.createDocument=function(c,y,i){throw new Error("This DOM method is not implemented.")},r.prototype.createHTMLDocument=function(c){throw new Error("This DOM method is not implemented.")},r.prototype.getFeature=function(c,y){throw new Error("This DOM method is not implemented.")},r})()}).call(se)});var le=F((ae,ce)=>{(function(){var t;ce.exports=t=(function(){function r(){}return r.prototype.handleError=function(c){throw new Error(c)},r})()}).call(ae)});var pe=F((fe,he)=>{(function(){var t;he.exports=t=(function(){function r(c){this.arr=c||[]}return Object.defineProperty(r.prototype,"length",{get:function(){return this.arr.length}}),r.prototype.item=function(c){return this.arr[c]||null},r.prototype.contains=function(c){return this.arr.indexOf(c)!==-1},r})()}).call(fe)});var ye=F((de,me)=>{(function(){var t,r,c;r=le(),c=pe(),me.exports=t=(function(){function y(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new r,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=i=Object.create(this.defaultParams)}return Object.defineProperty(y.prototype,"parameterNames",{get:function(){return new c(Object.keys(this.defaultParams))}}),y.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},y.prototype.canSetParameter=function(i,f){return!0},y.prototype.setParameter=function(i,f){return f!=null?this.params[i]=f:delete this.params[i]},y})()}).call(de)});var k=F((ge,we)=>{(function(){we.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(ge)});var Vt=F((Te,De)=>{(function(){var t,r,c;t=k(),c=Q(),De.exports=r=(function(){function y(i,f,u){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),f==null)throw new Error("Missing attribute name. "+this.debugInfo(f));this.name=this.stringify.name(f),this.value=this.stringify.attValue(u),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(y.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(y.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(y.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(y.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(y.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(y.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(y.prototype,"specified",{get:function(){return!0}}),y.prototype.clone=function(){return Object.create(this)},y.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},y.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},y.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},y})()}).call(Te)});var wt=F((be,Ee)=>{(function(){var t;Ee.exports=t=(function(){function r(c){this.nodes=c}return Object.defineProperty(r.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),r.prototype.clone=function(){return this.nodes=null},r.prototype.getNamedItem=function(c){return this.nodes[c]},r.prototype.setNamedItem=function(c){var y;return y=this.nodes[c.nodeName],this.nodes[c.nodeName]=c,y||null},r.prototype.removeNamedItem=function(c){var y;return y=this.nodes[c],delete this.nodes[c],y||null},r.prototype.item=function(c){return this.nodes[Object.keys(this.nodes)[c]]||null},r.prototype.getNamedItemNS=function(c,y){throw new Error("This DOM method is not implemented.")},r.prototype.setNamedItemNS=function(c){throw new Error("This DOM method is not implemented.")},r.prototype.removeNamedItemNS=function(c,y){throw new Error("This DOM method is not implemented.")},r})()}).call(be)});var Tt=F((Ne,Oe)=>{(function(){var t,r,c,y,i,f,u,l,m,g=function(O,D){for(var p in D)N.call(D,p)&&(O[p]=D[p]);function T(){this.constructor=O}return T.prototype=D.prototype,O.prototype=new T,O.__super__=D.prototype,O},N={}.hasOwnProperty;m=tt(),l=m.isObject,u=m.isFunction,f=m.getValue,i=Q(),t=k(),r=Vt(),y=wt(),Oe.exports=c=(function(O){g(D,O);function D(p,T,E){var A,M,_,d;if(D.__super__.constructor.call(this,p),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,E!=null&&this.attribute(E),p.type===t.Document&&(this.isRoot=!0,this.documentObject=p,p.rootObject=this,p.children)){for(d=p.children,M=0,_=d.length;M<_;M++)if(A=d[M],A.type===t.DocType){A.name=this.name;break}}}return Object.defineProperty(D.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(D.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(D.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(D.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(D.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(D.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new y(this.attribs)),this.attributeMap}}),D.prototype.clone=function(){var p,T,E,A;E=Object.create(this),E.isRoot&&(E.documentObject=null),E.attribs={},A=this.attribs;for(T in A)N.call(A,T)&&(p=A[T],E.attribs[T]=p.clone());return E.children=[],this.children.forEach(function(M){var _;return _=M.clone(),_.parent=E,E.children.push(_)}),E},D.prototype.attribute=function(p,T){var E,A;if(p!=null&&(p=f(p)),l(p))for(E in p)N.call(p,E)&&(A=p[E],this.attribute(E,A));else u(T)&&(T=T.apply()),this.options.keepNullAttributes&&T==null?this.attribs[p]=new r(this,p,""):T!=null&&(this.attribs[p]=new r(this,p,T));return this},D.prototype.removeAttribute=function(p){var T,E,A;if(p==null)throw new Error("Missing attribute name. "+this.debugInfo());if(p=f(p),Array.isArray(p))for(E=0,A=p.length;E<A;E++)T=p[E],delete this.attribs[T];else delete this.attribs[p];return this},D.prototype.toString=function(p){return this.options.writer.element(this,this.options.writer.filterOptions(p))},D.prototype.att=function(p,T){return this.attribute(p,T)},D.prototype.a=function(p,T){return this.attribute(p,T)},D.prototype.getAttribute=function(p){return this.attribs.hasOwnProperty(p)?this.attribs[p].value:null},D.prototype.setAttribute=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getAttributeNode=function(p){return this.attribs.hasOwnProperty(p)?this.attribs[p]:null},D.prototype.setAttributeNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeAttributeNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getAttributeNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setAttributeNS=function(p,T,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeAttributeNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getAttributeNodeNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setAttributeNodeNS=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getElementsByTagNameNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.hasAttribute=function(p){return this.attribs.hasOwnProperty(p)},D.prototype.hasAttributeNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setIdAttribute=function(p,T){return this.attribs.hasOwnProperty(p)?this.attribs[p].isId:T},D.prototype.setIdAttributeNS=function(p,T,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setIdAttributeNode=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getElementsByTagNameNS=function(p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getElementsByClassName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isEqualNode=function(p){var T,E,A;if(!D.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)||p.namespaceURI!==this.namespaceURI||p.prefix!==this.prefix||p.localName!==this.localName||p.attribs.length!==this.attribs.length)return!1;for(T=E=0,A=this.attribs.length-1;0<=A?E<=A:E>=A;T=0<=A?++E:--E)if(!this.attribs[T].isEqualNode(p.attribs[T]))return!1;return!0},D})(i)}).call(Ne)});var dt=F((Ie,Ce)=>{(function(){var t,r,c=function(i,f){for(var u in f)y.call(f,u)&&(i[u]=f[u]);function l(){this.constructor=i}return l.prototype=f.prototype,i.prototype=new l,i.__super__=f.prototype,i},y={}.hasOwnProperty;r=Q(),Ce.exports=t=(function(i){c(f,i);function f(u){f.__super__.constructor.call(this,u),this.value=""}return Object.defineProperty(f.prototype,"data",{get:function(){return this.value},set:function(u){return this.value=u||""}}),Object.defineProperty(f.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(f.prototype,"textContent",{get:function(){return this.value},set:function(u){return this.value=u||""}}),f.prototype.clone=function(){return Object.create(this)},f.prototype.substringData=function(u,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.appendData=function(u){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.insertData=function(u,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.deleteData=function(u,l){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.replaceData=function(u,l,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.isEqualNode=function(u){return!(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(u)||u.data!==this.data)},f})(r)}).call(Ie)});var Dt=F((_e,Le)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;t=k(),c=dt(),Le.exports=r=(function(f){y(u,f);function u(l,m){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(m)}return u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return this.options.writer.cdata(this,this.options.writer.filterOptions(l))},u})(c)}).call(_e)});var bt=F((ve,Me)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;t=k(),r=dt(),Me.exports=c=(function(f){y(u,f);function u(l,m){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(m)}return u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return this.options.writer.comment(this,this.options.writer.filterOptions(l))},u})(r)}).call(ve)});var Et=F((Ae,Pe)=>{(function(){var t,r,c,y,i=function(u,l){for(var m in l)f.call(l,m)&&(u[m]=l[m]);function g(){this.constructor=u}return g.prototype=l.prototype,u.prototype=new g,u.__super__=l.prototype,u},f={}.hasOwnProperty;y=tt().isObject,c=Q(),t=k(),Pe.exports=r=(function(u){i(l,u);function l(m,g,N,O){var D;l.__super__.constructor.call(this,m),y(g)&&(D=g,g=D.version,N=D.encoding,O=D.standalone),g||(g="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(g),N!=null&&(this.encoding=this.stringify.xmlEncoding(N)),O!=null&&(this.standalone=this.stringify.xmlStandalone(O))}return l.prototype.toString=function(m){return this.options.writer.declaration(this,this.options.writer.filterOptions(m))},l})(c)}).call(Ae)});var Nt=F((xe,Se)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;c=Q(),t=k(),Se.exports=r=(function(f){y(u,f);function u(l,m,g,N,O,D){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(g==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(m));if(!N)throw new Error("Missing DTD attribute type. "+this.debugInfo(m));if(!O)throw new Error("Missing DTD attribute default. "+this.debugInfo(m));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(m));if(D&&!O.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(m));this.elementName=this.stringify.name(m),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(g),this.attributeType=this.stringify.dtdAttType(N),D&&(this.defaultValue=this.stringify.dtdAttDefault(D)),this.defaultValueType=O}return u.prototype.toString=function(l){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(l))},u})(c)}).call(xe)});var Ot=F((Fe,qe)=>{(function(){var t,r,c,y,i=function(u,l){for(var m in l)f.call(l,m)&&(u[m]=l[m]);function g(){this.constructor=u}return g.prototype=l.prototype,u.prototype=new g,u.__super__=l.prototype,u},f={}.hasOwnProperty;y=tt().isObject,c=Q(),t=k(),qe.exports=r=(function(u){i(l,u);function l(m,g,N,O){if(l.__super__.constructor.call(this,m),N==null)throw new Error("Missing DTD entity name. "+this.debugInfo(N));if(O==null)throw new Error("Missing DTD entity value. "+this.debugInfo(N));if(this.pe=!!g,this.name=this.stringify.name(N),this.type=t.EntityDeclaration,!y(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(N));if(O.pubID&&!O.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(N));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(N))}}return Object.defineProperty(l.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(l.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(l.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(l.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(l.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(l.prototype,"xmlVersion",{get:function(){return null}}),l.prototype.toString=function(m){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(m))},l})(c)}).call(Fe)});var It=F((Xe,Re)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;c=Q(),t=k(),Re.exports=r=(function(f){y(u,f);function u(l,m,g){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing DTD element name. "+this.debugInfo());g||(g="(#PCDATA)"),Array.isArray(g)&&(g="("+g.join(",")+")"),this.name=this.stringify.name(m),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(g)}return u.prototype.toString=function(l){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(l))},u})(c)}).call(Xe)});var Ct=F((je,Be)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;c=Q(),t=k(),Be.exports=r=(function(f){y(u,f);function u(l,m,g){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing DTD notation name. "+this.debugInfo(m));if(!g.pubID&&!g.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(m));this.name=this.stringify.name(m),this.type=t.NotationDeclaration,g.pubID!=null&&(this.pubID=this.stringify.dtdPubID(g.pubID)),g.sysID!=null&&(this.sysID=this.stringify.dtdSysID(g.sysID))}return Object.defineProperty(u.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(u.prototype,"systemId",{get:function(){return this.sysID}}),u.prototype.toString=function(l){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(l))},u})(c)}).call(je)});var _t=F((Ue,Ve)=>{(function(){var t,r,c,y,i,f,u,l,m,g=function(O,D){for(var p in D)N.call(D,p)&&(O[p]=D[p]);function T(){this.constructor=O}return T.prototype=D.prototype,O.prototype=new T,O.__super__=D.prototype,O},N={}.hasOwnProperty;m=tt().isObject,l=Q(),t=k(),r=Nt(),y=Ot(),c=It(),i=Ct(),u=wt(),Ve.exports=f=(function(O){g(D,O);function D(p,T,E){var A,M,_,d,o,n;if(D.__super__.constructor.call(this,p),this.type=t.DocType,p.children){for(d=p.children,M=0,_=d.length;M<_;M++)if(A=d[M],A.type===t.Element){this.name=A.name;break}}this.documentObject=p,m(T)&&(o=T,T=o.pubID,E=o.sysID),E==null&&(n=[T,E],E=n[0],T=n[1]),T!=null&&(this.pubID=this.stringify.dtdPubID(T)),E!=null&&(this.sysID=this.stringify.dtdSysID(E))}return Object.defineProperty(D.prototype,"entities",{get:function(){var p,T,E,A,M;for(A={},M=this.children,T=0,E=M.length;T<E;T++)p=M[T],p.type===t.EntityDeclaration&&!p.pe&&(A[p.name]=p);return new u(A)}}),Object.defineProperty(D.prototype,"notations",{get:function(){var p,T,E,A,M;for(A={},M=this.children,T=0,E=M.length;T<E;T++)p=M[T],p.type===t.NotationDeclaration&&(A[p.name]=p);return new u(A)}}),Object.defineProperty(D.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(D.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(D.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),D.prototype.element=function(p,T){var E;return E=new c(this,p,T),this.children.push(E),this},D.prototype.attList=function(p,T,E,A,M){var _;return _=new r(this,p,T,E,A,M),this.children.push(_),this},D.prototype.entity=function(p,T){var E;return E=new y(this,!1,p,T),this.children.push(E),this},D.prototype.pEntity=function(p,T){var E;return E=new y(this,!0,p,T),this.children.push(E),this},D.prototype.notation=function(p,T){var E;return E=new i(this,p,T),this.children.push(E),this},D.prototype.toString=function(p){return this.options.writer.docType(this,this.options.writer.filterOptions(p))},D.prototype.ele=function(p,T){return this.element(p,T)},D.prototype.att=function(p,T,E,A,M){return this.attList(p,T,E,A,M)},D.prototype.ent=function(p,T){return this.entity(p,T)},D.prototype.pent=function(p,T){return this.pEntity(p,T)},D.prototype.not=function(p,T){return this.notation(p,T)},D.prototype.up=function(){return this.root()||this.documentObject},D.prototype.isEqualNode=function(p){return!(!D.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)||p.name!==this.name||p.publicId!==this.publicId||p.systemId!==this.systemId)},D})(l)}).call(Ue)});var Lt=F((We,ke)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;t=k(),r=Q(),ke.exports=c=(function(f){y(u,f);function u(l,m){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(m)}return u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return this.options.writer.raw(this,this.options.writer.filterOptions(l))},u})(r)}).call(We)});var vt=F((Ge,Ye)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;t=k(),r=dt(),Ye.exports=c=(function(f){y(u,f);function u(l,m){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(m)}return Object.defineProperty(u.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(u.prototype,"wholeText",{get:function(){var l,m,g;for(g="",m=this.previousSibling;m;)g=m.data+g,m=m.previousSibling;for(g+=this.data,l=this.nextSibling;l;)g=g+l.data,l=l.nextSibling;return g}}),u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return this.options.writer.text(this,this.options.writer.filterOptions(l))},u.prototype.splitText=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.replaceWholeText=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},u})(r)}).call(Ge)});var Mt=F((Ke,ze)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;t=k(),r=dt(),ze.exports=c=(function(f){y(u,f);function u(l,m,g){if(u.__super__.constructor.call(this,l),m==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(m),this.name=this.target,g&&(this.value=this.stringify.insValue(g))}return u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(l))},u.prototype.isEqualNode=function(l){return!(!u.__super__.isEqualNode.apply(this,arguments).isEqualNode(l)||l.target!==this.target)},u})(r)}).call(Ke)});var Wt=F((He,$e)=>{(function(){var t,r,c,y=function(f,u){for(var l in u)i.call(u,l)&&(f[l]=u[l]);function m(){this.constructor=f}return m.prototype=u.prototype,f.prototype=new m,f.__super__=u.prototype,f},i={}.hasOwnProperty;c=Q(),t=k(),$e.exports=r=(function(f){y(u,f);function u(l){u.__super__.constructor.call(this,l),this.type=t.Dummy}return u.prototype.clone=function(){return Object.create(this)},u.prototype.toString=function(l){return""},u})(c)}).call(He)});var Je=F((Qe,Ze)=>{(function(){var t;Ze.exports=t=(function(){function r(c){this.nodes=c}return Object.defineProperty(r.prototype,"length",{get:function(){return this.nodes.length||0}}),r.prototype.clone=function(){return this.nodes=null},r.prototype.item=function(c){return this.nodes[c]||null},r})()}).call(Qe)});var rr=F((tr,er)=>{(function(){er.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(tr)});var Q=F((nr,ir)=>{(function(){var t,r,c,y,i,f,u,l,m,g,N,O,D,p,T,E,A,M,_,d={}.hasOwnProperty;_=tt(),M=_.isObject,A=_.isFunction,E=_.isEmpty,T=_.getValue,l=null,c=null,y=null,i=null,f=null,D=null,p=null,O=null,u=null,r=null,N=null,m=null,t=null,ir.exports=g=(function(){function o(n){this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,l||(l=Tt(),c=Dt(),y=bt(),i=Et(),f=_t(),D=Lt(),p=vt(),O=Mt(),u=Wt(),r=k(),N=Je(),m=wt(),t=rr())}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 N(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 n;return n=this.parent.children.indexOf(this),this.parent.children[n-1]||null}}),Object.defineProperty(o.prototype,"nextSibling",{get:function(){var n;return n=this.parent.children.indexOf(this),this.parent.children[n+1]||null}}),Object.defineProperty(o.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(o.prototype,"textContent",{get:function(){var n,h,C,I,a;if(this.nodeType===r.Element||this.nodeType===r.DocumentFragment){for(a="",I=this.children,h=0,C=I.length;h<C;h++)n=I[h],n.textContent&&(a+=n.textContent);return a}else return null},set:function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),o.prototype.setParent=function(n){var h,C,I,a,w;for(this.parent=n,n&&(this.options=n.options,this.stringify=n.stringify),a=this.children,w=[],C=0,I=a.length;C<I;C++)h=a[C],w.push(h.setParent(this));return w},o.prototype.element=function(n,h,C){var I,a,w,v,P,x,q,X,S,V,R;if(x=null,h===null&&C==null&&(S=[{},null],h=S[0],C=S[1]),h==null&&(h={}),h=T(h),M(h)||(V=[h,C],C=V[0],h=V[1]),n!=null&&(n=T(n)),Array.isArray(n))for(w=0,q=n.length;w<q;w++)a=n[w],x=this.element(a);else if(A(n))x=this.element(n.apply());else if(M(n)){for(P in n)if(d.call(n,P))if(R=n[P],A(R)&&(R=R.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&P.indexOf(this.stringify.convertAttKey)===0)x=this.attribute(P.substr(this.stringify.convertAttKey.length),R);else if(!this.options.separateArrayItems&&Array.isArray(R)&&E(R))x=this.dummy();else if(M(R)&&E(R))x=this.element(P);else if(!this.options.keepNullNodes&&R==null)x=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(R))for(v=0,X=R.length;v<X;v++)a=R[v],I={},I[P]=a,x=this.element(I);else M(R)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&P.indexOf(this.stringify.convertTextKey)===0?x=this.element(R):(x=this.element(P),x.element(R)):x=this.element(P,R)}else!this.options.keepNullNodes&&C===null?x=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&n.indexOf(this.stringify.convertTextKey)===0?x=this.text(C):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&n.indexOf(this.stringify.convertCDataKey)===0?x=this.cdata(C):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&n.indexOf(this.stringify.convertCommentKey)===0?x=this.comment(C):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&n.indexOf(this.stringify.convertRawKey)===0?x=this.raw(C):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&n.indexOf(this.stringify.convertPIKey)===0?x=this.instruction(n.substr(this.stringify.convertPIKey.length),C):x=this.node(n,h,C);if(x==null)throw new Error("Could not create any elements with: "+n+". "+this.debugInfo());return x},o.prototype.insertBefore=function(n,h,C){var I,a,w,v,P;if(n?.type)return w=n,v=h,w.setParent(this),v?(a=children.indexOf(v),P=children.splice(a),children.push(w),Array.prototype.push.apply(children,P)):children.push(w),w;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(n));return a=this.parent.children.indexOf(this),P=this.parent.children.splice(a),I=this.parent.element(n,h,C),Array.prototype.push.apply(this.parent.children,P),I},o.prototype.insertAfter=function(n,h,C){var I,a,w;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(n));return a=this.parent.children.indexOf(this),w=this.parent.children.splice(a+1),I=this.parent.element(n,h,C),Array.prototype.push.apply(this.parent.children,w),I},o.prototype.remove=function(){var n,h;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return n=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[n,n-n+1].concat(h=[])),this.parent},o.prototype.node=function(n,h,C){var I,a;return n!=null&&(n=T(n)),h||(h={}),h=T(h),M(h)||(a=[h,C],C=a[0],h=a[1]),I=new l(this,n,h),C!=null&&I.text(C),this.children.push(I),I},o.prototype.text=function(n){var h;return M(n)&&this.element(n),h=new p(this,n),this.children.push(h),this},o.prototype.cdata=function(n){var h;return h=new c(this,n),this.children.push(h),this},o.prototype.comment=function(n){var h;return h=new y(this,n),this.children.push(h),this},o.prototype.commentBefore=function(n){var h,C,I;return C=this.parent.children.indexOf(this),I=this.parent.children.splice(C),h=this.parent.comment(n),Array.prototype.push.apply(this.parent.children,I),this},o.prototype.commentAfter=function(n){var h,C,I;return C=this.parent.children.indexOf(this),I=this.parent.children.splice(C+1),h=this.parent.comment(n),Array.prototype.push.apply(this.parent.children,I),this},o.prototype.raw=function(n){var h;return h=new D(this,n),this.children.push(h),this},o.prototype.dummy=function(){var n;return n=new u(this),n},o.prototype.instruction=function(n,h){var C,I,a,w,v;if(n!=null&&(n=T(n)),h!=null&&(h=T(h)),Array.isArray(n))for(w=0,v=n.length;w<v;w++)C=n[w],this.instruction(C);else if(M(n))for(C in n)d.call(n,C)&&(I=n[C],this.instruction(C,I));else A(h)&&(h=h.apply()),a=new O(this,n,h),this.children.push(a);return this},o.prototype.instructionBefore=function(n,h){var C,I,a;return I=this.parent.children.indexOf(this),a=this.parent.children.splice(I),C=this.parent.instruction(n,h),Array.prototype.push.apply(this.parent.children,a),this},o.prototype.instructionAfter=function(n,h){var C,I,a;return I=this.parent.children.indexOf(this),a=this.parent.children.splice(I+1),C=this.parent.instruction(n,h),Array.prototype.push.apply(this.parent.children,a),this},o.prototype.declaration=function(n,h,C){var I,a;return I=this.document(),a=new i(I,n,h,C),I.children.length===0?I.children.unshift(a):I.children[0].type===r.Declaration?I.children[0]=a:I.children.unshift(a),I.root()||I},o.prototype.dtd=function(n,h){var C,I,a,w,v,P,x,q,X,S;for(I=this.document(),a=new f(I,n,h),X=I.children,w=v=0,x=X.length;v<x;w=++v)if(C=X[w],C.type===r.DocType)return I.children[w]=a,a;for(S=I.children,w=P=0,q=S.length;P<q;w=++P)if(C=S[w],C.isRoot)return I.children.splice(w,0,a),a;return I.children.push(a),a},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 n;for(n=this;n;){if(n.type===r.Document)return n.rootObject;if(n.isRoot)return n;n=n.parent}},o.prototype.document=function(){var n;for(n=this;n;){if(n.type===r.Document)return n;n=n.parent}},o.prototype.end=function(n){return this.document().end(n)},o.prototype.prev=function(){var n;if(n=this.parent.children.indexOf(this),n<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[n-1]},o.prototype.next=function(){var n;if(n=this.parent.children.indexOf(this),n===-1||n===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[n+1]},o.prototype.importDocument=function(n){var h;return h=n.root().clone(),h.parent=this,h.isRoot=!1,this.children.push(h),this},o.prototype.debugInfo=function(n){var h,C;return n=n||this.name,n==null&&!((h=this.parent)!=null&&h.name)?"":n==null?"parent: <"+this.parent.name+">":(C=this.parent)!=null&&C.name?"node: <"+n+">, parent: <"+this.parent.name+">":"node: <"+n+">"},o.prototype.ele=function(n,h,C){return this.element(n,h,C)},o.prototype.nod=function(n,h,C){return this.node(n,h,C)},o.prototype.txt=function(n){return this.text(n)},o.prototype.dat=function(n){return this.cdata(n)},o.prototype.com=function(n){return this.comment(n)},o.prototype.ins=function(n,h){return this.instruction(n,h)},o.prototype.doc=function(){return this.document()},o.prototype.dec=function(n,h,C){return this.declaration(n,h,C)},o.prototype.e=function(n,h,C){return this.element(n,h,C)},o.prototype.n=function(n,h,C){return this.node(n,h,C)},o.prototype.t=function(n){return this.text(n)},o.prototype.d=function(n){return this.cdata(n)},o.prototype.c=function(n){return this.comment(n)},o.prototype.r=function(n){return this.raw(n)},o.prototype.i=function(n,h){return this.instruction(n,h)},o.prototype.u=function(){return this.up()},o.prototype.importXMLBuilder=function(n){return this.importDocument(n)},o.prototype.replaceChild=function(n,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.removeChild=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendChild=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.hasChildNodes=function(){return this.children.length!==0},o.prototype.cloneNode=function(n){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(n,h){return!0},o.prototype.hasAttributes=function(){return this.attribs.length!==0},o.prototype.compareDocumentPosition=function(n){var h,C;return h=this,h===n?0:this.document()!==n.document()?(C=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?C|=t.Preceding:C|=t.Following,C):h.isAncestor(n)?t.Contains|t.Preceding:h.isDescendant(n)?t.Contains|t.Following:h.isPreceding(n)?t.Preceding:t.Following},o.prototype.isSameNode=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.lookupPrefix=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isDefaultNamespace=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.lookupNamespaceURI=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(n){var h,C,I;if(n.nodeType!==this.nodeType||n.children.length!==this.children.length)return!1;for(h=C=0,I=this.children.length-1;0<=I?C<=I:C>=I;h=0<=I?++C:--C)if(!this.children[h].isEqualNode(n.children[h]))return!1;return!0},o.prototype.getFeature=function(n,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.setUserData=function(n,h,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.getUserData=function(n){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.contains=function(n){return n?n===this||this.isDescendant(n):!1},o.prototype.isDescendant=function(n){var h,C,I,a,w;for(w=this.children,I=0,a=w.length;I<a;I++)if(h=w[I],n===h||(C=h.isDescendant(n),C))return!0;return!1},o.prototype.isAncestor=function(n){return n.isDescendant(this)},o.prototype.isPreceding=function(n){var h,C;return h=this.treePosition(n),C=this.treePosition(this),h===-1||C===-1?!1:h<C},o.prototype.isFollowing=function(n){var h,C;return h=this.treePosition(n),C=this.treePosition(this),h===-1||C===-1?!1:h>C},o.prototype.treePosition=function(n){var h,C;return C=0,h=!1,this.foreachTreeNode(this.document(),function(I){if(C++,!h&&I===n)return h=!0}),h?C:-1},o.prototype.foreachTreeNode=function(n,h){var C,I,a,w,v;for(n||(n=this.document()),w=n.children,I=0,a=w.length;I<a;I++){if(C=w[I],v=h(C))return v;if(v=this.foreachTreeNode(C,h),v)return v}},o})()}).call(nr)});var kt=F((or,sr)=>{(function(){var t,r=function(y,i){return function(){return y.apply(i,arguments)}},c={}.hasOwnProperty;sr.exports=t=(function(){function y(i){this.assertLegalName=r(this.assertLegalName,this),this.assertLegalChar=r(this.assertLegalChar,this);var f,u,l;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),u=i.stringify||{};for(f in u)c.call(u,f)&&(l=u[f],this[f]=l)}return y.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},y.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},y.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},y.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},y.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},y.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},y.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},y.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},y.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},y.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},y.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},y.prototype.convertAttKey="@",y.prototype.convertPIKey="?",y.prototype.convertTextKey="#text",y.prototype.convertCDataKey="#cdata",y.prototype.convertCommentKey="#comment",y.prototype.convertRawKey="#raw",y.prototype.assertLegalChar=function(i){var f,u;if(this.options.noValidation)return i;if(f="",this.options.version==="1.0"){if(f=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u=i.match(f))throw new Error("Invalid character in string: "+i+" at index "+u.index)}else if(this.options.version==="1.1"&&(f=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u=i.match(f)))throw new Error("Invalid character in string: "+i+" at index "+u.index);return i},y.prototype.assertLegalName=function(i){var f;if(this.options.noValidation)return i;if(this.assertLegalChar(i),f=/^([: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])*$/,!i.match(f))throw new Error("Invalid character in name");return i},y.prototype.textEscape=function(i){var f;return this.options.noValidation?i:(f=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(f,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},y.prototype.attEscape=function(i){var f;return this.options.noValidation?i:(f=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(f,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},y})()}).call(or)});var mt=F((ur,ar)=>{(function(){ar.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(ur)});var Gt=F((cr,lr)=>{(function(){var t,r,c,y,i,f,u,l,m,g,N,O,D,p,T,E,A,M={}.hasOwnProperty;A=tt().assign,t=k(),m=Et(),g=_t(),c=Dt(),y=bt(),O=Tt(),p=Lt(),T=vt(),D=Mt(),N=Wt(),i=Nt(),f=It(),u=Ot(),l=Ct(),r=mt(),lr.exports=E=(function(){function _(d){var o,n,h;d||(d={}),this.options=d,n=d.writer||{};for(o in n)M.call(n,o)&&(h=n[o],this["_"+o]=this[o],this[o]=h)}return _.prototype.filterOptions=function(d){var o,n,h,C,I,a,w,v;return d||(d={}),d=A({},this.options,d),o={writer:this},o.pretty=d.pretty||!1,o.allowEmpty=d.allowEmpty||!1,o.indent=(n=d.indent)!=null?n:" ",o.newline=(h=d.newline)!=null?h:`
3
+ `,o.offset=(C=d.offset)!=null?C:0,o.dontPrettyTextNodes=(I=(a=d.dontPrettyTextNodes)!=null?a:d.dontprettytextnodes)!=null?I:0,o.spaceBeforeSlash=(w=(v=d.spaceBeforeSlash)!=null?v:d.spacebeforeslash)!=null?w:"",o.spaceBeforeSlash===!0&&(o.spaceBeforeSlash=" "),o.suppressPrettyCount=0,o.user={},o.state=r.None,o},_.prototype.indent=function(d,o,n){var h;return!o.pretty||o.suppressPrettyCount?"":o.pretty&&(h=(n||0)+o.offset+1,h>0)?new Array(h).join(o.indent):""},_.prototype.endline=function(d,o,n){return!o.pretty||o.suppressPrettyCount?"":o.newline},_.prototype.attribute=function(d,o,n){var h;return this.openAttribute(d,o,n),h=" "+d.name+'="'+d.value+'"',this.closeAttribute(d,o,n),h},_.prototype.cdata=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<![CDATA[",o.state=r.InsideTag,h+=d.value,o.state=r.CloseTag,h+="]]>"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.comment=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<!-- ",o.state=r.InsideTag,h+=d.value,o.state=r.CloseTag,h+=" -->"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.declaration=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<?xml",o.state=r.InsideTag,h+=' version="'+d.version+'"',d.encoding!=null&&(h+=' encoding="'+d.encoding+'"'),d.standalone!=null&&(h+=' standalone="'+d.standalone+'"'),o.state=r.CloseTag,h+=o.spaceBeforeSlash+"?>",h+=this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.docType=function(d,o,n){var h,C,I,a,w;if(n||(n=0),this.openNode(d,o,n),o.state=r.OpenTag,a=this.indent(d,o,n),a+="<!DOCTYPE "+d.root().name,d.pubID&&d.sysID?a+=' PUBLIC "'+d.pubID+'" "'+d.sysID+'"':d.sysID&&(a+=' SYSTEM "'+d.sysID+'"'),d.children.length>0){for(a+=" [",a+=this.endline(d,o,n),o.state=r.InsideTag,w=d.children,C=0,I=w.length;C<I;C++)h=w[C],a+=this.writeChildNode(h,o,n+1);o.state=r.CloseTag,a+="]"}return o.state=r.CloseTag,a+=o.spaceBeforeSlash+">",a+=this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),a},_.prototype.element=function(d,o,n){var h,C,I,a,w,v,P,x,q,X,S,V,R,J;n||(n=0),X=!1,S="",this.openNode(d,o,n),o.state=r.OpenTag,S+=this.indent(d,o,n)+"<"+d.name,V=d.attribs;for(q in V)M.call(V,q)&&(h=V[q],S+=this.attribute(h,o,n));if(I=d.children.length,a=I===0?null:d.children[0],I===0||d.children.every(function(ht){return(ht.type===t.Text||ht.type===t.Raw)&&ht.value===""}))o.allowEmpty?(S+=">",o.state=r.CloseTag,S+="</"+d.name+">"+this.endline(d,o,n)):(o.state=r.CloseTag,S+=o.spaceBeforeSlash+"/>"+this.endline(d,o,n));else if(o.pretty&&I===1&&(a.type===t.Text||a.type===t.Raw)&&a.value!=null)S+=">",o.state=r.InsideTag,o.suppressPrettyCount++,X=!0,S+=this.writeChildNode(a,o,n+1),o.suppressPrettyCount--,X=!1,o.state=r.CloseTag,S+="</"+d.name+">"+this.endline(d,o,n);else{if(o.dontPrettyTextNodes){for(R=d.children,w=0,P=R.length;w<P;w++)if(C=R[w],(C.type===t.Text||C.type===t.Raw)&&C.value!=null){o.suppressPrettyCount++,X=!0;break}}for(S+=">"+this.endline(d,o,n),o.state=r.InsideTag,J=d.children,v=0,x=J.length;v<x;v++)C=J[v],S+=this.writeChildNode(C,o,n+1);o.state=r.CloseTag,S+=this.indent(d,o,n)+"</"+d.name+">",X&&o.suppressPrettyCount--,S+=this.endline(d,o,n),o.state=r.None}return this.closeNode(d,o,n),S},_.prototype.writeChildNode=function(d,o,n){switch(d.type){case t.CData:return this.cdata(d,o,n);case t.Comment:return this.comment(d,o,n);case t.Element:return this.element(d,o,n);case t.Raw:return this.raw(d,o,n);case t.Text:return this.text(d,o,n);case t.ProcessingInstruction:return this.processingInstruction(d,o,n);case t.Dummy:return"";case t.Declaration:return this.declaration(d,o,n);case t.DocType:return this.docType(d,o,n);case t.AttributeDeclaration:return this.dtdAttList(d,o,n);case t.ElementDeclaration:return this.dtdElement(d,o,n);case t.EntityDeclaration:return this.dtdEntity(d,o,n);case t.NotationDeclaration:return this.dtdNotation(d,o,n);default:throw new Error("Unknown XML node type: "+d.constructor.name)}},_.prototype.processingInstruction=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<?",o.state=r.InsideTag,h+=d.target,d.value&&(h+=" "+d.value),o.state=r.CloseTag,h+=o.spaceBeforeSlash+"?>",h+=this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.raw=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n),o.state=r.InsideTag,h+=d.value,o.state=r.CloseTag,h+=this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.text=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n),o.state=r.InsideTag,h+=d.value,o.state=r.CloseTag,h+=this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.dtdAttList=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<!ATTLIST",o.state=r.InsideTag,h+=" "+d.elementName+" "+d.attributeName+" "+d.attributeType,d.defaultValueType!=="#DEFAULT"&&(h+=" "+d.defaultValueType),d.defaultValue&&(h+=' "'+d.defaultValue+'"'),o.state=r.CloseTag,h+=o.spaceBeforeSlash+">"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.dtdElement=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<!ELEMENT",o.state=r.InsideTag,h+=" "+d.name+" "+d.value,o.state=r.CloseTag,h+=o.spaceBeforeSlash+">"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.dtdEntity=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<!ENTITY",o.state=r.InsideTag,d.pe&&(h+=" %"),h+=" "+d.name,d.value?h+=' "'+d.value+'"':(d.pubID&&d.sysID?h+=' PUBLIC "'+d.pubID+'" "'+d.sysID+'"':d.sysID&&(h+=' SYSTEM "'+d.sysID+'"'),d.nData&&(h+=" NDATA "+d.nData)),o.state=r.CloseTag,h+=o.spaceBeforeSlash+">"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.dtdNotation=function(d,o,n){var h;return this.openNode(d,o,n),o.state=r.OpenTag,h=this.indent(d,o,n)+"<!NOTATION",o.state=r.InsideTag,h+=" "+d.name,d.pubID&&d.sysID?h+=' PUBLIC "'+d.pubID+'" "'+d.sysID+'"':d.pubID?h+=' PUBLIC "'+d.pubID+'"':d.sysID&&(h+=' SYSTEM "'+d.sysID+'"'),o.state=r.CloseTag,h+=o.spaceBeforeSlash+">"+this.endline(d,o,n),o.state=r.None,this.closeNode(d,o,n),h},_.prototype.openNode=function(d,o,n){},_.prototype.closeNode=function(d,o,n){},_.prototype.openAttribute=function(d,o,n){},_.prototype.closeAttribute=function(d,o,n){},_})()}).call(cr)});var At=F((fr,hr)=>{(function(){var t,r,c=function(i,f){for(var u in f)y.call(f,u)&&(i[u]=f[u]);function l(){this.constructor=i}return l.prototype=f.prototype,i.prototype=new l,i.__super__=f.prototype,i},y={}.hasOwnProperty;r=Gt(),hr.exports=t=(function(i){c(f,i);function f(u){f.__super__.constructor.call(this,u)}return f.prototype.document=function(u,l){var m,g,N,O,D;for(l=this.filterOptions(l),O="",D=u.children,g=0,N=D.length;g<N;g++)m=D[g],O+=this.writeChildNode(m,l,0);return l.pretty&&O.slice(-l.newline.length)===l.newline&&(O=O.slice(0,-l.newline.length)),O},f})(r)}).call(fr)});var Yt=F((pr,dr)=>{(function(){var t,r,c,y,i,f,u,l,m=function(N,O){for(var D in O)g.call(O,D)&&(N[D]=O[D]);function p(){this.constructor=N}return p.prototype=O.prototype,N.prototype=new p,N.__super__=O.prototype,N},g={}.hasOwnProperty;l=tt().isPlainObject,c=Ut(),r=ye(),i=Q(),t=k(),u=kt(),f=At(),dr.exports=y=(function(N){m(O,N);function O(D){O.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new r,D||(D={}),D.writer||(D.writer=new f),this.options=D,this.stringify=new u(D)}return Object.defineProperty(O.prototype,"implementation",{value:new c}),Object.defineProperty(O.prototype,"doctype",{get:function(){var D,p,T,E;for(E=this.children,p=0,T=E.length;p<T;p++)if(D=E[p],D.type===t.DocType)return D;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(D){var p;return p={},D?l(D)&&(p=D,D=this.options.writer):D=this.options.writer,D.document(this,D.filterOptions(p))},O.prototype.toString=function(D){return this.options.writer.document(this,this.options.writer.filterOptions(D))},O.prototype.createElement=function(D){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(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createComment=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createCDATASection=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createProcessingInstruction=function(D,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createAttribute=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createEntityReference=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByTagName=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.importNode=function(D,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createElementNS=function(D,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createAttributeNS=function(D,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByTagNameNS=function(D,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementById=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.adoptNode=function(D){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(D,p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.getElementsByClassName=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createEvent=function(D){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(D,p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O.prototype.createTreeWalker=function(D,p,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},O})(i)}).call(pr)});var gr=F((mr,yr)=>{(function(){var t,r,c,y,i,f,u,l,m,g,N,O,D,p,T,E,A,M,_,d,o,n,h,C,I={}.hasOwnProperty;C=tt(),n=C.isObject,o=C.isFunction,h=C.isPlainObject,d=C.getValue,t=k(),O=Yt(),p=Tt(),y=Dt(),i=bt(),E=Lt(),_=vt(),T=Mt(),g=Et(),N=_t(),f=Nt(),l=Ot(),u=It(),m=Ct(),c=Vt(),M=kt(),A=At(),r=mt(),yr.exports=D=(function(){function a(w,v,P){var x;this.name="?xml",this.type=t.Document,w||(w={}),x={},w.writer?h(w.writer)&&(x=w.writer,w.writer=new A):w.writer=new A,this.options=w,this.writer=w.writer,this.writerOptions=this.writer.filterOptions(x),this.stringify=new M(w),this.onDataCallback=v||function(){},this.onEndCallback=P||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return a.prototype.createChildNode=function(w){var v,P,x,q,X,S,V,R;switch(w.type){case t.CData:this.cdata(w.value);break;case t.Comment:this.comment(w.value);break;case t.Element:x={},V=w.attribs;for(P in V)I.call(V,P)&&(v=V[P],x[P]=v.value);this.node(w.name,x);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(w.value);break;case t.Text:this.text(w.value);break;case t.ProcessingInstruction:this.instruction(w.target,w.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+w.constructor.name)}for(R=w.children,X=0,S=R.length;X<S;X++)q=R[X],this.createChildNode(q),q.type===t.Element&&this.up();return this},a.prototype.dummy=function(){return this},a.prototype.node=function(w,v,P){var x;if(w==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(w));return this.openCurrent(),w=d(w),v==null&&(v={}),v=d(v),n(v)||(x=[v,P],P=x[0],v=x[1]),this.currentNode=new p(this,w,v),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,P!=null&&this.text(P),this},a.prototype.element=function(w,v,P){var x,q,X,S,V,R;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(w)||n(w)||o(w))for(S=this.options.noValidation,this.options.noValidation=!0,R=new O(this.options).element("TEMP_ROOT"),R.element(w),this.options.noValidation=S,V=R.children,q=0,X=V.length;q<X;q++)x=V[q],this.createChildNode(x),x.type===t.Element&&this.up();else this.node(w,v,P);return this},a.prototype.attribute=function(w,v){var P,x;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(w));if(w!=null&&(w=d(w)),n(w))for(P in w)I.call(w,P)&&(x=w[P],this.attribute(P,x));else o(v)&&(v=v.apply()),this.options.keepNullAttributes&&v==null?this.currentNode.attribs[w]=new c(this,w,""):v!=null&&(this.currentNode.attribs[w]=new c(this,w,v));return this},a.prototype.text=function(w){var v;return this.openCurrent(),v=new _(this,w),this.onData(this.writer.text(v,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.cdata=function(w){var v;return this.openCurrent(),v=new y(this,w),this.onData(this.writer.cdata(v,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.comment=function(w){var v;return this.openCurrent(),v=new i(this,w),this.onData(this.writer.comment(v,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.raw=function(w){var v;return this.openCurrent(),v=new E(this,w),this.onData(this.writer.raw(v,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.instruction=function(w,v){var P,x,q,X,S;if(this.openCurrent(),w!=null&&(w=d(w)),v!=null&&(v=d(v)),Array.isArray(w))for(P=0,X=w.length;P<X;P++)x=w[P],this.instruction(x);else if(n(w))for(x in w)I.call(w,x)&&(q=w[x],this.instruction(x,q));else o(v)&&(v=v.apply()),S=new T(this,w,v),this.onData(this.writer.processingInstruction(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},a.prototype.declaration=function(w,v,P){var x;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return x=new g(this,w,v,P),this.onData(this.writer.declaration(x,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.doctype=function(w,v,P){if(this.openCurrent(),w==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 N(this,v,P),this.currentNode.rootNodeName=w,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},a.prototype.dtdElement=function(w,v){var P;return this.openCurrent(),P=new u(this,w,v),this.onData(this.writer.dtdElement(P,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.attList=function(w,v,P,x,q){var X;return this.openCurrent(),X=new f(this,w,v,P,x,q),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.entity=function(w,v){var P;return this.openCurrent(),P=new l(this,!1,w,v),this.onData(this.writer.dtdEntity(P,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.pEntity=function(w,v){var P;return this.openCurrent(),P=new l(this,!0,w,v),this.onData(this.writer.dtdEntity(P,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.prototype.notation=function(w,v){var P;return this.openCurrent(),P=new m(this,w,v),this.onData(this.writer.dtdNotation(P,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},a.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},a.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},a.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},a.prototype.openNode=function(w){var v,P,x,q;if(!w.isOpen){if(!this.root&&this.currentLevel===0&&w.type===t.Element&&(this.root=w),P="",w.type===t.Element){this.writerOptions.state=r.OpenTag,P=this.writer.indent(w,this.writerOptions,this.currentLevel)+"<"+w.name,q=w.attribs;for(x in q)I.call(q,x)&&(v=q[x],P+=this.writer.attribute(v,this.writerOptions,this.currentLevel));P+=(w.children?">":"/>")+this.writer.endline(w,this.writerOptions,this.currentLevel),this.writerOptions.state=r.InsideTag}else this.writerOptions.state=r.OpenTag,P=this.writer.indent(w,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+w.rootNodeName,w.pubID&&w.sysID?P+=' PUBLIC "'+w.pubID+'" "'+w.sysID+'"':w.sysID&&(P+=' SYSTEM "'+w.sysID+'"'),w.children?(P+=" [",this.writerOptions.state=r.InsideTag):(this.writerOptions.state=r.CloseTag,P+=">"),P+=this.writer.endline(w,this.writerOptions,this.currentLevel);return this.onData(P,this.currentLevel),w.isOpen=!0}},a.prototype.closeNode=function(w){var v;if(!w.isClosed)return v="",this.writerOptions.state=r.CloseTag,w.type===t.Element?v=this.writer.indent(w,this.writerOptions,this.currentLevel)+"</"+w.name+">"+this.writer.endline(w,this.writerOptions,this.currentLevel):v=this.writer.indent(w,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(w,this.writerOptions,this.currentLevel),this.writerOptions.state=r.None,this.onData(v,this.currentLevel),w.isClosed=!0},a.prototype.onData=function(w,v){return this.documentStarted=!0,this.onDataCallback(w,v+1)},a.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},a.prototype.debugInfo=function(w){return w==null?"":"node: <"+w+">"},a.prototype.ele=function(){return this.element.apply(this,arguments)},a.prototype.nod=function(w,v,P){return this.node(w,v,P)},a.prototype.txt=function(w){return this.text(w)},a.prototype.dat=function(w){return this.cdata(w)},a.prototype.com=function(w){return this.comment(w)},a.prototype.ins=function(w,v){return this.instruction(w,v)},a.prototype.dec=function(w,v,P){return this.declaration(w,v,P)},a.prototype.dtd=function(w,v,P){return this.doctype(w,v,P)},a.prototype.e=function(w,v,P){return this.element(w,v,P)},a.prototype.n=function(w,v,P){return this.node(w,v,P)},a.prototype.t=function(w){return this.text(w)},a.prototype.d=function(w){return this.cdata(w)},a.prototype.c=function(w){return this.comment(w)},a.prototype.r=function(w){return this.raw(w)},a.prototype.i=function(w,v){return this.instruction(w,v)},a.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},a.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},a.prototype.ent=function(w,v){return this.entity(w,v)},a.prototype.pent=function(w,v){return this.pEntity(w,v)},a.prototype.not=function(w,v){return this.notation(w,v)},a})()}).call(mr)});var Dr=F((wr,Tr)=>{(function(){var t,r,c,y,i=function(u,l){for(var m in l)f.call(l,m)&&(u[m]=l[m]);function g(){this.constructor=u}return g.prototype=l.prototype,u.prototype=new g,u.__super__=l.prototype,u},f={}.hasOwnProperty;t=k(),y=Gt(),r=mt(),Tr.exports=c=(function(u){i(l,u);function l(m,g){this.stream=m,l.__super__.constructor.call(this,g)}return l.prototype.endline=function(m,g,N){return m.isLastRootNode&&g.state===r.CloseTag?"":l.__super__.endline.call(this,m,g,N)},l.prototype.document=function(m,g){var N,O,D,p,T,E,A,M,_;for(A=m.children,O=D=0,T=A.length;D<T;O=++D)N=A[O],N.isLastRootNode=O===m.children.length-1;for(g=this.filterOptions(g),M=m.children,_=[],p=0,E=M.length;p<E;p++)N=M[p],_.push(this.writeChildNode(N,g,0));return _},l.prototype.attribute=function(m,g,N){return this.stream.write(l.__super__.attribute.call(this,m,g,N))},l.prototype.cdata=function(m,g,N){return this.stream.write(l.__super__.cdata.call(this,m,g,N))},l.prototype.comment=function(m,g,N){return this.stream.write(l.__super__.comment.call(this,m,g,N))},l.prototype.declaration=function(m,g,N){return this.stream.write(l.__super__.declaration.call(this,m,g,N))},l.prototype.docType=function(m,g,N){var O,D,p,T;if(N||(N=0),this.openNode(m,g,N),g.state=r.OpenTag,this.stream.write(this.indent(m,g,N)),this.stream.write("<!DOCTYPE "+m.root().name),m.pubID&&m.sysID?this.stream.write(' PUBLIC "'+m.pubID+'" "'+m.sysID+'"'):m.sysID&&this.stream.write(' SYSTEM "'+m.sysID+'"'),m.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(m,g,N)),g.state=r.InsideTag,T=m.children,D=0,p=T.length;D<p;D++)O=T[D],this.writeChildNode(O,g,N+1);g.state=r.CloseTag,this.stream.write("]")}return g.state=r.CloseTag,this.stream.write(g.spaceBeforeSlash+">"),this.stream.write(this.endline(m,g,N)),g.state=r.None,this.closeNode(m,g,N)},l.prototype.element=function(m,g,N){var O,D,p,T,E,A,M,_,d,o;N||(N=0),this.openNode(m,g,N),g.state=r.OpenTag,this.stream.write(this.indent(m,g,N)+"<"+m.name),d=m.attribs;for(M in d)f.call(d,M)&&(O=d[M],this.attribute(O,g,N));if(p=m.children.length,T=p===0?null:m.children[0],p===0||m.children.every(function(n){return(n.type===t.Text||n.type===t.Raw)&&n.value===""}))g.allowEmpty?(this.stream.write(">"),g.state=r.CloseTag,this.stream.write("</"+m.name+">")):(g.state=r.CloseTag,this.stream.write(g.spaceBeforeSlash+"/>"));else if(g.pretty&&p===1&&(T.type===t.Text||T.type===t.Raw)&&T.value!=null)this.stream.write(">"),g.state=r.InsideTag,g.suppressPrettyCount++,_=!0,this.writeChildNode(T,g,N+1),g.suppressPrettyCount--,_=!1,g.state=r.CloseTag,this.stream.write("</"+m.name+">");else{for(this.stream.write(">"+this.endline(m,g,N)),g.state=r.InsideTag,o=m.children,E=0,A=o.length;E<A;E++)D=o[E],this.writeChildNode(D,g,N+1);g.state=r.CloseTag,this.stream.write(this.indent(m,g,N)+"</"+m.name+">")}return this.stream.write(this.endline(m,g,N)),g.state=r.None,this.closeNode(m,g,N)},l.prototype.processingInstruction=function(m,g,N){return this.stream.write(l.__super__.processingInstruction.call(this,m,g,N))},l.prototype.raw=function(m,g,N){return this.stream.write(l.__super__.raw.call(this,m,g,N))},l.prototype.text=function(m,g,N){return this.stream.write(l.__super__.text.call(this,m,g,N))},l.prototype.dtdAttList=function(m,g,N){return this.stream.write(l.__super__.dtdAttList.call(this,m,g,N))},l.prototype.dtdElement=function(m,g,N){return this.stream.write(l.__super__.dtdElement.call(this,m,g,N))},l.prototype.dtdEntity=function(m,g,N){return this.stream.write(l.__super__.dtdEntity.call(this,m,g,N))},l.prototype.dtdNotation=function(m,g,N){return this.stream.write(l.__super__.dtdNotation.call(this,m,g,N))},l})(y)}).call(wr)});var Er=F((br,ut)=>{(function(){var t,r,c,y,i,f,u,l,m,g;g=tt(),l=g.assign,m=g.isFunction,c=Ut(),y=Yt(),i=gr(),u=At(),f=Dr(),t=k(),r=mt(),ut.exports.create=function(N,O,D,p){var T,E;if(N==null)throw new Error("Root element needs a name.");return p=l({},O,D,p),T=new y(p),E=T.element(N),p.headless||(T.declaration(p),(p.pubID!=null||p.sysID!=null)&&T.dtd(p)),E},ut.exports.begin=function(N,O,D){var p;return m(N)&&(p=[N,O],O=p[0],D=p[1],N={}),O?new i(N,O,D):new y(N)},ut.exports.stringWriter=function(N){return new u(N)},ut.exports.streamWriter=function(N,O){return new f(N,O)},ut.exports.implementation=new c,ut.exports.nodeType=t,ut.exports.writerState=r}).call(br)});var Nr=F(Kt=>{(function(){"use strict";var t,r,c,y,i,f={}.hasOwnProperty;t=Er(),r=gt().defaults,y=function(u){return typeof u=="string"&&(u.indexOf("&")>=0||u.indexOf(">")>=0||u.indexOf("<")>=0)},i=function(u){return"<![CDATA["+c(u)+"]]>"},c=function(u){return u.replace("]]>","]]]]><![CDATA[>")},Kt.Builder=(function(){function u(l){var m,g,N;this.options={},g=r["0.2"];for(m in g)f.call(g,m)&&(N=g[m],this.options[m]=N);for(m in l)f.call(l,m)&&(N=l[m],this.options[m]=N)}return u.prototype.buildObject=function(l){var m,g,N,O,D;return m=this.options.attrkey,g=this.options.charkey,Object.keys(l).length===1&&this.options.rootName===r["0.2"].rootName?(D=Object.keys(l)[0],l=l[D]):D=this.options.rootName,N=(function(p){return function(T,E){var A,M,_,d,o,n;if(typeof E!="object")p.options.cdata&&y(E)?T.raw(i(E)):T.txt(E);else if(Array.isArray(E)){for(d in E)if(f.call(E,d)){M=E[d];for(o in M)_=M[o],T=N(T.ele(o),_).up()}}else for(o in E)if(f.call(E,o))if(M=E[o],o===m){if(typeof M=="object")for(A in M)n=M[A],T=T.att(A,n)}else if(o===g)p.options.cdata&&y(M)?T=T.raw(i(M)):T=T.txt(M);else if(Array.isArray(M))for(d in M)f.call(M,d)&&(_=M[d],typeof _=="string"?p.options.cdata&&y(_)?T=T.ele(o).raw(i(_)).up():T=T.ele(o,_).up():T=N(T.ele(o),_).up());else typeof M=="object"?T=N(T.ele(o),M).up():typeof M=="string"&&p.options.cdata&&y(M)?T=T.ele(o).raw(i(M)).up():(M==null&&(M=""),T=T.ele(o,M.toString()).up());return T}})(this),O=t.create(D,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),N(O,l).end(this.options.renderOpts)},u})()}).call(Kt)});var Or=F((Mn,zt)=>{function K(t){if(t)return ln(t);this._callbacks=new Map}function ln(t){return Object.assign(t,K.prototype),t._callbacks=new Map,t}K.prototype.on=function(t,r){let c=this._callbacks.get(t)??[];return c.push(r),this._callbacks.set(t,c),this};K.prototype.once=function(t,r){let c=(...y)=>{this.off(t,c),r.apply(this,y)};return c.fn=r,this.on(t,c),this};K.prototype.off=function(t,r){if(t===void 0&&r===void 0)return this._callbacks.clear(),this;if(r===void 0)return this._callbacks.delete(t),this;let c=this._callbacks.get(t);if(c){for(let[y,i]of c.entries())if(i===r||i.fn===r){c.splice(y,1);break}c.length===0?this._callbacks.delete(t):this._callbacks.set(t,c)}return this};K.prototype.emit=function(t,...r){let c=this._callbacks.get(t);if(c){let y=[...c];for(let i of y)i.apply(this,r)}return this};K.prototype.listeners=function(t){return this._callbacks.get(t)??[]};K.prototype.listenerCount=function(t){if(t)return this.listeners(t).length;let r=0;for(let c of this._callbacks.values())r+=c.length;return r};K.prototype.hasListeners=function(t){return this.listenerCount(t)>0};K.prototype.addEventListener=K.prototype.on;K.prototype.removeListener=K.prototype.off;K.prototype.removeEventListener=K.prototype.off;K.prototype.removeAllListeners=K.prototype.off;typeof zt<"u"&&(zt.exports=K)});var _r=F((An,Cr)=>{var Ir=Or();function yt(){Ir.call(this)}yt.prototype=new Ir;Cr.exports=yt;yt.Stream=yt;yt.prototype.pipe=function(t,r){var c=this;function y(N){t.writable&&t.write(N)===!1&&c.pause&&c.pause()}c.on("data",y);function i(){c.readable&&c.resume&&c.resume()}t.on("drain",i),!t._isStdio&&(!r||r.end!==!1)&&(c.on("end",u),c.on("close",l));var f=!1;function u(){f||(f=!0,t.end())}function l(){f||(f=!0,typeof t.destroy=="function"&&t.destroy())}function m(N){if(g(),!this.hasListeners("error"))throw N}c.on("error",m),t.on("error",m);function g(){c.off("data",y),t.off("drain",i),c.off("end",u),c.off("close",l),c.off("error",m),t.off("error",m),c.off("end",g),c.off("close",g),t.off("end",g),t.off("close",g)}return c.on("end",g),c.on("close",g),t.on("end",g),t.on("close",g),t.emit("pipe",c),t}});var Lr=F(Pt=>{(function(t){t.parser=function(s,e){return new c(s,e)},t.SAXParser=c,t.SAXStream=N,t.createStream=m,t.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function c(s,e){if(!(this instanceof c))return new c(s,e);var L=this;i(L),L.q=L.c="",L.bufferCheckPosition=t.MAX_BUFFER_LENGTH,L.encoding=null,L.opt=e||{},L.opt.lowercase=L.opt.lowercase||L.opt.lowercasetags,L.looseCase=L.opt.lowercase?"toLowerCase":"toUpperCase",L.opt.maxEntityCount=L.opt.maxEntityCount||512,L.opt.maxEntityDepth=L.opt.maxEntityDepth||4,L.entityCount=L.entityDepth=0,L.tags=[],L.closed=L.closedRoot=L.sawRoot=!1,L.tag=L.error=null,L.strict=!!s,L.noscript=!!(s||L.opt.noscript),L.state=a.BEGIN,L.strictEntities=L.opt.strictEntities,L.ENTITIES=L.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),L.attribList=[],L.opt.xmlns&&(L.ns=Object.create(E)),L.opt.unquotedAttributeValues===void 0&&(L.opt.unquotedAttributeValues=!s),L.trackPosition=L.opt.position!==!1,L.trackPosition&&(L.position=L.line=L.column=0),v(L,"onready")}Object.create||(Object.create=function(s){function e(){}e.prototype=s;var L=new e;return L}),Object.keys||(Object.keys=function(s){var e=[];for(var L in s)s.hasOwnProperty(L)&&e.push(L);return e});function y(s){for(var e=Math.max(t.MAX_BUFFER_LENGTH,10),L=0,b=0,j=r.length;b<j;b++){var W=s[r[b]].length;if(W>e)switch(r[b]){case"textNode":V(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: "+r[b])}L=Math.max(L,W)}var G=t.MAX_BUFFER_LENGTH-L;s.bufferCheckPosition=G+s.position}function i(s){for(var e=0,L=r.length;e<L;e++)s[r[e]]=""}function f(s){V(s),s.cdata!==""&&(S(s,"oncdata",s.cdata),s.cdata=""),s.script!==""&&(S(s,"onscript",s.script),s.script="")}c.prototype={end:function(){ht(this)},write:tn,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){f(this)}};var u;try{u=_r().Stream}catch{u=function(){}}u||(u=function(){});var l=t.EVENTS.filter(function(s){return s!=="error"&&s!=="end"});function m(s,e){return new N(s,e)}function g(s,e){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":e?"utf8":null}function N(s,e){if(!(this instanceof N))return new N(s,e);u.apply(this),this._parser=new c(s,e),this.writable=!0,this.readable=!0;var L=this;this._parser.onend=function(){L.emit("end")},this._parser.onerror=function(b){L.emit("error",b),L._parser.error=null},this._decoder=null,this._decoderBuffer=null,l.forEach(function(b){Object.defineProperty(L,"on"+b,{get:function(){return L._parser["on"+b]},set:function(j){if(!j)return L.removeAllListeners(b),L._parser["on"+b]=j,j;L.on(b,j)},enumerable:!0,configurable:!1})})}N.prototype=Object.create(u.prototype,{constructor:{value:N}}),N.prototype._decodeBuffer=function(s,e){if(this._decoderBuffer&&(s=Buffer.concat([this._decoderBuffer,s]),this._decoderBuffer=null),!this._decoder){var L=g(s,e);if(!L)return this._decoderBuffer=s,"";this._parser.encoding=L,this._decoder=new TextDecoder(L)}return this._decoder.decode(s,{stream:!e})},N.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 e=this._decodeBuffer(Buffer.alloc(0),!0);e&&(this._parser.write(e),this.emit("data",e))}return this._parser.write(s.toString()),this.emit("data",s),!0},N.prototype.end=function(s){if(s&&s.length&&this.write(s),this._decoderBuffer){var e=this._decodeBuffer(Buffer.alloc(0),!0);e&&(this._parser.write(e),this.emit("data",e))}else if(this._decoder){var L=this._decoder.decode();L&&(this._parser.write(L),this.emit("data",L))}return this._parser.end(),!0},N.prototype.on=function(s,e){var L=this;return!L._parser["on"+s]&&l.indexOf(s)!==-1&&(L._parser["on"+s]=function(){var b=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,s),L.emit.apply(L,b)}),u.prototype.on.call(L,s,e)};var O="[CDATA[",D="DOCTYPE",p="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/2000/xmlns/",E={xml:p,xmlns:T},A=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,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-]/,_=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function o(s){return s===" "||s===`
4
+ `||s==="\r"||s===" "}function n(s){return s==='"'||s==="'"}function h(s){return s===">"||o(s)}function C(s,e){return s.test(e)}function I(s,e){return!C(s,e)}var a=0;t.STATE={BEGIN:a++,BEGIN_WHITESPACE:a++,TEXT:a++,TEXT_ENTITY:a++,OPEN_WAKA:a++,SGML_DECL:a++,SGML_DECL_QUOTED:a++,DOCTYPE:a++,DOCTYPE_QUOTED:a++,DOCTYPE_DTD:a++,DOCTYPE_DTD_QUOTED:a++,COMMENT_STARTING:a++,COMMENT:a++,COMMENT_ENDING:a++,COMMENT_ENDED:a++,CDATA:a++,CDATA_ENDING:a++,CDATA_ENDING_2:a++,PROC_INST:a++,PROC_INST_BODY:a++,PROC_INST_ENDING:a++,OPEN_TAG:a++,OPEN_TAG_SLASH:a++,ATTRIB:a++,ATTRIB_NAME:a++,ATTRIB_NAME_SAW_WHITE:a++,ATTRIB_VALUE:a++,ATTRIB_VALUE_QUOTED:a++,ATTRIB_VALUE_CLOSED:a++,ATTRIB_VALUE_UNQUOTED:a++,ATTRIB_VALUE_ENTITY_Q:a++,ATTRIB_VALUE_ENTITY_U:a++,CLOSE_TAG:a++,CLOSE_TAG_SAW_WHITE:a++,SCRIPT:a++,SCRIPT_ENDING:a++},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 e=t.ENTITIES[s],L=typeof e=="number"?String.fromCharCode(e):e;t.ENTITIES[s]=L});for(var w in t.STATE)t.STATE[t.STATE[w]]=w;a=t.STATE;function v(s,e,L){s[e]&&s[e](L)}function P(s){var e=s&&s.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return e?e[2]:null}function x(s){return s?s.toLowerCase().replace(/[^a-z0-9]/g,""):null}function q(s,e){let L=x(s),b=x(e);return!L||!b?!0:b==="utf16"?L==="utf16le"||L==="utf16be":L===b}function X(s,e){if(!(!s.strict||!s.encoding||!e||e.name!=="xml")){var L=P(e.body);L&&!q(s.encoding,L)&&B(s,"XML declaration encoding "+L+" does not match detected stream encoding "+s.encoding.toUpperCase())}}function S(s,e,L){s.textNode&&V(s),v(s,e,L)}function V(s){s.textNode=R(s.opt,s.textNode),s.textNode&&v(s,"ontext",s.textNode),s.textNode=""}function R(s,e){return s.trim&&(e=e.trim()),s.normalize&&(e=e.replace(/\s+/g," ")),e}function J(s,e){return V(s),s.trackPosition&&(e+=`
5
+ Line: `+s.line+`
6
+ Column: `+s.column+`
7
+ Char: `+s.c),e=new Error(e),s.error=e,v(s,"onerror",e),s}function ht(s){return s.sawRoot&&!s.closedRoot&&B(s,"Unclosed root tag"),s.state!==a.BEGIN&&s.state!==a.BEGIN_WHITESPACE&&s.state!==a.TEXT&&J(s,"Unexpected end"),V(s),s.c="",s.closed=!0,v(s,"onend"),c.call(s,s.strict,s.opt),s}function B(s,e){if(typeof s!="object"||!(s instanceof c))throw new Error("bad call to strictFail");s.strict&&J(s,e)}function Zr(s){s.strict||(s.tagName=s.tagName[s.looseCase]());var e=s.tags[s.tags.length-1]||s,L=s.tag={name:s.tagName,attributes:{}};s.opt.xmlns&&(L.ns=e.ns),s.attribList.length=0,S(s,"onopentagstart",L)}function Ft(s,e){var L=s.indexOf(":"),b=L<0?["",s]:s.split(":"),j=b[0],W=b[1];return e&&s==="xmlns"&&(j="xmlns",W=""),{prefix:j,local:W}}function qt(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 e=Ft(s.attribName,!0),L=e.prefix,b=e.local;if(L==="xmlns")if(b==="xml"&&s.attribValue!==p)B(s,"xml: prefix must be bound to "+p+`
8
+ Actual: `+s.attribValue);else if(b==="xmlns"&&s.attribValue!==T)B(s,"xmlns: prefix must be bound to "+T+`
9
+ Actual: `+s.attribValue);else{var j=s.tag,W=s.tags[s.tags.length-1]||s;j.ns===W.ns&&(j.ns=Object.create(W.ns)),j.ns[b]=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 at(s,e){if(s.opt.xmlns){var L=s.tag,b=Ft(s.tagName);L.prefix=b.prefix,L.local=b.local,L.uri=L.ns[b.prefix]||"",L.prefix&&!L.uri&&(B(s,"Unbound namespace prefix: "+JSON.stringify(s.tagName)),L.uri=b.prefix);var j=s.tags[s.tags.length-1]||s;L.ns&&j.ns!==L.ns&&Object.keys(L.ns).forEach(function(ne){S(s,"onopennamespace",{prefix:ne,uri:L.ns[ne]})});for(var W=0,G=s.attribList.length;W<G;W++){var z=s.attribList[W],H=z[0],et=z[1],Y=Ft(H,!0),rt=Y.prefix,en=Y.local,re=rt===""?"":L.ns[rt]||"",jt={name:H,value:et,prefix:rt,local:en,uri:re};rt&&rt!=="xmlns"&&!re&&(B(s,"Unbound namespace prefix: "+JSON.stringify(rt)),jt.uri=rt),s.tag.attributes[H]=jt,S(s,"onattribute",jt)}s.attribList.length=0}s.tag.isSelfClosing=!!e,s.sawRoot=!0,s.tags.push(s.tag),S(s,"onopentag",s.tag),e||(!s.noscript&&s.tagName.toLowerCase()==="script"?s.state=a.SCRIPT:s.state=a.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=a.TEXT;return}if(s.script){if(s.tagName!=="script"){s.script+="</"+s.tagName+">",s.tagName="",s.state=a.SCRIPT;return}S(s,"onscript",s.script),s.script=""}var e=s.tags.length,L=s.tagName;s.strict||(L=L[s.looseCase]());for(var b=L;e--;){var j=s.tags[e];if(j.name!==b)B(s,"Unexpected close tag");else break}if(e<0){B(s,"Unmatched closing tag: "+s.tagName),s.textNode+="</"+s.tagName+">",s.state=a.TEXT;return}s.tagName=L;for(var W=s.tags.length;W-- >e;){var G=s.tag=s.tags.pop();s.tagName=s.tag.name,S(s,"onclosetag",s.tagName);var z={};for(var H in G.ns)z[H]=G.ns[H];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})})}e===0&&(s.closedRoot=!0),s.tagName=s.attribValue=s.attribName="",s.attribList.length=0,s.state=a.TEXT}function Jr(s){var e=s.entity,L=e.toLowerCase(),b,j="";return s.ENTITIES[e]?s.ENTITIES[e]:s.ENTITIES[L]?s.ENTITIES[L]:(e=L,e.charAt(0)==="#"&&(e.charAt(1)==="x"?(e=e.slice(2),b=parseInt(e,16),j=b.toString(16)):(e=e.slice(1),b=parseInt(e,10),j=b.toString(10))),e=e.replace(/^0+/,""),isNaN(b)||j.toLowerCase()!==e||b<0||b>1114111?(B(s,"Invalid character entity"),"&"+s.entity+";"):String.fromCodePoint(b))}function ee(s,e){e==="<"?(s.state=a.OPEN_WAKA,s.startTagPosition=s.position):o(e)||(B(s,"Non-whitespace before first tag."),s.textNode=e,s.state=a.TEXT)}function Rt(s,e){var L="";return e<s.length&&(L=s.charAt(e)),L}function tn(s){var e=this;if(this.error)throw this.error;if(e.closed)return J(e,"Cannot write after close. Assign an onready handler.");if(s===null)return ht(e);typeof s=="object"&&(s=s.toString());for(var L=0,b="";b=Rt(s,L++),e.c=b,!!b;)switch(e.trackPosition&&(e.position++,b===`
10
+ `?(e.line++,e.column=0):e.column++),e.state){case a.BEGIN:if(e.state=a.BEGIN_WHITESPACE,b==="\uFEFF")continue;ee(e,b);continue;case a.BEGIN_WHITESPACE:ee(e,b);continue;case a.TEXT:if(e.sawRoot&&!e.closedRoot){for(var W=L-1;b&&b!=="<"&&b!=="&";)b=Rt(s,L++),b&&e.trackPosition&&(e.position++,b===`
11
+ `?(e.line++,e.column=0):e.column++);e.textNode+=s.substring(W,L-1)}b==="<"&&!(e.sawRoot&&e.closedRoot&&!e.strict)?(e.state=a.OPEN_WAKA,e.startTagPosition=e.position):(!o(b)&&(!e.sawRoot||e.closedRoot)&&B(e,"Text data outside of root node."),b==="&"?e.state=a.TEXT_ENTITY:e.textNode+=b);continue;case a.SCRIPT:b==="<"?e.state=a.SCRIPT_ENDING:e.script+=b;continue;case a.SCRIPT_ENDING:b==="/"?e.state=a.CLOSE_TAG:(e.script+="<"+b,e.state=a.SCRIPT);continue;case a.OPEN_WAKA:if(b==="!")e.state=a.SGML_DECL,e.sgmlDecl="";else if(!o(b))if(C(A,b))e.state=a.OPEN_TAG,e.tagName=b;else if(b==="/")e.state=a.CLOSE_TAG,e.tagName="";else if(b==="?")e.state=a.PROC_INST,e.procInstName=e.procInstBody="";else{if(B(e,"Unencoded <"),e.startTagPosition+1<e.position){var j=e.position-e.startTagPosition;b=new Array(j).join(" ")+b}e.textNode+="<"+b,e.state=a.TEXT}continue;case a.SGML_DECL:if(e.sgmlDecl+b==="--"){e.state=a.COMMENT,e.comment="",e.sgmlDecl="";continue}e.doctype&&e.doctype!==!0&&e.sgmlDecl?(e.state=a.DOCTYPE_DTD,e.doctype+="<!"+e.sgmlDecl+b,e.sgmlDecl=""):(e.sgmlDecl+b).toUpperCase()===O?(S(e,"onopencdata"),e.state=a.CDATA,e.sgmlDecl="",e.cdata=""):(e.sgmlDecl+b).toUpperCase()===D?(e.state=a.DOCTYPE,(e.doctype||e.sawRoot)&&B(e,"Inappropriately located doctype declaration"),e.doctype="",e.sgmlDecl=""):b===">"?(S(e,"onsgmldeclaration",e.sgmlDecl),e.sgmlDecl="",e.state=a.TEXT):(n(b)&&(e.state=a.SGML_DECL_QUOTED),e.sgmlDecl+=b);continue;case a.SGML_DECL_QUOTED:b===e.q&&(e.state=a.SGML_DECL,e.q=""),e.sgmlDecl+=b;continue;case a.DOCTYPE:b===">"?(e.state=a.TEXT,S(e,"ondoctype",e.doctype),e.doctype=!0):(e.doctype+=b,b==="["?e.state=a.DOCTYPE_DTD:n(b)&&(e.state=a.DOCTYPE_QUOTED,e.q=b));continue;case a.DOCTYPE_QUOTED:e.doctype+=b,b===e.q&&(e.q="",e.state=a.DOCTYPE);continue;case a.DOCTYPE_DTD:b==="]"?(e.doctype+=b,e.state=a.DOCTYPE):b==="<"?(e.state=a.OPEN_WAKA,e.startTagPosition=e.position):n(b)?(e.doctype+=b,e.state=a.DOCTYPE_DTD_QUOTED,e.q=b):e.doctype+=b;continue;case a.DOCTYPE_DTD_QUOTED:e.doctype+=b,b===e.q&&(e.state=a.DOCTYPE_DTD,e.q="");continue;case a.COMMENT:b==="-"?e.state=a.COMMENT_ENDING:e.comment+=b;continue;case a.COMMENT_ENDING:b==="-"?(e.state=a.COMMENT_ENDED,e.comment=R(e.opt,e.comment),e.comment&&S(e,"oncomment",e.comment),e.comment=""):(e.comment+="-"+b,e.state=a.COMMENT);continue;case a.COMMENT_ENDED:b!==">"?(B(e,"Malformed comment"),e.comment+="--"+b,e.state=a.COMMENT):e.doctype&&e.doctype!==!0?e.state=a.DOCTYPE_DTD:e.state=a.TEXT;continue;case a.CDATA:for(var W=L-1;b&&b!=="]";)b=Rt(s,L++),b&&e.trackPosition&&(e.position++,b===`
12
+ `?(e.line++,e.column=0):e.column++);e.cdata+=s.substring(W,L-1),b==="]"&&(e.state=a.CDATA_ENDING);continue;case a.CDATA_ENDING:b==="]"?e.state=a.CDATA_ENDING_2:(e.cdata+="]"+b,e.state=a.CDATA);continue;case a.CDATA_ENDING_2:b===">"?(e.cdata&&S(e,"oncdata",e.cdata),S(e,"onclosecdata"),e.cdata="",e.state=a.TEXT):b==="]"?e.cdata+="]":(e.cdata+="]]"+b,e.state=a.CDATA);continue;case a.PROC_INST:b==="?"?e.state=a.PROC_INST_ENDING:o(b)?e.state=a.PROC_INST_BODY:e.procInstName+=b;continue;case a.PROC_INST_BODY:if(!e.procInstBody&&o(b))continue;b==="?"?e.state=a.PROC_INST_ENDING:e.procInstBody+=b;continue;case a.PROC_INST_ENDING:if(b===">"){let et={name:e.procInstName,body:e.procInstBody};X(e,et),S(e,"onprocessinginstruction",et),e.procInstName=e.procInstBody="",e.state=a.TEXT}else e.procInstBody+="?"+b,e.state=a.PROC_INST_BODY;continue;case a.OPEN_TAG:C(M,b)?e.tagName+=b:(Zr(e),b===">"?at(e):b==="/"?e.state=a.OPEN_TAG_SLASH:(o(b)||B(e,"Invalid character in tag name"),e.state=a.ATTRIB));continue;case a.OPEN_TAG_SLASH:b===">"?(at(e,!0),Xt(e)):(B(e,"Forward-slash in opening tag not followed by >"),e.state=a.ATTRIB);continue;case a.ATTRIB:if(o(b))continue;b===">"?at(e):b==="/"?e.state=a.OPEN_TAG_SLASH:C(A,b)?(e.attribName=b,e.attribValue="",e.state=a.ATTRIB_NAME):B(e,"Invalid attribute name");continue;case a.ATTRIB_NAME:b==="="?e.state=a.ATTRIB_VALUE:b===">"?(B(e,"Attribute without value"),e.attribValue=e.attribName,qt(e),at(e)):o(b)?e.state=a.ATTRIB_NAME_SAW_WHITE:C(M,b)?e.attribName+=b:B(e,"Invalid attribute name");continue;case a.ATTRIB_NAME_SAW_WHITE:if(b==="=")e.state=a.ATTRIB_VALUE;else{if(o(b))continue;B(e,"Attribute without value"),e.tag.attributes[e.attribName]="",e.attribValue="",S(e,"onattribute",{name:e.attribName,value:""}),e.attribName="",b===">"?at(e):C(A,b)?(e.attribName=b,e.state=a.ATTRIB_NAME):(B(e,"Invalid attribute name"),e.state=a.ATTRIB)}continue;case a.ATTRIB_VALUE:if(o(b))continue;n(b)?(e.q=b,e.state=a.ATTRIB_VALUE_QUOTED):(e.opt.unquotedAttributeValues||J(e,"Unquoted attribute value"),e.state=a.ATTRIB_VALUE_UNQUOTED,e.attribValue=b);continue;case a.ATTRIB_VALUE_QUOTED:if(b!==e.q){b==="&"?e.state=a.ATTRIB_VALUE_ENTITY_Q:e.attribValue+=b;continue}qt(e),e.q="",e.state=a.ATTRIB_VALUE_CLOSED;continue;case a.ATTRIB_VALUE_CLOSED:o(b)?e.state=a.ATTRIB:b===">"?at(e):b==="/"?e.state=a.OPEN_TAG_SLASH:C(A,b)?(B(e,"No whitespace between attributes"),e.attribName=b,e.attribValue="",e.state=a.ATTRIB_NAME):B(e,"Invalid attribute name");continue;case a.ATTRIB_VALUE_UNQUOTED:if(!h(b)){b==="&"?e.state=a.ATTRIB_VALUE_ENTITY_U:e.attribValue+=b;continue}qt(e),b===">"?at(e):e.state=a.ATTRIB;continue;case a.CLOSE_TAG:if(e.tagName)b===">"?Xt(e):C(M,b)?e.tagName+=b:e.script?(e.script+="</"+e.tagName+b,e.tagName="",e.state=a.SCRIPT):(o(b)||B(e,"Invalid tagname in closing tag"),e.state=a.CLOSE_TAG_SAW_WHITE);else{if(o(b))continue;I(A,b)?e.script?(e.script+="</"+b,e.state=a.SCRIPT):B(e,"Invalid tagname in closing tag."):e.tagName=b}continue;case a.CLOSE_TAG_SAW_WHITE:if(o(b))continue;b===">"?Xt(e):B(e,"Invalid characters in closing tag");continue;case a.TEXT_ENTITY:case a.ATTRIB_VALUE_ENTITY_Q:case a.ATTRIB_VALUE_ENTITY_U:var G,z;switch(e.state){case a.TEXT_ENTITY:G=a.TEXT,z="textNode";break;case a.ATTRIB_VALUE_ENTITY_Q:G=a.ATTRIB_VALUE_QUOTED,z="attribValue";break;case a.ATTRIB_VALUE_ENTITY_U:G=a.ATTRIB_VALUE_UNQUOTED,z="attribValue";break}if(b===";"){var H=Jr(e);e.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(H)?((e.entityCount+=1)>e.opt.maxEntityCount&&J(e,"Parsed entity count exceeds max entity count"),(e.entityDepth+=1)>e.opt.maxEntityDepth&&J(e,"Parsed entity depth exceeds max entity depth"),e.entity="",e.state=G,e.write(H),e.entityDepth-=1):(e[z]+=H,e.entity="",e.state=G)}else C(e.entity.length?d:_,b)?e.entity+=b:(B(e,"Invalid character in entity name"),e[z]+="&"+e.entity+b,e.entity="",e.state=G);continue;default:throw new Error(e,"Unknown state: "+e.state)}return e.position>=e.bufferCheckPosition&&y(e),e}String.fromCodePoint||(function(){var s=String.fromCharCode,e=Math.floor,L=function(){var b=16384,j=[],W,G,z=-1,H=arguments.length;if(!H)return"";for(var et="";++z<H;){var Y=Number(arguments[z]);if(!isFinite(Y)||Y<0||Y>1114111||e(Y)!==Y)throw RangeError("Invalid code point: "+Y);Y<=65535?j.push(Y):(Y-=65536,W=(Y>>10)+55296,G=Y%1024+56320,j.push(W,G)),(z+1===H||j.length>b)&&(et+=s.apply(null,j),j.length=0)}return et};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:L,configurable:!0,writable:!0}):String.fromCodePoint=L})()})(typeof Pt>"u"?Pt.sax={}:Pt)});var jr=F((xn,Ht)=>{"use strict";var pt=typeof Reflect=="object"?Reflect:null,vr=pt&&typeof pt.apply=="function"?pt.apply:function(r,c,y){return Function.prototype.apply.call(r,c,y)},xt;pt&&typeof pt.ownKeys=="function"?xt=pt.ownKeys:Object.getOwnPropertySymbols?xt=function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:xt=function(r){return Object.getOwnPropertyNames(r)};function fn(t){console&&console.warn&&console.warn(t)}var Ar=Number.isNaN||function(r){return r!==r};function U(){U.init.call(this)}Ht.exports=U;Ht.exports.once=mn;U.EventEmitter=U;U.prototype._events=void 0;U.prototype._eventsCount=0;U.prototype._maxListeners=void 0;var Mr=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 Mr},set:function(t){if(typeof t!="number"||t<0||Ar(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Mr=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(r){if(typeof r!="number"||r<0||Ar(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this};function Pr(t){return t._maxListeners===void 0?U.defaultMaxListeners:t._maxListeners}U.prototype.getMaxListeners=function(){return Pr(this)};U.prototype.emit=function(r){for(var c=[],y=1;y<arguments.length;y++)c.push(arguments[y]);var i=r==="error",f=this._events;if(f!==void 0)i=i&&f.error===void 0;else if(!i)return!1;if(i){var u;if(c.length>0&&(u=c[0]),u instanceof Error)throw u;var l=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw l.context=u,l}var m=f[r];if(m===void 0)return!1;if(typeof m=="function")vr(m,this,c);else for(var g=m.length,N=Xr(m,g),y=0;y<g;++y)vr(N[y],this,c);return!0};function xr(t,r,c,y){var i,f,u;if(St(c),f=t._events,f===void 0?(f=t._events=Object.create(null),t._eventsCount=0):(f.newListener!==void 0&&(t.emit("newListener",r,c.listener?c.listener:c),f=t._events),u=f[r]),u===void 0)u=f[r]=c,++t._eventsCount;else if(typeof u=="function"?u=f[r]=y?[c,u]:[u,c]:y?u.unshift(c):u.push(c),i=Pr(t),i>0&&u.length>i&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=r,l.count=u.length,fn(l)}return t}U.prototype.addListener=function(r,c){return xr(this,r,c,!1)};U.prototype.on=U.prototype.addListener;U.prototype.prependListener=function(r,c){return xr(this,r,c,!0)};function hn(){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 Sr(t,r,c){var y={fired:!1,wrapFn:void 0,target:t,type:r,listener:c},i=hn.bind(y);return i.listener=c,y.wrapFn=i,i}U.prototype.once=function(r,c){return St(c),this.on(r,Sr(this,r,c)),this};U.prototype.prependOnceListener=function(r,c){return St(c),this.prependListener(r,Sr(this,r,c)),this};U.prototype.removeListener=function(r,c){var y,i,f,u,l;if(St(c),i=this._events,i===void 0)return this;if(y=i[r],y===void 0)return this;if(y===c||y.listener===c)--this._eventsCount===0?this._events=Object.create(null):(delete i[r],i.removeListener&&this.emit("removeListener",r,y.listener||c));else if(typeof y!="function"){for(f=-1,u=y.length-1;u>=0;u--)if(y[u]===c||y[u].listener===c){l=y[u].listener,f=u;break}if(f<0)return this;f===0?y.shift():pn(y,f),y.length===1&&(i[r]=y[0]),i.removeListener!==void 0&&this.emit("removeListener",r,l||c)}return this};U.prototype.off=U.prototype.removeListener;U.prototype.removeAllListeners=function(r){var c,y,i;if(y=this._events,y===void 0)return this;if(y.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):y[r]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete y[r]),this;if(arguments.length===0){var f=Object.keys(y),u;for(i=0;i<f.length;++i)u=f[i],u!=="removeListener"&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(c=y[r],typeof c=="function")this.removeListener(r,c);else if(c!==void 0)for(i=c.length-1;i>=0;i--)this.removeListener(r,c[i]);return this};function Fr(t,r,c){var y=t._events;if(y===void 0)return[];var i=y[r];return i===void 0?[]:typeof i=="function"?c?[i.listener||i]:[i]:c?dn(i):Xr(i,i.length)}U.prototype.listeners=function(r){return Fr(this,r,!0)};U.prototype.rawListeners=function(r){return Fr(this,r,!1)};U.listenerCount=function(t,r){return typeof t.listenerCount=="function"?t.listenerCount(r):qr.call(t,r)};U.prototype.listenerCount=qr;function qr(t){var r=this._events;if(r!==void 0){var c=r[t];if(typeof c=="function")return 1;if(c!==void 0)return c.length}return 0}U.prototype.eventNames=function(){return this._eventsCount>0?xt(this._events):[]};function Xr(t,r){for(var c=new Array(r),y=0;y<r;++y)c[y]=t[y];return c}function pn(t,r){for(;r+1<t.length;r++)t[r]=t[r+1];t.pop()}function dn(t){for(var r=new Array(t.length),c=0;c<r.length;++c)r[c]=t[c].listener||t[c];return r}function mn(t,r){return new Promise(function(c,y){function i(u){t.removeListener(r,f),y(u)}function f(){typeof t.removeListener=="function"&&t.removeListener("error",i),c([].slice.call(arguments))}Rr(t,r,f,{once:!0}),r!=="error"&&yn(t,i,{once:!0})})}function yn(t,r,c){typeof t.on=="function"&&Rr(t,"error",r,c)}function Rr(t,r,c,y){if(typeof t.on=="function")y.once?t.once(r,c):t.on(r,c);else if(typeof t.addEventListener=="function")t.addEventListener(r,function i(f){y.once&&t.removeEventListener(r,i),c(f)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Br=F($t=>{(function(){"use strict";$t.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call($t)});var Qt=F(ct=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),ct.normalize=function(r){return r.toLowerCase()},ct.firstCharLowerCase=function(r){return r.charAt(0).toLowerCase()+r.slice(1)},ct.stripPrefix=function(r){return r.replace(t,"")},ct.parseNumbers=function(r){return isNaN(r)||(r=r%1===0?parseInt(r,10):parseFloat(r)),r},ct.parseBooleans=function(r){return/^(?:true|false)$/i.test(r)&&(r=r.toLowerCase()==="true"),r}}).call(ct)});var Vr=F(Ur=>{Ur.every=function(t){return new Zt(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 Zt(t){this.count=0;var r=wn(t);r&&(this.time=Number(r[0])*nt[r[1]],this.type=r[1])}Zt.prototype.do=function(t){this.time&&(this.interval=setInterval(c,this.time));var r=this;function c(){r.count++,t.call(r)}return this};Zt.prototype.stop=function(){return this.interval&&(clearInterval(this.interval),delete this.interval),this};var gn=/^\s*(\d+(?:\.\d+)?)\s*([a-z]+)\s*$/;function wn(t){var r=t.match(gn);return r&&nt[r[2]]?r.slice(1):null}});var Wr=F(it=>{(function(){"use strict";var t,r,c,y,i,f,u,l,m,g=function(D,p){return function(){return D.apply(p,arguments)}},N=function(D,p){for(var T in p)O.call(p,T)&&(D[T]=p[T]);function E(){this.constructor=D}return E.prototype=p.prototype,D.prototype=new E,D.__super__=p.prototype,D},O={}.hasOwnProperty;l=Lr(),y=jr(),t=Br(),u=Qt(),m=Vr().setImmediate,r=gt().defaults,i=function(D){return typeof D=="object"&&D!=null&&Object.keys(D).length===0},f=function(D,p,T){var E,A,M;for(E=0,A=D.length;E<A;E++)M=D[E],p=M(p,T);return p},c=function(D,p,T){var E;return E=Object.create(null),E.value=T,E.writable=!0,E.enumerable=!0,E.configurable=!0,Object.defineProperty(D,p,E)},it.Parser=(function(D){N(p,D);function p(T){this.parseStringPromise=g(this.parseStringPromise,this),this.parseString=g(this.parseString,this),this.reset=g(this.reset,this),this.assignOrPush=g(this.assignOrPush,this),this.processAsync=g(this.processAsync,this);var E,A,M;if(!(this instanceof it.Parser))return new it.Parser(T);this.options={},A=r["0.2"];for(E in A)O.call(A,E)&&(M=A[E],this.options[E]=M);for(E in T)O.call(T,E)&&(M=T[E],this.options[E]=M);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(u.normalize)),this.reset()}return p.prototype.processAsync=function(){var T,E;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),m(this.processAsync))}catch(A){if(E=A,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(E)}},p.prototype.assignOrPush=function(T,E,A){return E in T?(T[E]instanceof Array||c(T,E,[T[E]]),T[E].push(A)):this.options.explicitArray?c(T,E,[A]):c(T,E,A)},p.prototype.reset=function(){var T,E,A,M;return this.removeAllListeners(),this.saxParser=l.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(_){return function(d){if(_.saxParser.resume(),!_.saxParser.errThrown)return _.saxParser.errThrown=!0,_.emit("error",d)}})(this),this.saxParser.onend=(function(_){return function(){if(!_.saxParser.ended)return _.saxParser.ended=!0,_.emit("end",_.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,M=[],T=this.options.attrkey,E=this.options.charkey,this.saxParser.onopentag=(function(_){return function(d){var o,n,h,C,I;if(h={},h[E]="",!_.options.ignoreAttrs){I=d.attributes;for(o in I)O.call(I,o)&&(!(T in h)&&!_.options.mergeAttrs&&(h[T]={}),n=_.options.attrValueProcessors?f(_.options.attrValueProcessors,d.attributes[o],o):d.attributes[o],C=_.options.attrNameProcessors?f(_.options.attrNameProcessors,o):o,_.options.mergeAttrs?_.assignOrPush(h,C,n):c(h[T],C,n))}return h["#name"]=_.options.tagNameProcessors?f(_.options.tagNameProcessors,d.name):d.name,_.options.xmlns&&(h[_.options.xmlnskey]={uri:d.uri,local:d.local}),M.push(h)}})(this),this.saxParser.onclosetag=(function(_){return function(){var d,o,n,h,C,I,a,w,v,P;if(I=M.pop(),C=I["#name"],(!_.options.explicitChildren||!_.options.preserveChildrenOrder)&&delete I["#name"],I.cdata===!0&&(d=I.cdata,delete I.cdata),v=M[M.length-1],I[E].match(/^\s*$/)&&!d?(o=I[E],delete I[E]):(_.options.trim&&(I[E]=I[E].trim()),_.options.normalize&&(I[E]=I[E].replace(/\s{2,}/g," ").trim()),I[E]=_.options.valueProcessors?f(_.options.valueProcessors,I[E],C):I[E],Object.keys(I).length===1&&E in I&&!_.EXPLICIT_CHARKEY&&(I=I[E])),i(I)&&(typeof _.options.emptyTag=="function"?I=_.options.emptyTag():I=_.options.emptyTag!==""?_.options.emptyTag:o),_.options.validator!=null&&(P="/"+(function(){var x,q,X;for(X=[],x=0,q=M.length;x<q;x++)h=M[x],X.push(h["#name"]);return X})().concat(C).join("/"),(function(){var x;try{return I=_.options.validator(P,v&&v[C],I)}catch(q){return x=q,_.emit("error",x)}})()),_.options.explicitChildren&&!_.options.mergeAttrs&&typeof I=="object"){if(!_.options.preserveChildrenOrder)h={},_.options.attrkey in I&&(h[_.options.attrkey]=I[_.options.attrkey],delete I[_.options.attrkey]),!_.options.charsAsChildren&&_.options.charkey in I&&(h[_.options.charkey]=I[_.options.charkey],delete I[_.options.charkey]),Object.getOwnPropertyNames(I).length>0&&(h[_.options.childkey]=I),I=h;else if(v){v[_.options.childkey]=v[_.options.childkey]||[],a={};for(n in I)O.call(I,n)&&c(a,n,I[n]);v[_.options.childkey].push(a),delete I["#name"],Object.keys(I).length===1&&E in I&&!_.EXPLICIT_CHARKEY&&(I=I[E])}}return M.length>0?_.assignOrPush(v,C,I):(_.options.explicitRoot&&(w=I,I={},c(I,C,w)),_.resultObject=I,_.saxParser.ended=!0,_.emit("end",_.resultObject))}})(this),A=(function(_){return function(d){var o,n;if(n=M[M.length-1],n)return n[E]+=d,_.options.explicitChildren&&_.options.preserveChildrenOrder&&_.options.charsAsChildren&&(_.options.includeWhiteChars||d.replace(/\\n/g,"").trim()!=="")&&(n[_.options.childkey]=n[_.options.childkey]||[],o={"#name":"__text__"},o[E]=d,_.options.normalize&&(o[E]=o[E].replace(/\s{2,}/g," ").trim()),n[_.options.childkey].push(o)),n}})(this),this.saxParser.ontext=A,this.saxParser.oncdata=(function(_){return function(d){var o;if(o=A(d),o)return o.cdata=!0}})(this)},p.prototype.parseString=function(T,E){var A;E!=null&&typeof E=="function"&&(this.on("end",function(M){return this.reset(),E(null,M)}),this.on("error",function(M){return this.reset(),E(M)}));try{return T=T.toString(),T.trim()===""?(this.emit("end",null),!0):(T=t.stripBOM(T),this.options.async?(this.remaining=T,m(this.processAsync),this.saxParser):this.saxParser.write(T).close())}catch(M){if(A=M,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw A}else return this.emit("error",A),this.saxParser.errThrown=!0}},p.prototype.parseStringPromise=function(T){return new Promise((function(E){return function(A,M){return E.parseString(T,function(_,d){return _?M(_):A(d)})}})(this))},p})(y),it.parseString=function(D,p,T){var E,A,M;return T!=null?(typeof T=="function"&&(E=T),typeof p=="object"&&(A=p)):(typeof p=="function"&&(E=p),A={}),M=new it.Parser(A),M.parseString(D,E)},it.parseStringPromise=function(D,p){var T,E;return typeof p=="object"&&(T=p),E=new it.Parser(T),E.parseStringPromise(D)}}).call(it)});var kr=F(ot=>{(function(){"use strict";var t,r,c,y,i=function(u,l){for(var m in l)f.call(l,m)&&(u[m]=l[m]);function g(){this.constructor=u}return g.prototype=l.prototype,u.prototype=new g,u.__super__=l.prototype,u},f={}.hasOwnProperty;r=gt(),t=Nr(),c=Wr(),y=Qt(),ot.defaults=r.defaults,ot.processors=y,ot.ValidationError=(function(u){i(l,u);function l(m){this.message=m}return l})(Error),ot.Builder=t.Builder,ot.Parser=c.Parser,ot.parseString=c.parseString,ot.parseStringPromise=c.parseStringPromise}).call(ot)});var te=cn(kr()),$r=8e3;self.onmessage=async t=>{let{sourceType:r}=t.data;try{let c;if(r==="wms"){let{url:y,options:i}=t.data;c=await Tn(y,i)}else if(r==="wmts"){let{url:y,options:i}=t.data;c=await bn(y,i)}else c=null;self.postMessage(c)}catch{self.postMessage(null)}};var Tn=async(t,r)=>{let c=t+"?request=getcapabilities&service=wms",y=new AbortController,i=setTimeout(()=>y.abort(),$r);try{let f=await fetch(c,{signal:y.signal});if(clearTimeout(i),!f.ok)throw new Error(`(${f.status}) Error fetching capabilities.. ${f.statusText}`);let u=await f.text();return await Dn(u,c,r)}catch(f){throw f}},Dn=async(t,r,c)=>{let y=0,i=(g,N,O=null,D=0)=>{if(y>=c.maxNodes||D>c.maxDepth)return;y+=1;let p={name:g.Name?$(g.Name[0]):"",description:g.Abstract?$(g.Abstract[0]):"",selected:!1,parent:O,time:null};if(g.Title&&(p.title=$(g.Title[0])),Array.isArray(g.Dimension)){for(let T of g.Dimension)if(T.$?.name.toLowerCase()==="time"&&T.$?.units==="ISO8601"){p.time=Object.assign({current:T.$?.default??null},Qr(T._,T.$?.default));break}}g.Layer&&(p.children=[],g.Layer.forEach(T=>i(T,p.children,p,D+1))),N.push(p)};if(t.indexOf("<Capability")===-1)throw new Error("Error: Invalid response received!");let f=await(0,te.parseStringPromise)(t);if(!f.WMS_Capabilities&&!f.WMT_MS_Capabilities)throw new Error("Error: No Capabilities found!");let u=f.WMS_Capabilities?f.WMS_Capabilities:f.WMT_MS_Capabilities?f.WMT_MS_Capabilities:void 0;if(!u?.Capability[0].Layer)throw new Error("Error: No layer information found!");let l={name:"",description:"",type:"WMS",url:r,layers:[]};if(Z(u?.Service)){let g=u?.Service[0];l.name=Z(g.Title)?$(g.Title[0]):Z(g.Name)?$(g.Name[0]):"WMS",l.description=Z(g.Abstract)?$(g.Abstract[0]):""}let m=[];return u.Capability[0].Layer.forEach(g=>{i(g,m)}),m.sort((g,N)=>g.name<N.name?-1:1),l.layers=m,l},bn=async(t,r)=>{let c=t+"?request=GetCapabilities&service=wmts",y=new AbortController,i=setTimeout(()=>y.abort(),$r);try{let f=await fetch(c,{signal:y.signal});if(clearTimeout(i),!f.ok)throw new Error(`(${f.status}) Error fetching capabilities.. ${f.statusText}`);let u=await f.text();return await En(u,c,r)}catch(f){throw f}},En=async(t,r,c)=>{let y=l=>{if(!Z(l["ows:Identifier"]))return null;let m={name:Z(l["ows:Title"])?$(l["ows:Title"][0]):"",description:Z(l["ows:Abstract"])?$(l["ows:Abstract"][0]):"",id:$(l["ows:Identifier"][0])};if(Z(l["ows:WGS84BoundingBox"])&&(m.bounds=[Number(l["ows:WGS84BoundingBox"][0]["ows:LowerCorner"][0].split(" ")[0]),Number(l["ows:WGS84BoundingBox"][0]["ows:LowerCorner"][0].split(" ")[1]),Number(l["ows:WGS84BoundingBox"][0]["ows:UpperCorner"][0].split(" ")[0]),Number(l["ows:WGS84BoundingBox"][0]["ows:UpperCorner"][0].split(" ")[1])]),Z(l.Format)){let g=$(l.Format[0]);m.format=g.indexOf("jpg")!==-1?"jpg":"png"}else m.format="png";return Z(l.Dimension)&&l.Dimension.forEach(g=>{$(g["ows:Identifier"][0]).toLowerCase()==="time"&&(m.time=Object.assign({current:ft($(g.Default[0]))??null},Qr($(g.Value),$(g.Default[0]))))}),m};if(t.indexOf("<Capabilities")===-1)throw new Error("Error: Invalid response received!");let i=await(0,te.parseStringPromise)(t);if(!Z(i.Capabilities?.Contents))throw new Error("Error: No Capabilities found!");if(!Z(i.Capabilities.Contents[0].Layer))throw new Error("Error: No layer information found!");let f={name:"",description:"",type:"WMTS",url:r,layers:[]},u=0;for(let l of i.Capabilities.Contents[0].Layer){if(u>=c.maxNodes)break;let m=y(l);m&&f.layers.push(m),u++}return f.layers.sort((l,m)=>l.name<m.name?-1:1),f},Z=t=>Array.isArray(t)&&t.length!==0,$=t=>t._??t,Jt=t=>{let r=/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/,c=t.match(r);return c?{years:parseInt(c[1]??"0"),months:parseInt(c[2]??"0"),weeks:parseInt(c[3]??"0"),days:parseInt(c[4]??"0"),hours:parseInt(c[5]??"0"),minutes:parseInt(c[6]??"0"),seconds:parseFloat(c[7]??"0")}:{years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0}},Nn=t=>{let r=Jt(t);return r.weeks*(3600*1e3*24*7)+r.days*(3600*1e3*24)+r.hours*(3600*1e3)+r.minutes*(60*1e3)+r.seconds*1e3},Gr=(t,r,c)=>{let y={y:new Date(t).getFullYear(),m:new Date(t).getMonth(),d:new Date(t).getDate()},i={y:c?y.y+r.years:y.y-r.years,m:c?y.m+r.months:y.m-r.months,d:c?y.d+r.days:y.d-r.days};if(r.weeks){let l=r.weeks*7;i.d=c?i.d+l:i.d-l}let f=new Date(t);f.setFullYear(i.y,i.m,i.d);let u=r.hours*(1e3*3600)+r.minutes*(1e3*60)+r.seconds*1e3;return u=c?u:0-u,f.setTime(f.getTime()+u),f.toISOString()},Yr=t=>t.startsWith("P"),Kr=t=>!t.includes("-")&&!t.includes(":"),zr=t=>t.split("-").length===2&&!t.includes("T"),On=t=>t.split("-").length===3&&!t.includes("T"),In=t=>t.length===8&&!t.startsWith("P"),Cn=t=>t.includes("T")&&!t.includes(":"),Hr=t=>t.includes("/"),ft=t=>{try{return t.toLocaleLowerCase()==="current"||t.toLocaleLowerCase()==="present"?new Date().toISOString():(In(t)?t=`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6)}`:Cn(t)&&(t+=":00:00.000Z"),new Date(t).toISOString())}catch{throw new Error(`Unhandled Date format (${t})`)}},Qr=(t,r)=>{let c=i=>{if(Kr(i))return`${i}-12-31T23:59:59.999Z`;if(zr(i)){let f=i.split("-").map(l=>parseInt(l)),u=new Date(f[0],f[1],0).getDate();return`${i}-${u}T23:59:59.999Z`}else return On(i)?`${i}T23:59:59.999Z`:ft(i)},y=i=>{let f={from:null,to:null};if((i[0].toLocaleLowerCase()==="present"||i[0].toLocaleLowerCase()==="current")&&(i[0]=new Date().toISOString()),(i[1].toLocaleLowerCase()==="present"||i[1].toLocaleLowerCase()==="current")&&(i[1]=new Date().toISOString()),Yr(i[0])?f.from=Gr(i[1],Jt(i[0]),!1):f.from=ft(i[0]),Yr(i[1])?f.to=Gr(i[0],Jt(i[1]),!0):f.to=c(i[1]),i.length===3){let u=Nn(i[2]);u&&(f.interval=u)}return f};try{if(Array.isArray(t)){let i=[];if(t.forEach(u=>{if(Hr(u)){let l=y(u.split("/"));l&&i.push(l)}}),i.length){let u=new Date(r).valueOf();for(let l=0;l<i.length;l++)if(u>=new Date(i[l].from).valueOf()&&u<=new Date(i[l].to).valueOf())return i[l];return i[i.length-1]}let f=t.map(u=>ft(u));if(f.length>1)return{from:f[0]??null,to:f[f.length-1]??null,values:f};t=f[0]}if(t.includes(",")){let i=t.split(",").map(f=>ft(f));return{from:i[0]??null,to:i[i.length-1]??null,values:i}}else if(typeof t=="string"){if(Hr(t))return y(t.split("/"));if(Kr(t)){let i=new Date(t),f=i.getFullYear();return i.setFullYear(f+1),{from:ft(t),to:i.toISOString()}}else if(zr(t)){let i=new Date(t),f=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return i.setFullYear(i.getFullYear(),i.getMonth(),f),i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59,999),{from:ft(t),to:i.toISOString()}}else return{from:null,to:null}}}catch{return{from:null,to:null}}};