@npm9912/v-map 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -96
- package/dist/cjs/{cesium-provider-BiFFyAl9.js → cesium-provider-CTtu9eTD.js} +6 -5
- package/dist/cjs/{deck-provider-Ctq3Q8a1.js → deck-provider-fNa818HH.js} +9 -9
- package/dist/cjs/events-BMG7RKne.js +11 -0
- package/dist/cjs/{geotiff-source-RaNzzWkC.js → geotiff-source-B9ARUE9z.js} +1 -1
- package/dist/cjs/{index-ISOEpMC3.js → index-9APmzoa2.js} +6 -6
- package/dist/cjs/{index-CbVT-Con.js → index-BJg0ncfC.js} +4 -4
- package/dist/cjs/{index-CJvvX4yx.js → index-C1ubapwF.js} +4 -4
- package/dist/cjs/{index-B8LHqjyg.js → index-ChrKyU6i.js} +4 -4
- package/dist/cjs/{index-JSwBbvGA.js → index-DmGHwivM.js} +1 -0
- package/dist/cjs/{layer-extension-B_olS0rc.js → layer-extension-D3a-1DFI.js} +1 -1
- package/dist/cjs/{leaflet-provider-DOqfs7g5.js → leaflet-provider-7Nw-AdV_.js} +6 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{messages-D7h4m8Tx.js → messages-CFCxeG8p.js} +0 -9
- package/dist/cjs/{openlayers-provider-Dfeg6L4n.js → openlayers-provider-DMxYtFkS.js} +5 -4
- package/dist/cjs/{polygon-layer-B9PrN7vr.js → polygon-layer-Dx1ZWZP0.js} +1 -1
- package/dist/cjs/{scenegraph-layer-DwNoxQdi.js → scenegraph-layer-ctLehP0q.js} +1 -1
- package/dist/cjs/v-map-builder.cjs.entry.js +4 -3
- package/dist/cjs/v-map-error.cjs.entry.js +121 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +11 -10
- package/dist/cjs/{v-map-layer-helper-iAzxAg9I.js → v-map-layer-helper-DnWpjZ_Q.js} +7 -6
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +5 -4
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +1 -1
- package/dist/cjs/v-map.cjs.js +2 -2
- package/dist/cjs/{v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js → v-map.v-map-layer-osm.v-map-layergroup-BJ3_NqAj.js} +16 -15
- package/dist/cjs/v-map_3.cjs.entry.js +5 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map-error/v-map-error.css +136 -0
- package/dist/collection/components/v-map-error/v-map-error.js +277 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +1 -1
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +1 -1
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +1 -1
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +1 -1
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +1 -1
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +1 -1
- package/dist/collection/components/v-map-style/v-map-style.js +1 -1
- package/dist/components/cesium-provider.js +1 -1
- package/dist/components/deck-provider.js +1 -1
- package/dist/components/events.js +1 -1
- package/dist/components/geotiff-source.js +1 -1
- package/dist/components/leaflet-provider.js +1 -1
- package/dist/components/logger.js +1 -0
- package/dist/components/openlayers-provider.js +1 -1
- package/dist/components/v-map-builder.js +2 -2
- package/dist/components/v-map-error.d.ts +11 -0
- package/dist/components/v-map-error.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -1
- package/dist/components/v-map-layer-geotiff2.js +1 -1
- package/dist/components/v-map-layer-google2.js +1 -1
- package/dist/components/v-map-layer-helper.js +1 -1
- package/dist/components/v-map-layer-osm2.js +1 -1
- package/dist/components/v-map-layer-scatterplot2.js +1 -1
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/components/v-map-layer-terrain2.js +1 -1
- package/dist/components/v-map-layer-tile3d2.js +1 -1
- package/dist/components/v-map-layer-wcs2.js +1 -1
- package/dist/components/v-map-layer-wfs2.js +1 -1
- package/dist/components/v-map-layer-wkt2.js +1 -1
- package/dist/components/v-map-layer-wms2.js +1 -1
- package/dist/components/v-map-layer-xyz2.js +1 -1
- package/dist/components/v-map-layergroup2.js +1 -1
- package/dist/components/v-map-style2.js +2 -2
- package/dist/components/v-map2.js +1 -1
- package/dist/esm/{cesium-provider-BJfAup3w.js → cesium-provider-Bh__cBGf.js} +6 -5
- package/dist/esm/{deck-provider-C7U9VDEq.js → deck-provider-DxIpS4lY.js} +9 -9
- package/dist/esm/events-CrV_misM.js +9 -0
- package/dist/esm/{geotiff-source-esnDnC-u.js → geotiff-source-BRjO-Dvr.js} +1 -1
- package/dist/esm/{index-BIEmlzCf.js → index-Bh2gBu9u.js} +5 -5
- package/dist/esm/{index-jzneDarq.js → index-BoNyIrdq.js} +1 -1
- package/dist/esm/{index-jN06TXUp.js → index-C3mnOs0I.js} +4 -4
- package/dist/esm/{index-B1zwA4IC.js → index-C63kfbil.js} +6 -6
- package/dist/esm/{index-DbSdn93t.js → index-DxbztwCv.js} +7 -7
- package/dist/esm/{layer-extension-CZXK5goK.js → layer-extension-C5Y2UES3.js} +1 -1
- package/dist/esm/{leaflet-provider-Q41TB6ku.js → leaflet-provider-k6JSYiYX.js} +6 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{messages-CMKJzsgL.js → messages-QJHuuz0g.js} +1 -9
- package/dist/esm/{openlayers-provider-CMsDsQTQ.js → openlayers-provider-DIquf3Tx.js} +5 -4
- package/dist/esm/{polygon-layer-ByhxGhWC.js → polygon-layer-ZIT5mJy5.js} +1 -1
- package/dist/esm/{scenegraph-layer-09K_B6DT.js → scenegraph-layer-CNIRd2uu.js} +1 -1
- package/dist/esm/v-map-builder.entry.js +3 -2
- package/dist/esm/v-map-error.entry.js +119 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +10 -9
- package/dist/esm/{v-map-layer-helper-Dys44Cgo.js → v-map-layer-helper-CuHYsU9f.js} +2 -1
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +5 -4
- package/dist/esm/v-map-layercontrol.entry.js +1 -1
- package/dist/esm/v-map.js +3 -3
- package/dist/esm/{v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js → v-map.v-map-layer-osm.v-map-layergroup-Zwdvm9PG.js} +10 -9
- package/dist/esm/v-map_3.entry.js +5 -4
- package/dist/types/components/v-map-error/v-map-error.d.ts +79 -0
- package/dist/types/components.d.ts +128 -0
- package/dist/v-map/p-05ee633f.entry.js +1 -0
- package/dist/v-map/p-08ad1392.entry.js +1 -0
- package/dist/v-map/p-2-mR3oVa.js +1 -0
- package/dist/v-map/{p-c21c93fe.entry.js → p-3a57b64a.entry.js} +1 -1
- package/dist/v-map/p-58dda864.entry.js +1 -0
- package/dist/v-map/p-915314c0.entry.js +10 -0
- package/dist/v-map/{p-MyTSFnEk.js → p-9Rt23jlQ.js} +1 -1
- package/dist/v-map/p-BSsFEMZP.js +1 -0
- package/dist/v-map/{p-jzneDarq.js → p-BoNyIrdq.js} +2 -2
- package/dist/v-map/p-BpE6L1g0.js +1 -0
- package/dist/v-map/{p-DvHXtWUg.js → p-C0M0-Kvt.js} +1 -1
- package/dist/v-map/p-CbiLpFhO.js +1 -0
- package/dist/v-map/p-Ci70E1EM.js +1 -0
- package/dist/v-map/p-CrV_misM.js +1 -0
- package/dist/v-map/{p-DrOQ9V4h.js → p-DAf4itFZ.js} +1 -1
- package/dist/v-map/p-DVBtCUtQ.js +1 -0
- package/dist/v-map/{p-CZqY0yW4.js → p-DuJ_mTaq.js} +1 -1
- package/dist/v-map/p-G6iftXUC.js +1 -0
- package/dist/v-map/{p-CMKJzsgL.js → p-QJHuuz0g.js} +1 -1
- package/dist/v-map/{p-aa410e64.entry.js → p-e21ea0ce.entry.js} +2 -2
- package/dist/v-map/{p-DmICdG34.js → p-rCyRSFJb.js} +2 -2
- package/dist/v-map/{p-CafTHT9i.js → p-vhbi5XXi.js} +1 -1
- package/dist/v-map/{p-Dckgonw8.js → p-yXLNXXx-.js} +1 -1
- package/dist/v-map/v-map.esm.js +1 -1
- package/package.json +29 -5
- package/dist/v-map/p--vVleK-M.js +0 -1
- package/dist/v-map/p-09d10db0.entry.js +0 -1
- package/dist/v-map/p-5eba6058.entry.js +0 -10
- package/dist/v-map/p-6b102336.entry.js +0 -1
- package/dist/v-map/p-BdijL4Av.js +0 -1
- package/dist/v-map/p-BeFu0ap4.js +0 -1
- package/dist/v-map/p-BxFJezdK.js +0 -1
- package/dist/v-map/p-DCTHyf58.js +0 -1
- package/dist/v-map/p-WaMDUuAz.js +0 -1
- package/dist/v-map/p-uiIP-taz.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as n,HTMLElement as e,createEvent as r,h as i}from"@stencil/core/internal/client";import{c as o,g as s,a as u}from"./_commonjsHelpers.js";import{l as a,V as c}from"./events.js";import{M as l}from"./messages.js";function h(t){return null!=t&&"number"==typeof t.valueOf()}function f(t){return null!=t&&"boolean"==typeof t.valueOf()}const p=t=>x(t)||d(t),d=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||h(t)||f(t)||null===t,m=t=>y(t)||v(t)||w(t)||b(t)||w(t)||f(t),y=t=>{const n=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===n&&(t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t))(t[0])&&p(t[1])&&p(t[2])&&("<=x<="!==t[0]||h(t[3]))},v=t=>Array.isArray(t)&&t.length>=3&&(t=>["&&","||"].includes(t))(t[0])&&t.every(((t,n)=>0===n||m(t))),b=t=>Array.isArray(t)&&2===t.length&&(t=>"!"===t)(t[0])&&m(t[1]),g=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(t?.name),w=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(t?.name),x=t=>w(t)||g(t)||(t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(t?.name))(t)||(t=>["case","property","step"].includes(t?.name))(t),E=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",S=new RegExp("^["+E+"]["+E+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function O(t,n){const e=[];let r=n.exec(t);for(;r;){const i=[];i.startIndex=n.lastIndex-r[0].length;const o=r.length;for(let t=0;t<o;t++)i.push(r[t]);e.push(i),r=n.exec(t)}return e}const F=function(t){return!(null==S.exec(t))},T=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],M=["__proto__","constructor","prototype"],k={allowBooleanAttributes:!1,unpairedTags:[]};function I(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function _(t,n){const e=n;for(;n<t.length;n++)if("?"!=t[n]&&" "!=t[n]);else{const r=t.substr(e,n-e);if(n>5&&"xml"===r)return P("InvalidXml","XML declaration allowed only at the start of the document.",R(t,n));if("?"==t[n]&&">"==t[n+1]){n++;break}}return n}function A(t,n){if(t.length>n+5&&"-"===t[n+1]&&"-"===t[n+2]){for(n+=3;n<t.length;n++)if("-"===t[n]&&"-"===t[n+1]&&">"===t[n+2]){n+=2;break}}else if(t.length>n+8&&"D"===t[n+1]&&"O"===t[n+2]&&"C"===t[n+3]&&"T"===t[n+4]&&"Y"===t[n+5]&&"P"===t[n+6]&&"E"===t[n+7]){let e=1;for(n+=8;n<t.length;n++)if("<"===t[n])e++;else if(">"===t[n]&&(e--,0===e))break}else if(t.length>n+9&&"["===t[n+1]&&"C"===t[n+2]&&"D"===t[n+3]&&"A"===t[n+4]&&"T"===t[n+5]&&"A"===t[n+6]&&"["===t[n+7])for(n+=8;n<t.length;n++)if("]"===t[n]&&"]"===t[n+1]&&">"===t[n+2]){n+=2;break}return n}function C(t,n){let e="",r="",i=!1;for(;n<t.length;n++){if('"'===t[n]||"'"===t[n])""===r?r=t[n]:r!==t[n]||(r="");else if(">"===t[n]&&""===r){i=!0;break}e+=t[n]}return""===r&&{value:e,index:n,tagClosed:i}}const N=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function D(t,n){const e=O(t,N),r={};for(let t=0;t<e.length;t++){if(0===e[t][1].length)return P("InvalidAttr","Attribute '"+e[t][2]+"' has no space in starting.",$(e[t]));if(void 0!==e[t][3]&&void 0===e[t][4])return P("InvalidAttr","Attribute '"+e[t][2]+"' is without value.",$(e[t]));if(void 0===e[t][3]&&!n.allowBooleanAttributes)return P("InvalidAttr","boolean attribute '"+e[t][2]+"' is not allowed.",$(e[t]));const i=e[t][2];if(!L(i))return P("InvalidAttr","Attribute '"+i+"' is an invalid name.",$(e[t]));if(Object.prototype.hasOwnProperty.call(r,i))return P("InvalidAttr","Attribute '"+i+"' is repeated.",$(e[t]));r[i]=1}return!0}function j(t,n){if(";"===t[++n])return-1;if("#"===t[n])return function(t,n){let e=/\d/;for("x"===t[n]&&(n++,e=/[\da-fA-F]/);n<t.length;n++){if(";"===t[n])return n;if(!t[n].match(e))break}return-1}(t,++n);let e=0;for(;n<t.length;n++,e++)if(!(t[n].match(/\w/)&&e<20)){if(";"===t[n])break;return-1}return n}function P(t,n,e){return{err:{code:t,msg:n,line:e.line||e,col:e.col}}}function L(t){return F(t)}function R(t,n){const e=t.substring(0,n).split(/\r?\n/);return{line:e.length,col:e[e.length-1].length+1}}function $(t){return t.startIndex+t[1].length}const z=t=>T.includes(t)?"__"+t:t,U={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,n){return n},attributeValueProcessor:function(t,n){return n},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:z};function G(t,n){if("string"!=typeof t)return;const e=t.toLowerCase();if(T.some((t=>e===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${n}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(M.some((t=>e===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${n}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function B(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??10),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1e3),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??100),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:B(!0)}const q=function(t){const n=Object.assign({},U,t),e=[{value:n.attributeNamePrefix,name:"attributeNamePrefix"},{value:n.attributesGroupName,name:"attributesGroupName"},{value:n.textNodeName,name:"textNodeName"},{value:n.cdataPropName,name:"cdataPropName"},{value:n.commentPropName,name:"commentPropName"}];for(const{value:t,name:n}of e)t&&G(t,n);return null===n.onDangerousProperty&&(n.onDangerousProperty=z),n.processEntities=B(n.processEntities),n.stopNodes&&Array.isArray(n.stopNodes)&&(n.stopNodes=n.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),n};let W;W="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class Y{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,n){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==n&&(this.child[this.child.length-1][W]={startIndex:n})}static getMetaDataSymbol(){return W}}class V{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const e=Object.create(null);let r=0;if("O"!==t[n+3]||"C"!==t[n+4]||"T"!==t[n+5]||"Y"!==t[n+6]||"P"!==t[n+7]||"E"!==t[n+8])throw new Error("Invalid Tag instead of DOCTYPE");{n+=9;let i=1,o=!1,s=!1;for(;n<t.length;n++)if("<"!==t[n]||s)if(">"===t[n]){if(s?"-"===t[n-1]&&"-"===t[n-2]&&(s=!1,i--):i--,0===i)break}else"["===t[n]&&(o=!0);else{if(o&&K(t,"!ENTITY",n)){let i,o;if(n+=7,[i,o,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),-1===o.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&r>=this.options.maxEntityCount)throw new Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e[i]={regx:RegExp(`&${t};`,"g"),val:o},r++}}else if(o&&K(t,"!ELEMENT",n)){n+=8;const{index:e}=this.readElementExp(t,n+1);n=e}else if(o&&K(t,"!ATTLIST",n))n+=8;else if(o&&K(t,"!NOTATION",n)){n+=9;const{index:e}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=e}else{if(!K(t,"!--",n))throw new Error("Invalid DOCTYPE");s=!0}i++}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:e,i:n}}readEntityExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n])&&'"'!==t[n]&&"'"!==t[n];)n++;let r=t.substring(e,n);if(X(r),n=H(t,n),!this.suppressValidationErr){if("SYSTEM"===t.substring(n,n+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[n])throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(t,n,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[r,i,--n]}readNotationExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);!this.suppressValidationErr&&X(r),n=H(t,n);const i=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n=H(t,n+=i.length);let o=null,s=null;if("PUBLIC"===i)[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),'"'!==t[n=H(t,n)]&&"'"!==t[n]||([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if("SYSTEM"===i&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,e){let r="";const i=t[n];if('"'!==i&&"'"!==i)throw new Error(`Expected quoted string, found "${i}"`);const o=++n;for(;n<t.length&&t[n]!==i;)n++;if(r=t.substring(o,n),t[n]!==i)throw new Error(`Unterminated ${e} value`);return[++n,r]}readElementExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);if(!this.suppressValidationErr&&!F(r))throw new Error(`Invalid element name: "${r}"`);let i="";if("E"===t[n=H(t,n)]&&K(t,"MPTY",n))n+=4;else if("A"===t[n]&&K(t,"NY",n))n+=2;else if("("===t[n]){const e=++n;for(;n<t.length&&")"!==t[n];)n++;if(i=t.substring(e,n),")"!==t[n])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:i.trim(),index:n}}readAttlistExp(t,n){let e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);for(X(r),e=n=H(t,n);n<t.length&&!/\s/.test(t[n]);)n++;let i=t.substring(e,n);if(!X(i))throw new Error(`Invalid attribute name: "${i}"`);n=H(t,n);let o="";if("NOTATION"===t.substring(n,n+8).toUpperCase()){if(o="NOTATION","("!==t[n=H(t,n+=8)])throw new Error(`Expected '(', found "${t[n]}"`);n++;let e=[];for(;n<t.length&&")"!==t[n];){const r=n;for(;n<t.length&&"|"!==t[n]&&")"!==t[n];)n++;let i=t.substring(r,n);if(i=i.trim(),!X(i))throw new Error(`Invalid notation name: "${i}"`);e.push(i),"|"===t[n]&&(n++,n=H(t,n))}if(")"!==t[n])throw new Error("Unterminated list of notations");n++,o+=" ("+e.join("|")+")"}else{const e=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;if(o+=t.substring(e,n),!this.suppressValidationErr&&!["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"].includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=H(t,n);let s="";return"#REQUIRED"===t.substring(n,n+8).toUpperCase()?(s="#REQUIRED",n+=8):"#IMPLIED"===t.substring(n,n+7).toUpperCase()?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:i,attributeType:o,defaultValue:s,index:n}}}const H=(t,n)=>{for(;n<t.length&&/\s/.test(t[n]);)n++;return n};function K(t,n,e){for(let r=0;r<n.length;r++)if(n[r]!==t[e+r+1])return!1;return!0}function X(t){if(F(t))return t;throw new Error(`Invalid entity name ${t}`)}const Q=/^[-+]?0x[a-fA-F0-9]+$/,Z=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,J={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};const tt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class nt{constructor(t,n={}){this.pattern=t,this.separator=n.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some((t=>"deep-wildcard"===t.type)),this._hasAttributeCondition=this.segments.some((t=>void 0!==t.attrName)),this._hasPositionSelector=this.segments.some((t=>void 0!==t.position))}_parse(t){const n=[];let e=0,r="";for(;e<t.length;)t[e]===this.separator?e+1<t.length&&t[e+1]===this.separator?(r.trim()&&(n.push(this._parseSegment(r.trim())),r=""),n.push({type:"deep-wildcard"}),e+=2):(r.trim()&&n.push(this._parseSegment(r.trim())),r="",e++):(r+=t[e],e++);return r.trim()&&n.push(this._parseSegment(r.trim())),n}_parseSegment(t){const n={type:"tag"};let e=null,r=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){const t=i[2].slice(1,-1);t&&(e=t)}let o,s,u=r;if(r.includes("::")){const n=r.indexOf("::");if(o=r.substring(0,n).trim(),u=r.substring(n+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${t}`)}let a=null;if(u.includes(":")){const t=u.lastIndexOf(":"),n=u.substring(0,t).trim(),e=u.substring(t+1).trim();["first","last","odd","even"].includes(e)||/^nth\(\d+\)$/.test(e)?(s=n,a=e):s=u}else s=u;if(!s)throw new Error(`Invalid segment pattern: ${t}`);if(n.tag=s,o&&(n.namespace=o),e)if(e.includes("=")){const t=e.indexOf("=");n.attrName=e.substring(0,t).trim(),n.attrValue=e.substring(t+1).trim()}else n.attrName=e.trim();if(a){const t=a.match(/^nth\((\d+)\)$/);t?(n.position="nth",n.positionValue=parseInt(t[1],10)):n.position=a}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}const et=new Set(["push","pop","reset","updateCurrent","restore"]);class rt{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,n=null,e=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;this.siblingStacks[r]||(this.siblingStacks[r]=new Map);const i=this.siblingStacks[r],o=e?`${e}:${t}`:t,s=i.get(o)||0;let u=0;for(const t of i.values())u+=t;i.set(o,s+1);const a={tag:t,position:u,counter:s};null!=e&&(a.namespace=e),null!=n&&(a.values=n),this.path.push(a)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){this.path.length>0&&null!=t&&(this.path[this.path.length-1].values=t)}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const n=this.path[this.path.length-1];return n.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const n=this.path[this.path.length-1];return void 0!==n.values&&t in n.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,n=!0){const e=t||this.separator;return this.path.map((t=>n&&t.namespace?`${t.namespace}:${t.tag}`:t.tag)).join(e)}toArray(){return this.path.map((t=>t.tag))}reset(){this.path=[],this.siblingStacks=[]}matches(t){const n=t.segments;return 0!==n.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(!this._matchSegment(t[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let n=this.path.length-1,e=t.length-1;for(;e>=0&&n>=0;){const r=t[e];if("deep-wildcard"===r.type){if(e--,e<0)return!0;const r=t[e];let i=!1;for(let t=n;t>=0;t--)if(this._matchSegment(r,this.path[t],t===this.path.length-1)){n=t-1,e--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[n],n===this.path.length-1))return!1;n--,e--}}return e<0}_matchSegment(t,n,e){if("*"!==t.tag&&t.tag!==n.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==n.namespace)return!1;if(void 0!==t.attrName){if(!e)return!1;if(!n.values||!(t.attrName in n.values))return!1;if(void 0!==t.attrValue&&String(n.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!e)return!1;const r=n.counter??0;if("first"===t.position&&0!==r)return!1;if("odd"===t.position&&r%2!=1)return!1;if("even"===t.position&&r%2!=0)return!1;if("nth"===t.position&&r!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map((t=>({...t}))),siblingStacks:this.siblingStacks.map((t=>new Map(t)))}}restore(t){this.path=t.path.map((t=>({...t}))),this.siblingStacks=t.siblingStacks.map((t=>new Map(t)))}readOnly(){return new Proxy(this,{get(t,n,e){if(et.has(n))return()=>{throw new TypeError(`Cannot call '${n}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const r=Reflect.get(t,n,e);return"path"===n||"siblingStacks"===n?Object.freeze(Array.isArray(r)?r.map((t=>t instanceof Map?Object.freeze(new Map(t)):Object.freeze({...t}))):r):"function"==typeof r?r.bind(t):r},set(t,n){throw new TypeError(`Cannot set property '${String(n)}' on a read-only Matcher.`)},deleteProperty(t,n){throw new TypeError(`Cannot delete property '${String(n)}' from a read-only Matcher.`)}})}}function it(t,n){if(!t)return{};const e=n.attributesGroupName?t[n.attributesGroupName]:t;if(!e)return{};const r={};for(const t in e)t.startsWith(n.attributeNamePrefix)?r[t.substring(n.attributeNamePrefix.length)]=e[t]:r[t]=e[t];return r}function ot(t){if(!t||"string"!=typeof t)return;const n=t.indexOf(":");if(-1!==n&&n>0){const e=t.substring(0,n);if("xmlns"!==e)return e}}class st{constructor(t){var n;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,n)=>xt(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,n)=>xt(n,16,"&#x")}},this.addExternalEntities=ut,this.parseXml=ft,this.parseTextData=at,this.resolveNameSpace=ct,this.buildAttributesMap=ht,this.isItStopNode=yt,this.replaceEntitiesValue=dt,this.readStopNodeData=gt,this.saveTextToParentTag=mt,this.addChild=pt,this.ignoreAttributesFn="function"==typeof(n=this.options.ignoreAttributes)?n:Array.isArray(n)?t=>{for(const e of n){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new rt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];"string"==typeof n?this.stopNodeExpressions.push(new nt(n)):n instanceof nt&&this.stopNodeExpressions.push(n)}}}}function ut(t){const n=Object.keys(t);for(let e=0;e<n.length;e++){const r=n[e],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:t[r]}}}function at(t,n,e,r,i,o,s){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t,n,e));const r=this.options.jPath?e.toString():e,u=this.options.tagValueProcessor(n,t,r,i,o);return null==u?t:typeof u!=typeof t||u!==t?u:this.options.trimValues||t.trim()===t?wt(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function ct(t){if(this.options.removeNSPrefix){const n=t.split(":"),e="/"===t.charAt(0)?"/":"";if("xmlns"===n[0])return"";2===n.length&&(t=e+n[1])}return t}const lt=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function ht(t,n,e){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const r=O(t,lt),i=r.length,o={},s={};for(let t=0;t<i;t++){const n=this.resolveNameSpace(r[t][1]),i=r[t][4];if(n.length&&void 0!==i){let t=i;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,e,this.readonlyMatcher),s[n]=t}}Object.keys(s).length>0&&"object"==typeof n&&n.updateCurrent&&n.updateCurrent(s);for(let t=0;t<i;t++){const i=this.resolveNameSpace(r[t][1]),s=this.options.jPath?n.toString():this.readonlyMatcher;if(this.ignoreAttributesFn(i,s))continue;let u=r[t][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),a=St(a,this.options),void 0!==u){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,e,this.readonlyMatcher);const t=this.options.jPath?n.toString():this.readonlyMatcher,r=this.options.attributeValueProcessor(i,u,t);o[a]=null==r?u:typeof r!=typeof u||r!==u?r:wt(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const ft=function(t){t=t.replace(/\r\n?/g,"\n");const n=new Y("!xml");let e=n,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const i=new V(this.options.processEntities);for(let o=0;o<t.length;o++)if("<"===t[o])if("/"===t[o+1]){const n=vt(t,">",o,"Closing Tag is not closed.");let i=t.substring(o+2,n).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}i=Et(this.options.transformTagName,i,"",this.options).tagName,e&&(r=this.saveTextToParentTag(r,e,this.readonlyMatcher));const s=this.matcher.getCurrentTag();if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);s&&-1!==this.options.unpairedTags.indexOf(s)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,e=this.tagsNodeStack.pop(),r="",o=n}else if("?"===t[o+1]){let n=bt(t,o,!1,"?>");if(!n)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,e,this.readonlyMatcher),this.options.ignoreDeclaration&&"?xml"===n.tagName||this.options.ignorePiTags);else{const t=new Y(n.tagName);t.add(this.options.textNodeName,""),n.tagName!==n.tagExp&&n.attrExpPresent&&(t[":@"]=this.buildAttributesMap(n.tagExp,this.matcher,n.tagName)),this.addChild(e,t,this.readonlyMatcher,o)}o=n.closeIndex+1}else if("!--"===t.substr(o+1,3)){const n=vt(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(o+4,n-2);r=this.saveTextToParentTag(r,e,this.readonlyMatcher),e.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}o=n}else if("!D"===t.substr(o+1,2)){const n=i.readDocType(t,o);this.docTypeEntities=n.entities,o=n.i}else if("!["===t.substr(o+1,2)){const n=vt(t,"]]>",o,"CDATA is not closed.")-2,i=t.substring(o+9,n);r=this.saveTextToParentTag(r,e,this.readonlyMatcher);let s=this.parseTextData(i,e.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?e.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):e.add(this.options.textNodeName,s),o=n+2}else{let i=bt(t,o,this.options.removeNSPrefix);if(!i){const n=t.substring(Math.max(0,o-50),Math.min(t.length,o+50));throw new Error(`readTagExp returned undefined at position ${o}. Context: "${n}"`)}let s=i.tagName;const u=i.rawTagName;let a=i.tagExp,c=i.attrExpPresent,l=i.closeIndex;if(({tagName:s,tagExp:a}=Et(this.options.transformTagName,s,a,this.options)),this.options.strictReservedNames&&(s===this.options.commentPropName||s===this.options.cdataPropName||s===this.options.textNodeName||s===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${s}`);e&&r&&"!xml"!==e.tagname&&(r=this.saveTextToParentTag(r,e,this.readonlyMatcher,!1)),e&&-1!==this.options.unpairedTags.indexOf(e.tagname)&&(e=this.tagsNodeStack.pop(),this.matcher.pop());let h=!1;a.length>0&&a.lastIndexOf("/")===a.length-1&&(h=!0,"/"===s[s.length-1]?(s=s.substr(0,s.length-1),a=s):a=a.substr(0,a.length-1),c=s!==a);let f,p=null;f=ot(u),s!==n.tagname&&this.matcher.push(s,{},f),s!==a&&c&&(p=this.buildAttributesMap(a,this.matcher,s),p&&it(p,this.options)),s!==n.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const d=o;if(this.isCurrentNodeStopNode){let n="";if(h)o=i.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(s))o=i.closeIndex;else{const e=this.readStopNodeData(t,u,l+1);if(!e)throw new Error(`Unexpected end of ${u}`);o=e.i,n=e.tagContent}const r=new Y(s);p&&(r[":@"]=p),r.add(this.options.textNodeName,n),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(e,r,this.readonlyMatcher,d)}else{if(h){({tagName:s,tagExp:a}=Et(this.options.transformTagName,s,a,this.options));const t=new Y(s);p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(s)){const t=new Y(s);p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),this.matcher.pop(),this.isCurrentNodeStopNode=!1,o=i.closeIndex;continue}{const t=new Y(s);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(e),p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),e=t}}r="",o=l}}else r+=t[o];return n.child};function pt(t,n,e,r){this.options.captureMetaData||(r=void 0);const i=this.options.jPath?e.toString():e,o=this.options.updateTag(n.tagname,i,n[":@"]);!1===o||("string"==typeof o?(n.tagname=o,t.addChild(n,r)):t.addChild(n,r))}function dt(t,n,e){const r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){const i=this.options.jPath?e.toString():e;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(n):r.allowedTags(n,i)))return t}if(r.tagFilter){const i=this.options.jPath?e.toString():e;if(!r.tagFilter(n,i))return t}for(const n of Object.keys(this.docTypeEntities)){const e=this.docTypeEntities[n],i=t.match(e.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const n=t.length;if(t=t.replace(e.regx,e.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-n,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}for(const n of Object.keys(this.lastEntities)){const e=this.lastEntities[n],i=t.match(e.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(e.regex,e.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(const n of Object.keys(this.htmlEntities)){const e=this.htmlEntities[n],i=t.match(e.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(e.regex,e.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function mt(t,n,e,r){return t&&(void 0===r&&(r=0===n.child.length),void 0!==(t=this.parseTextData(t,n.tagname,e,!1,!!n[":@"]&&0!==Object.keys(n[":@"]).length,r))&&""!==t&&n.add(this.options.textNodeName,t),t=""),t}function yt(t,n){if(!t||0===t.length)return!1;for(let e=0;e<t.length;e++)if(n.matches(t[e]))return!0;return!1}function vt(t,n,e,r){const i=t.indexOf(n,e);if(-1===i)throw new Error(r);return i+n.length-1}function bt(t,n,e,r=">"){const i=function(t,n,e=">"){let r,i="";for(let o=n;o<t.length;o++){let n=t[o];if(r)n===r&&(r="");else if('"'===n||"'"===n)r=n;else if(n===e[0]){if(!e[1])return{data:i,index:o};if(t[o+1]===e[1])return{data:i,index:o}}else"\t"===n&&(n=" ");i+=n}}(t,n+1,r);if(!i)return;let o=i.data;const s=i.index,u=o.search(/\s/);let a=o,c=!0;-1!==u&&(a=o.substring(0,u),o=o.substring(u+1).trimStart());const l=a;if(e){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1),c=a!==i.data.substr(t+1))}return{tagName:a,tagExp:o,closeIndex:s,attrExpPresent:c,rawTagName:l}}function gt(t,n,e){const r=e;let i=1;for(;e<t.length;e++)if("<"===t[e])if("/"===t[e+1]){const o=vt(t,">",e,`${n} is not closed`);if(t.substring(e+2,o).trim()===n&&(i--,0===i))return{tagContent:t.substring(r,e),i:o};e=o}else if("?"===t[e+1])e=vt(t,"?>",e+1,"StopNode is not closed.");else if("!--"===t.substr(e+1,3))e=vt(t,"--\x3e",e+3,"StopNode is not closed.");else if("!["===t.substr(e+1,2))e=vt(t,"]]>",e,"StopNode is not closed.")-2;else{const r=bt(t,e,">");r&&((r&&r.tagName)===n&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,e=r.closeIndex)}}function wt(t,n,e){if(n&&"string"==typeof t){const n=t.trim();return"true"===n||"false"!==n&&function(t,n={}){if(n=Object.assign({},J,n),!t||"string"!=typeof t)return t;let e=t.trim();if(0===e.length)return t;if(void 0!==n.skipLike&&n.skipLike.test(e))return t;if("0"===e)return 0;if(n.hex&&Q.test(e))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(e);if(isFinite(e)){if(e.includes("e")||e.includes("E"))return function(t,n,e){if(!e.eNotation)return t;const r=n.match(tt);if(r){let i=r[1]||"";const o=-1===r[3].indexOf("e")?"E":"e",s=r[2],u=i?t[s.length+1]===o:t[s.length]===o;return s.length>1&&u?t:(1!==s.length||!r[3].startsWith(`.${o}`)&&r[3][0]!==o)&&s.length>0?e.leadingZeros&&!u?(n=(r[1]||"")+r[3],Number(n)):t:Number(n)}return t}(t,e,n);{const i=Z.exec(e);if(i){const o=i[1]||"",s=i[2];let u=(r=i[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substring(0,r.length-1)),r):r;if(!n.leadingZeros&&(s.length>1||1===s.length&&!(o?"."===t[s.length+1]:"."===t[s.length])))return t;{const r=Number(e),i=String(r);if(0===r)return r;if(-1!==i.search(/[eE]/))return n.eNotation?r:t;if(-1!==e.indexOf("."))return"0"===i||i===u||i===`${o}${u}`?r:t;let a=s?u:e;return s?a===i||o+a===i?r:t:a===i||a===o+i?r:t}}return t}}var r;return function(t,n,e){const r=n===1/0;switch(e.infinity.toLowerCase()){case"null":return null;case"infinity":return n;case"string":return r?"Infinity":"-Infinity";default:return t}}(t,Number(e),n)}(t,e)}return function(t){return void 0!==t}(t)?t:""}function xt(t,n,e){const r=Number.parseInt(t,n);return r>=0&&r<=1114111?String.fromCodePoint(r):e+t+";"}function Et(t,n,e,r){if(t){const r=t(n);e===n&&(e=r),n=r}return{tagName:n=St(n,r),tagExp:e}}function St(t,n){if(M.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return T.includes(t)?n.onDangerousProperty(t):t}const Ot=Y.getMetaDataSymbol();function Ft(t,n){if(!t||"object"!=typeof t)return{};if(!n)return t;const e={};for(const r in t)r.startsWith(n)?e[r.substring(n.length)]=t[r]:e[r]=t[r];return e}function Tt(t,n,e,r){return Mt(t,n,e,r)}function Mt(t,n,e,r){let i;const o={};for(let s=0;s<t.length;s++){const u=t[s],a=kt(u);if(void 0!==a&&a!==n.textNodeName){const t=Ft(u[":@"]||{},n.attributeNamePrefix);e.push(a,t)}if(a===n.textNodeName)void 0===i?i=u[a]:i+=""+u[a];else{if(void 0===a)continue;if(u[a]){let t=Mt(u[a],n,e,r);const i=_t(t,n);if(u[":@"]?It(t,u[":@"],r,n):1!==Object.keys(t).length||void 0===t[n.textNodeName]||n.alwaysCreateTextNode?0===Object.keys(t).length&&(n.alwaysCreateTextNode?t[n.textNodeName]="":t=""):t=t[n.textNodeName],void 0!==u[Ot]&&"object"==typeof t&&null!==t&&(t[Ot]=u[Ot]),void 0!==o[a]&&Object.prototype.hasOwnProperty.call(o,a))Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(t);else{const e=n.jPath?r.toString():r;o[a]=n.isArray(a,e,i)?[t]:t}void 0!==a&&a!==n.textNodeName&&e.pop()}}}return"string"==typeof i?i.length>0&&(o[n.textNodeName]=i):void 0!==i&&(o[n.textNodeName]=i),o}function kt(t){const n=Object.keys(t);for(let t=0;t<n.length;t++){const e=n[t];if(":@"!==e)return e}}function It(t,n,e,r){if(n){const i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const o=i[s],u=o.startsWith(r.attributeNamePrefix)?o.substring(r.attributeNamePrefix.length):o,a=r.jPath?e.toString()+"."+u:e;t[o]=r.isArray(o,a,!0,!0)?[n[o]]:n[o]}}}function _t(t,n){const{textNodeName:e}=n,r=Object.keys(t).length;return 0===r||!(1!==r||!t[e]&&"boolean"!=typeof t[e]&&0!==t[e])}class At{constructor(t){this.externalEntities={},this.options=q(t)}parse(t,n){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(n){!0===n&&(n={});const e=function(t,n){n=Object.assign({},k,n);const e=[];let r=!1,i=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let o=0;o<t.length;o++)if("<"===t[o]&&"?"===t[o+1]){if(o+=2,o=_(t,o),o.err)return o}else{if("<"!==t[o]){if(I(t[o]))continue;return P("InvalidChar","char '"+t[o]+"' is not expected.",R(t,o))}{let s=o;if(o++,"!"===t[o]){o=A(t,o);continue}{let u=!1;"/"===t[o]&&(u=!0,o++);let a="";for(;o<t.length&&">"!==t[o]&&" "!==t[o]&&"\t"!==t[o]&&"\n"!==t[o]&&"\r"!==t[o];o++)a+=t[o];if(a=a.trim(),"/"===a[a.length-1]&&(a=a.substring(0,a.length-1),o--),!F(a)){let n;return n=0===a.trim().length?"Invalid space after '<'.":"Tag '"+a+"' is an invalid name.",P("InvalidTag",n,R(t,o))}const c=C(t,o);if(!1===c)return P("InvalidAttr","Attributes for '"+a+"' have open quote.",R(t,o));let l=c.value;if(o=c.index,"/"===l[l.length-1]){const e=o-l.length;l=l.substring(0,l.length-1);const i=D(l,n);if(!0!==i)return P(i.err.code,i.err.msg,R(t,e+i.err.line));r=!0}else if(u){if(!c.tagClosed)return P("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",R(t,o));if(l.trim().length>0)return P("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",R(t,s));if(0===e.length)return P("InvalidTag","Closing tag '"+a+"' has not been opened.",R(t,s));{const n=e.pop();if(a!==n.tagName){let e=R(t,n.tagStartPos);return P("InvalidTag","Expected closing tag '"+n.tagName+"' (opened in line "+e.line+", col "+e.col+") instead of closing tag '"+a+"'.",R(t,s))}0==e.length&&(i=!0)}}else{const u=D(l,n);if(!0!==u)return P(u.err.code,u.err.msg,R(t,o-l.length+u.err.line));if(!0===i)return P("InvalidXml","Multiple possible root nodes found.",R(t,o));-1!==n.unpairedTags.indexOf(a)||e.push({tagName:a,tagStartPos:s}),r=!0}for(o++;o<t.length;o++)if("<"===t[o]){if("!"===t[o+1]){o++,o=A(t,o);continue}if("?"!==t[o+1])break;if(o=_(t,++o),o.err)return o}else if("&"===t[o]){const n=j(t,o);if(-1==n)return P("InvalidChar","char '&' is not expected.",R(t,o));o=n}else if(!0===i&&!I(t[o]))return P("InvalidXml","Extra text at the end",R(t,o));"<"===t[o]&&o--}}}return r?1==e.length?P("InvalidTag","Unclosed tag '"+e[0].tagName+"'.",R(t,e[0].tagStartPos)):!(e.length>0)||P("InvalidXml","Invalid '"+JSON.stringify(e.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):P("InvalidXml","Start tag expected.",1)}(t,n);if(!0!==e)throw Error(`${e.err.msg}:${e.err.line}:${e.err.col}`)}const e=new st(this.options);e.addExternalEntities(this.externalEntities);const r=e.parseXml(t);return this.options.preserveOrder||void 0===r?r:Tt(r,this.options,e.matcher,e.readonlyMatcher)}addEntity(t,n){if(-1!==n.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===n)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Y.getMetaDataSymbol()}}function Ct(t,n){let e="";n.format&&n.indentBy.length>0&&(e="\n");const r=[];if(n.stopNodes&&Array.isArray(n.stopNodes))for(let t=0;t<n.stopNodes.length;t++){const e=n.stopNodes[t];"string"==typeof e?r.push(new nt(e)):e instanceof nt&&r.push(e)}return Nt(t,n,e,new rt,r)}function Nt(t,n,e,r,i){let o="",s=!1;if(n.maxNestedTags&&r.getDepth()>n.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let e=t.toString();return e=zt(e,n),e}return""}for(let u=0;u<t.length;u++){const a=t[u],c=Lt(a);if(void 0===c)continue;const l=Dt(a[":@"],n);r.push(c,l);const h=$t(r,i);if(c===n.textNodeName){let t=a[c];h||(t=n.tagValueProcessor(c,t),t=zt(t,n)),s&&(o+=e),o+=t,s=!1,r.pop();continue}if(c===n.cdataPropName){s&&(o+=e),o+=`<![CDATA[${a[c][0][n.textNodeName]}]]>`,s=!1,r.pop();continue}if(c===n.commentPropName){o+=e+`\x3c!--${a[c][0][n.textNodeName]}--\x3e`,s=!0,r.pop();continue}if("?"===c[0]){const t=Rt(a[":@"],n,h);let i=a[c][0][n.textNodeName];i=0!==i.length?" "+i:"",o+=("?xml"===c?"":e)+`<${c}${i}${t}?>`,s=!0,r.pop();continue}let f=e;""!==f&&(f+=n.indentBy);const p=e+`<${c}${Rt(a[":@"],n,h)}`;let d;d=h?jt(a[c],n):Nt(a[c],n,f,r,i),-1!==n.unpairedTags.indexOf(c)?o+=n.suppressUnpairedNode?p+">":p+"/>":d&&0!==d.length||!n.suppressEmptyNode?d&&d.endsWith(">")?o+=p+`>${d}${e}</${c}>`:(o+=p+">",d&&""!==e&&(d.includes("/>")||d.includes("</"))?o+=e+n.indentBy+d+e:o+=d,o+=`</${c}>`):o+=p+"/>",s=!0,r.pop()}return o}function Dt(t,n){if(!t||n.ignoreAttributes)return null;const e={};let r=!1;for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i.startsWith(n.attributeNamePrefix)?i.substr(n.attributeNamePrefix.length):i]=t[i],r=!0);return r?e:null}function jt(t,n){if(!Array.isArray(t))return null!=t?t.toString():"";let e="";for(let r=0;r<t.length;r++){const i=t[r],o=Lt(i);if(o===n.textNodeName)e+=i[o];else if(o===n.cdataPropName)e+=i[o][0][n.textNodeName];else if(o===n.commentPropName)e+=i[o][0][n.textNodeName];else{if(o&&"?"===o[0])continue;if(o){const t=Pt(i[":@"],n),r=jt(i[o],n);e+=r&&0!==r.length?`<${o}${t}>${r}</${o}>`:`<${o}${t}/>`}}}return e}function Pt(t,n){let e="";if(t&&!n.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];e+=!0===i&&n.suppressBooleanAttributes?` ${r.substr(n.attributeNamePrefix.length)}`:` ${r.substr(n.attributeNamePrefix.length)}="${i}"`}return e}function Lt(t){const n=Object.keys(t);for(let e=0;e<n.length;e++){const r=n[e];if(Object.prototype.hasOwnProperty.call(t,r)&&":@"!==r)return r}}function Rt(t,n,e){let r="";if(t&&!n.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o;e?o=t[i]:(o=n.attributeValueProcessor(i,t[i]),o=zt(o,n)),r+=!0===o&&n.suppressBooleanAttributes?` ${i.substr(n.attributeNamePrefix.length)}`:` ${i.substr(n.attributeNamePrefix.length)}="${o}"`}return r}function $t(t,n){if(!n||0===n.length)return!1;for(let e=0;e<n.length;e++)if(t.matches(n[e]))return!0;return!1}function zt(t,n){if(t&&t.length>0&&n.processEntities)for(let e=0;e<n.entities.length;e++){const r=n.entities[e];t=t.replace(r.regex,r.val)}return t}const Ut={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,n){return n},attributeValueProcessor:function(t,n){return n},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function Gt(t){if(this.options=Object.assign({},Ut,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];"string"==typeof n?this.stopNodeExpressions.push(new nt(n)):n instanceof nt&&this.stopNodeExpressions.push(n)}var n;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(n=this.options.ignoreAttributes)?n:Array.isArray(n)?t=>{for(const e of n){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Wt),this.processTextOrObjNode=Bt,this.options.format?(this.indentate=qt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Bt(t,n,e,r){const i=this.extractAttributes(t);if(r.push(n,i),this.checkStopNode(r)){const i=this.buildRawContent(t),o=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(i,n,o,e)}const o=this.j2x(t,e+1,r);return r.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],n,o.attrStr,e,r):this.buildObjectNode(o.val,n,o.attrStr,e)}function qt(t){return this.options.indentBy.repeat(t)}function Wt(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}function Yt(t){return g(t)?t:Number(t)}function Vt(t){const{name:n}=t;return"pi"===n||"random"===n?[{Function:[],":@":{"@_name":n}}]:"property"===n?{PropertyName:[{"#text":t.args[0]}]}:[{Function:t.args.map((t=>{if(x(t)){const n=Vt(t);return Array.isArray(n)?n[0]:n}return{Literal:[{"#text":t}]}})),":@":{"@_name":n}}]}function Ht(t){var n,e;const r=null==(e=null==(n=null==t?void 0:t[0])?void 0:n[":@"])?void 0:e["@_name"],i=null==t?void 0:t[0].Function.map((t=>{var n,e,r,i;return t.Function?Ht([t]):t.PropertyName?{name:"property",args:[null==(e=null==(n=null==t?void 0:t.PropertyName)?void 0:n[0])?void 0:e["#text"]]}:null==(i=null==(r=null==t?void 0:t.Literal)?void 0:r[0])?void 0:i["#text"]})),o={name:r};return i.length>0&&(o.args=i),o}function Kt(t,n){return null==t?void 0:t.filter((t=>Object.keys(t).includes(n)))}function Xt(t,n,e){var r,i,o,s,u,a,c,l,h,f;if(!t)return;const p=t.filter((t=>{var n;return null==(n=Object.keys(t))?void 0:n.includes(e)})).find((t=>{var e;return(null==(e=null==t?void 0:t[":@"])?void 0:e["@_name"])===n}));return null!=(i=null==(r=null==p?void 0:p[e])?void 0:r[0])&&i.Function?Ht(null==p?void 0:p[e]):null!=(s=null==(o=null==p?void 0:p[e])?void 0:o[0])&&s.Literal?null==(l=null==(c=null==(a=null==(u=null==p?void 0:p[e])?void 0:u[0])?void 0:a.Literal)?void 0:c[0])?void 0:l["#text"]:null==(f=null==(h=null==p?void 0:p[e])?void 0:h[0])?void 0:f["#text"]}function Qt(t,n,e){return Xt(t,n,"1.0.0"===e?"CssParameter":"SvgParameter")}function Zt(t,n){var e;return null==(e=null==t?void 0:t[":@"])?void 0:e[`@_${n}`]}function Jt(t){return Object.keys(t).some((t=>t.endsWith("Symbolizer")))}function tn(t,n,e){var r,i,o,s,u,a;const c=n.split(/\.(.*)/s);let l=c[0];const h=c[1];let f=t,p=0;if(null!=h&&h.startsWith("@"))return f=Kt(t,l)[p],Zt(f,h.substring(1));if(Array.isArray(t)){if("#text"===l){if(null!=(r=f[0])&&r.Function)return Ht(f);if(null!=(i=f[0])&&i.Literal)return null==(u=null==(s=null==(o=f[0])?void 0:o.Literal)?void 0:s[0])?void 0:u["#text"]}if("#text"===l&&null!=(a=f[0])&&a.Function)return Ht(f);if(l.startsWith("$")&&e)return Qt(f,l.substring(1),e);l.endsWith("]")&&(p=Number(l.split("[")[1].split("]")[0]),l=l.split("[")[0]),f=Kt(t,l)[p]}return f?h?tn(f[l],h,e):f[l]:void 0}function nn(t,n){return Object.keys(t).filter((e=>t[e]===n))}function en(t){return"number"==typeof t&&!isNaN(t)}function rn(t,n){for(const e in n)n[e]instanceof Object&&Object.assign(n[e],rn(t[e]??{},n[e]));return Object.assign(t||{},n),t}Gt.prototype.build=function(t){if(this.options.preserveOrder)return Ct(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const n=new rt;return this.j2x(t,0,n).val}},Gt.prototype.j2x=function(t,n,e){let r="",i="";if(this.options.maxNestedTags&&e.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?e.toString():e,s=this.checkStopNode(e);for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u))if(void 0===t[u])this.isAttribute(u)&&(i+="");else if(null===t[u])this.isAttribute(u)?i+="":i+=u===this.options.cdataPropName?"":"?"===u[0]?this.indentate(n)+"<"+u+"?"+this.tagEndChar:this.indentate(n)+"<"+u+"/"+this.tagEndChar;else if(t[u]instanceof Date)i+=this.buildTextValNode(t[u],u,"",n,e);else if("object"!=typeof t[u]){const a=this.isAttribute(u);if(a&&!this.ignoreAttributesFn(a,o))r+=this.buildAttrPairStr(a,""+t[u],s);else if(!a)if(u===this.options.textNodeName){let n=this.options.tagValueProcessor(u,""+t[u]);i+=this.replaceEntitiesValue(n)}else{e.push(u);const r=this.checkStopNode(e);if(e.pop(),r){const e=""+t[u];i+=""===e?this.indentate(n)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(n)+"<"+u+">"+e+"</"+u+this.tagEndChar}else i+=this.buildTextValNode(t[u],u,"",n,e)}}else if(Array.isArray(t[u])){const r=t[u].length;let o="",s="";for(let a=0;a<r;a++){const r=t[u][a];if(void 0===r);else if(null===r)i+="?"===u[0]?this.indentate(n)+"<"+u+"?"+this.tagEndChar:this.indentate(n)+"<"+u+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){e.push(u);const t=this.j2x(r,n+1,e);e.pop(),o+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(s+=t.attrStr)}else o+=this.processTextOrObjNode(r,u,n,e);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(u,r);t=this.replaceEntitiesValue(t),o+=t}else{e.push(u);const t=this.checkStopNode(e);if(e.pop(),t){const t=""+r;o+=""===t?this.indentate(n)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(n)+"<"+u+">"+t+"</"+u+this.tagEndChar}else o+=this.buildTextValNode(r,u,"",n,e)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,u,s,n)),i+=o}else if(this.options.attributesGroupName&&u===this.options.attributesGroupName){const n=Object.keys(t[u]),e=n.length;for(let i=0;i<e;i++)r+=this.buildAttrPairStr(n[i],""+t[u][n[i]],s)}else i+=this.processTextOrObjNode(t[u],u,n,e);return{attrStr:r,val:i}},Gt.prototype.buildAttrPairStr=function(t,n,e){return e||(n=this.options.attributeValueProcessor(t,""+n),n=this.replaceEntitiesValue(n)),this.options.suppressBooleanAttributes&&"true"===n?" "+t:" "+t+'="'+n+'"'},Gt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const n={};let e=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=r[t],e=!0)}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(n[i]=t[r],e=!0)}return e?n:null},Gt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let n="";for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;if(this.isAttribute(e))continue;if(this.options.attributesGroupName&&e===this.options.attributesGroupName)continue;const r=t[e];if(e===this.options.textNodeName)n+=r;else if(Array.isArray(r)){for(let t of r)if("string"==typeof t||"number"==typeof t)n+=`<${e}>${t}</${e}>`;else if("object"==typeof t&&null!==t){const r=this.buildRawContent(t),i=this.buildAttributesForStopNode(t);n+=""===r?`<${e}${i}/>`:`<${e}${i}>${r}</${e}>`}}else if("object"==typeof r&&null!==r){const t=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);n+=""===t?`<${e}${i}/>`:`<${e}${i}>${t}</${e}>`}else n+=`<${e}>${r}</${e}>`}return n},Gt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let n="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const e=t[this.options.attributesGroupName];for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const r=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,i=e[t];n+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}else for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const r=this.isAttribute(e);if(r){const i=t[e];n+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}return n},Gt.prototype.buildObjectNode=function(t,n,e,r){if(""===t)return"?"===n[0]?this.indentate(r)+"<"+n+e+"?"+this.tagEndChar:this.indentate(r)+"<"+n+e+this.closeTag(n)+this.tagEndChar;{let i="</"+n+this.tagEndChar,o="";return"?"===n[0]&&(o="?",i=""),!e&&""!==e||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&n===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+n+e+o+this.tagEndChar+t+this.indentate(r)+i:this.indentate(r)+"<"+n+e+o+">"+t+i}},Gt.prototype.closeTag=function(t){let n="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(n="/"):n=this.options.suppressEmptyNode?"/":`></${t}`,n},Gt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let n=0;n<this.stopNodeExpressions.length;n++)if(t.matches(this.stopNodeExpressions[n]))return!0;return!1},Gt.prototype.buildTextValNode=function(t,n,e,r){if(!1!==this.options.cdataPropName&&n===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&n===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===n[0])return this.indentate(r)+"<"+n+e+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(n,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+n+e+this.closeTag(n)+this.tagEndChar:this.indentate(r)+"<"+n+e+">"+i+"</"+n+this.tagEndChar}},Gt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let n=0;n<this.options.entities.length;n++){const e=this.options.entities[n];t=t.replace(e.regex,e.val)}return t};var on=Object.defineProperty,sn=(t,n,e)=>((t,n,e)=>n in t?on(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e)(t,"symbol"!=typeof n?n+"":n,e);const un=["1.0.0","1.1.0"],an="GeoServer",cn=/^ttf:\/\/(.+)#(.+)$/,ln={PropertyIsEqualTo:"==",PropertyIsNotEqualTo:"!=",PropertyIsLike:"*=",PropertyIsLessThan:"<",PropertyIsLessThanOrEqualTo:"<=",PropertyIsGreaterThan:">",PropertyIsGreaterThanOrEqualTo:">=",PropertyIsNull:"==",PropertyIsBetween:"<=x<="},hn={Not:"!"},fn={And:"&&",Or:"||",PropertyIsBetween:"&&"},pn="http://www.opengeospatial.org/se/units/metre",dn="http://www.opengeospatial.org/se/units/pixel",mn=["add","sub","mul","div"],yn={en:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`MarkSymbolizer cannot be parsed. WellKnownName ${t} is not supported.`,noFilterDetected:"No Filter detected.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Failed to parse SymbolizerKind ${t} from SldRule.`,colorMapEntriesParseFailedColorUndefined:"Cannot parse ColorMapEntries. color is undefined.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Cannot parse ContrastEnhancement. Histogram and Normalize are mutually exclusive.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Cannot parse ChannelSelection. RGB and Grayscale are mutually exclusive.",channelSelectionParseFailedRGBChannelsUndefined:"Cannot parse ChannelSelection. Red, Green and Blue channels must be defined."},de:{},fr:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`Échec de lecture du symbole de type MarkSymbolizer. Le WellKnownName ${t} n'est pas supporté.`,noFilterDetected:"Aucun filtre détecté.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Échec de lecture du type de symbole ${t} à partir de SldRule.`,colorMapEntriesParseFailedColorUndefined:"Lecture de ColorMapEntries échoué. color n'est pas défini.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Échec de lecture des propriétés de contraste ContrastEnhancement échoué. Histogram et Normalize sont mutuellement exclusifs.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Échec de lecture de la sélection de canaux ChannelSelection. RGB et Grayscale sont mutuellement exclusifs.",channelSelectionParseFailedRGBChannelsUndefined:"Échec de lecture de la sélection de canaux ChannelSelection. Les canaux Rouge, Vert et Bleu doivent être définis."}},vn=t=>null==t;class bn{constructor(t){sn(this,"title","SLD Style Parser"),sn(this,"unsupportedProperties",{Symbolizer:{MarkSymbolizer:{avoidEdges:"none",blur:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",pitchAlignment:"none",pitchScale:"none",visibility:"none"},FillSymbolizer:{antialias:"none",opacity:{support:"none",info:"General opacity is not supported. Use fillOpacity and strokeOpacity instead."},visibility:"none"},IconSymbolizer:{allowOverlap:"none",anchor:"none",avoidEdges:"none",color:"none",haloBlur:"none",haloColor:"none",haloOpacity:"none",haloWidth:"none",keepUpright:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",optional:"none",padding:"none",pitchAlignment:"none",rotationAlignment:"none",textFit:"none",image:{support:"partial",info:"Sprites are not supported"},textFitPadding:"none",visibility:"none"},LineSymbolizer:{blur:"none",gapWidth:"none",gradient:"none",miterLimit:"none",roundLimit:"none",spacing:"none",visibility:"none"},RasterSymbolizer:{brightnessMax:"none",brightnessMin:"none",contrast:"none",fadeDuration:"none",hueRotate:"none",resampling:"none",saturation:"none",visibility:"none"},TextSymbolizer:{placement:{support:"partial",info:'Only "line" and "point" are currently supported'}}}}),sn(this,"translations",yn),sn(this,"locale","en"),sn(this,"_parser"),sn(this,"_builder"),sn(this,"_numericFilterFields",[]),sn(this,"_boolFilterFields",[]),sn(this,"_sldVersion","1.0.0"),sn(this,"_sldEnvironment",null),sn(this,"_readingSldVersion","1.0.0"),sn(this,"_symbolizerUnits","pixel"),sn(this,"getTextSymbolizerLabelFromSldSymbolizer",(t=>{var n;if(Array.isArray(t)&&t[0]&&"object"==typeof t[0]&&(t[0].Function||t[0]["ogc:Function"])){const e=t[0],r=t=>{var n,e,r,i,o,s,u,a;return t.PropertyName||t["ogc:PropertyName"]?{name:"property",args:[(null==(e=null==(n=t.PropertyName)?void 0:n[0])?void 0:e["#text"])??(null==(i=null==(r=t["ogc:PropertyName"])?void 0:r[0])?void 0:i["#text"])]}:t.Literal||t["ogc:Literal"]?void 0!==(null==(s=null==(o=t.Literal)?void 0:o[0])?void 0:s["#text"])?t.Literal[0]["#text"]:(null==(a=null==(u=t["ogc:Literal"])?void 0:u[0])?void 0:a["#text"])??"":t.Function||t["ogc:Function"]?this.getTextSymbolizerLabelFromSldSymbolizer([t]):t};return{name:null==(n=e[":@"])?void 0:n["@_name"],args:(e.Function||e["ogc:Function"]).map(r)}}return t.map((t=>{var n,e,r,i,o,s;const u=Object.keys(t)[0];switch(u.replace("ogc:","")){case"#text":return t["#text"];case"Literal":return(null==(e=null==(n=null==t?void 0:t[u])?void 0:n[0])?void 0:e["#text"])||(null==(s=null==(o=null==(i=null==(r=null==t?void 0:t[u])?void 0:r[0])?void 0:i["#cdata"])?void 0:o[0])?void 0:s["#text"]);case"PropertyName":return`{{${t[u][0]["#text"]}}}`;default:return""}})).join("")})),sn(this,"getSldLabelFromTextSymbolizer",(t=>{if(function(t){return null!=t&&"string"==typeof t.valueOf()}(t)){const n="{{",e="}}",r=[];let i=t;for(;i.length;){let t,o=i;const s=o.indexOf(n);if(-1===s){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}s>0&&(t=o.slice(0,s)),o=o.slice(s+n.length);const u=o.indexOf(e);if(-1===u){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}const a=o.slice(0,u);o=o.slice(u+e.length),t&&(t.includes(" ")||t.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":t}]}]}):r.push({"ogc:Literal":[{"#text":t}]})),r.push({"ogc:PropertyName":[{"#text":a}]}),i=o}return r}return this.geoStylerFunctionToSldFunctionRecursive(t)})),this.parser=new At({...null==t?void 0:t.parserOptions,ignoreDeclaration:!0,removeNSPrefix:!0,ignoreAttributes:!1,preserveOrder:!0,trimValues:!0}),this.builder=new Gt({...null==t?void 0:t.builderOptions,cdataPropName:"#cdata",ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}),null!=t&&t.sldVersion&&(this.sldVersion=null==t?void 0:t.sldVersion),void 0!==(null==t?void 0:t.sldEnvironment)&&(this.sldEnvironment=t.sldEnvironment),null!=t&&t.locale&&(this.locale=t.locale),null!=t&&t.translations&&(this.translations=rn(this.translations,t.translations)),Object.assign(this,t)}translate(t,n){var e,r;const i=(null==(r=null==(e=this.translations)?void 0:e[this.locale])?void 0:r[t])??t;return"function"==typeof i?i(n):i}get parser(){return this._parser}set parser(t){this._parser=t}get builder(){return this._builder}set builder(t){this._builder=t}get numericFilterFields(){return this._numericFilterFields}set numericFilterFields(t){this._numericFilterFields=t}get boolFilterFields(){return this._boolFilterFields}set boolFilterFields(t){this._boolFilterFields=t}get sldVersion(){return this._sldVersion}set sldVersion(t){this._sldVersion=t}get sldEnvironment(){return this._sldEnvironment}set sldEnvironment(t){this._sldEnvironment=t}isSldEnv(t){return this.sldEnvironment===t}get readingSldVersion(){return this._readingSldVersion}set readingSldVersion(t){this._readingSldVersion=t}get symbolizerUnits(){return this._symbolizerUnits}set symbolizerUnits(t){this._symbolizerUnits=t}readStyle(t){return new Promise((n=>{try{const e=this.parser.parse(t),r=Zt(e[0],"version");if(!un.includes(r))throw new Error(`SLD version must be ${un.toString()}`);this._readingSldVersion=r,n({output:this.sldObjectToGeoStylerStyle(e)})}catch(t){n({errors:[t]})}}))}sldObjectToGeoStylerStyle(t){const n=this.getRulesFromSldObject(t);return{name:this.getStyleNameFromSldObject(t),rules:n}}getRulesFromSldObject(t){const n=Kt(t[0].StyledLayerDescriptor,"NamedLayer"),e=[];return n.forEach((({NamedLayer:t})=>{Kt(t,"UserStyle").forEach((({UserStyle:t})=>{Kt(t,"FeatureTypeStyle").forEach((({FeatureTypeStyle:t})=>{Kt(t,"Rule").forEach((({Rule:t})=>{const n=this.getFilterFromRule(t),r=this.getScaleDenominatorFromRule(t),i=this.getSymbolizersFromRule(t),o=tn(t,"Title.#text"),s=tn(t,"Name.#text"),u={name:void 0!==o?o:void 0!==s?s:""};n&&(u.filter=n),r&&(u.scaleDenominator=r),i&&(u.symbolizers=i),e.push(u)}))}))}))})),e}getStyleNameFromSldObject(t){const n=tn(t,"StyledLayerDescriptor.NamedLayer[0].UserStyle.Name.#text"),e=tn(t,"StyledLayerDescriptor.NamedLayer.Name.#text");return n||e||""}getFilterFromRule(t){var n;const e=tn(t,"Filter");if(!e||0===e.length)return;const r=null==(n=Object.keys(e[0]))?void 0:n[0];return r?this.getFilterFromOperatorAndComparison(r,e):void 0}getScaleDenominatorFromRule(t){const n={},e=tn(t,"MinScaleDenominator.#text");e&&(n.min=Number(e));const r=tn(t,"MaxScaleDenominator.#text");return r&&(n.max=Number(r)),Number.isFinite(n.min)||Number.isFinite(n.max)?n:void 0}getSymbolizersFromRule(t){return t.filter(Jt).map((t=>{const n=Object.keys(t)[0];switch(n){case"PointSymbolizer":return this.getPointSymbolizerFromSldSymbolizer(t);case"LineSymbolizer":return this.getLineSymbolizerFromSldSymbolizer(t);case"TextSymbolizer":return this.getTextSymbolizerFromSldSymbolizer(t);case"PolygonSymbolizer":return this.getFillSymbolizerFromSldSymbolizer(t);case"RasterSymbolizer":return this.getRasterSymbolizerFromSldSymbolizer(t);default:throw new Error(this.translate("symbolizerKindParseFailed",{sldSymbolizerName:n}))}}))}getFilterFromOperatorAndComparison(t,n){var e;let r;if("Function"===t){const e=Array.isArray(n)?n[0][":@"]["@_name"]:n[":@"]["@_name"];t=`PropertyIs${e.charAt(0).toUpperCase()+e.slice(1)}`}if("PropertyIsBetween"===t)r=["<=x<=",tn(n,"PropertyIsBetween.PropertyName.#text"),Number(tn(n,"PropertyIsBetween.LowerBoundary.Literal.#text")),Number(tn(n,"PropertyIsBetween.UpperBoundary.Literal.#text"))];else if(Object.keys(ln).includes(t))r=this.getFilterFromComparisonOperator(t,n);else if(Object.keys(fn).includes(t)){const i=fn[t],o=null==(e=tn(n,t))?void 0:e.map((t=>{var n;const e=null==(n=Object.keys(t))?void 0:n[0];return this.getFilterFromOperatorAndComparison(e,t)}));r=[i,...o]}else{if(!Object.keys(hn).includes(t))throw new Error(this.translate("noFilterDetected"));{const e=hn[t],i=Object.keys(n[t][0])[0];r=[e,this.getFilterFromOperatorAndComparison(i,n[t][0])]}}return r}getFilterFromComparisonOperator(t,n){if("Function"===t){const e=Array.isArray(n)?n[0][":@"]["@_name"]:n[":@"]["@_name"];t=`PropertyIs${e.charAt(0).toUpperCase()+e.slice(1)}`}const e=ln[t],r=!!tn(n,"Function");let i=[];const o=tn(n,r?"Function":t)||[];return i=o.map(((t,n)=>{var e;const r=null==(e=Object.keys(t))?void 0:e[0];return mn.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,o,n)})),"PropertyIsNull"===t&&(i[1]=null),[e,...i]}getFilterArgsFromArithmeticOperators(t,n){const[e,r]=n;return{name:t.toLowerCase(),args:[this.processArithmeticOperand(e,n),this.processArithmeticOperand(r,n)]}}processArithmeticOperand(t,n){var e;const r=null==(e=Object.keys(t))?void 0:e[0];return r&&mn.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,n,0)}getFilterArgsFromPropertyName(t,n,e){const r=tn([t],"PropertyName.#text");return void 0!==r?1===n.length||0===e&&void 0===tn([n[1]],"PropertyName.#text")?r:{name:"property",args:[r]}:tn([t],"#text")}getOffsetFromDisplacement(t){if(vn(t))return;const n=Number(tn(t,"DisplacementX.#text")),e=Number(tn(t,"DisplacementY.#text"));return[Number.isFinite(n)?Yt(n):0,Number.isFinite(e)&&0!==e?-Yt(e):0]}getPointSymbolizerFromSldSymbolizer(t,n){const e=t.PointSymbolizer;let r;return tn(e,"Graphic.Mark.WellKnownName.#text"),r=tn(e,"Graphic.ExternalGraphic")?this.getIconSymbolizerFromSldSymbolizer(t):this.getMarkSymbolizerFromSldSymbolizer(t),r}getLineSymbolizerFromSldSymbolizer(t){const n=t.LineSymbolizer,e=this.getDistanceUnit(t),r={kind:"Line"},i=tn(n,"Stroke",this.readingSldVersion),o=Qt(i,"stroke",this.readingSldVersion),s=Qt(i,"stroke-width",this.readingSldVersion),u=Qt(i,"stroke-opacity",this.readingSldVersion),a=Qt(i,"stroke-linejoin",this.readingSldVersion),c=Qt(i,"stroke-linecap",this.readingSldVersion),l=Qt(i,"stroke-dasharray",this.readingSldVersion),h=Qt(i,"stroke-dashoffset",this.readingSldVersion);if(vn(o)||(r.color=o),vn(s)||(r.width=Yt(s)),vn(e)||(r.widthUnit=e),vn(u)||(r.opacity=Yt(u)),vn(a)||(r.join="mitre"===a?"miter":a),vn(c)||(r.cap=c),!vn(l)){const t=l.split(" ").map(Yt);r.dasharray=t}vn(h)||(r.dashOffset=Yt(h));const f=tn(i,"GraphicStroke");vn(f)||(r.graphicStroke=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:f},e));const p=tn(i,"GraphicFill");vn(p)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:p},e));const d=tn(n,"PerpendicularOffset.#text");return vn(d)||(r.perpendicularOffset=Yt(d)),r}getTextSymbolizerFromSldSymbolizer(t){const n=t.TextSymbolizer,e=this.getDistanceUnit(t),r={kind:"Text"},i=tn(n,"Font"),o=tn(n,"Fill"),s=tn(n,"Label"),u=tn(n,"Halo"),a=tn(u,"Fill"),c=Qt(o,"fill",this.readingSldVersion),l=Qt(o,"fill-opacity",this.readingSldVersion),h=Qt(i,"font-family",this.readingSldVersion),f=Qt(i,"font-style",this.readingSldVersion),p=Qt(i,"font-size",this.readingSldVersion),d=Qt(i,"font-weight",this.readingSldVersion),m=Qt(a,"fill",this.readingSldVersion);vn(s)||(r.label=this.getTextSymbolizerLabelFromSldSymbolizer(s)),r.color=c||"#000000",vn(l)||(r.opacity=Yt(l));const y=tn(n,"Halo.Radius.#text");vn(y)||(r.haloWidth=Yt(y)),vn(e)||(r.haloWidthUnit=e);const v=Qt(a,"fill-opacity",this.readingSldVersion);vn(v)||(r.haloOpacity=Yt(v)),vn(m)||(r.haloColor=m);const b=tn(n,"LabelPlacement");if(!vn(b)){const t=tn(b,"PointPlacement"),n=tn(b,"LinePlacement");if(vn(t)){if(!vn(n)&&(r.placement="line","1.1.0"===this.readingSldVersion)){const t=tn(n,"IsRepeated.#text"),e=tn(n,"Gap.#text");t&&!vn(e)&&(r.repeat=Yt(e))}}else{r.placement="point";const n=tn(t,"AnchorPoint");if(!vn(n)){const t=tn(n,"AnchorPointX.#text"),e=tn(n,"AnchorPointY.#text");r.anchor=this.getAnchorFromSldAnchorPoint(t,e)}const e=tn(t,"Displacement"),i=this.getOffsetFromDisplacement(e);vn(i)||(r.offset=i);const o=tn(t,"Rotation.#text");vn(o)||(r.rotate=Yt(o))}}return vn(h)||(r.font=[h]),vn(f)||(r.fontStyle=f.toLowerCase()),vn(d)||(r.fontWeight=d.toLowerCase()),vn(p)||(r.size=Yt(p)),vn(e)||(r.sizeUnit=e),r}getFillSymbolizerFromSldSymbolizer(t){const n=t.PolygonSymbolizer,e=this.getDistanceUnit(t),r={kind:"Fill"},i=tn(n,"Stroke"),o=tn(n,"Fill"),s=Qt(o,"fill-opacity",this.readingSldVersion),u=Qt(o,"fill",this.readingSldVersion),a=Qt(i,"stroke",this.readingSldVersion),c=Qt(i,"stroke-width",this.readingSldVersion),l=Qt(i,"stroke-opacity",this.readingSldVersion),h=Qt(i,"stroke-dasharray",this.readingSldVersion),f=Qt(i,"stroke-linecap",this.readingSldVersion),p=Qt(i,"stroke-linejoin",this.readingSldVersion),d=tn(n,"Fill.GraphicFill");if(vn(d)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:d})),this.isSldEnv(an)){const t=function(t){return Xt(t,"graphic-margin","VendorOption")}(n);vn(t)||(r.graphicFillPadding=t.split(/\s/).map(Yt))}return vn(u)||(r.color=u),vn(s)||(r.fillOpacity=Yt(s)),vn(a)||(r.outlineColor=a),vn(c)||(r.outlineWidth=Yt(c)),vn(e)||(r.outlineWidthUnit=e),vn(l)||(r.outlineOpacity=Yt(l)),vn(h)||(r.outlineDasharray=h.split(" ").map(Yt)),vn(f)||(r.outlineCap=f),vn(p)||(r.outlineJoin=p),r}getRasterSymbolizerFromSldSymbolizer(t){const n=t.RasterSymbolizer,e={kind:"Raster"};let r=tn(n,"Opacity.#text");vn(r)||(r=Yt(r),e.opacity=r);const i=tn(n,"ColorMap"),o=tn(n,"ColorMap.@type"),s=tn(n,"ColorMap.@extended");if(!vn(i)){const t=this.getColorMapFromSldColorMap(i,o,s);e.colorMap=t}const u=tn(n,"ChannelSelection");if(!vn(u)){const t=this.getChannelSelectionFromSldChannelSelection(u);e.channelSelection=t}const a=tn(n,"ContrastEnhancement");if(!vn(a)){const t=this.getContrastEnhancementFromSldContrastEnhancement(a);e.contrastEnhancement=t}return e}getMarkSymbolizerFromSldSymbolizer(t){const n=t.PointSymbolizer,e=this.getDistanceUnit(t),r=tn(n,"Graphic.Mark.WellKnownName.#text"),i=tn(n,"Graphic.Mark.Stroke"),o=tn(n,"Graphic.Mark.Fill"),s=tn(n,"Graphic.Opacity.#text"),u=tn(n,"Graphic.Size.#text"),a=tn(n,"Graphic.Rotation.#text"),c=Qt(o,"fill-opacity",this.readingSldVersion),l=Qt(o,"fill",this.readingSldVersion),h=tn(n,"Graphic.Displacement"),f={kind:"Mark",wellKnownName:"circle"};vn(s)||(f.opacity=Yt(s)),vn(c)||(f.fillOpacity=Yt(c)),vn(l)||(f.color=l),vn(a)||(f.rotate=Yt(a)),vn(u)||(f.radius=g(u)?u:Number(u)/2),vn(e)||(f.radiusUnit=e);const p=this.getOffsetFromDisplacement(h);switch(vn(p)||(f.offset=p),r){case"arrow":case"arrowhead":case"asterisk_fill":case"backslash":case"circle":case"cross":case"cross2":case"cross_fill":case"decagon":case"diagonal_half_square":case"diamond":case"equilateral_triangle":case"filled_arrowhead":case"half_arc":case"half_square":case"heart":case"hexagon":case"horline":case"left_half_triangle":case"line":case"octagon":case"parallelogram_left":case"parallelogram_right":case"pentagon":case"quarter_arc":case"quarter_circle":case"quarter_square":case"right_half_triangle":case"rounded_square":case"semi_circle":case"shield":case"slash":case"square":case"square_with_corners":case"star":case"star_diamond":case"third_arc":case"third_circle":case"trapezoid":case"triangle":case"x":case"shape://vertline":case"shape://horline":case"shape://slash":case"shape://backslash":case"shape://dot":case"shape://plus":case"shape://times":case"shape://oarrow":case"shape://carrow":case"brush://dense1":case"brush://dense2":case"brush://dense3":case"brush://dense4":case"brush://dense5":case"brush://dense6":case"brush://dense7":f.wellKnownName=r;break;default:if(cn.test(r)){f.wellKnownName=r;break}throw new Error(this.translate("marksymbolizerParseFailedUnknownWellknownName",{wellKnownName:r}))}const d=Qt(i,"stroke",this.readingSldVersion);vn(d)||(f.strokeColor=d);const m=Qt(i,"stroke-width",this.readingSldVersion);vn(m)||(f.strokeWidth=Yt(m)),vn(e)||(f.strokeWidthUnit=e);const y=Qt(i,"stroke-opacity",this.readingSldVersion);vn(y)||(f.strokeOpacity=Yt(y));const v=Qt(i,"stroke-dasharray",this.readingSldVersion);if(!vn(v)){const t=v.split(" ").map(Yt);f.strokeDasharray=t}return f}getIconSymbolizerFromSldSymbolizer(t,n){const e=t.PointSymbolizer,r=n||this.getDistanceUnit(t);let i=tn(e,"Graphic.ExternalGraphic.OnlineResource.@href");i||"1.1.0"!==this.sldVersion||"base64"!==tn(e,"Graphic.ExternalGraphic.InlineContent.@encoding")||(i=`data:${tn(e,"Graphic.ExternalGraphic.Format.#text")};base64,${tn(e,"Graphic.ExternalGraphic.InlineContent.#text")}`);const o={kind:"Icon",image:i},s=tn(e,"Graphic.Opacity.#text"),u=tn(e,"Graphic.Size.#text"),a=tn(e,"Graphic.Rotation.#text"),c=tn(e,"Graphic.Displacement");vn(s)||(o.opacity=Yt(s)),vn(u)||(o.size=Yt(u)),vn(r)||(o.sizeUnit=r),vn(a)||(o.rotate=Yt(a));const l=this.getOffsetFromDisplacement(c);return vn(l)||(o.offset=l),o}getColorMapFromSldColorMap(t,n="ramp",e){const r={type:n};e&&(r.extended="true"===e);const i=Kt(t,"ColorMapEntry");if(Array.isArray(i)){const t=i.map((t=>{const n=Zt(t,"color");if(!n)throw new Error(this.translate("colorMapEntriesParseFailedColorUndefined"));let e=Zt(t,"quantity");e&&(e=Yt(e));const r=Zt(t,"label");let i=Zt(t,"opacity");return vn(i)||(i=Yt(i)),{color:n,quantity:e,label:r,opacity:i}}));r.colorMapEntries=t}return r}getContrastEnhancementFromSldContrastEnhancement(t){const n={},e=!!tn(t,"Histogram"),r=!!tn(t,"Normalize");if(e&&r)throw new Error(this.translate("contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive"));e?n.enhancementType="histogram":r&&(n.enhancementType="normalize");let i=tn(t,"GammaValue.#text");return i&&(i=Yt(i)),n.gammaValue=i,n}getChannelFromSldChannel(t){var n;const e={sourceChannelName:null==(n=tn(t,"SourceChannelName.#text"))?void 0:n.toString()},r=tn(t,"ContrastEnhancement");return r&&(e.contrastEnhancement=this.getContrastEnhancementFromSldContrastEnhancement(r)),e}getChannelSelectionFromSldChannelSelection(t){let n;const e=tn(t,"RedChannel"),r=tn(t,"BlueChannel"),i=tn(t,"GreenChannel"),o=tn(t,"GrayChannel");if(o&&e&&r&&i)throw new Error(this.translate("channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive"));if(o)n={grayChannel:this.getChannelFromSldChannel(o)};else{if(!(e&&i&&r))throw new Error(this.translate("channelSelectionParseFailedRGBChannelsUndefined"));n={redChannel:this.getChannelFromSldChannel(e),blueChannel:this.getChannelFromSldChannel(r),greenChannel:this.getChannelFromSldChannel(i)}}return n}writeStyle(t){return new Promise((n=>{const e=this.checkForUnsupportedProperties(t);try{const r=this.geoStylerStyleToSldObject(t);n({output:this.builder.build(r),unsupportedProperties:e,warnings:e&&["Your style contains unsupportedProperties!"]})}catch(t){n({errors:[t]})}}))}getTagName(t){return["Filter"].includes(t)?t:"CssParameter"===t?"1.1.0"===this.sldVersion?"se:SvgParameter":"CssParameter":"1.1.0"===this.sldVersion?`se:${t}`:t}geoStylerStyleToSldObject(t){const n=this.getSldRulesFromRules(t.rules);n.forEach((t=>{const n=Kt(tn(t,this.getTagName("Rule")),"Filter").at(0);n&&(n[":@"]={"@_xmlns":"http://www.opengis.net/ogc"})}));const e=[...n],r=this.getTagName("Name"),i=this.getTagName("Title"),o=this.getTagName("FeatureTypeStyle"),s={"@_version":this.sldVersion,"@_xsi:schemaLocation":"http://www.opengis.net/sld StyledLayerDescriptor.xsd","@_xmlns":"http://www.opengis.net/sld","@_xmlns:ogc":"http://www.opengis.net/ogc","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xmlns:se":"http://www.opengis.net/se"},u=[];return u.push({[r]:[{"#text":t.name||""}]}),"1.0.0"===this.sldVersion&&u.push({[i]:[{"#text":t.name||""}]}),u.push({[o]:e}),[{"?xml":[{"#text":""}],":@":{"@_version":"1.0","@_encoding":"UTF-8","@_standalone":"yes"}},{StyledLayerDescriptor:[{NamedLayer:[{[r]:[{"#text":t.name||""}]},{UserStyle:u}]}],":@":s}]}getSldRulesFromRules(t){const n=this.getTagName("Name"),e=this.getTagName("Filter"),r=this.getTagName("Rule"),i=this.getTagName("MinScaleDenominator"),o=this.getTagName("MaxScaleDenominator");return t.map((t=>{const s={[r]:[]};if(t.name&&s[r].push({[n]:[{"#text":t.name}]}),t.filter){const n=this.getSldFilterFromFilter(t.filter);s[r].push({[e]:n})}if(t.scaleDenominator){const{min:n,max:e}=t.scaleDenominator;n&&Number.isFinite(n)&&s[r].push({[i]:[{"#text":n}]}),e&&Number.isFinite(e)&&s[r].push({[o]:[{"#text":e}]})}const u=this.getSldSymbolizersFromSymbolizers(t.symbolizers);let a=[];return u.length>0&&(a=Object.keys(u[0])),a.forEach((t=>{0===u[0][t].length&&delete u[0][t]})),u.length>0&&0!==a.length&&(s[r]=[...s[r],...u]),s}))}getSldComparisonFilterFromComparisonFilter(t){const n=[],e=t[1],r=t[2],i=nn(ln,t[0]),o=i.length>1&&null===r?i[1]:i[0],s="PropertyName";if(x(e)||x(r)){const t=o.replace("PropertyIs",""),n=t.charAt(0).toLowerCase()+t.slice(1),i=x(e)?Vt(e):e,s=x(r)?Vt(r):r,u=[];return x(e)?u.unshift(Array.isArray(i)?null==i?void 0:i[0]:i):u.unshift({Literal:[{"#text":i}]}),x(r)?u.push(Array.isArray(s)?null==s?void 0:s[0]:s):u.push({Literal:[{"#text":s}]}),[{Function:u,":@":{"@_name":n}}]}if("PropertyIsNull"===o)n.push({[o]:[{[s]:[{"#text":e}]}]});else if("PropertyIsLike"===o)n.push({[o]:[{[s]:[{"#text":e}]},{Literal:[{"#text":r}]}],":@":{"@_wildCard":"*","@_singleChar":".","@_escape":"!"}});else if("PropertyIsBetween"===o){const r=t;n.push({[o]:[{[s]:[{"#text":e}]},{LowerBoundary:[{Literal:[{"#text":r[2]}]}]},{UpperBoundary:[{Literal:[{"#text":r[3]}]}]}]})}else n.push({[o]:[{[s]:[{"#text":e}]},{Literal:[{"#text":r}]}]});return n}getSldFilterFromFilter(t){let n=[];if(y(t))n=this.getSldComparisonFilterFromComparisonFilter(t);else if(b(t))n.push({Not:this.getSldFilterFromFilter(t[1])});else if(v(t)){const[e,...r]=t,i=nn(fn,e)[0],o=r.map((t=>this.getSldFilterFromFilter(t)[0]));n.push({[i]:o})}return n}moveUomEntryToAttributes(t,n){const e=n[n.length-1].uom;e&&("1.1.0"===this.sldVersion&&(t[":@"]={"@_uom":e}),n.pop())}addUomEntry(t,n){"m"===n&&t.push({uom:pn}),"px"===n&&t.push({uom:dn})}getDistanceUnit(t){if(!t)return;const n=Zt(t,"uom");if(n){if(n===pn)return"m";if(n===dn)return"px"}}getSldSymbolizersFromSymbolizers(t){const n=[],e=this.getTagName("PointSymbolizer"),r=this.getTagName("TextSymbolizer"),i=this.getTagName("LineSymbolizer"),o=this.getTagName("PolygonSymbolizer"),s=this.getTagName("RasterSymbolizer");return t.forEach((t=>{const u={};let a;switch(t.kind){case"Mark":a=this.getSldPointSymbolizerFromMarkSymbolizer(t),u[e]=a;break;case"Icon":a=this.getSldPointSymbolizerFromIconSymbolizer(t),u[e]=a;break;case"Text":a=this.getSldTextSymbolizerFromTextSymbolizer(t),u[r]=a;break;case"Line":a=this.getSldLineSymbolizerFromLineSymbolizer(t),u[i]=a;break;case"Fill":a=this.getSldPolygonSymbolizerFromFillSymbolizer(t),u[o]=a;break;case"Raster":a=this.getSldRasterSymbolizerFromRasterSymbolizer(t),u[s]=a}u&&a&&this.moveUomEntryToAttributes(u,a),n.push(u)})),n}getDisplacementFromOffset(t){const n=this.getTagName("Displacement"),e=this.getTagName("DisplacementX"),r=this.getTagName("DisplacementY"),i=x(t[0])?Vt(t[0]):[{"#text":t[0].toString()}],o=x(t[1])?Vt(t[1]):[{"#text":(-1*t[1]).toString()}];return{[n]:[{[e]:i},{[r]:o}]}}getSldPointSymbolizerFromMarkSymbolizer(t){var n;const e=this.getTagName("WellKnownName"),r=this.getTagName("CssParameter"),i=this.getTagName("Fill"),o=this.getTagName("Mark"),s=this.getTagName("Stroke"),u=this.getTagName("Opacity"),a=this.getTagName("Rotation"),c=this.getTagName("Size"),l=this.getTagName("Graphic"),h=cn.test(t.wellKnownName),f=[{[e]:[{"#text":h?t.wellKnownName:t.wellKnownName.toLowerCase()}]}];if(t.color||!vn(t.fillOpacity)){const n=[];if(t.color)if(x(t.color)){const e=Vt(t.color);n.push({[r]:e,":@":{"@_name":"fill"}})}else n.push({[r]:[{"#text":t.color}],":@":{"@_name":"fill"}});if(!vn(t.fillOpacity))if(x(t.fillOpacity)){const e=Vt(t.fillOpacity);n.push({[r]:e,":@":{"@_name":"fill-opacity"}})}else n.push({[r]:[{"#text":t.fillOpacity}],":@":{"@_name":"fill-opacity"}});f.push({[i]:n})}if(t.strokeColor||Number.isFinite(t.strokeWidth)||Number.isFinite(t.strokeOpacity)){const e=[];if(t.strokeColor)if(x(t.strokeColor)){const n=Vt(t.strokeColor);e.push({[r]:n,":@":{"@_name":"stroke"}})}else e.push({[r]:[{"#text":t.strokeColor}],":@":{"@_name":"stroke"}});if(!vn(t.strokeWidth))if(x(t.strokeWidth)){const n=Vt(t.strokeWidth);e.push({[r]:n,":@":{"@_name":"stroke-width"}})}else e.push({[r]:[{"#text":t.strokeWidth}],":@":{"@_name":"stroke-width"}});if(!vn(t.strokeOpacity))if(x(t.strokeOpacity)){const n=Vt(t.strokeOpacity);e.push({[r]:n,":@":{"@_name":"stroke-opacity"}})}else e.push({[r]:[{"#text":t.strokeOpacity}],":@":{"@_name":"stroke-opacity"}});if(!vn(t.strokeDasharray))if(x(t.strokeDasharray)){const n=Vt(t.strokeDasharray);e.push({[r]:n,":@":{"@_name":"stroke-dasharray"}})}else e.push({[r]:[{"#text":null==(n=t.strokeDasharray)?void 0:n.join(" ")}],":@":{"@_name":"stroke-dasharray"}});f.push({[s]:e})}const p=[{[o]:f}];vn(t.opacity)||p.push({[u]:[{"#text":t.opacity.toString()}]}),void 0!==t.radius&&(x(t.radius)?p.push({[c]:Vt(t.radius)}):p.push({[c]:[{"#text":(2*t.radius).toString()}]})),t.rotate&&p.push({[a]:[{"#text":t.rotate.toString()}]}),t.offset&&("1.1.0"===this.sldVersion||this.isSldEnv(an))&&p.push(this.getDisplacementFromOffset(t.offset));const d=[{[l]:p}];return this.addUomEntry(d,t.radiusUnit),d}pushGeoServerVendorOption(t,n,e){this.isSldEnv(an)&&t.push(this.createGeoServerVendorOption(n,e))}createGeoServerVendorOption(t,n){return{[this.getTagName("VendorOption")]:[{"#text":n}],":@":{"@_name":t}}}getSldPointSymbolizerFromIconSymbolizer(t){const n=this.getTagName("Opacity"),e=this.getTagName("Rotation"),r=this.getTagName("Size"),i=this.getTagName("Graphic"),o=this.getTagName("Displacement"),s=this.getTagName("DisplacementX"),u=this.getTagName("DisplacementY"),a=[];if("string"==typeof t.image||t.image instanceof String){const n=function(t){const n=t.split(",");if(2!==n.length||!n[0].startsWith("data:image/")||!n[0].endsWith(";base64"))return;const e=n[0].split(";");if(2!==e.length)return;const r=e[0].split("/").pop();return r?{data:n[1],extension:r}:void 0}(t.image);a.push(n?this.getSldExternalResourceInlineContent(n):this.getSldExternalResourceOnlineResource(t.image))}return vn(t.opacity)||a.push({[n]:[{"#text":t.opacity}]}),t.size&&a.push({[r]:[{"#text":t.size}]}),t.rotate&&a.push({[e]:[{"#text":t.rotate}]}),t.offset&&"1.1.0"===this.sldVersion&&a.push({[o]:[{[s]:[{"#text":t.offset[0].toString()}]},{[u]:[{"#text":t.offset[1].toString()}]}]}),[{[i]:a}]}getSldExternalResourceInlineContent(t){const n=this.getTagName("ExternalGraphic"),e=this.getTagName("Format"),r=this.getTagName("InlineContent");return{[n]:[{[r]:[{"#text":t.data}],":@":{"@_encoding":"base64"}},{[e]:[{"#text":`image/${t.extension}`}]}]}}getSldExternalResourceOnlineResource(t){const n=this.getTagName("ExternalGraphic"),e=this.getTagName("Format"),r=this.getTagName("OnlineResource"),i={[n]:[{[r]:[],":@":{"@_xlink:type":"simple","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xlink:href":t}},{[e]:[]}]},o=t.split(".").pop();switch(o){case"png":case"jpeg":case"gif":i[n][1][e]=[{"#text":`image/${o}`}];break;case"jpg":i[n][1][e]=[{"#text":"image/jpeg"}];break;case"svg":i[n][1][e]=[{"#text":"image/svg+xml"}]}return i}getSldAnchorPointFromAnchor(t,n){return!t||x(t)?0:"x"===n?t.indexOf("left")>=0?0:t.indexOf("right")>=0?1:.5:t.indexOf("bottom")>=0?0:t.indexOf("top")>=0?1:.5}getAnchorFromSldAnchorPoint(t,n){if(!en(t)||!en(n))return;const e=t<.25?"left":t>.75?"right":"",r=n<.25?"bottom":n>.75?"top":"";return(e&&r?r+"-"+e:r+e)||void 0}getSldTextSymbolizerFromTextSymbolizer(t){const n=this.getTagName("CssParameter"),e=this.getTagName("Fill"),r=this.getTagName("Halo"),i=this.getTagName("Font"),o=this.getTagName("Displacement"),s=this.getTagName("DisplacementX"),u=this.getTagName("DisplacementY"),a=this.getTagName("AnchorPoint"),c=this.getTagName("AnchorPointX"),l=this.getTagName("AnchorPointY"),h=this.getTagName("LabelPlacement"),f=this.getTagName("PointPlacement"),p=this.getTagName("LinePlacement"),d=this.getTagName("Rotation"),m=this.getTagName("Radius"),y=this.getTagName("Label"),v=this.getTagName("PerpendicularOffset"),b=this.getTagName("IsRepeated"),g=this.getTagName("Gap"),w=[{[y]:t.label?this.getSldLabelFromTextSymbolizer(t.label):void 0}],E={font:"font-family",size:"font-size",fontStyle:"font-style",fontWeight:"font-weight"},S=Object.keys(t).filter((t=>"kind"!==t&&E[t])).map((e=>{var r;if(x(t[e])){const r=Vt(t[e]);return{[n]:r,":@":{"@_name":E[e]}}}return{[n]:[{"#text":"font"===e?null==(r=t[e])?void 0:r[0]:t[e]}],":@":{"@_name":E[e]}}}));if(S.length>0&&w.push({[i]:S}),"line"===t.placement){const n=[];if(void 0!==t.perpendicularOffset)if(x(t.perpendicularOffset)){const e=Vt(t.perpendicularOffset);n.push({[v]:e})}else n.push({[v]:[{"#text":t.perpendicularOffset.toString()}]});if("1.1.0"===this.sldVersion&&void 0!==t.repeat)if(n.push({[b]:[{"#text":!0}]}),x(t.repeat)){const e=Vt(t.repeat);n.push({[g]:e})}else n.push({[g]:[{"#text":t.repeat.toString()}]});w.push({[h]:[{[p]:n}]})}else if(Number.isFinite(t.offset)||t.anchor||void 0!==t.rotate||"point"===t.placement){const n=[];t.offset&&n.push({[o]:[{[s]:[{"#text":t.offset[0].toString()}]},{[u]:[{"#text":(-t.offset[1]).toString()}]}]}),t.anchor&&n.push({[a]:[{[c]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"x").toString()}]},{[l]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"y").toString()}]}]}),void 0!==t.rotate&&n.push({[d]:[{"#text":t.rotate.toString()}]}),w.push({[h]:[{[f]:n}]})}if(Number.isFinite(t.haloWidth)||t.haloColor){const i=[],o=[];t.haloWidth&&i.push({[m]:[{"#text":t.haloWidth.toString()}]}),t.haloColor&&o.push({[n]:[{"#text":t.haloColor}],":@":{"@_name":"fill"}}),t.haloOpacity&&o.push({[n]:[{"#text":t.haloOpacity}],":@":{"@_name":"fill-opacity"}}),o.length>0&&i.push({[e]:o}),w.push({[r]:i})}if(t.color||Number.isFinite(t.opacity)){const r=[{[n]:[{"#text":t.color||"#000000"}],":@":{"@_name":"fill"}}];Number.isFinite(t.opacity)&&r.push({[n]:[{"#text":`${t.opacity}`}],":@":{"@_name":"fill-opacity"}}),w.push({[e]:r})}return this.addUomEntry(w,t.sizeUnit),w}geoStylerFunctionToSldFunctionRecursive(t){if(null===t)return t;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return{"ogc:Literal":[{"#text":t}]};if("object"==typeof t){if("string"==typeof t.name||Array.isArray(t.args))return[{"ogc:Function":t.args.map((t=>"object"==typeof t&&null!==t&&"property"===t.name&&Array.isArray(t.args)?{"ogc:PropertyName":[{"#text":t.args[0]}]}:"object"==typeof t&&null!==t&&"string"==typeof t.name&&Array.isArray(t.args)?this.geoStylerFunctionToSldFunctionRecursive(t)[0]:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?{"ogc:Literal":[{"#text":t}]}:t)),":@":{"@_name":t.name}}];if("property"===t.name&&Array.isArray(t.args))return{"ogc:PropertyName":[{"#text":t.args[0]}]}}return t}getSldLineSymbolizerFromLineSymbolizer(t){var n,e,r,i,o,s,u;const a=this.getTagName("CssParameter"),c=this.getTagName("Stroke"),l=this.getTagName("GraphicStroke"),h=this.getTagName("GraphicFill"),f=this.getTagName("PerpendicularOffset"),p={color:"stroke",width:"stroke-width",opacity:"stroke-opacity",join:"stroke-linejoin",cap:"stroke-linecap",dasharray:"stroke-dasharray",dashOffset:"stroke-dashoffset"},d=[],m=Object.keys(t).filter((n=>"kind"!==n&&p[n]&&null!=t[n])).map((n=>{let e=t[n];if("dasharray"===n)return e=t.dasharray?t.dasharray.join(" "):void 0,{[a]:[{"#text":e}],":@":{"@_name":p[n]}};if("join"===n&&"miter"===e&&(e="mitre"),x(t[n])){const e=Vt(t[n]);return{[a]:e,":@":{"@_name":p[n]}}}return{[a]:[{"#text":t[n]}],":@":{"@_name":p[n]}}}));if(null!=t&&t.graphicStroke)if(Array.isArray(null==(n=null==d?void 0:d[0])?void 0:n[c])||(d[0]={[c]:[]}),"Mark"===(null==(e=null==t?void 0:t.graphicStroke)?void 0:e.kind)){const n=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicStroke);d[0][c].push({[l]:n})}else if("Icon"===(null==(r=null==t?void 0:t.graphicStroke)?void 0:r.kind)){const n=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicStroke);d[0][c].push({[l]:n})}if(null!=t&&t.graphicFill)if(Array.isArray(null==(i=null==d?void 0:d[0])?void 0:i[c])||(d[0]={[c]:[]}),"Mark"===(null==(o=null==t?void 0:t.graphicFill)?void 0:o.kind)){const n=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill);d[0][c].push({[h]:n})}else if("Icon"===(null==(s=null==t?void 0:t.graphicFill)?void 0:s.kind)){const n=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill);d[0][c].push({[h]:n})}return 0!==m.length&&(Array.isArray(null==(u=null==d?void 0:d[0])?void 0:u[c])||(d[0]={[c]:[]}),d[0][c].push(...m)),t.perpendicularOffset&&d.push({[f]:[{"#text":t.perpendicularOffset}]}),0===d.length&&d.push({[c]:{}}),this.addUomEntry(d,t.widthUnit),d}getSldPolygonSymbolizerFromFillSymbolizer(t){const n=this.getTagName("CssParameter"),e=this.getTagName("Stroke"),r=this.getTagName("Fill"),i={outlineColor:"stroke",outlineWidth:"stroke-width",outlineOpacity:"stroke-opacity",outlineDasharray:"stroke-dasharray",outlineCap:"stroke-linecap",outlineJoin:"stroke-linejoin"},o={color:"fill",fillOpacity:"fill-opacity"},s=[],u=[];let a;null!=t&&t.graphicFill&&("Mark"===(null==t?void 0:t.graphicFill.kind)?a=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill):"Icon"===(null==t?void 0:t.graphicFill.kind)&&(a=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill))),Object.keys(t).filter((t=>"kind"!==t)).filter((n=>null!=t[n])).forEach((e=>{if(Object.keys(o).includes(e))if(x(t[e])){const r=Vt(t[e]);u.push({[n]:r,":@":{"@_name":o[e]}})}else u.push({[n]:[{"#text":t[e]}],":@":{"@_name":o[e]}});else if(Object.keys(i).includes(e)){let r="";if("outlineDasharray"===e){const n=t[e];r="",n.forEach(((t,e)=>{r+=t,e<n.length-1&&(r+=" ")}))}else r="outlineWidth"===e||"outlineOpacity"===e?t[e]+"":t[e];if(x(t[e])){const r=Vt(t[e]);s.push({[n]:r,":@":{"@_name":i[e]}})}else s.push({[n]:[{"#text":r}],":@":{"@_name":i[e]}})}}));const c=[];if(u.length>0||a){const n=[],e=t.graphicFillPadding;e&&this.pushGeoServerVendorOption(c,"graphic-margin",e.join(" ")),c.push({[r]:n}),a&&n.push({[this.getTagName("GraphicFill")]:a}),u.length>0&&n.push(...u)}return s.length>0&&c.push({[e]:s}),this.addUomEntry(c,t.outlineWidthUnit),c}getSldRasterSymbolizerFromRasterSymbolizer(t){const n=[];let e,r,i;return void 0!==t.opacity&&(n.push({}),n[0].Opacity=[{"#text":t.opacity}]),t.colorMap&&(e=this.getSldColorMapFromColorMap(t.colorMap),null!=e&&e[0]&&n.push({ColorMap:e})),t.channelSelection&&(r=this.getSldChannelSelectionFromChannelSelection(t.channelSelection),null!=r&&r[0]&&n.push({ChannelSelection:r})),t.contrastEnhancement&&(i=this.getSldContrastEnhancementFromContrastEnhancement(t.contrastEnhancement),null!=i&&i[0]&&n.push({ContrastEnhancement:i})),n}getSldColorMapFromColorMap(t){const n=[];if(t.type&&(n[":@"]={"@_type":t.type}),void 0!==t.extended){const e=t.extended.toString();n[":@"]||(n[":@"]={}),n[":@"]["@_extended"]=e}if(t.colorMapEntries&&t.colorMapEntries.length>0){const e=t.colorMapEntries.map((t=>{const n={ColorMapEntry:[],":@":{}};return t.color&&(n[":@"]["@_color"]=t.color),typeof t.quantity<"u"&&(n[":@"]["@_quantity"]=t.quantity.toString()),t.label&&(n[":@"]["@_label"]=t.label),typeof t.opacity<"u"&&(n[":@"]["@_opacity"]=t.opacity.toString()),n})).filter((t=>Object.keys(t).length>0));n.push(...e)}return n}getSldChannelSelectionFromChannelSelection(t){const n={redChannel:"RedChannel",blueChannel:"BlueChannel",greenChannel:"GreenChannel",grayChannel:"GrayChannel"},e=Object.keys(t),r=[];return e.forEach((e=>{var i,o;const s=[],u=null==(i=null==t?void 0:t[e])?void 0:i.sourceChannelName,a=n[e],c=null==(o=null==t?void 0:t[e])?void 0:o.contrastEnhancement;(u||c)&&(u&&s.push({SourceChannelName:[{"#text":u}]}),c&&s.push({ContrastEnhancement:this.getSldContrastEnhancementFromContrastEnhancement(c)}),r.push({[a]:s}))})),r}getSldContrastEnhancementFromContrastEnhancement(t){const n=[],e=null==t?void 0:t.enhancementType;return"normalize"===e?n.push({Normalize:[]}):"histogram"===e&&n.push({Histogram:[]}),void 0!==t.gammaValue&&n.push({GammaValue:[{"#text":t.gammaValue}]}),n}checkForUnsupportedProperties(t){const n={};if(t.rules.forEach((t=>{t.symbolizers.forEach((t=>{var e,r;const i=(t=>t[0].toUpperCase()+t.slice(1))(`${t.kind}Symbolizer`),o=null==(r=null==(e=this.unsupportedProperties)?void 0:e.Symbolizer)?void 0:r[i];o&&("string"==typeof o||o instanceof String?(n.Symbolizer||(n.Symbolizer={}),n.Symbolizer[i]=o):Object.keys(t).forEach((e=>{if(o[e]){const r=String(t[e]).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(`["']${r}["']`);if("partial"===o[e].support&&s.test(o[e].info))return;n.Symbolizer||(n.Symbolizer={}),n.Symbolizer[i]||(n.Symbolizer[i]={}),n.Symbolizer[i][e]=o[e]}})))}))})),Object.keys(n).length>0)return n}}function gn(t){return null!=t&&"number"==typeof t.valueOf()}function wn(t){return null!=t&&"boolean"==typeof t.valueOf()}sn(bn,"title","SLD Style Parser");const xn=t=>Dn(t)||En(t),En=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||gn(t)||wn(t)||null===t,Sn=t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t),On=t=>["&&","||"].includes(t),Fn=t=>"!"===t,Tn=t=>Mn(t)||kn(t)||Nn(t)||In(t)||Nn(t)||wn(t),Mn=t=>{const n=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===n&&Sn(t[0])&&xn(t[1])&&xn(t[2])&&("<=x<="!==t[0]||gn(t[3]))},kn=t=>Array.isArray(t)&&t.length>=3&&On(t[0])&&t.every(((t,n)=>0===n||Tn(t))),In=t=>Array.isArray(t)&&2===t.length&&Fn(t[0])&&Tn(t[1]),_n=t=>"Fill"===(null==t?void 0:t.kind),An=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(null==t?void 0:t.name),Cn=t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(null==t?void 0:t.name),Nn=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(null==t?void 0:t.name),Dn=t=>Nn(t)||An(t)||Cn(t)||(t=>["case","property","step"].includes(null==t?void 0:t.name))(t);class jn{static getResolutions(){const t=[];let n=78271.51696402048;for(t.push(2*n);t.length<=24;n/=2)t.push(n);return t}static getScaleForResolution(t){return 1*t*39.37008*(25.4/.28)}static getZoomForResolution(t){let n=0;const e=jn.getResolutions(),r=e.length;for(;n<r;++n)if(e[n]<t&&n+1<r){const r=e[n]/e[n+1];return n+Math.log(e[n]/t)/Math.log(r)}return r-1}static getResolutionForScale(t){return t/3571.428685714285}static zoomToScale(t){const n=jn.getResolutions();if(t>=n.length)throw new Error("Cannot parse scaleDenominator. ZoomLevel does not exist.");let e;if(Number.isInteger(t))e=n[t];else{const r=Math.floor(t),i=n[r];e=Math.pow(2,r)*i/Math.pow(2,t)}return this.getScaleForResolution(e)}static allUndefined(t){return!t||!Object.keys(t).some((n=>void 0!==t[n]))}static symbolizerAllUndefined(t){return!Object.keys(t).filter((t=>"kind"!==t&&"visibility"!==t)).some((n=>void 0!==t[n]))}static getUrlForMbPlaceholder(t){const n="mapbox://";return t&&t.startsWith(n)?t.replace(n,"https://api.mapbox.com/"):t}static getMbPlaceholderForUrl(t){const n="https://api.mapbox.com/";return t&&t.startsWith(n)?t.replace(n,"mapbox://"):t}static resolveMbTextPlaceholder(t){let n=new RegExp("\\{.*?\\}","g");return t.replace(n,(t=>`{${t}}`))}static getSpriteName(t,n){if(!n?.sprite||!t)throw new Error("Cannot retrieve sprite name. Sprite or metadata missing.");const e=Object.keys(n.sprite).find((e=>{const r=n.sprite[e];return r.position[0]===t.position[0]&&r.position[1]===t.position[1]&&r.size[0]===t.size[0]&&r.size[1]===t.size[1]}));if(!e)throw new Error("Cannot retrieve sprite name. No matching sprite in metadata.");return e||""}static splitRgbaColor(t){const n=t.substring(t.indexOf("(")+1,t.lastIndexOf(")")).split(/,\s*/);return[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10),parseFloat(n[3])]}static getHexCodeFromRgbArray(t){return"#"+t.map(((t,n)=>{const e=t.toString(16);return n<3?1===e.length?"0"+e:e:""})).join("")}static getHexColor(t){if(t.startsWith("#"))return t;if(t.startsWith("rgb")){const n=this.splitRgbaColor(t);return this.getHexCodeFromRgbArray(n)}}}var Pn,Ln,Rn,$n={exports:{}},zn=(Pn||(Pn=1,Ln=$n,Rn=$n.exports,function(){var t,n="Expected a function",e="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,s=128,u=1/0,a=9007199254740991,c=NaN,l=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",256]],f="[object Arguments]",p="[object Array]",d="[object Boolean]",m="[object Date]",y="[object Error]",v="[object Function]",b="[object GeneratorFunction]",g="[object Map]",w="[object Number]",x="[object Object]",E="[object Promise]",S="[object RegExp]",O="[object Set]",F="[object String]",T="[object Symbol]",M="[object WeakMap]",k="[object ArrayBuffer]",I="[object DataView]",_="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",N="[object Int16Array]",D="[object Int32Array]",j="[object Uint8Array]",P="[object Uint8ClampedArray]",L="[object Uint16Array]",R="[object Uint32Array]",$=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,q=RegExp(G.source),W=RegExp(B.source),Y=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,J=RegExp(Z.source),tt=/^\s+/,nt=/\s/,et=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rt=/\{\n\/\* \[wrapped with (.+)\] \*/,it=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,st=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,at=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ct=/\w*$/,lt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,pt=/^0o[0-7]+$/i,dt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",gt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",wt="\\u2700-\\u27bf",xt="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",St="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ft="["+bt+"]",Tt="["+Ot+"]",Mt="["+gt+"]",kt="\\d+",It="["+wt+"]",_t="["+xt+"]",At="[^"+bt+Ot+kt+wt+xt+Et+"]",Ct="\\ud83c[\\udffb-\\udfff]",Nt="[^"+bt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt="["+Et+"]",Lt="\\u200d",Rt="(?:"+_t+"|"+At+")",$t="(?:"+Pt+"|"+At+")",zt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+Mt+"|"+Ct+")?",Bt="["+St+"]?",qt=Bt+Gt+"(?:"+Lt+"(?:"+[Nt,Dt,jt].join("|")+")"+Bt+Gt+")*",Wt="(?:"+[It,Dt,jt].join("|")+")"+qt,Yt="(?:"+[Nt+Mt+"?",Mt,Dt,jt,Ft].join("|")+")",Vt=RegExp("['’]","g"),Ht=RegExp(Mt,"g"),Kt=RegExp(Ct+"(?="+Ct+")|"+Yt+qt,"g"),Xt=RegExp([Pt+"?"+_t+"+"+zt+"(?="+[Tt,Pt,"$"].join("|")+")",$t+"+"+Ut+"(?="+[Tt,Pt+Rt,"$"].join("|")+")",Pt+"?"+Rt+"+"+zt,Pt+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kt,Wt].join("|"),"g"),Qt=RegExp("["+Lt+bt+gt+St+"]"),Zt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Jt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tn=-1,nn={};nn[_]=nn[A]=nn[C]=nn[N]=nn[D]=nn[j]=nn[P]=nn[L]=nn[R]=!0,nn[f]=nn[p]=nn[k]=nn[d]=nn[I]=nn[m]=nn[y]=nn[v]=nn[g]=nn[w]=nn[x]=nn[S]=nn[O]=nn[F]=nn[M]=!1;var en={};en[f]=en[p]=en[k]=en[I]=en[d]=en[m]=en[_]=en[A]=en[C]=en[N]=en[D]=en[g]=en[w]=en[x]=en[S]=en[O]=en[F]=en[T]=en[j]=en[P]=en[L]=en[R]=!0,en[y]=en[v]=en[M]=!1;var rn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},on=parseFloat,sn=parseInt,un="object"==typeof o&&o&&o.Object===Object&&o,an="object"==typeof self&&self&&self.Object===Object&&self,cn=un||an||Function("return this")(),ln=Rn&&!Rn.nodeType&&Rn,hn=ln&&Ln&&!Ln.nodeType&&Ln,fn=hn&&hn.exports===ln,pn=fn&&un.process,dn=function(){try{return hn&&hn.require&&hn.require("util").types||pn&&pn.binding&&pn.binding("util")}catch(t){}}(),mn=dn&&dn.isArrayBuffer,yn=dn&&dn.isDate,vn=dn&&dn.isMap,bn=dn&&dn.isRegExp,gn=dn&&dn.isSet,wn=dn&&dn.isTypedArray;function xn(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}function En(t,n,e,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];n(r,s,e(s),t)}return r}function Sn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r&&!1!==n(t[e],e,t););return t}function On(t,n){for(var e=null==t?0:t.length;e--&&!1!==n(t[e],e,t););return t}function Fn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(!n(t[e],e,t))return!1;return!0}function Tn(t,n){for(var e=-1,r=null==t?0:t.length,i=0,o=[];++e<r;){var s=t[e];n(s,e,t)&&(o[i++]=s)}return o}function Mn(t,n){return!(null==t||!t.length)&&$n(t,n,0)>-1}function kn(t,n,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(n,t[r]))return!0;return!1}function In(t,n){for(var e=-1,r=null==t?0:t.length,i=Array(r);++e<r;)i[e]=n(t[e],e,t);return i}function _n(t,n){for(var e=-1,r=n.length,i=t.length;++e<r;)t[i+e]=n[e];return t}function An(t,n,e,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(e=t[++i]);++i<o;)e=n(e,t[i],i,t);return e}function Cn(t,n,e,r){var i=null==t?0:t.length;for(r&&i&&(e=t[--i]);i--;)e=n(e,t[i],i,t);return e}function Nn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(n(t[e],e,t))return!0;return!1}var Dn=Bn("length");function jn(t,n,e){var r;return e(t,(function(t,e,i){if(n(t,e,i))return r=e,!1})),r}function Pn(t,n,e,r){for(var i=t.length,o=e+(r?1:-1);r?o--:++o<i;)if(n(t[o],o,t))return o;return-1}function $n(t,n,e){return n==n?function(t,n,e){for(var r=e-1,i=t.length;++r<i;)if(t[r]===n)return r;return-1}(t,n,e):Pn(t,Un,e)}function zn(t,n,e,r){for(var i=e-1,o=t.length;++i<o;)if(r(t[i],n))return i;return-1}function Un(t){return t!=t}function Gn(t,n){var e=null==t?0:t.length;return e?Yn(t,n)/e:c}function Bn(n){return function(e){return null==e?t:e[n]}}function qn(n){return function(e){return null==n?t:n[e]}}function Wn(t,n,e,r,i){return i(t,(function(t,i,o){e=r?(r=!1,t):n(e,t,i,o)})),e}function Yn(n,e){for(var r,i=-1,o=n.length;++i<o;){var s=e(n[i]);s!==t&&(r=r===t?s:r+s)}return r}function Vn(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r}function Hn(t){return t?t.slice(0,he(t)+1).replace(tt,""):t}function Kn(t){return function(n){return t(n)}}function Xn(t,n){return In(n,(function(n){return t[n]}))}function Qn(t,n){return t.has(n)}function Zn(t,n){for(var e=-1,r=t.length;++e<r&&$n(n,t[e],0)>-1;);return e}function Jn(t,n){for(var e=t.length;e--&&$n(n,t[e],0)>-1;);return e}var te=qn({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),ne=qn({"&":"&","<":"<",">":">",'"':""","'":"'"});function ee(t){return"\\"+rn[t]}function re(t){return Qt.test(t)}function ie(t){var n=-1,e=Array(t.size);return t.forEach((function(t,r){e[++n]=[r,t]})),e}function oe(t,n){return function(e){return t(n(e))}}function se(t,n){for(var e=-1,i=t.length,o=0,s=[];++e<i;){var u=t[e];u!==n&&u!==r||(t[e]=r,s[o++]=e)}return s}function ue(t){var n=-1,e=Array(t.size);return t.forEach((function(t){e[++n]=t})),e}function ae(t){var n=-1,e=Array(t.size);return t.forEach((function(t){e[++n]=[t,t]})),e}function ce(t){return re(t)?function(t){for(var n=Kt.lastIndex=0;Kt.test(t);)++n;return n}(t):Dn(t)}function le(t){return re(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function he(t){for(var n=t.length;n--&&nt.test(t.charAt(n)););return n}var fe=qn({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pe=function o(nt){var bt,gt=(nt=null==nt?cn:pe.defaults(cn.Object(),nt,pe.pick(cn,Jt))).Array,wt=nt.Date,xt=nt.Error,Et=nt.Function,St=nt.Math,Ot=nt.Object,Ft=nt.RegExp,Tt=nt.String,Mt=nt.TypeError,kt=gt.prototype,It=Ot.prototype,_t=nt["__core-js_shared__"],At=Et.prototype.toString,Ct=It.hasOwnProperty,Nt=0,Dt=(bt=/[^.]+$/.exec(_t&&_t.keys&&_t.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",jt=It.toString,Pt=At.call(Ot),Lt=cn._,Rt=Ft("^"+At.call(Ct).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$t=fn?nt.Buffer:t,zt=nt.Symbol,Ut=nt.Uint8Array,Gt=$t?$t.allocUnsafe:t,Bt=oe(Ot.getPrototypeOf,Ot),qt=Ot.create,Wt=It.propertyIsEnumerable,Yt=kt.splice,Kt=zt?zt.isConcatSpreadable:t,Qt=zt?zt.iterator:t,rn=zt?zt.toStringTag:t,un=function(){try{var t=uo(Ot,"defineProperty");return t({},"",{}),t}catch(t){}}(),an=nt.clearTimeout!==cn.clearTimeout&&nt.clearTimeout,ln=wt&&wt.now!==cn.Date.now&&wt.now,hn=nt.setTimeout!==cn.setTimeout&&nt.setTimeout,pn=St.ceil,dn=St.floor,Dn=Ot.getOwnPropertySymbols,Ln=$t?$t.isBuffer:t,Rn=nt.isFinite,qn=kt.join,de=oe(Ot.keys,Ot),me=St.max,ye=St.min,ve=wt.now,be=nt.parseInt,ge=St.random,we=kt.reverse,xe=uo(nt,"DataView"),Ee=uo(nt,"Map"),Se=uo(nt,"Promise"),Oe=uo(nt,"Set"),Fe=uo(nt,"WeakMap"),Te=uo(Ot,"create"),Me=Fe&&new Fe,ke={},Ie=Po(xe),_e=Po(Ee),Ae=Po(Se),Ce=Po(Oe),Ne=Po(Fe),De=zt?zt.prototype:t,je=De?De.valueOf:t,Pe=De?De.toString:t;function Le(t){if(Js(t)&&!Gs(t)&&!(t instanceof Ue)){if(t instanceof ze)return t;if(Ct.call(t,"__wrapped__"))return Lo(t)}return new ze(t)}var Re=function(){function n(){}return function(e){if(!Zs(e))return{};if(qt)return qt(e);n.prototype=e;var r=new n;return n.prototype=t,r}}();function $e(){}function ze(n,e){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Ue(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Ge(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function Be(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function qe(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function We(t){var n=-1,e=null==t?0:t.length;for(this.__data__=new qe;++n<e;)this.add(t[n])}function Ye(t){var n=this.__data__=new Be(t);this.size=n.size}function Ve(t,n){var e=Gs(t),r=!e&&Us(t),i=!e&&!r&&Ys(t),o=!e&&!r&&!i&&uu(t),s=e||r||i||o,u=s?Vn(t.length,Tt):[],a=u.length;for(var c in t)!n&&!Ct.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,a))||u.push(c);return u}function He(n){var e=n.length;return e?n[qr(0,e-1)]:t}function Ke(t,n){return Ao(Fi(t),ir(n,0,t.length))}function Xe(t){return Ao(Fi(t))}function Qe(n,e,r){(r!==t&&!Rs(n[e],r)||r===t&&!(e in n))&&er(n,e,r)}function Ze(n,e,r){var i=n[e];Ct.call(n,e)&&Rs(i,r)&&(r!==t||e in n)||er(n,e,r)}function Je(t,n){for(var e=t.length;e--;)if(Rs(t[e][0],n))return e;return-1}function tr(t,n,e,r){return cr(t,(function(t,i,o){n(r,t,e(t),o)})),r}function nr(t,n){return t&&Ti(n,Iu(n),t)}function er(t,n,e){"__proto__"==n&&un?un(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}function rr(n,e){for(var r=-1,i=e.length,o=gt(i),s=null==n;++r<i;)o[r]=s?t:Ou(n,e[r]);return o}function ir(n,e,r){return n==n&&(r!==t&&(n=n<=r?n:r),e!==t&&(n=n>=e?n:e)),n}function or(n,e,r,i,o,s){var u,a=1&e,c=2&e,l=4&e;if(r&&(u=o?r(n,i,o,s):r(n)),u!==t)return u;if(!Zs(n))return n;var h=Gs(n);if(h){if(u=function(t){var n=t.length,e=new t.constructor(n);return n&&"string"==typeof t[0]&&Ct.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(n),!a)return Fi(n,u)}else{var p=lo(n),y=p==v||p==b;if(Ys(n))return gi(n,a);if(p==x||p==f||y&&!o){if(u=c||y?{}:fo(n),!a)return c?function(t,n){return Ti(t,co(t),n)}(n,function(t,n){return t&&Ti(n,_u(n),t)}(u,n)):function(t,n){return Ti(t,ao(t),n)}(n,nr(u,n))}else{if(!en[p])return o?n:{};u=function(t,n,e){var r=t.constructor;switch(n){case k:return wi(t);case d:case m:return new r(+t);case I:return function(t,n){var e=n?wi(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case _:case A:case C:case N:case D:case j:case P:case L:case R:return xi(t,e);case g:return new r;case w:case F:return new r(t);case S:return function(t){var n=new t.constructor(t.source,ct.exec(t));return n.lastIndex=t.lastIndex,n}(t);case O:return new r;case T:return je?Ot(je.call(t)):{}}}(n,p,a)}}s||(s=new Ye);var E=s.get(n);if(E)return E;s.set(n,u),iu(n)?n.forEach((function(t){u.add(or(t,e,r,t,n,s))})):tu(n)&&n.forEach((function(t,i){u.set(i,or(t,e,r,i,n,s))}));var M=h?t:(l?c?to:Ji:c?_u:Iu)(n);return Sn(M||n,(function(t,i){M&&(t=n[i=t]),Ze(u,i,or(t,e,r,i,n,s))})),u}function sr(n,e,r){var i=r.length;if(null==n)return!i;for(n=Ot(n);i--;){var o=r[i],s=n[o];if(s===t&&!(o in n)||!(0,e[o])(s))return!1}return!0}function ur(e,r,i){if("function"!=typeof e)throw new Mt(n);return Mo((function(){e.apply(t,i)}),r)}function ar(t,n,e,r){var i=-1,o=Mn,s=!0,u=t.length,a=[],c=n.length;if(!u)return a;e&&(n=In(n,Kn(e))),r?(o=kn,s=!1):n.length>=200&&(o=Qn,s=!1,n=new We(n));t:for(;++i<u;){var l=t[i],h=null==e?l:e(l);if(l=r||0!==l?l:0,s&&h==h){for(var f=c;f--;)if(n[f]===h)continue t;a.push(l)}else o(n,h,r)||a.push(l)}return a}Le.templateSettings={escape:Y,evaluate:V,interpolate:H,variable:"",imports:{_:Le}},(Le.prototype=$e.prototype).constructor=Le,(ze.prototype=Re($e.prototype)).constructor=ze,(Ue.prototype=Re($e.prototype)).constructor=Ue,Ge.prototype.clear=function(){this.__data__=Te?Te(null):{},this.size=0},Ge.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},Ge.prototype.get=function(n){var r=this.__data__;if(Te){var i=r[n];return i===e?t:i}return Ct.call(r,n)?r[n]:t},Ge.prototype.has=function(n){var e=this.__data__;return Te?e[n]!==t:Ct.call(e,n)},Ge.prototype.set=function(n,r){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=Te&&r===t?e:r,this},Be.prototype.clear=function(){this.__data__=[],this.size=0},Be.prototype.delete=function(t){var n=this.__data__,e=Je(n,t);return!(e<0||(e==n.length-1?n.pop():Yt.call(n,e,1),--this.size,0))},Be.prototype.get=function(n){var e=this.__data__,r=Je(e,n);return r<0?t:e[r][1]},Be.prototype.has=function(t){return Je(this.__data__,t)>-1},Be.prototype.set=function(t,n){var e=this.__data__,r=Je(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this},qe.prototype.clear=function(){this.size=0,this.__data__={hash:new Ge,map:new(Ee||Be),string:new Ge}},qe.prototype.delete=function(t){var n=oo(this,t).delete(t);return this.size-=n?1:0,n},qe.prototype.get=function(t){return oo(this,t).get(t)},qe.prototype.has=function(t){return oo(this,t).has(t)},qe.prototype.set=function(t,n){var e=oo(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this},We.prototype.add=We.prototype.push=function(t){return this.__data__.set(t,e),this},We.prototype.has=function(t){return this.__data__.has(t)},Ye.prototype.clear=function(){this.__data__=new Be,this.size=0},Ye.prototype.delete=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e},Ye.prototype.get=function(t){return this.__data__.get(t)},Ye.prototype.has=function(t){return this.__data__.has(t)},Ye.prototype.set=function(t,n){var e=this.__data__;if(e instanceof Be){var r=e.__data__;if(!Ee||r.length<199)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new qe(r)}return e.set(t,n),this.size=e.size,this};var cr=Ii(vr),lr=Ii(br,!0);function hr(t,n){var e=!0;return cr(t,(function(t,r,i){return e=!!n(t,r,i)})),e}function fr(n,e,r){for(var i=-1,o=n.length;++i<o;){var s=n[i],u=e(s);if(null!=u&&(a===t?u==u&&!su(u):r(u,a)))var a=u,c=s}return c}function pr(t,n){var e=[];return cr(t,(function(t,r,i){n(t,r,i)&&e.push(t)})),e}function dr(t,n,e,r,i){var o=-1,s=t.length;for(e||(e=po),i||(i=[]);++o<s;){var u=t[o];n>0&&e(u)?n>1?dr(u,n-1,e,r,i):_n(i,u):r||(i[i.length]=u)}return i}var mr=_i(),yr=_i(!0);function vr(t,n){return t&&mr(t,n,Iu)}function br(t,n){return t&&yr(t,n,Iu)}function gr(t,n){return Tn(n,(function(n){return Ks(t[n])}))}function wr(n,e){for(var r=0,i=(e=mi(e,n)).length;null!=n&&r<i;)n=n[jo(e[r++])];return r&&r==i?n:t}function xr(t,n,e){var r=n(t);return Gs(t)?r:_n(r,e(t))}function Er(n){return null==n?n===t?"[object Undefined]":"[object Null]":rn&&rn in Ot(n)?function(n){var e=Ct.call(n,rn),r=n[rn];try{n[rn]=t;var i=!0}catch(t){}var o=jt.call(n);return i&&(e?n[rn]=r:delete n[rn]),o}(n):function(t){return jt.call(t)}(n)}function Sr(t,n){return t>n}function Or(t,n){return null!=t&&Ct.call(t,n)}function Fr(t,n){return null!=t&&n in Ot(t)}function Tr(n,e,r){for(var i=r?kn:Mn,o=n[0].length,s=n.length,u=s,a=gt(s),c=1/0,l=[];u--;){var h=n[u];u&&e&&(h=In(h,Kn(e))),c=ye(h.length,c),a[u]=!r&&(e||o>=120&&h.length>=120)?new We(u&&h):t}h=n[0];var f=-1,p=a[0];t:for(;++f<o&&l.length<c;){var d=h[f],m=e?e(d):d;if(d=r||0!==d?d:0,!(p?Qn(p,m):i(l,m,r))){for(u=s;--u;){var y=a[u];if(!(y?Qn(y,m):i(n[u],m,r)))continue t}p&&p.push(m),l.push(d)}}return l}function Mr(n,e,r){var i=null==(n=Oo(n,e=mi(e,n)))?n:n[jo(Ho(e))];return null==i?t:xn(i,n,r)}function kr(t){return Js(t)&&Er(t)==f}function Ir(n,e,r,i,o){return n===e||(null==n||null==e||!Js(n)&&!Js(e)?n!=n&&e!=e:function(n,e,r,i,o,s){var u=Gs(n),a=Gs(e),c=u?p:lo(n),l=a?p:lo(e),h=(c=c==f?x:c)==x,v=(l=l==f?x:l)==x,b=c==l;if(b&&Ys(n)){if(!Ys(e))return!1;u=!0,h=!1}if(b&&!h)return s||(s=new Ye),u||uu(n)?Qi(n,e,r,i,o,s):function(t,n,e,r,i,o,s){switch(e){case I:if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case k:return!(t.byteLength!=n.byteLength||!o(new Ut(t),new Ut(n)));case d:case m:case w:return Rs(+t,+n);case y:return t.name==n.name&&t.message==n.message;case S:case F:return t==n+"";case g:var u=ie;case O:if(u||(u=ue),t.size!=n.size&&!(1&r))return!1;var a=s.get(t);if(a)return a==n;r|=2,s.set(t,n);var c=Qi(u(t),u(n),r,i,o,s);return s.delete(t),c;case T:if(je)return je.call(t)==je.call(n)}return!1}(n,e,c,r,i,o,s);if(!(1&r)){var E=h&&Ct.call(n,"__wrapped__"),M=v&&Ct.call(e,"__wrapped__");if(E||M){var _=E?n.value():n,A=M?e.value():e;return s||(s=new Ye),o(_,A,r,i,s)}}return!!b&&(s||(s=new Ye),function(n,e,r,i,o,s){var u=1&r,a=Ji(n),c=a.length;if(c!=Ji(e).length&&!u)return!1;for(var l=c;l--;){var h=a[l];if(!(u?h in e:Ct.call(e,h)))return!1}var f=s.get(n),p=s.get(e);if(f&&p)return f==e&&p==n;var d=!0;s.set(n,e),s.set(e,n);for(var m=u;++l<c;){var y=n[h=a[l]],v=e[h];if(i)var b=u?i(v,y,h,e,n,s):i(y,v,h,n,e,s);if(!(b===t?y===v||o(y,v,r,i,s):b)){d=!1;break}m||(m="constructor"==h)}if(d&&!m){var g=n.constructor,w=e.constructor;g==w||!("constructor"in n)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof w&&w instanceof w||(d=!1)}return s.delete(n),s.delete(e),d}(n,e,r,i,o,s))}(n,e,r,i,Ir,o))}function _r(n,e,r,i){var o=r.length,s=o,u=!i;if(null==n)return!s;for(n=Ot(n);o--;){var a=r[o];if(u&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++o<s;){var c=(a=r[o])[0],l=n[c],h=a[1];if(u&&a[2]){if(l===t&&!(c in n))return!1}else{var f=new Ye;if(i)var p=i(l,h,c,n,e,f);if(!(p===t?Ir(h,l,3,i,f):p))return!1}}return!0}function Ar(t){return!(!Zs(t)||(n=t,Dt&&Dt in n))&&(Ks(t)?Rt:ft).test(Po(t));var n}function Cr(t){return"function"==typeof t?t:null==t?na:"object"==typeof t?Gs(t)?Lr(t[0],t[1]):Pr(t):la(t)}function Nr(t){if(!wo(t))return de(t);var n=[];for(var e in Ot(t))Ct.call(t,e)&&"constructor"!=e&&n.push(e);return n}function Dr(t,n){return t<n}function jr(t,n){var e=-1,r=qs(t)?gt(t.length):[];return cr(t,(function(t,i,o){r[++e]=n(t,i,o)})),r}function Pr(t){var n=so(t);return 1==n.length&&n[0][2]?Eo(n[0][0],n[0][1]):function(e){return e===t||_r(e,t,n)}}function Lr(n,e){return vo(n)&&xo(e)?Eo(jo(n),e):function(r){var i=Ou(r,n);return i===t&&i===e?Fu(r,n):Ir(e,i,3)}}function Rr(n,e,r,i,o){n!==e&&mr(e,(function(s,u){if(o||(o=new Ye),Zs(s))!function(n,e,r,i,o,s,u){var a=Fo(n,r),c=Fo(e,r),l=u.get(c);if(l)Qe(n,r,l);else{var h=s?s(a,c,r+"",n,e,u):t,f=h===t;if(f){var p=Gs(c),d=!p&&Ys(c),m=!p&&!d&&uu(c);h=c,p||d||m?Gs(a)?h=a:Ws(a)?h=Fi(a):d?(f=!1,h=gi(c,!0)):m?(f=!1,h=xi(c,!0)):h=[]:eu(c)||Us(c)?(h=a,Us(a)?h=mu(a):Zs(a)&&!Ks(a)||(h=fo(c))):f=!1}f&&(u.set(c,h),o(h,c,i,s,u),u.delete(c)),Qe(n,r,h)}}(n,e,u,r,Rr,i,o);else{var a=i?i(Fo(n,u),s,u+"",n,e,o):t;a===t&&(a=s),Qe(n,u,a)}}),_u)}function $r(n,e){var r=n.length;if(r)return mo(e+=e<0?r:0,r)?n[e]:t}function zr(t,n,e){n=n.length?In(n,(function(t){return Gs(t)?function(n){return wr(n,1===t.length?t[0]:t)}:t})):[na];var r=-1;n=In(n,Kn(io()));var i=jr(t,(function(t){var e=In(n,(function(n){return n(t)}));return{criteria:e,index:++r,value:t}}));return function(t){var n=t.length;for(t.sort((function(t,n){return function(t,n,e){for(var r=-1,i=t.criteria,o=n.criteria,s=i.length,u=e.length;++r<s;){var a=Ei(i[r],o[r]);if(a)return r>=u?a:a*("desc"==e[r]?-1:1)}return t.index-n.index}(t,n,e)}));n--;)t[n]=t[n].value;return t}(i)}function Ur(t,n,e){for(var r=-1,i=n.length,o={};++r<i;){var s=n[r],u=wr(t,s);e(u,s)&&Kr(o,mi(s,t),u)}return o}function Gr(t,n,e,r){var i=r?zn:$n,o=-1,s=n.length,u=t;for(t===n&&(n=Fi(n)),e&&(u=In(t,Kn(e)));++o<s;)for(var a=0,c=n[o],l=e?e(c):c;(a=i(u,l,a,r))>-1;)u!==t&&Yt.call(u,a,1),Yt.call(t,a,1);return t}function Br(t,n){for(var e=t?n.length:0,r=e-1;e--;){var i=n[e];if(e==r||i!==o){var o=i;mo(i)?Yt.call(t,i,1):ui(t,i)}}return t}function qr(t,n){return t+dn(ge()*(n-t+1))}function Wr(t,n){var e="";if(!t||n<1||n>a)return e;do{n%2&&(e+=t),(n=dn(n/2))&&(t+=t)}while(n);return e}function Yr(t,n){return ko(So(t,n,na),t+"")}function Vr(t){return He(Ru(t))}function Hr(t,n){var e=Ru(t);return Ao(e,ir(n,0,e.length))}function Kr(n,e,r,i){if(!Zs(n))return n;for(var o=-1,s=(e=mi(e,n)).length,u=s-1,a=n;null!=a&&++o<s;){var c=jo(e[o]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(o!=u){var h=a[c];(l=i?i(h,c,a):t)===t&&(l=Zs(h)?h:mo(e[o+1])?[]:{})}Ze(a,c,l),a=a[c]}return n}var Xr=Me?function(t,n){return Me.set(t,n),t}:na,Qr=un?function(t,n){return un(t,"toString",{configurable:!0,enumerable:!1,value:Zu(n),writable:!0})}:na;function Zr(t){return Ao(Ru(t))}function Jr(t,n,e){var r=-1,i=t.length;n<0&&(n=-n>i?0:i+n),(e=e>i?i:e)<0&&(e+=i),i=n>e?0:e-n>>>0,n>>>=0;for(var o=gt(i);++r<i;)o[r]=t[r+n];return o}function ti(t,n){var e;return cr(t,(function(t,r,i){return!(e=n(t,r,i))})),!!e}function ni(t,n,e){var r=0,i=null==t?r:t.length;if("number"==typeof n&&n==n&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!su(s)&&(e?s<=n:s<n)?r=o+1:i=o}return i}return ei(t,n,na,e)}function ei(n,e,r,i){var o=0,s=null==n?0:n.length;if(0===s)return 0;for(var u=(e=r(e))!=e,a=null===e,c=su(e),l=e===t;o<s;){var h=dn((o+s)/2),f=r(n[h]),p=f!==t,d=null===f,m=f==f,y=su(f);if(u)var v=i||m;else v=l?m&&(i||p):a?m&&p&&(i||!d):c?m&&p&&!d&&(i||!y):!d&&!y&&(i?f<=e:f<e);v?o=h+1:s=h}return ye(s,4294967294)}function ri(t,n){for(var e=-1,r=t.length,i=0,o=[];++e<r;){var s=t[e],u=n?n(s):s;if(!e||!Rs(u,a)){var a=u;o[i++]=0===s?0:s}}return o}function ii(t){return"number"==typeof t?t:su(t)?c:+t}function oi(t){if("string"==typeof t)return t;if(Gs(t))return In(t,oi)+"";if(su(t))return Pe?Pe.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function si(t,n,e){var r=-1,i=Mn,o=t.length,s=!0,u=[],a=u;if(e)s=!1,i=kn;else if(o>=200){var c=n?null:Wi(t);if(c)return ue(c);s=!1,i=Qn,a=new We}else a=n?[]:u;t:for(;++r<o;){var l=t[r],h=n?n(l):l;if(l=e||0!==l?l:0,s&&h==h){for(var f=a.length;f--;)if(a[f]===h)continue t;n&&a.push(h),u.push(l)}else i(a,h,e)||(a!==u&&a.push(h),u.push(l))}return u}function ui(t,n){return null==(t=Oo(t,n=mi(n,t)))||delete t[jo(Ho(n))]}function ai(t,n,e,r){return Kr(t,n,e(wr(t,n)),r)}function ci(t,n,e,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&n(t[o],o,t););return e?Jr(t,r?0:o,r?o+1:i):Jr(t,r?o+1:0,r?i:o)}function li(t,n){var e=t;return e instanceof Ue&&(e=e.value()),An(n,(function(t,n){return n.func.apply(n.thisArg,_n([t],n.args))}),e)}function hi(t,n,e){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=gt(r);++i<r;)for(var s=t[i],u=-1;++u<r;)u!=i&&(o[i]=ar(o[i]||s,t[u],n,e));return si(dr(o,1),n,e)}function fi(n,e,r){for(var i=-1,o=n.length,s=e.length,u={};++i<o;)r(u,n[i],i<s?e[i]:t);return u}function pi(t){return Ws(t)?t:[]}function di(t){return"function"==typeof t?t:na}function mi(t,n){return Gs(t)?t:vo(t,n)?[t]:Do(yu(t))}var yi=Yr;function vi(n,e,r){var i=n.length;return r=r===t?i:r,!e&&r>=i?n:Jr(n,e,r)}var bi=an||function(t){return cn.clearTimeout(t)};function gi(t,n){if(n)return t.slice();var e=t.length,r=Gt?Gt(e):new t.constructor(e);return t.copy(r),r}function wi(t){var n=new t.constructor(t.byteLength);return new Ut(n).set(new Ut(t)),n}function xi(t,n){var e=n?wi(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}function Ei(n,e){if(n!==e){var r=n!==t,i=null===n,o=n==n,s=su(n),u=e!==t,a=null===e,c=e==e,l=su(e);if(!a&&!l&&!s&&n>e||s&&u&&c&&!a&&!l||i&&u&&c||!r&&c||!o)return 1;if(!i&&!s&&!l&&n<e||l&&r&&o&&!i&&!s||a&&r&&o||!u&&o||!c)return-1}return 0}function Si(t,n,e,r){for(var i=-1,o=t.length,s=e.length,u=-1,a=n.length,c=me(o-s,0),l=gt(a+c),h=!r;++u<a;)l[u]=n[u];for(;++i<s;)(h||i<o)&&(l[e[i]]=t[i]);for(;c--;)l[u++]=t[i++];return l}function Oi(t,n,e,r){for(var i=-1,o=t.length,s=-1,u=e.length,a=-1,c=n.length,l=me(o-u,0),h=gt(l+c),f=!r;++i<l;)h[i]=t[i];for(var p=i;++a<c;)h[p+a]=n[a];for(;++s<u;)(f||i<o)&&(h[p+e[s]]=t[i++]);return h}function Fi(t,n){var e=-1,r=t.length;for(n||(n=gt(r));++e<r;)n[e]=t[e];return n}function Ti(n,e,r,i){var o=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var a=e[s],c=i?i(r[a],n[a],a,r,n):t;c===t&&(c=n[a]),o?er(r,a,c):Ze(r,a,c)}return r}function Mi(t,n){return function(e,r){var i=Gs(e)?En:tr,o=n?n():{};return i(e,t,io(r,2),o)}}function ki(n){return Yr((function(e,r){var i=-1,o=r.length,s=o>1?r[o-1]:t,u=o>2?r[2]:t;for(s=n.length>3&&"function"==typeof s?(o--,s):t,u&&yo(r[0],r[1],u)&&(s=o<3?t:s,o=1),e=Ot(e);++i<o;){var a=r[i];a&&n(e,a,i,s)}return e}))}function Ii(t,n){return function(e,r){if(null==e)return e;if(!qs(e))return t(e,r);for(var i=e.length,o=n?i:-1,s=Ot(e);(n?o--:++o<i)&&!1!==r(s[o],o,s););return e}}function _i(t){return function(n,e,r){for(var i=-1,o=Ot(n),s=r(n),u=s.length;u--;){var a=s[t?u:++i];if(!1===e(o[a],a,o))break}return n}}function Ai(n){return function(e){var r=re(e=yu(e))?le(e):t,i=r?r[0]:e.charAt(0),o=r?vi(r,1).join(""):e.slice(1);return i[n]()+o}}function Ci(t){return function(n){return An(Ku(Uu(n).replace(Vt,"")),t,"")}}function Ni(t){return function(){var n=arguments;switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3]);case 5:return new t(n[0],n[1],n[2],n[3],n[4]);case 6:return new t(n[0],n[1],n[2],n[3],n[4],n[5]);case 7:return new t(n[0],n[1],n[2],n[3],n[4],n[5],n[6])}var e=Re(t.prototype),r=t.apply(e,n);return Zs(r)?r:e}}function Di(n){return function(e,r,i){var o=Ot(e);if(!qs(e)){var s=io(r,3);e=Iu(e),r=function(t){return s(o[t],t,o)}}var u=n(e,r,i);return u>-1?o[s?e[u]:u]:t}}function ji(e){return Zi((function(r){var i=r.length,o=i,s=ze.prototype.thru;for(e&&r.reverse();o--;){var u=r[o];if("function"!=typeof u)throw new Mt(n);if(s&&!a&&"wrapper"==eo(u))var a=new ze([],!0)}for(o=a?o:i;++o<i;){var c=eo(u=r[o]),l="wrapper"==c?no(u):t;a=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[eo(l[0])].apply(a,l[3]):1==u.length&&bo(u)?a[c]():a.thru(u)}return function(){var t=arguments,n=t[0];if(a&&1==t.length&&Gs(n))return a.plant(n).value();for(var e=0,o=i?r[e].apply(this,t):n;++e<i;)o=r[e].call(this,o);return o}}))}function Pi(n,e,r,i,o,u,a,c,l,h){var f=e&s,p=1&e,d=2&e,m=24&e,y=512&e,v=d?t:Ni(n);return function s(){for(var b=arguments.length,g=gt(b),w=b;w--;)g[w]=arguments[w];if(m)var x=ro(s),E=function(t,n){for(var e=t.length,r=0;e--;)t[e]===n&&++r;return r}(g,x);if(i&&(g=Si(g,i,o,m)),u&&(g=Oi(g,u,a,m)),b-=E,m&&b<h){var S=se(g,x);return Bi(n,e,Pi,s.placeholder,r,g,S,c,l,h-b)}var O=p?r:this,F=d?O[n]:n;return b=g.length,c?g=function(n,e){for(var r=n.length,i=ye(e.length,r),o=Fi(n);i--;){var s=e[i];n[i]=mo(s,r)?o[s]:t}return n}(g,c):y&&b>1&&g.reverse(),f&&l<b&&(g.length=l),this&&this!==cn&&this instanceof s&&(F=v||Ni(F)),F.apply(O,g)}}function Li(t,n){return function(e,r){return function(t,n,e,r){return vr(t,(function(t,i,o){n(r,e(t),i,o)})),r}(e,t,n(r),{})}}function Ri(n,e){return function(r,i){var o;if(r===t&&i===t)return e;if(r!==t&&(o=r),i!==t){if(o===t)return i;"string"==typeof r||"string"==typeof i?(r=oi(r),i=oi(i)):(r=ii(r),i=ii(i)),o=n(r,i)}return o}}function $i(t){return Zi((function(n){return n=In(n,Kn(io())),Yr((function(e){var r=this;return t(n,(function(t){return xn(t,r,e)}))}))}))}function zi(n,e){var r=(e=e===t?" ":oi(e)).length;if(r<2)return r?Wr(e,n):e;var i=Wr(e,pn(n/ce(e)));return re(e)?vi(le(i),0,n).join(""):i.slice(0,n)}function Ui(n){return function(e,r,i){return i&&"number"!=typeof i&&yo(e,r,i)&&(r=i=t),e=hu(e),r===t?(r=e,e=0):r=hu(r),function(t,n,e,r){for(var i=-1,o=me(pn((n-t)/(e||1)),0),s=gt(o);o--;)s[r?o:++i]=t,t+=e;return s}(e,r,i=i===t?e<r?1:-1:hu(i),n)}}function Gi(t){return function(n,e){return"string"==typeof n&&"string"==typeof e||(n=du(n),e=du(e)),t(n,e)}}function Bi(n,e,r,o,s,u,a,c,l,h){var f=8&e;e|=f?i:64,4&(e&=~(f?64:i))||(e&=-4);var p=[n,e,s,f?u:t,f?a:t,f?t:u,f?t:a,c,l,h],d=r.apply(t,p);return bo(n)&&To(d,p),d.placeholder=o,Io(d,n,e)}function qi(t){var n=St[t];return function(t,e){if(t=du(t),(e=null==e?0:ye(fu(e),292))&&Rn(t)){var r=(yu(t)+"e").split("e");return+((r=(yu(n(r[0]+"e"+(+r[1]+e)))+"e").split("e"))[0]+"e"+(+r[1]-e))}return n(t)}}var Wi=Oe&&1/ue(new Oe([,-0]))[1]==u?function(t){return new Oe(t)}:sa;function Yi(t){return function(n){var e=lo(n);return e==g?ie(n):e==O?ae(n):function(t,n){return In(n,(function(n){return[n,t[n]]}))}(n,t(n))}}function Vi(e,o,u,a,c,l,h,f){var p=2&o;if(!p&&"function"!=typeof e)throw new Mt(n);var d=a?a.length:0;if(d||(o&=-97,a=c=t),h=h===t?h:me(fu(h),0),f=f===t?f:fu(f),d-=c?c.length:0,64&o){var m=a,y=c;a=c=t}var v=p?t:no(e),b=[e,o,u,a,c,m,y,l,h,f];if(v&&function(t,n){var e=t[1],i=n[1],o=e|i;if(!(o<131||(i==s&&8==e||i==s&&256==e&&t[7].length<=n[8]||384==i&&n[7].length<=n[8]&&8==e)))return t;1&i&&(t[2]=n[2],o|=1&e?0:4);var u=n[3];if(u){var a=t[3];t[3]=a?Si(a,u,n[4]):u,t[4]=a?se(t[3],r):n[4]}(u=n[5])&&(t[5]=(a=t[5])?Oi(a,u,n[6]):u,t[6]=a?se(t[5],r):n[6]),(u=n[7])&&(t[7]=u),i&s&&(t[8]=null==t[8]?n[8]:ye(t[8],n[8])),null==t[9]&&(t[9]=n[9]),t[0]=n[0],t[1]=o}(b,v),e=b[0],o=b[1],u=b[2],a=b[3],c=b[4],!(f=b[9]=b[9]===t?p?0:e.length:me(b[9]-d,0))&&24&o&&(o&=-25),o&&1!=o)g=8==o||16==o?function(n,e,r){var i=Ni(n);return function o(){for(var s=arguments.length,u=gt(s),a=s,c=ro(o);a--;)u[a]=arguments[a];var l=s<3&&u[0]!==c&&u[s-1]!==c?[]:se(u,c);return(s-=l.length)<r?Bi(n,e,Pi,o.placeholder,t,u,l,t,t,r-s):xn(this&&this!==cn&&this instanceof o?i:n,this,u)}}(e,o,f):o!=i&&33!=o||c.length?Pi.apply(t,b):function(t,n,e,r){var i=1&n,o=Ni(t);return function n(){for(var s=-1,u=arguments.length,a=-1,c=r.length,l=gt(c+u),h=this&&this!==cn&&this instanceof n?o:t;++a<c;)l[a]=r[a];for(;u--;)l[a++]=arguments[++s];return xn(h,i?e:this,l)}}(e,o,u,a);else var g=function(t,n,e){var r=1&n,i=Ni(t);return function n(){return(this&&this!==cn&&this instanceof n?i:t).apply(r?e:this,arguments)}}(e,o,u);return Io((v?Xr:To)(g,b),e,o)}function Hi(n,e,r,i){return n===t||Rs(n,It[r])&&!Ct.call(i,r)?e:n}function Ki(n,e,r,i,o,s){return Zs(n)&&Zs(e)&&(s.set(e,n),Rr(n,e,t,Ki,s),s.delete(e)),n}function Xi(n){return eu(n)?t:n}function Qi(n,e,r,i,o,s){var u=1&r,a=n.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var l=s.get(n),h=s.get(e);if(l&&h)return l==e&&h==n;var f=-1,p=!0,d=2&r?new We:t;for(s.set(n,e),s.set(e,n);++f<a;){var m=n[f],y=e[f];if(i)var v=u?i(y,m,f,e,n,s):i(m,y,f,n,e,s);if(v!==t){if(v)continue;p=!1;break}if(d){if(!Nn(e,(function(t,n){if(!Qn(d,n)&&(m===t||o(m,t,r,i,s)))return d.push(n)}))){p=!1;break}}else if(m!==y&&!o(m,y,r,i,s)){p=!1;break}}return s.delete(n),s.delete(e),p}function Zi(n){return ko(So(n,t,Bo),n+"")}function Ji(t){return xr(t,Iu,ao)}function to(t){return xr(t,_u,co)}var no=Me?function(t){return Me.get(t)}:sa;function eo(t){for(var n=t.name+"",e=ke[n],r=Ct.call(ke,n)?e.length:0;r--;){var i=e[r],o=i.func;if(null==o||o==t)return i.name}return n}function ro(t){return(Ct.call(Le,"placeholder")?Le:t).placeholder}function io(){var t=Le.iteratee||ea;return t=t===ea?Cr:t,arguments.length?t(arguments[0],arguments[1]):t}function oo(t,n){var e,r,i=t.__data__;return("string"==(r=typeof(e=n))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?i["string"==typeof n?"string":"hash"]:i.map}function so(t){for(var n=Iu(t),e=n.length;e--;){var r=n[e],i=t[r];n[e]=[r,i,xo(i)]}return n}function uo(n,e){var r=function(n,e){return null==n?t:n[e]}(n,e);return Ar(r)?r:t}var ao=Dn?function(t){return null==t?[]:(t=Ot(t),Tn(Dn(t),(function(n){return Wt.call(t,n)})))}:pa,co=Dn?function(t){for(var n=[];t;)_n(n,ao(t)),t=Bt(t);return n}:pa,lo=Er;function ho(t,n,e){for(var r=-1,i=(n=mi(n,t)).length,o=!1;++r<i;){var s=jo(n[r]);if(!(o=null!=t&&e(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Qs(i)&&mo(s,i)&&(Gs(t)||Us(t))}function fo(t){return"function"!=typeof t.constructor||wo(t)?{}:Re(Bt(t))}function po(t){return Gs(t)||Us(t)||!!(Kt&&t&&t[Kt])}function mo(t,n){var e=typeof t;return!!(n=null==n?a:n)&&("number"==e||"symbol"!=e&&dt.test(t))&&t>-1&&t%1==0&&t<n}function yo(t,n,e){if(!Zs(e))return!1;var r=typeof n;return!!("number"==r?qs(e)&&mo(n,e.length):"string"==r&&n in e)&&Rs(e[n],t)}function vo(t,n){if(Gs(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!su(t))||X.test(t)||!K.test(t)||null!=n&&t in Ot(n)}function bo(t){var n=eo(t),e=Le[n];if("function"!=typeof e||!(n in Ue.prototype))return!1;if(t===e)return!0;var r=no(e);return!!r&&t===r[0]}(xe&&lo(new xe(new ArrayBuffer(1)))!=I||Ee&&lo(new Ee)!=g||Se&&lo(Se.resolve())!=E||Oe&&lo(new Oe)!=O||Fe&&lo(new Fe)!=M)&&(lo=function(n){var e=Er(n),r=e==x?n.constructor:t,i=r?Po(r):"";if(i)switch(i){case Ie:return I;case _e:return g;case Ae:return E;case Ce:return O;case Ne:return M}return e});var go=_t?Ks:da;function wo(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||It)}function xo(t){return t==t&&!Zs(t)}function Eo(n,e){return function(r){return null!=r&&r[n]===e&&(e!==t||n in Ot(r))}}function So(n,e,r){return e=me(e===t?n.length-1:e,0),function(){for(var t=arguments,i=-1,o=me(t.length-e,0),s=gt(o);++i<o;)s[i]=t[e+i];i=-1;for(var u=gt(e+1);++i<e;)u[i]=t[i];return u[e]=r(s),xn(n,this,u)}}function Oo(t,n){return n.length<2?t:wr(t,Jr(n,0,-1))}function Fo(t,n){if(("constructor"!==n||"function"!=typeof t[n])&&"__proto__"!=n)return t[n]}var To=_o(Xr),Mo=hn||function(t,n){return cn.setTimeout(t,n)},ko=_o(Qr);function Io(t,n,e){var r=n+"";return ko(t,function(t,n){var e=n.length;if(!e)return t;var r=e-1;return n[r]=(e>1?"& ":"")+n[r],n=n.join(e>2?", ":" "),t.replace(et,"{\n/* [wrapped with "+n+"] */\n")}(r,function(t,n){return Sn(h,(function(e){var r="_."+e[0];n&e[1]&&!Mn(t,r)&&t.push(r)})),t.sort()}(function(t){var n=t.match(rt);return n?n[1].split(it):[]}(r),e)))}function _o(n){var e=0,r=0;return function(){var i=ve(),o=16-(i-r);if(r=i,o>0){if(++e>=800)return arguments[0]}else e=0;return n.apply(t,arguments)}}function Ao(n,e){var r=-1,i=n.length,o=i-1;for(e=e===t?i:e;++r<e;){var s=qr(r,o),u=n[s];n[s]=n[r],n[r]=u}return n.length=e,n}var Co,No,Do=(Co=Cs((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(Q,(function(t,e,r,i){n.push(r?i.replace(ut,"$1"):e||t)})),n}),(function(t){return 500===No.size&&No.clear(),t})),No=Co.cache,Co);function jo(t){if("string"==typeof t||su(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function Po(t){if(null!=t){try{return At.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Lo(t){if(t instanceof Ue)return t.clone();var n=new ze(t.__wrapped__,t.__chain__);return n.__actions__=Fi(t.__actions__),n.__index__=t.__index__,n.__values__=t.__values__,n}var Ro=Yr((function(t,n){return Ws(t)?ar(t,dr(n,1,Ws,!0)):[]})),$o=Yr((function(n,e){var r=Ho(e);return Ws(r)&&(r=t),Ws(n)?ar(n,dr(e,1,Ws,!0),io(r,2)):[]})),zo=Yr((function(n,e){var r=Ho(e);return Ws(r)&&(r=t),Ws(n)?ar(n,dr(e,1,Ws,!0),t,r):[]}));function Uo(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:fu(e);return i<0&&(i=me(r+i,0)),Pn(t,io(n,3),i)}function Go(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i-1;return r!==t&&(o=fu(r),o=r<0?me(i+o,0):ye(o,i-1)),Pn(n,io(e,3),o,!0)}function Bo(t){return null!=t&&t.length?dr(t,1):[]}function qo(n){return n&&n.length?n[0]:t}var Wo=Yr((function(t){var n=In(t,pi);return n.length&&n[0]===t[0]?Tr(n):[]})),Yo=Yr((function(n){var e=Ho(n),r=In(n,pi);return e===Ho(r)?e=t:r.pop(),r.length&&r[0]===n[0]?Tr(r,io(e,2)):[]})),Vo=Yr((function(n){var e=Ho(n),r=In(n,pi);return(e="function"==typeof e?e:t)&&r.pop(),r.length&&r[0]===n[0]?Tr(r,t,e):[]}));function Ho(n){var e=null==n?0:n.length;return e?n[e-1]:t}var Ko=Yr(Xo);function Xo(t,n){return t&&t.length&&n&&n.length?Gr(t,n):t}var Qo=Zi((function(t,n){var e=null==t?0:t.length,r=rr(t,n);return Br(t,In(n,(function(t){return mo(t,e)?+t:t})).sort(Ei)),r}));function Zo(t){return null==t?t:we.call(t)}var Jo=Yr((function(t){return si(dr(t,1,Ws,!0))})),ts=Yr((function(n){var e=Ho(n);return Ws(e)&&(e=t),si(dr(n,1,Ws,!0),io(e,2))})),ns=Yr((function(n){var e=Ho(n);return e="function"==typeof e?e:t,si(dr(n,1,Ws,!0),t,e)}));function es(t){if(!t||!t.length)return[];var n=0;return t=Tn(t,(function(t){if(Ws(t))return n=me(t.length,n),!0})),Vn(n,(function(n){return In(t,Bn(n))}))}function rs(n,e){if(!n||!n.length)return[];var r=es(n);return null==e?r:In(r,(function(n){return xn(e,t,n)}))}var is=Yr((function(t,n){return Ws(t)?ar(t,n):[]})),os=Yr((function(t){return hi(Tn(t,Ws))})),ss=Yr((function(n){var e=Ho(n);return Ws(e)&&(e=t),hi(Tn(n,Ws),io(e,2))})),us=Yr((function(n){var e=Ho(n);return e="function"==typeof e?e:t,hi(Tn(n,Ws),t,e)})),as=Yr(es),cs=Yr((function(n){var e=n.length,r=e>1?n[e-1]:t;return r="function"==typeof r?(n.pop(),r):t,rs(n,r)}));function ls(t){var n=Le(t);return n.__chain__=!0,n}function hs(t,n){return n(t)}var fs=Zi((function(n){var e=n.length,r=e?n[0]:0,i=this.__wrapped__,o=function(t){return rr(t,n)};return!(e>1||this.__actions__.length)&&i instanceof Ue&&mo(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:hs,args:[o],thisArg:t}),new ze(i,this.__chain__).thru((function(n){return e&&!n.length&&n.push(t),n}))):this.thru(o)})),ps=Mi((function(t,n,e){Ct.call(t,e)?++t[e]:er(t,e,1)})),ds=Di(Uo),ms=Di(Go);function ys(t,n){return(Gs(t)?Sn:cr)(t,io(n,3))}function vs(t,n){return(Gs(t)?On:lr)(t,io(n,3))}var bs=Mi((function(t,n,e){Ct.call(t,e)?t[e].push(n):er(t,e,[n])})),gs=Yr((function(t,n,e){var r=-1,i="function"==typeof n,o=qs(t)?gt(t.length):[];return cr(t,(function(t){o[++r]=i?xn(n,t,e):Mr(t,n,e)})),o})),ws=Mi((function(t,n,e){er(t,e,n)}));function xs(t,n){return(Gs(t)?In:jr)(t,io(n,3))}var Es=Mi((function(t,n,e){t[e?0:1].push(n)}),(function(){return[[],[]]})),Ss=Yr((function(t,n){if(null==t)return[];var e=n.length;return e>1&&yo(t,n[0],n[1])?n=[]:e>2&&yo(n[0],n[1],n[2])&&(n=[n[0]]),zr(t,dr(n,1),[])})),Os=ln||function(){return cn.Date.now()};function Fs(n,e,r){return e=r?t:e,Vi(n,s,t,t,t,t,e=n&&null==e?n.length:e)}function Ts(e,r){var i;if("function"!=typeof r)throw new Mt(n);return e=fu(e),function(){return--e>0&&(i=r.apply(this,arguments)),e<=1&&(r=t),i}}var Ms=Yr((function(t,n,e){var r=1;if(e.length){var o=se(e,ro(Ms));r|=i}return Vi(t,r,n,e,o)})),ks=Yr((function(t,n,e){var r=3;if(e.length){var o=se(e,ro(ks));r|=i}return Vi(n,r,t,e,o)}));function Is(e,r,i){var o,s,u,a,c,l,h=0,f=!1,p=!1,d=!0;if("function"!=typeof e)throw new Mt(n);function m(n){var r=o,i=s;return o=s=t,h=n,a=e.apply(i,r)}function y(n){var e=n-l;return l===t||e>=r||e<0||p&&n-h>=u}function v(){var t=Os();if(y(t))return b(t);c=Mo(v,function(t){var n=r-(t-l);return p?ye(n,u-(t-h)):n}(t))}function b(n){return c=t,d&&o?m(n):(o=s=t,a)}function g(){var n=Os(),e=y(n);if(o=arguments,s=this,l=n,e){if(c===t)return function(t){return h=t,c=Mo(v,r),f?m(t):a}(l);if(p)return bi(c),c=Mo(v,r),m(l)}return c===t&&(c=Mo(v,r)),a}return r=du(r)||0,Zs(i)&&(f=!!i.leading,u=(p="maxWait"in i)?me(du(i.maxWait)||0,r):u,d="trailing"in i?!!i.trailing:d),g.cancel=function(){c!==t&&bi(c),h=0,o=l=s=c=t},g.flush=function(){return c===t?a:b(Os())},g}var _s=Yr((function(t,n){return ur(t,1,n)})),As=Yr((function(t,n,e){return ur(t,du(n)||0,e)}));function Cs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Cs.Cache||qe),r}function Ns(t){if("function"!=typeof t)throw new Mt(n);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}Cs.Cache=qe;var Ds=yi((function(t,n){var e=(n=1==n.length&&Gs(n[0])?In(n[0],Kn(io())):In(dr(n,1),Kn(io()))).length;return Yr((function(r){for(var i=-1,o=ye(r.length,e);++i<o;)r[i]=n[i].call(this,r[i]);return xn(t,this,r)}))})),js=Yr((function(n,e){var r=se(e,ro(js));return Vi(n,i,t,e,r)})),Ps=Yr((function(n,e){var r=se(e,ro(Ps));return Vi(n,64,t,e,r)})),Ls=Zi((function(n,e){return Vi(n,256,t,t,t,e)}));function Rs(t,n){return t===n||t!=t&&n!=n}var $s=Gi(Sr),zs=Gi((function(t,n){return t>=n})),Us=kr(function(){return arguments}())?kr:function(t){return Js(t)&&Ct.call(t,"callee")&&!Wt.call(t,"callee")},Gs=gt.isArray,Bs=mn?Kn(mn):function(t){return Js(t)&&Er(t)==k};function qs(t){return null!=t&&Qs(t.length)&&!Ks(t)}function Ws(t){return Js(t)&&qs(t)}var Ys=Ln||da,Vs=yn?Kn(yn):function(t){return Js(t)&&Er(t)==m};function Hs(t){if(!Js(t))return!1;var n=Er(t);return n==y||"[object DOMException]"==n||"string"==typeof t.message&&"string"==typeof t.name&&!eu(t)}function Ks(t){if(!Zs(t))return!1;var n=Er(t);return n==v||n==b||"[object AsyncFunction]"==n||"[object Proxy]"==n}function Xs(t){return"number"==typeof t&&t==fu(t)}function Qs(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Zs(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}function Js(t){return null!=t&&"object"==typeof t}var tu=vn?Kn(vn):function(t){return Js(t)&&lo(t)==g};function nu(t){return"number"==typeof t||Js(t)&&Er(t)==w}function eu(t){if(!Js(t)||Er(t)!=x)return!1;var n=Bt(t);if(null===n)return!0;var e=Ct.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&At.call(e)==Pt}var ru=bn?Kn(bn):function(t){return Js(t)&&Er(t)==S},iu=gn?Kn(gn):function(t){return Js(t)&&lo(t)==O};function ou(t){return"string"==typeof t||!Gs(t)&&Js(t)&&Er(t)==F}function su(t){return"symbol"==typeof t||Js(t)&&Er(t)==T}var uu=wn?Kn(wn):function(t){return Js(t)&&Qs(t.length)&&!!nn[Er(t)]},au=Gi(Dr),cu=Gi((function(t,n){return t<=n}));function lu(t){if(!t)return[];if(qs(t))return ou(t)?le(t):Fi(t);if(Qt&&t[Qt])return function(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}(t[Qt]());var n=lo(t);return(n==g?ie:n==O?ue:Ru)(t)}function hu(t){return t?(t=du(t))===u||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function fu(t){var n=hu(t),e=n%1;return n==n?e?n-e:n:0}function pu(t){return t?ir(fu(t),0,l):0}function du(t){if("number"==typeof t)return t;if(su(t))return c;if(Zs(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=Zs(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=Hn(t);var e=ht.test(t);return e||pt.test(t)?sn(t.slice(2),e?2:8):lt.test(t)?c:+t}function mu(t){return Ti(t,_u(t))}function yu(t){return null==t?"":oi(t)}var vu=ki((function(t,n){if(wo(n)||qs(n))Ti(n,Iu(n),t);else for(var e in n)Ct.call(n,e)&&Ze(t,e,n[e])})),bu=ki((function(t,n){Ti(n,_u(n),t)})),gu=ki((function(t,n,e,r){Ti(n,_u(n),t,r)})),wu=ki((function(t,n,e,r){Ti(n,Iu(n),t,r)})),xu=Zi(rr),Eu=Yr((function(n,e){n=Ot(n);var r=-1,i=e.length,o=i>2?e[2]:t;for(o&&yo(e[0],e[1],o)&&(i=1);++r<i;)for(var s=e[r],u=_u(s),a=-1,c=u.length;++a<c;){var l=u[a],h=n[l];(h===t||Rs(h,It[l])&&!Ct.call(n,l))&&(n[l]=s[l])}return n})),Su=Yr((function(n){return n.push(t,Ki),xn(Cu,t,n)}));function Ou(n,e,r){var i=null==n?t:wr(n,e);return i===t?r:i}function Fu(t,n){return null!=t&&ho(t,n,Fr)}var Tu=Li((function(t,n,e){null!=n&&"function"!=typeof n.toString&&(n=jt.call(n)),t[n]=e}),Zu(na)),Mu=Li((function(t,n,e){null!=n&&"function"!=typeof n.toString&&(n=jt.call(n)),Ct.call(t,n)?t[n].push(e):t[n]=[e]}),io),ku=Yr(Mr);function Iu(t){return qs(t)?Ve(t):Nr(t)}function _u(t){return qs(t)?Ve(t,!0):function(t){if(!Zs(t))return function(t){var n=[];if(null!=t)for(var e in Ot(t))n.push(e);return n}(t);var n=wo(t),e=[];for(var r in t)("constructor"!=r||!n&&Ct.call(t,r))&&e.push(r);return e}(t)}var Au=ki((function(t,n,e){Rr(t,n,e)})),Cu=ki((function(t,n,e,r){Rr(t,n,e,r)})),Nu=Zi((function(t,n){var e={};if(null==t)return e;var r=!1;n=In(n,(function(n){return n=mi(n,t),r||(r=n.length>1),n})),Ti(t,to(t),e),r&&(e=or(e,7,Xi));for(var i=n.length;i--;)ui(e,n[i]);return e})),Du=Zi((function(t,n){return null==t?{}:function(t,n){return Ur(t,n,(function(n,e){return Fu(t,e)}))}(t,n)}));function ju(t,n){if(null==t)return{};var e=In(to(t),(function(t){return[t]}));return n=io(n),Ur(t,e,(function(t,e){return n(t,e[0])}))}var Pu=Yi(Iu),Lu=Yi(_u);function Ru(t){return null==t?[]:Xn(t,Iu(t))}var $u=Ci((function(t,n,e){return n=n.toLowerCase(),t+(e?zu(n):n)}));function zu(t){return Hu(yu(t).toLowerCase())}function Uu(t){return(t=yu(t))&&t.replace(mt,te).replace(Ht,"")}var Gu=Ci((function(t,n,e){return t+(e?"-":"")+n.toLowerCase()})),Bu=Ci((function(t,n,e){return t+(e?" ":"")+n.toLowerCase()})),qu=Ai("toLowerCase"),Wu=Ci((function(t,n,e){return t+(e?"_":"")+n.toLowerCase()})),Yu=Ci((function(t,n,e){return t+(e?" ":"")+Hu(n)})),Vu=Ci((function(t,n,e){return t+(e?" ":"")+n.toUpperCase()})),Hu=Ai("toUpperCase");function Ku(n,e,r){return n=yu(n),(e=r?t:e)===t?function(t){return Zt.test(t)}(n)?function(t){return t.match(Xt)||[]}(n):function(t){return t.match(ot)||[]}(n):n.match(e)||[]}var Xu=Yr((function(n,e){try{return xn(n,t,e)}catch(t){return Hs(t)?t:new xt(t)}})),Qu=Zi((function(t,n){return Sn(n,(function(n){n=jo(n),er(t,n,Ms(t[n],t))})),t}));function Zu(t){return function(){return t}}var Ju=ji(),ta=ji(!0);function na(t){return t}function ea(t){return Cr("function"==typeof t?t:or(t,1))}var ra=Yr((function(t,n){return function(e){return Mr(e,t,n)}})),ia=Yr((function(t,n){return function(e){return Mr(t,e,n)}}));function oa(t,n,e){var r=Iu(n),i=gr(n,r);null!=e||Zs(n)&&(i.length||!r.length)||(e=n,n=t,t=this,i=gr(n,Iu(n)));var o=!(Zs(e)&&"chain"in e&&!e.chain),s=Ks(t);return Sn(i,(function(e){var r=n[e];t[e]=r,s&&(t.prototype[e]=function(){var n=this.__chain__;if(o||n){var e=t(this.__wrapped__);return(e.__actions__=Fi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),e.__chain__=n,e}return r.apply(t,_n([this.value()],arguments))})})),t}function sa(){}var ua=$i(In),aa=$i(Fn),ca=$i(Nn);function la(t){return vo(t)?Bn(jo(t)):function(t){return function(n){return wr(n,t)}}(t)}var ha=Ui(),fa=Ui(!0);function pa(){return[]}function da(){return!1}var ma,ya=Ri((function(t,n){return t+n}),0),va=qi("ceil"),ba=Ri((function(t,n){return t/n}),1),ga=qi("floor"),wa=Ri((function(t,n){return t*n}),1),xa=qi("round"),Ea=Ri((function(t,n){return t-n}),0);return Le.after=function(t,e){if("function"!=typeof e)throw new Mt(n);return t=fu(t),function(){if(--t<1)return e.apply(this,arguments)}},Le.ary=Fs,Le.assign=vu,Le.assignIn=bu,Le.assignInWith=gu,Le.assignWith=wu,Le.at=xu,Le.before=Ts,Le.bind=Ms,Le.bindAll=Qu,Le.bindKey=ks,Le.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Gs(t)?t:[t]},Le.chain=ls,Le.chunk=function(n,e,r){e=(r?yo(n,e,r):e===t)?1:me(fu(e),0);var i=null==n?0:n.length;if(!i||e<1)return[];for(var o=0,s=0,u=gt(pn(i/e));o<i;)u[s++]=Jr(n,o,o+=e);return u},Le.compact=function(t){for(var n=-1,e=null==t?0:t.length,r=0,i=[];++n<e;){var o=t[n];o&&(i[r++]=o)}return i},Le.concat=function(){var t=arguments.length;if(!t)return[];for(var n=gt(t-1),e=arguments[0],r=t;r--;)n[r-1]=arguments[r];return _n(Gs(e)?Fi(e):[e],dr(n,1))},Le.cond=function(t){var e=null==t?0:t.length,r=io();return t=e?In(t,(function(t){if("function"!=typeof t[1])throw new Mt(n);return[r(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(xn(i[0],this,n))return xn(i[1],this,n)}}))},Le.conforms=function(t){return function(t){var n=Iu(t);return function(e){return sr(e,t,n)}}(or(t,1))},Le.constant=Zu,Le.countBy=ps,Le.create=function(t,n){var e=Re(t);return null==n?e:nr(e,n)},Le.curry=function n(e,r,i){var o=Vi(e,8,t,t,t,t,t,r=i?t:r);return o.placeholder=n.placeholder,o},Le.curryRight=function n(e,r,i){var o=Vi(e,16,t,t,t,t,t,r=i?t:r);return o.placeholder=n.placeholder,o},Le.debounce=Is,Le.defaults=Eu,Le.defaultsDeep=Su,Le.defer=_s,Le.delay=As,Le.difference=Ro,Le.differenceBy=$o,Le.differenceWith=zo,Le.drop=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,(e=r||e===t?1:fu(e))<0?0:e,i):[]},Le.dropRight=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,0,(e=i-(e=r||e===t?1:fu(e)))<0?0:e):[]},Le.dropRightWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!0,!0):[]},Le.dropWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!0):[]},Le.fill=function(n,e,r,i){var o=null==n?0:n.length;return o?(r&&"number"!=typeof r&&yo(n,e,r)&&(r=0,i=o),function(n,e,r,i){var o=n.length;for((r=fu(r))<0&&(r=-r>o?0:o+r),(i=i===t||i>o?o:fu(i))<0&&(i+=o),i=r>i?0:pu(i);r<i;)n[r++]=e;return n}(n,e,r,i)):[]},Le.filter=function(t,n){return(Gs(t)?Tn:pr)(t,io(n,3))},Le.flatMap=function(t,n){return dr(xs(t,n),1)},Le.flatMapDeep=function(t,n){return dr(xs(t,n),u)},Le.flatMapDepth=function(n,e,r){return r=r===t?1:fu(r),dr(xs(n,e),r)},Le.flatten=Bo,Le.flattenDeep=function(t){return null!=t&&t.length?dr(t,u):[]},Le.flattenDepth=function(n,e){return null!=n&&n.length?dr(n,e=e===t?1:fu(e)):[]},Le.flip=function(t){return Vi(t,512)},Le.flow=Ju,Le.flowRight=ta,Le.fromPairs=function(t){for(var n=-1,e=null==t?0:t.length,r={};++n<e;){var i=t[n];r[i[0]]=i[1]}return r},Le.functions=function(t){return null==t?[]:gr(t,Iu(t))},Le.functionsIn=function(t){return null==t?[]:gr(t,_u(t))},Le.groupBy=bs,Le.initial=function(t){return null!=t&&t.length?Jr(t,0,-1):[]},Le.intersection=Wo,Le.intersectionBy=Yo,Le.intersectionWith=Vo,Le.invert=Tu,Le.invertBy=Mu,Le.invokeMap=gs,Le.iteratee=ea,Le.keyBy=ws,Le.keys=Iu,Le.keysIn=_u,Le.map=xs,Le.mapKeys=function(t,n){var e={};return n=io(n,3),vr(t,(function(t,r,i){er(e,n(t,r,i),t)})),e},Le.mapValues=function(t,n){var e={};return n=io(n,3),vr(t,(function(t,r,i){er(e,r,n(t,r,i))})),e},Le.matches=function(t){return Pr(or(t,1))},Le.matchesProperty=function(t,n){return Lr(t,or(n,1))},Le.memoize=Cs,Le.merge=Au,Le.mergeWith=Cu,Le.method=ra,Le.methodOf=ia,Le.mixin=oa,Le.negate=Ns,Le.nthArg=function(t){return t=fu(t),Yr((function(n){return $r(n,t)}))},Le.omit=Nu,Le.omitBy=function(t,n){return ju(t,Ns(io(n)))},Le.once=function(t){return Ts(2,t)},Le.orderBy=function(n,e,r,i){return null==n?[]:(Gs(e)||(e=null==e?[]:[e]),Gs(r=i?t:r)||(r=null==r?[]:[r]),zr(n,e,r))},Le.over=ua,Le.overArgs=Ds,Le.overEvery=aa,Le.overSome=ca,Le.partial=js,Le.partialRight=Ps,Le.partition=Es,Le.pick=Du,Le.pickBy=ju,Le.property=la,Le.propertyOf=function(n){return function(e){return null==n?t:wr(n,e)}},Le.pull=Ko,Le.pullAll=Xo,Le.pullAllBy=function(t,n,e){return t&&t.length&&n&&n.length?Gr(t,n,io(e,2)):t},Le.pullAllWith=function(n,e,r){return n&&n.length&&e&&e.length?Gr(n,e,t,r):n},Le.pullAt=Qo,Le.range=ha,Le.rangeRight=fa,Le.rearg=Ls,Le.reject=function(t,n){return(Gs(t)?Tn:pr)(t,Ns(io(n,3)))},Le.remove=function(t,n){var e=[];if(!t||!t.length)return e;var r=-1,i=[],o=t.length;for(n=io(n,3);++r<o;){var s=t[r];n(s,r,t)&&(e.push(s),i.push(r))}return Br(t,i),e},Le.rest=function(e,r){if("function"!=typeof e)throw new Mt(n);return Yr(e,r=r===t?r:fu(r))},Le.reverse=Zo,Le.sampleSize=function(n,e,r){return e=(r?yo(n,e,r):e===t)?1:fu(e),(Gs(n)?Ke:Hr)(n,e)},Le.set=function(t,n,e){return null==t?t:Kr(t,n,e)},Le.setWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:Kr(n,e,r,i)},Le.shuffle=function(t){return(Gs(t)?Xe:Zr)(t)},Le.slice=function(n,e,r){var i=null==n?0:n.length;return i?(r&&"number"!=typeof r&&yo(n,e,r)?(e=0,r=i):(e=null==e?0:fu(e),r=r===t?i:fu(r)),Jr(n,e,r)):[]},Le.sortBy=Ss,Le.sortedUniq=function(t){return t&&t.length?ri(t):[]},Le.sortedUniqBy=function(t,n){return t&&t.length?ri(t,io(n,2)):[]},Le.split=function(n,e,r){return r&&"number"!=typeof r&&yo(n,e,r)&&(e=r=t),(r=r===t?l:r>>>0)?(n=yu(n))&&("string"==typeof e||null!=e&&!ru(e))&&!(e=oi(e))&&re(n)?vi(le(n),0,r):n.split(e,r):[]},Le.spread=function(t,e){if("function"!=typeof t)throw new Mt(n);return e=null==e?0:me(fu(e),0),Yr((function(n){var r=n[e],i=vi(n,0,e);return r&&_n(i,r),xn(t,this,i)}))},Le.tail=function(t){var n=null==t?0:t.length;return n?Jr(t,1,n):[]},Le.take=function(n,e,r){return n&&n.length?Jr(n,0,(e=r||e===t?1:fu(e))<0?0:e):[]},Le.takeRight=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,(e=i-(e=r||e===t?1:fu(e)))<0?0:e,i):[]},Le.takeRightWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!1,!0):[]},Le.takeWhile=function(t,n){return t&&t.length?ci(t,io(n,3)):[]},Le.tap=function(t,n){return n(t),t},Le.throttle=function(t,e,r){var i=!0,o=!0;if("function"!=typeof t)throw new Mt(n);return Zs(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Is(t,e,{leading:i,maxWait:e,trailing:o})},Le.thru=hs,Le.toArray=lu,Le.toPairs=Pu,Le.toPairsIn=Lu,Le.toPath=function(t){return Gs(t)?In(t,jo):su(t)?[t]:Fi(Do(yu(t)))},Le.toPlainObject=mu,Le.transform=function(t,n,e){var r=Gs(t),i=r||Ys(t)||uu(t);if(n=io(n,4),null==e){var o=t&&t.constructor;e=i?r?new o:[]:Zs(t)&&Ks(o)?Re(Bt(t)):{}}return(i?Sn:vr)(t,(function(t,r,i){return n(e,t,r,i)})),e},Le.unary=function(t){return Fs(t,1)},Le.union=Jo,Le.unionBy=ts,Le.unionWith=ns,Le.uniq=function(t){return t&&t.length?si(t):[]},Le.uniqBy=function(t,n){return t&&t.length?si(t,io(n,2)):[]},Le.uniqWith=function(n,e){return e="function"==typeof e?e:t,n&&n.length?si(n,t,e):[]},Le.unset=function(t,n){return null==t||ui(t,n)},Le.unzip=es,Le.unzipWith=rs,Le.update=function(t,n,e){return null==t?t:ai(t,n,di(e))},Le.updateWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:ai(n,e,di(r),i)},Le.values=Ru,Le.valuesIn=function(t){return null==t?[]:Xn(t,_u(t))},Le.without=is,Le.words=Ku,Le.wrap=function(t,n){return js(di(n),t)},Le.xor=os,Le.xorBy=ss,Le.xorWith=us,Le.zip=as,Le.zipObject=function(t,n){return fi(t||[],n||[],Ze)},Le.zipObjectDeep=function(t,n){return fi(t||[],n||[],Kr)},Le.zipWith=cs,Le.entries=Pu,Le.entriesIn=Lu,Le.extend=bu,Le.extendWith=gu,oa(Le,Le),Le.add=ya,Le.attempt=Xu,Le.camelCase=$u,Le.capitalize=zu,Le.ceil=va,Le.clamp=function(n,e,r){return r===t&&(r=e,e=t),r!==t&&(r=(r=du(r))==r?r:0),e!==t&&(e=(e=du(e))==e?e:0),ir(du(n),e,r)},Le.clone=function(t){return or(t,4)},Le.cloneDeep=function(t){return or(t,5)},Le.cloneDeepWith=function(n,e){return or(n,5,e="function"==typeof e?e:t)},Le.cloneWith=function(n,e){return or(n,4,e="function"==typeof e?e:t)},Le.conformsTo=function(t,n){return null==n||sr(t,n,Iu(n))},Le.deburr=Uu,Le.defaultTo=function(t,n){return null==t||t!=t?n:t},Le.divide=ba,Le.endsWith=function(n,e,r){n=yu(n),e=oi(e);var i=n.length,o=r=r===t?i:ir(fu(r),0,i);return(r-=e.length)>=0&&n.slice(r,o)==e},Le.eq=Rs,Le.escape=function(t){return(t=yu(t))&&W.test(t)?t.replace(B,ne):t},Le.escapeRegExp=function(t){return(t=yu(t))&&J.test(t)?t.replace(Z,"\\$&"):t},Le.every=function(n,e,r){var i=Gs(n)?Fn:hr;return r&&yo(n,e,r)&&(e=t),i(n,io(e,3))},Le.find=ds,Le.findIndex=Uo,Le.findKey=function(t,n){return jn(t,io(n,3),vr)},Le.findLast=ms,Le.findLastIndex=Go,Le.findLastKey=function(t,n){return jn(t,io(n,3),br)},Le.floor=ga,Le.forEach=ys,Le.forEachRight=vs,Le.forIn=function(t,n){return null==t?t:mr(t,io(n,3),_u)},Le.forInRight=function(t,n){return null==t?t:yr(t,io(n,3),_u)},Le.forOwn=function(t,n){return t&&vr(t,io(n,3))},Le.forOwnRight=function(t,n){return t&&br(t,io(n,3))},Le.get=Ou,Le.gt=$s,Le.gte=zs,Le.has=function(t,n){return null!=t&&ho(t,n,Or)},Le.hasIn=Fu,Le.head=qo,Le.identity=na,Le.includes=function(t,n,e,r){t=qs(t)?t:Ru(t),e=e&&!r?fu(e):0;var i=t.length;return e<0&&(e=me(i+e,0)),ou(t)?e<=i&&t.indexOf(n,e)>-1:!!i&&$n(t,n,e)>-1},Le.indexOf=function(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:fu(e);return i<0&&(i=me(r+i,0)),$n(t,n,i)},Le.inRange=function(n,e,r){return e=hu(e),r===t?(r=e,e=0):r=hu(r),function(t,n,e){return t>=ye(n,e)&&t<me(n,e)}(n=du(n),e,r)},Le.invoke=ku,Le.isArguments=Us,Le.isArray=Gs,Le.isArrayBuffer=Bs,Le.isArrayLike=qs,Le.isArrayLikeObject=Ws,Le.isBoolean=function(t){return!0===t||!1===t||Js(t)&&Er(t)==d},Le.isBuffer=Ys,Le.isDate=Vs,Le.isElement=function(t){return Js(t)&&1===t.nodeType&&!eu(t)},Le.isEmpty=function(t){if(null==t)return!0;if(qs(t)&&(Gs(t)||"string"==typeof t||"function"==typeof t.splice||Ys(t)||uu(t)||Us(t)))return!t.length;var n=lo(t);if(n==g||n==O)return!t.size;if(wo(t))return!Nr(t).length;for(var e in t)if(Ct.call(t,e))return!1;return!0},Le.isEqual=function(t,n){return Ir(t,n)},Le.isEqualWith=function(n,e,r){var i=(r="function"==typeof r?r:t)?r(n,e):t;return i===t?Ir(n,e,t,r):!!i},Le.isError=Hs,Le.isFinite=function(t){return"number"==typeof t&&Rn(t)},Le.isFunction=Ks,Le.isInteger=Xs,Le.isLength=Qs,Le.isMap=tu,Le.isMatch=function(t,n){return t===n||_r(t,n,so(n))},Le.isMatchWith=function(n,e,r){return r="function"==typeof r?r:t,_r(n,e,so(e),r)},Le.isNaN=function(t){return nu(t)&&t!=+t},Le.isNative=function(t){if(go(t))throw new xt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ar(t)},Le.isNil=function(t){return null==t},Le.isNull=function(t){return null===t},Le.isNumber=nu,Le.isObject=Zs,Le.isObjectLike=Js,Le.isPlainObject=eu,Le.isRegExp=ru,Le.isSafeInteger=function(t){return Xs(t)&&t>=-9007199254740991&&t<=a},Le.isSet=iu,Le.isString=ou,Le.isSymbol=su,Le.isTypedArray=uu,Le.isUndefined=function(n){return n===t},Le.isWeakMap=function(t){return Js(t)&&lo(t)==M},Le.isWeakSet=function(t){return Js(t)&&"[object WeakSet]"==Er(t)},Le.join=function(t,n){return null==t?"":qn.call(t,n)},Le.kebabCase=Gu,Le.last=Ho,Le.lastIndexOf=function(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i;return r!==t&&(o=(o=fu(r))<0?me(i+o,0):ye(o,i-1)),e==e?function(t,n,e){for(var r=e+1;r--;)if(t[r]===n)return r;return r}(n,e,o):Pn(n,Un,o,!0)},Le.lowerCase=Bu,Le.lowerFirst=qu,Le.lt=au,Le.lte=cu,Le.max=function(n){return n&&n.length?fr(n,na,Sr):t},Le.maxBy=function(n,e){return n&&n.length?fr(n,io(e,2),Sr):t},Le.mean=function(t){return Gn(t,na)},Le.meanBy=function(t,n){return Gn(t,io(n,2))},Le.min=function(n){return n&&n.length?fr(n,na,Dr):t},Le.minBy=function(n,e){return n&&n.length?fr(n,io(e,2),Dr):t},Le.stubArray=pa,Le.stubFalse=da,Le.stubObject=function(){return{}},Le.stubString=function(){return""},Le.stubTrue=function(){return!0},Le.multiply=wa,Le.nth=function(n,e){return n&&n.length?$r(n,fu(e)):t},Le.noConflict=function(){return cn._===this&&(cn._=Lt),this},Le.noop=sa,Le.now=Os,Le.pad=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;if(!n||r>=n)return t;var i=(n-r)/2;return zi(dn(i),e)+t+zi(pn(i),e)},Le.padEnd=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;return n&&r<n?t+zi(n-r,e):t},Le.padStart=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;return n&&r<n?zi(n-r,e)+t:t},Le.parseInt=function(t,n,e){return e||null==n?n=0:n&&(n=+n),be(yu(t).replace(tt,""),n||0)},Le.random=function(n,e,r){if(r&&"boolean"!=typeof r&&yo(n,e,r)&&(e=r=t),r===t&&("boolean"==typeof e?(r=e,e=t):"boolean"==typeof n&&(r=n,n=t)),n===t&&e===t?(n=0,e=1):(n=hu(n),e===t?(e=n,n=0):e=hu(e)),n>e){var i=n;n=e,e=i}if(r||n%1||e%1){var o=ge();return ye(n+o*(e-n+on("1e-"+((o+"").length-1))),e)}return qr(n,e)},Le.reduce=function(t,n,e){var r=Gs(t)?An:Wn,i=arguments.length<3;return r(t,io(n,4),e,i,cr)},Le.reduceRight=function(t,n,e){var r=Gs(t)?Cn:Wn,i=arguments.length<3;return r(t,io(n,4),e,i,lr)},Le.repeat=function(n,e,r){return e=(r?yo(n,e,r):e===t)?1:fu(e),Wr(yu(n),e)},Le.replace=function(){var t=arguments,n=yu(t[0]);return t.length<3?n:n.replace(t[1],t[2])},Le.result=function(n,e,r){var i=-1,o=(e=mi(e,n)).length;for(o||(o=1,n=t);++i<o;){var s=null==n?t:n[jo(e[i])];s===t&&(i=o,s=r),n=Ks(s)?s.call(n):s}return n},Le.round=xa,Le.runInContext=o,Le.sample=function(t){return(Gs(t)?He:Vr)(t)},Le.size=function(t){if(null==t)return 0;if(qs(t))return ou(t)?ce(t):t.length;var n=lo(t);return n==g||n==O?t.size:Nr(t).length},Le.snakeCase=Wu,Le.some=function(n,e,r){var i=Gs(n)?Nn:ti;return r&&yo(n,e,r)&&(e=t),i(n,io(e,3))},Le.sortedIndex=function(t,n){return ni(t,n)},Le.sortedIndexBy=function(t,n,e){return ei(t,n,io(e,2))},Le.sortedIndexOf=function(t,n){var e=null==t?0:t.length;if(e){var r=ni(t,n);if(r<e&&Rs(t[r],n))return r}return-1},Le.sortedLastIndex=function(t,n){return ni(t,n,!0)},Le.sortedLastIndexBy=function(t,n,e){return ei(t,n,io(e,2),!0)},Le.sortedLastIndexOf=function(t,n){if(null!=t&&t.length){var e=ni(t,n,!0)-1;if(Rs(t[e],n))return e}return-1},Le.startCase=Yu,Le.startsWith=function(t,n,e){return t=yu(t),e=null==e?0:ir(fu(e),0,t.length),n=oi(n),t.slice(e,e+n.length)==n},Le.subtract=Ea,Le.sum=function(t){return t&&t.length?Yn(t,na):0},Le.sumBy=function(t,n){return t&&t.length?Yn(t,io(n,2)):0},Le.template=function(n,e,r){var i=Le.templateSettings;r&&yo(n,e,r)&&(e=t),n=yu(n),e=gu({},e,i,Hi);var o,s,u=gu({},e.imports,i.imports,Hi),a=Iu(u),c=Xn(u,a),l=0,h=e.interpolate||yt,f="__p += '",p=Ft((e.escape||yt).source+"|"+h.source+"|"+(h===H?at:yt).source+"|"+(e.evaluate||yt).source+"|$","g"),d="//# sourceURL="+(Ct.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tn+"]")+"\n";n.replace(p,(function(t,e,r,i,u,a){return r||(r=i),f+=n.slice(l,a).replace(vt,ee),e&&(o=!0,f+="' +\n__e("+e+") +\n'"),u&&(s=!0,f+="';\n"+u+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=a+t.length,t})),f+="';\n";var m=Ct.call(e,"variable")&&e.variable;if(m){if(st.test(m))throw new xt("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace($,""):f).replace(z,"$1").replace(U,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Xu((function(){return Et(a,d+"return "+f).apply(t,c)}));if(y.source=f,Hs(y))throw y;return y},Le.times=function(t,n){if((t=fu(t))<1||t>a)return[];var e=l,r=ye(t,l);n=io(n),t-=l;for(var i=Vn(r,n);++e<t;)n(e);return i},Le.toFinite=hu,Le.toInteger=fu,Le.toLength=pu,Le.toLower=function(t){return yu(t).toLowerCase()},Le.toNumber=du,Le.toSafeInteger=function(t){return t?ir(fu(t),-9007199254740991,a):0===t?t:0},Le.toString=yu,Le.toUpper=function(t){return yu(t).toUpperCase()},Le.trim=function(n,e,r){if((n=yu(n))&&(r||e===t))return Hn(n);if(!n||!(e=oi(e)))return n;var i=le(n),o=le(e);return vi(i,Zn(i,o),Jn(i,o)+1).join("")},Le.trimEnd=function(n,e,r){if((n=yu(n))&&(r||e===t))return n.slice(0,he(n)+1);if(!n||!(e=oi(e)))return n;var i=le(n);return vi(i,0,Jn(i,le(e))+1).join("")},Le.trimStart=function(n,e,r){if((n=yu(n))&&(r||e===t))return n.replace(tt,"");if(!n||!(e=oi(e)))return n;var i=le(n);return vi(i,Zn(i,le(e))).join("")},Le.truncate=function(n,e){var r=30,i="...";if(Zs(e)){var o="separator"in e?e.separator:o;r="length"in e?fu(e.length):r,i="omission"in e?oi(e.omission):i}var s=(n=yu(n)).length;if(re(n)){var u=le(n);s=u.length}if(r>=s)return n;var a=r-ce(i);if(a<1)return i;var c=u?vi(u,0,a).join(""):n.slice(0,a);if(o===t)return c+i;if(u&&(a+=c.length-a),ru(o)){if(n.slice(a).search(o)){var l,h=c;for(o.global||(o=Ft(o.source,yu(ct.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var f=l.index;c=c.slice(0,f===t?a:f)}}else if(n.indexOf(oi(o),a)!=a){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+i},Le.unescape=function(t){return(t=yu(t))&&q.test(t)?t.replace(G,fe):t},Le.uniqueId=function(t){var n=++Nt;return yu(t)+n},Le.upperCase=Vu,Le.upperFirst=Hu,Le.each=ys,Le.eachRight=vs,Le.first=qo,oa(Le,(ma={},vr(Le,(function(t,n){Ct.call(Le.prototype,n)||(ma[n]=t)})),ma),{chain:!1}),Le.VERSION="4.17.21",Sn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Le[t].placeholder=Le})),Sn(["drop","take"],(function(n,e){Ue.prototype[n]=function(r){r=r===t?1:me(fu(r),0);var i=this.__filtered__&&!e?new Ue(this):this.clone();return i.__filtered__?i.__takeCount__=ye(r,i.__takeCount__):i.__views__.push({size:ye(r,l),type:n+(i.__dir__<0?"Right":"")}),i},Ue.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),Sn(["filter","map","takeWhile"],(function(t,n){var e=n+1,r=1==e||3==e;Ue.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:io(t,3),type:e}),n.__filtered__=n.__filtered__||r,n}})),Sn(["head","last"],(function(t,n){var e="take"+(n?"Right":"");Ue.prototype[t]=function(){return this[e](1).value()[0]}})),Sn(["initial","tail"],(function(t,n){var e="drop"+(n?"":"Right");Ue.prototype[t]=function(){return this.__filtered__?new Ue(this):this[e](1)}})),Ue.prototype.compact=function(){return this.filter(na)},Ue.prototype.find=function(t){return this.filter(t).head()},Ue.prototype.findLast=function(t){return this.reverse().find(t)},Ue.prototype.invokeMap=Yr((function(t,n){return"function"==typeof t?new Ue(this):this.map((function(e){return Mr(e,t,n)}))})),Ue.prototype.reject=function(t){return this.filter(Ns(io(t)))},Ue.prototype.slice=function(n,e){n=fu(n);var r=this;return r.__filtered__&&(n>0||e<0)?new Ue(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),e!==t&&(r=(e=fu(e))<0?r.dropRight(-e):r.take(e-n)),r)},Ue.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ue.prototype.toArray=function(){return this.take(l)},vr(Ue.prototype,(function(n,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Le[i?"take"+("last"==e?"Right":""):e],s=i||/^find/.test(e);o&&(Le.prototype[e]=function(){var e=this.__wrapped__,u=i?[1]:arguments,a=e instanceof Ue,c=u[0],l=a||Gs(e),h=function(t){var n=o.apply(Le,_n([t],u));return i&&f?n[0]:n};l&&r&&"function"==typeof c&&1!=c.length&&(a=l=!1);var f=this.__chain__,p=s&&!f,d=a&&!this.__actions__.length;if(!s&&l){e=d?e:new Ue(this);var m=n.apply(e,u);return m.__actions__.push({func:hs,args:[h],thisArg:t}),new ze(m,f)}return p&&d?n.apply(this,u):(m=this.thru(h),p?i?m.value()[0]:m.value():m)})})),Sn(["pop","push","shift","sort","splice","unshift"],(function(t){var n=kt[t],e=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Le.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return n.apply(Gs(i)?i:[],t)}return this[e]((function(e){return n.apply(Gs(e)?e:[],t)}))}})),vr(Ue.prototype,(function(t,n){var e=Le[n];if(e){var r=e.name+"";Ct.call(ke,r)||(ke[r]=[]),ke[r].push({name:n,func:e})}})),ke[Pi(t,2).name]=[{name:"wrapper",func:t}],Ue.prototype.clone=function(){var t=new Ue(this.__wrapped__);return t.__actions__=Fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Fi(this.__views__),t},Ue.prototype.reverse=function(){if(this.__filtered__){var t=new Ue(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ue.prototype.value=function(){var t=this.__wrapped__.value(),n=this.__dir__,e=Gs(t),r=n<0,i=e?t.length:0,o=function(t,n,e){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":n-=s;break;case"take":n=ye(n,t+s);break;case"takeRight":t=me(t,n-s)}}return{start:t,end:n}}(0,i,this.__views__),s=o.start,u=o.end,a=u-s,c=r?u:s-1,l=this.__iteratees__,h=l.length,f=0,p=ye(a,this.__takeCount__);if(!e||!r&&i==a&&p==a)return li(t,this.__actions__);var d=[];t:for(;a--&&f<p;){for(var m=-1,y=t[c+=n];++m<h;){var v=l[m],b=v.type,g=(0,v.iteratee)(y);if(2==b)y=g;else if(!g){if(1==b)continue t;break t}}d[f++]=y}return d},Le.prototype.at=fs,Le.prototype.chain=function(){return ls(this)},Le.prototype.commit=function(){return new ze(this.value(),this.__chain__)},Le.prototype.next=function(){this.__values__===t&&(this.__values__=lu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?t:this.__values__[this.__index__++]}},Le.prototype.plant=function(n){for(var e,r=this;r instanceof $e;){var i=Lo(r);i.__index__=0,i.__values__=t,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=n,e},Le.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ue){var e=n;return this.__actions__.length&&(e=new Ue(this)),(e=e.reverse()).__actions__.push({func:hs,args:[Zo],thisArg:t}),new ze(e,this.__chain__)}return this.thru(Zo)},Le.prototype.toJSON=Le.prototype.valueOf=Le.prototype.value=function(){return li(this.__wrapped__,this.__actions__)},Le.prototype.first=Le.prototype.head,Qt&&(Le.prototype[Qt]=function(){return this}),Le}();hn?((hn.exports=pe)._=pe,ln._=pe):cn._=pe}.call($n.exports)),$n.exports);
|
|
1
|
+
import{transformTag as t,proxyCustomElement as n,HTMLElement as e,createEvent as r,h as i}from"@stencil/core/internal/client";import{c as o,g as s,a as u}from"./_commonjsHelpers.js";import{l as a}from"./logger.js";import{M as c}from"./messages.js";import{V as l}from"./events.js";function h(t){return null!=t&&"number"==typeof t.valueOf()}function f(t){return null!=t&&"boolean"==typeof t.valueOf()}const p=t=>x(t)||d(t),d=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||h(t)||f(t)||null===t,m=t=>y(t)||v(t)||w(t)||b(t)||w(t)||f(t),y=t=>{const n=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===n&&(t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t))(t[0])&&p(t[1])&&p(t[2])&&("<=x<="!==t[0]||h(t[3]))},v=t=>Array.isArray(t)&&t.length>=3&&(t=>["&&","||"].includes(t))(t[0])&&t.every(((t,n)=>0===n||m(t))),b=t=>Array.isArray(t)&&2===t.length&&(t=>"!"===t)(t[0])&&m(t[1]),g=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(t?.name),w=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(t?.name),x=t=>w(t)||g(t)||(t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(t?.name))(t)||(t=>["case","property","step"].includes(t?.name))(t),E=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",S=new RegExp("^["+E+"]["+E+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function O(t,n){const e=[];let r=n.exec(t);for(;r;){const i=[];i.startIndex=n.lastIndex-r[0].length;const o=r.length;for(let t=0;t<o;t++)i.push(r[t]);e.push(i),r=n.exec(t)}return e}const F=function(t){return!(null==S.exec(t))},T=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],M=["__proto__","constructor","prototype"],k={allowBooleanAttributes:!1,unpairedTags:[]};function I(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function _(t,n){const e=n;for(;n<t.length;n++)if("?"!=t[n]&&" "!=t[n]);else{const r=t.substr(e,n-e);if(n>5&&"xml"===r)return P("InvalidXml","XML declaration allowed only at the start of the document.",R(t,n));if("?"==t[n]&&">"==t[n+1]){n++;break}}return n}function A(t,n){if(t.length>n+5&&"-"===t[n+1]&&"-"===t[n+2]){for(n+=3;n<t.length;n++)if("-"===t[n]&&"-"===t[n+1]&&">"===t[n+2]){n+=2;break}}else if(t.length>n+8&&"D"===t[n+1]&&"O"===t[n+2]&&"C"===t[n+3]&&"T"===t[n+4]&&"Y"===t[n+5]&&"P"===t[n+6]&&"E"===t[n+7]){let e=1;for(n+=8;n<t.length;n++)if("<"===t[n])e++;else if(">"===t[n]&&(e--,0===e))break}else if(t.length>n+9&&"["===t[n+1]&&"C"===t[n+2]&&"D"===t[n+3]&&"A"===t[n+4]&&"T"===t[n+5]&&"A"===t[n+6]&&"["===t[n+7])for(n+=8;n<t.length;n++)if("]"===t[n]&&"]"===t[n+1]&&">"===t[n+2]){n+=2;break}return n}function C(t,n){let e="",r="",i=!1;for(;n<t.length;n++){if('"'===t[n]||"'"===t[n])""===r?r=t[n]:r!==t[n]||(r="");else if(">"===t[n]&&""===r){i=!0;break}e+=t[n]}return""===r&&{value:e,index:n,tagClosed:i}}const N=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function D(t,n){const e=O(t,N),r={};for(let t=0;t<e.length;t++){if(0===e[t][1].length)return P("InvalidAttr","Attribute '"+e[t][2]+"' has no space in starting.",$(e[t]));if(void 0!==e[t][3]&&void 0===e[t][4])return P("InvalidAttr","Attribute '"+e[t][2]+"' is without value.",$(e[t]));if(void 0===e[t][3]&&!n.allowBooleanAttributes)return P("InvalidAttr","boolean attribute '"+e[t][2]+"' is not allowed.",$(e[t]));const i=e[t][2];if(!L(i))return P("InvalidAttr","Attribute '"+i+"' is an invalid name.",$(e[t]));if(Object.prototype.hasOwnProperty.call(r,i))return P("InvalidAttr","Attribute '"+i+"' is repeated.",$(e[t]));r[i]=1}return!0}function j(t,n){if(";"===t[++n])return-1;if("#"===t[n])return function(t,n){let e=/\d/;for("x"===t[n]&&(n++,e=/[\da-fA-F]/);n<t.length;n++){if(";"===t[n])return n;if(!t[n].match(e))break}return-1}(t,++n);let e=0;for(;n<t.length;n++,e++)if(!(t[n].match(/\w/)&&e<20)){if(";"===t[n])break;return-1}return n}function P(t,n,e){return{err:{code:t,msg:n,line:e.line||e,col:e.col}}}function L(t){return F(t)}function R(t,n){const e=t.substring(0,n).split(/\r?\n/);return{line:e.length,col:e[e.length-1].length+1}}function $(t){return t.startIndex+t[1].length}const z=t=>T.includes(t)?"__"+t:t,U={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,n){return n},attributeValueProcessor:function(t,n){return n},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:z};function G(t,n){if("string"!=typeof t)return;const e=t.toLowerCase();if(T.some((t=>e===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${n}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(M.some((t=>e===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${n}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function B(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??10),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1e3),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??100),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:B(!0)}const q=function(t){const n=Object.assign({},U,t),e=[{value:n.attributeNamePrefix,name:"attributeNamePrefix"},{value:n.attributesGroupName,name:"attributesGroupName"},{value:n.textNodeName,name:"textNodeName"},{value:n.cdataPropName,name:"cdataPropName"},{value:n.commentPropName,name:"commentPropName"}];for(const{value:t,name:n}of e)t&&G(t,n);return null===n.onDangerousProperty&&(n.onDangerousProperty=z),n.processEntities=B(n.processEntities),n.stopNodes&&Array.isArray(n.stopNodes)&&(n.stopNodes=n.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),n};let W;W="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class Y{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,n){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==n&&(this.child[this.child.length-1][W]={startIndex:n})}static getMetaDataSymbol(){return W}}class V{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const e=Object.create(null);let r=0;if("O"!==t[n+3]||"C"!==t[n+4]||"T"!==t[n+5]||"Y"!==t[n+6]||"P"!==t[n+7]||"E"!==t[n+8])throw new Error("Invalid Tag instead of DOCTYPE");{n+=9;let i=1,o=!1,s=!1;for(;n<t.length;n++)if("<"!==t[n]||s)if(">"===t[n]){if(s?"-"===t[n-1]&&"-"===t[n-2]&&(s=!1,i--):i--,0===i)break}else"["===t[n]&&(o=!0);else{if(o&&K(t,"!ENTITY",n)){let i,o;if(n+=7,[i,o,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),-1===o.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&r>=this.options.maxEntityCount)throw new Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e[i]={regx:RegExp(`&${t};`,"g"),val:o},r++}}else if(o&&K(t,"!ELEMENT",n)){n+=8;const{index:e}=this.readElementExp(t,n+1);n=e}else if(o&&K(t,"!ATTLIST",n))n+=8;else if(o&&K(t,"!NOTATION",n)){n+=9;const{index:e}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=e}else{if(!K(t,"!--",n))throw new Error("Invalid DOCTYPE");s=!0}i++}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:e,i:n}}readEntityExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n])&&'"'!==t[n]&&"'"!==t[n];)n++;let r=t.substring(e,n);if(X(r),n=H(t,n),!this.suppressValidationErr){if("SYSTEM"===t.substring(n,n+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[n])throw new Error("Parameter entities are not supported")}let i="";if([n,i]=this.readIdentifierVal(t,n,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[r,i,--n]}readNotationExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);!this.suppressValidationErr&&X(r),n=H(t,n);const i=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n=H(t,n+=i.length);let o=null,s=null;if("PUBLIC"===i)[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),'"'!==t[n=H(t,n)]&&"'"!==t[n]||([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if("SYSTEM"===i&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,e){let r="";const i=t[n];if('"'!==i&&"'"!==i)throw new Error(`Expected quoted string, found "${i}"`);const o=++n;for(;n<t.length&&t[n]!==i;)n++;if(r=t.substring(o,n),t[n]!==i)throw new Error(`Unterminated ${e} value`);return[++n,r]}readElementExp(t,n){const e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);if(!this.suppressValidationErr&&!F(r))throw new Error(`Invalid element name: "${r}"`);let i="";if("E"===t[n=H(t,n)]&&K(t,"MPTY",n))n+=4;else if("A"===t[n]&&K(t,"NY",n))n+=2;else if("("===t[n]){const e=++n;for(;n<t.length&&")"!==t[n];)n++;if(i=t.substring(e,n),")"!==t[n])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:i.trim(),index:n}}readAttlistExp(t,n){let e=n=H(t,n);for(;n<t.length&&!/\s/.test(t[n]);)n++;let r=t.substring(e,n);for(X(r),e=n=H(t,n);n<t.length&&!/\s/.test(t[n]);)n++;let i=t.substring(e,n);if(!X(i))throw new Error(`Invalid attribute name: "${i}"`);n=H(t,n);let o="";if("NOTATION"===t.substring(n,n+8).toUpperCase()){if(o="NOTATION","("!==t[n=H(t,n+=8)])throw new Error(`Expected '(', found "${t[n]}"`);n++;let e=[];for(;n<t.length&&")"!==t[n];){const r=n;for(;n<t.length&&"|"!==t[n]&&")"!==t[n];)n++;let i=t.substring(r,n);if(i=i.trim(),!X(i))throw new Error(`Invalid notation name: "${i}"`);e.push(i),"|"===t[n]&&(n++,n=H(t,n))}if(")"!==t[n])throw new Error("Unterminated list of notations");n++,o+=" ("+e.join("|")+")"}else{const e=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;if(o+=t.substring(e,n),!this.suppressValidationErr&&!["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"].includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=H(t,n);let s="";return"#REQUIRED"===t.substring(n,n+8).toUpperCase()?(s="#REQUIRED",n+=8):"#IMPLIED"===t.substring(n,n+7).toUpperCase()?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:i,attributeType:o,defaultValue:s,index:n}}}const H=(t,n)=>{for(;n<t.length&&/\s/.test(t[n]);)n++;return n};function K(t,n,e){for(let r=0;r<n.length;r++)if(n[r]!==t[e+r+1])return!1;return!0}function X(t){if(F(t))return t;throw new Error(`Invalid entity name ${t}`)}const Q=/^[-+]?0x[a-fA-F0-9]+$/,Z=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,J={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};const tt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class nt{constructor(t,n={}){this.pattern=t,this.separator=n.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some((t=>"deep-wildcard"===t.type)),this._hasAttributeCondition=this.segments.some((t=>void 0!==t.attrName)),this._hasPositionSelector=this.segments.some((t=>void 0!==t.position))}_parse(t){const n=[];let e=0,r="";for(;e<t.length;)t[e]===this.separator?e+1<t.length&&t[e+1]===this.separator?(r.trim()&&(n.push(this._parseSegment(r.trim())),r=""),n.push({type:"deep-wildcard"}),e+=2):(r.trim()&&n.push(this._parseSegment(r.trim())),r="",e++):(r+=t[e],e++);return r.trim()&&n.push(this._parseSegment(r.trim())),n}_parseSegment(t){const n={type:"tag"};let e=null,r=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){const t=i[2].slice(1,-1);t&&(e=t)}let o,s,u=r;if(r.includes("::")){const n=r.indexOf("::");if(o=r.substring(0,n).trim(),u=r.substring(n+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${t}`)}let a=null;if(u.includes(":")){const t=u.lastIndexOf(":"),n=u.substring(0,t).trim(),e=u.substring(t+1).trim();["first","last","odd","even"].includes(e)||/^nth\(\d+\)$/.test(e)?(s=n,a=e):s=u}else s=u;if(!s)throw new Error(`Invalid segment pattern: ${t}`);if(n.tag=s,o&&(n.namespace=o),e)if(e.includes("=")){const t=e.indexOf("=");n.attrName=e.substring(0,t).trim(),n.attrValue=e.substring(t+1).trim()}else n.attrName=e.trim();if(a){const t=a.match(/^nth\((\d+)\)$/);t?(n.position="nth",n.positionValue=parseInt(t[1],10)):n.position=a}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}const et=new Set(["push","pop","reset","updateCurrent","restore"]);class rt{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,n=null,e=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;this.siblingStacks[r]||(this.siblingStacks[r]=new Map);const i=this.siblingStacks[r],o=e?`${e}:${t}`:t,s=i.get(o)||0;let u=0;for(const t of i.values())u+=t;i.set(o,s+1);const a={tag:t,position:u,counter:s};null!=e&&(a.namespace=e),null!=n&&(a.values=n),this.path.push(a)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){this.path.length>0&&null!=t&&(this.path[this.path.length-1].values=t)}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const n=this.path[this.path.length-1];return n.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const n=this.path[this.path.length-1];return void 0!==n.values&&t in n.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,n=!0){const e=t||this.separator;return this.path.map((t=>n&&t.namespace?`${t.namespace}:${t.tag}`:t.tag)).join(e)}toArray(){return this.path.map((t=>t.tag))}reset(){this.path=[],this.siblingStacks=[]}matches(t){const n=t.segments;return 0!==n.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(!this._matchSegment(t[n],this.path[n],n===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let n=this.path.length-1,e=t.length-1;for(;e>=0&&n>=0;){const r=t[e];if("deep-wildcard"===r.type){if(e--,e<0)return!0;const r=t[e];let i=!1;for(let t=n;t>=0;t--)if(this._matchSegment(r,this.path[t],t===this.path.length-1)){n=t-1,e--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[n],n===this.path.length-1))return!1;n--,e--}}return e<0}_matchSegment(t,n,e){if("*"!==t.tag&&t.tag!==n.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==n.namespace)return!1;if(void 0!==t.attrName){if(!e)return!1;if(!n.values||!(t.attrName in n.values))return!1;if(void 0!==t.attrValue&&String(n.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!e)return!1;const r=n.counter??0;if("first"===t.position&&0!==r)return!1;if("odd"===t.position&&r%2!=1)return!1;if("even"===t.position&&r%2!=0)return!1;if("nth"===t.position&&r!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map((t=>({...t}))),siblingStacks:this.siblingStacks.map((t=>new Map(t)))}}restore(t){this.path=t.path.map((t=>({...t}))),this.siblingStacks=t.siblingStacks.map((t=>new Map(t)))}readOnly(){return new Proxy(this,{get(t,n,e){if(et.has(n))return()=>{throw new TypeError(`Cannot call '${n}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const r=Reflect.get(t,n,e);return"path"===n||"siblingStacks"===n?Object.freeze(Array.isArray(r)?r.map((t=>t instanceof Map?Object.freeze(new Map(t)):Object.freeze({...t}))):r):"function"==typeof r?r.bind(t):r},set(t,n){throw new TypeError(`Cannot set property '${String(n)}' on a read-only Matcher.`)},deleteProperty(t,n){throw new TypeError(`Cannot delete property '${String(n)}' from a read-only Matcher.`)}})}}function it(t,n){if(!t)return{};const e=n.attributesGroupName?t[n.attributesGroupName]:t;if(!e)return{};const r={};for(const t in e)t.startsWith(n.attributeNamePrefix)?r[t.substring(n.attributeNamePrefix.length)]=e[t]:r[t]=e[t];return r}function ot(t){if(!t||"string"!=typeof t)return;const n=t.indexOf(":");if(-1!==n&&n>0){const e=t.substring(0,n);if("xmlns"!==e)return e}}class st{constructor(t){var n;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,n)=>xt(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,n)=>xt(n,16,"&#x")}},this.addExternalEntities=ut,this.parseXml=ft,this.parseTextData=at,this.resolveNameSpace=ct,this.buildAttributesMap=ht,this.isItStopNode=yt,this.replaceEntitiesValue=dt,this.readStopNodeData=gt,this.saveTextToParentTag=mt,this.addChild=pt,this.ignoreAttributesFn="function"==typeof(n=this.options.ignoreAttributes)?n:Array.isArray(n)?t=>{for(const e of n){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new rt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];"string"==typeof n?this.stopNodeExpressions.push(new nt(n)):n instanceof nt&&this.stopNodeExpressions.push(n)}}}}function ut(t){const n=Object.keys(t);for(let e=0;e<n.length;e++){const r=n[e],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:t[r]}}}function at(t,n,e,r,i,o,s){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t,n,e));const r=this.options.jPath?e.toString():e,u=this.options.tagValueProcessor(n,t,r,i,o);return null==u?t:typeof u!=typeof t||u!==t?u:this.options.trimValues||t.trim()===t?wt(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function ct(t){if(this.options.removeNSPrefix){const n=t.split(":"),e="/"===t.charAt(0)?"/":"";if("xmlns"===n[0])return"";2===n.length&&(t=e+n[1])}return t}const lt=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function ht(t,n,e){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const r=O(t,lt),i=r.length,o={},s={};for(let t=0;t<i;t++){const n=this.resolveNameSpace(r[t][1]),i=r[t][4];if(n.length&&void 0!==i){let t=i;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,e,this.readonlyMatcher),s[n]=t}}Object.keys(s).length>0&&"object"==typeof n&&n.updateCurrent&&n.updateCurrent(s);for(let t=0;t<i;t++){const i=this.resolveNameSpace(r[t][1]),s=this.options.jPath?n.toString():this.readonlyMatcher;if(this.ignoreAttributesFn(i,s))continue;let u=r[t][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),a=St(a,this.options),void 0!==u){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,e,this.readonlyMatcher);const t=this.options.jPath?n.toString():this.readonlyMatcher,r=this.options.attributeValueProcessor(i,u,t);o[a]=null==r?u:typeof r!=typeof u||r!==u?r:wt(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const ft=function(t){t=t.replace(/\r\n?/g,"\n");const n=new Y("!xml");let e=n,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const i=new V(this.options.processEntities);for(let o=0;o<t.length;o++)if("<"===t[o])if("/"===t[o+1]){const n=vt(t,">",o,"Closing Tag is not closed.");let i=t.substring(o+2,n).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}i=Et(this.options.transformTagName,i,"",this.options).tagName,e&&(r=this.saveTextToParentTag(r,e,this.readonlyMatcher));const s=this.matcher.getCurrentTag();if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);s&&-1!==this.options.unpairedTags.indexOf(s)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,e=this.tagsNodeStack.pop(),r="",o=n}else if("?"===t[o+1]){let n=bt(t,o,!1,"?>");if(!n)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,e,this.readonlyMatcher),this.options.ignoreDeclaration&&"?xml"===n.tagName||this.options.ignorePiTags);else{const t=new Y(n.tagName);t.add(this.options.textNodeName,""),n.tagName!==n.tagExp&&n.attrExpPresent&&(t[":@"]=this.buildAttributesMap(n.tagExp,this.matcher,n.tagName)),this.addChild(e,t,this.readonlyMatcher,o)}o=n.closeIndex+1}else if("!--"===t.substr(o+1,3)){const n=vt(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(o+4,n-2);r=this.saveTextToParentTag(r,e,this.readonlyMatcher),e.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}o=n}else if("!D"===t.substr(o+1,2)){const n=i.readDocType(t,o);this.docTypeEntities=n.entities,o=n.i}else if("!["===t.substr(o+1,2)){const n=vt(t,"]]>",o,"CDATA is not closed.")-2,i=t.substring(o+9,n);r=this.saveTextToParentTag(r,e,this.readonlyMatcher);let s=this.parseTextData(i,e.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?e.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):e.add(this.options.textNodeName,s),o=n+2}else{let i=bt(t,o,this.options.removeNSPrefix);if(!i){const n=t.substring(Math.max(0,o-50),Math.min(t.length,o+50));throw new Error(`readTagExp returned undefined at position ${o}. Context: "${n}"`)}let s=i.tagName;const u=i.rawTagName;let a=i.tagExp,c=i.attrExpPresent,l=i.closeIndex;if(({tagName:s,tagExp:a}=Et(this.options.transformTagName,s,a,this.options)),this.options.strictReservedNames&&(s===this.options.commentPropName||s===this.options.cdataPropName||s===this.options.textNodeName||s===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${s}`);e&&r&&"!xml"!==e.tagname&&(r=this.saveTextToParentTag(r,e,this.readonlyMatcher,!1)),e&&-1!==this.options.unpairedTags.indexOf(e.tagname)&&(e=this.tagsNodeStack.pop(),this.matcher.pop());let h=!1;a.length>0&&a.lastIndexOf("/")===a.length-1&&(h=!0,"/"===s[s.length-1]?(s=s.substr(0,s.length-1),a=s):a=a.substr(0,a.length-1),c=s!==a);let f,p=null;f=ot(u),s!==n.tagname&&this.matcher.push(s,{},f),s!==a&&c&&(p=this.buildAttributesMap(a,this.matcher,s),p&&it(p,this.options)),s!==n.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const d=o;if(this.isCurrentNodeStopNode){let n="";if(h)o=i.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(s))o=i.closeIndex;else{const e=this.readStopNodeData(t,u,l+1);if(!e)throw new Error(`Unexpected end of ${u}`);o=e.i,n=e.tagContent}const r=new Y(s);p&&(r[":@"]=p),r.add(this.options.textNodeName,n),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(e,r,this.readonlyMatcher,d)}else{if(h){({tagName:s,tagExp:a}=Et(this.options.transformTagName,s,a,this.options));const t=new Y(s);p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(s)){const t=new Y(s);p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),this.matcher.pop(),this.isCurrentNodeStopNode=!1,o=i.closeIndex;continue}{const t=new Y(s);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(e),p&&(t[":@"]=p),this.addChild(e,t,this.readonlyMatcher,d),e=t}}r="",o=l}}else r+=t[o];return n.child};function pt(t,n,e,r){this.options.captureMetaData||(r=void 0);const i=this.options.jPath?e.toString():e,o=this.options.updateTag(n.tagname,i,n[":@"]);!1===o||("string"==typeof o?(n.tagname=o,t.addChild(n,r)):t.addChild(n,r))}function dt(t,n,e){const r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){const i=this.options.jPath?e.toString():e;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(n):r.allowedTags(n,i)))return t}if(r.tagFilter){const i=this.options.jPath?e.toString():e;if(!r.tagFilter(n,i))return t}for(const n of Object.keys(this.docTypeEntities)){const e=this.docTypeEntities[n],i=t.match(e.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const n=t.length;if(t=t.replace(e.regx,e.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-n,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}for(const n of Object.keys(this.lastEntities)){const e=this.lastEntities[n],i=t.match(e.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(e.regex,e.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(const n of Object.keys(this.htmlEntities)){const e=this.htmlEntities[n],i=t.match(e.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(e.regex,e.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function mt(t,n,e,r){return t&&(void 0===r&&(r=0===n.child.length),void 0!==(t=this.parseTextData(t,n.tagname,e,!1,!!n[":@"]&&0!==Object.keys(n[":@"]).length,r))&&""!==t&&n.add(this.options.textNodeName,t),t=""),t}function yt(t,n){if(!t||0===t.length)return!1;for(let e=0;e<t.length;e++)if(n.matches(t[e]))return!0;return!1}function vt(t,n,e,r){const i=t.indexOf(n,e);if(-1===i)throw new Error(r);return i+n.length-1}function bt(t,n,e,r=">"){const i=function(t,n,e=">"){let r,i="";for(let o=n;o<t.length;o++){let n=t[o];if(r)n===r&&(r="");else if('"'===n||"'"===n)r=n;else if(n===e[0]){if(!e[1])return{data:i,index:o};if(t[o+1]===e[1])return{data:i,index:o}}else"\t"===n&&(n=" ");i+=n}}(t,n+1,r);if(!i)return;let o=i.data;const s=i.index,u=o.search(/\s/);let a=o,c=!0;-1!==u&&(a=o.substring(0,u),o=o.substring(u+1).trimStart());const l=a;if(e){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1),c=a!==i.data.substr(t+1))}return{tagName:a,tagExp:o,closeIndex:s,attrExpPresent:c,rawTagName:l}}function gt(t,n,e){const r=e;let i=1;for(;e<t.length;e++)if("<"===t[e])if("/"===t[e+1]){const o=vt(t,">",e,`${n} is not closed`);if(t.substring(e+2,o).trim()===n&&(i--,0===i))return{tagContent:t.substring(r,e),i:o};e=o}else if("?"===t[e+1])e=vt(t,"?>",e+1,"StopNode is not closed.");else if("!--"===t.substr(e+1,3))e=vt(t,"--\x3e",e+3,"StopNode is not closed.");else if("!["===t.substr(e+1,2))e=vt(t,"]]>",e,"StopNode is not closed.")-2;else{const r=bt(t,e,">");r&&((r&&r.tagName)===n&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,e=r.closeIndex)}}function wt(t,n,e){if(n&&"string"==typeof t){const n=t.trim();return"true"===n||"false"!==n&&function(t,n={}){if(n=Object.assign({},J,n),!t||"string"!=typeof t)return t;let e=t.trim();if(0===e.length)return t;if(void 0!==n.skipLike&&n.skipLike.test(e))return t;if("0"===e)return 0;if(n.hex&&Q.test(e))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(e);if(isFinite(e)){if(e.includes("e")||e.includes("E"))return function(t,n,e){if(!e.eNotation)return t;const r=n.match(tt);if(r){let i=r[1]||"";const o=-1===r[3].indexOf("e")?"E":"e",s=r[2],u=i?t[s.length+1]===o:t[s.length]===o;return s.length>1&&u?t:(1!==s.length||!r[3].startsWith(`.${o}`)&&r[3][0]!==o)&&s.length>0?e.leadingZeros&&!u?(n=(r[1]||"")+r[3],Number(n)):t:Number(n)}return t}(t,e,n);{const i=Z.exec(e);if(i){const o=i[1]||"",s=i[2];let u=(r=i[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substring(0,r.length-1)),r):r;if(!n.leadingZeros&&(s.length>1||1===s.length&&!(o?"."===t[s.length+1]:"."===t[s.length])))return t;{const r=Number(e),i=String(r);if(0===r)return r;if(-1!==i.search(/[eE]/))return n.eNotation?r:t;if(-1!==e.indexOf("."))return"0"===i||i===u||i===`${o}${u}`?r:t;let a=s?u:e;return s?a===i||o+a===i?r:t:a===i||a===o+i?r:t}}return t}}var r;return function(t,n,e){const r=n===1/0;switch(e.infinity.toLowerCase()){case"null":return null;case"infinity":return n;case"string":return r?"Infinity":"-Infinity";default:return t}}(t,Number(e),n)}(t,e)}return function(t){return void 0!==t}(t)?t:""}function xt(t,n,e){const r=Number.parseInt(t,n);return r>=0&&r<=1114111?String.fromCodePoint(r):e+t+";"}function Et(t,n,e,r){if(t){const r=t(n);e===n&&(e=r),n=r}return{tagName:n=St(n,r),tagExp:e}}function St(t,n){if(M.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return T.includes(t)?n.onDangerousProperty(t):t}const Ot=Y.getMetaDataSymbol();function Ft(t,n){if(!t||"object"!=typeof t)return{};if(!n)return t;const e={};for(const r in t)r.startsWith(n)?e[r.substring(n.length)]=t[r]:e[r]=t[r];return e}function Tt(t,n,e,r){return Mt(t,n,e,r)}function Mt(t,n,e,r){let i;const o={};for(let s=0;s<t.length;s++){const u=t[s],a=kt(u);if(void 0!==a&&a!==n.textNodeName){const t=Ft(u[":@"]||{},n.attributeNamePrefix);e.push(a,t)}if(a===n.textNodeName)void 0===i?i=u[a]:i+=""+u[a];else{if(void 0===a)continue;if(u[a]){let t=Mt(u[a],n,e,r);const i=_t(t,n);if(u[":@"]?It(t,u[":@"],r,n):1!==Object.keys(t).length||void 0===t[n.textNodeName]||n.alwaysCreateTextNode?0===Object.keys(t).length&&(n.alwaysCreateTextNode?t[n.textNodeName]="":t=""):t=t[n.textNodeName],void 0!==u[Ot]&&"object"==typeof t&&null!==t&&(t[Ot]=u[Ot]),void 0!==o[a]&&Object.prototype.hasOwnProperty.call(o,a))Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(t);else{const e=n.jPath?r.toString():r;o[a]=n.isArray(a,e,i)?[t]:t}void 0!==a&&a!==n.textNodeName&&e.pop()}}}return"string"==typeof i?i.length>0&&(o[n.textNodeName]=i):void 0!==i&&(o[n.textNodeName]=i),o}function kt(t){const n=Object.keys(t);for(let t=0;t<n.length;t++){const e=n[t];if(":@"!==e)return e}}function It(t,n,e,r){if(n){const i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const o=i[s],u=o.startsWith(r.attributeNamePrefix)?o.substring(r.attributeNamePrefix.length):o,a=r.jPath?e.toString()+"."+u:e;t[o]=r.isArray(o,a,!0,!0)?[n[o]]:n[o]}}}function _t(t,n){const{textNodeName:e}=n,r=Object.keys(t).length;return 0===r||!(1!==r||!t[e]&&"boolean"!=typeof t[e]&&0!==t[e])}class At{constructor(t){this.externalEntities={},this.options=q(t)}parse(t,n){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(n){!0===n&&(n={});const e=function(t,n){n=Object.assign({},k,n);const e=[];let r=!1,i=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let o=0;o<t.length;o++)if("<"===t[o]&&"?"===t[o+1]){if(o+=2,o=_(t,o),o.err)return o}else{if("<"!==t[o]){if(I(t[o]))continue;return P("InvalidChar","char '"+t[o]+"' is not expected.",R(t,o))}{let s=o;if(o++,"!"===t[o]){o=A(t,o);continue}{let u=!1;"/"===t[o]&&(u=!0,o++);let a="";for(;o<t.length&&">"!==t[o]&&" "!==t[o]&&"\t"!==t[o]&&"\n"!==t[o]&&"\r"!==t[o];o++)a+=t[o];if(a=a.trim(),"/"===a[a.length-1]&&(a=a.substring(0,a.length-1),o--),!F(a)){let n;return n=0===a.trim().length?"Invalid space after '<'.":"Tag '"+a+"' is an invalid name.",P("InvalidTag",n,R(t,o))}const c=C(t,o);if(!1===c)return P("InvalidAttr","Attributes for '"+a+"' have open quote.",R(t,o));let l=c.value;if(o=c.index,"/"===l[l.length-1]){const e=o-l.length;l=l.substring(0,l.length-1);const i=D(l,n);if(!0!==i)return P(i.err.code,i.err.msg,R(t,e+i.err.line));r=!0}else if(u){if(!c.tagClosed)return P("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",R(t,o));if(l.trim().length>0)return P("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",R(t,s));if(0===e.length)return P("InvalidTag","Closing tag '"+a+"' has not been opened.",R(t,s));{const n=e.pop();if(a!==n.tagName){let e=R(t,n.tagStartPos);return P("InvalidTag","Expected closing tag '"+n.tagName+"' (opened in line "+e.line+", col "+e.col+") instead of closing tag '"+a+"'.",R(t,s))}0==e.length&&(i=!0)}}else{const u=D(l,n);if(!0!==u)return P(u.err.code,u.err.msg,R(t,o-l.length+u.err.line));if(!0===i)return P("InvalidXml","Multiple possible root nodes found.",R(t,o));-1!==n.unpairedTags.indexOf(a)||e.push({tagName:a,tagStartPos:s}),r=!0}for(o++;o<t.length;o++)if("<"===t[o]){if("!"===t[o+1]){o++,o=A(t,o);continue}if("?"!==t[o+1])break;if(o=_(t,++o),o.err)return o}else if("&"===t[o]){const n=j(t,o);if(-1==n)return P("InvalidChar","char '&' is not expected.",R(t,o));o=n}else if(!0===i&&!I(t[o]))return P("InvalidXml","Extra text at the end",R(t,o));"<"===t[o]&&o--}}}return r?1==e.length?P("InvalidTag","Unclosed tag '"+e[0].tagName+"'.",R(t,e[0].tagStartPos)):!(e.length>0)||P("InvalidXml","Invalid '"+JSON.stringify(e.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):P("InvalidXml","Start tag expected.",1)}(t,n);if(!0!==e)throw Error(`${e.err.msg}:${e.err.line}:${e.err.col}`)}const e=new st(this.options);e.addExternalEntities(this.externalEntities);const r=e.parseXml(t);return this.options.preserveOrder||void 0===r?r:Tt(r,this.options,e.matcher,e.readonlyMatcher)}addEntity(t,n){if(-1!==n.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===n)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Y.getMetaDataSymbol()}}function Ct(t,n){let e="";n.format&&n.indentBy.length>0&&(e="\n");const r=[];if(n.stopNodes&&Array.isArray(n.stopNodes))for(let t=0;t<n.stopNodes.length;t++){const e=n.stopNodes[t];"string"==typeof e?r.push(new nt(e)):e instanceof nt&&r.push(e)}return Nt(t,n,e,new rt,r)}function Nt(t,n,e,r,i){let o="",s=!1;if(n.maxNestedTags&&r.getDepth()>n.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let e=t.toString();return e=zt(e,n),e}return""}for(let u=0;u<t.length;u++){const a=t[u],c=Lt(a);if(void 0===c)continue;const l=Dt(a[":@"],n);r.push(c,l);const h=$t(r,i);if(c===n.textNodeName){let t=a[c];h||(t=n.tagValueProcessor(c,t),t=zt(t,n)),s&&(o+=e),o+=t,s=!1,r.pop();continue}if(c===n.cdataPropName){s&&(o+=e),o+=`<![CDATA[${a[c][0][n.textNodeName]}]]>`,s=!1,r.pop();continue}if(c===n.commentPropName){o+=e+`\x3c!--${a[c][0][n.textNodeName]}--\x3e`,s=!0,r.pop();continue}if("?"===c[0]){const t=Rt(a[":@"],n,h);let i=a[c][0][n.textNodeName];i=0!==i.length?" "+i:"",o+=("?xml"===c?"":e)+`<${c}${i}${t}?>`,s=!0,r.pop();continue}let f=e;""!==f&&(f+=n.indentBy);const p=e+`<${c}${Rt(a[":@"],n,h)}`;let d;d=h?jt(a[c],n):Nt(a[c],n,f,r,i),-1!==n.unpairedTags.indexOf(c)?o+=n.suppressUnpairedNode?p+">":p+"/>":d&&0!==d.length||!n.suppressEmptyNode?d&&d.endsWith(">")?o+=p+`>${d}${e}</${c}>`:(o+=p+">",d&&""!==e&&(d.includes("/>")||d.includes("</"))?o+=e+n.indentBy+d+e:o+=d,o+=`</${c}>`):o+=p+"/>",s=!0,r.pop()}return o}function Dt(t,n){if(!t||n.ignoreAttributes)return null;const e={};let r=!1;for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i.startsWith(n.attributeNamePrefix)?i.substr(n.attributeNamePrefix.length):i]=t[i],r=!0);return r?e:null}function jt(t,n){if(!Array.isArray(t))return null!=t?t.toString():"";let e="";for(let r=0;r<t.length;r++){const i=t[r],o=Lt(i);if(o===n.textNodeName)e+=i[o];else if(o===n.cdataPropName)e+=i[o][0][n.textNodeName];else if(o===n.commentPropName)e+=i[o][0][n.textNodeName];else{if(o&&"?"===o[0])continue;if(o){const t=Pt(i[":@"],n),r=jt(i[o],n);e+=r&&0!==r.length?`<${o}${t}>${r}</${o}>`:`<${o}${t}/>`}}}return e}function Pt(t,n){let e="";if(t&&!n.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];e+=!0===i&&n.suppressBooleanAttributes?` ${r.substr(n.attributeNamePrefix.length)}`:` ${r.substr(n.attributeNamePrefix.length)}="${i}"`}return e}function Lt(t){const n=Object.keys(t);for(let e=0;e<n.length;e++){const r=n[e];if(Object.prototype.hasOwnProperty.call(t,r)&&":@"!==r)return r}}function Rt(t,n,e){let r="";if(t&&!n.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o;e?o=t[i]:(o=n.attributeValueProcessor(i,t[i]),o=zt(o,n)),r+=!0===o&&n.suppressBooleanAttributes?` ${i.substr(n.attributeNamePrefix.length)}`:` ${i.substr(n.attributeNamePrefix.length)}="${o}"`}return r}function $t(t,n){if(!n||0===n.length)return!1;for(let e=0;e<n.length;e++)if(t.matches(n[e]))return!0;return!1}function zt(t,n){if(t&&t.length>0&&n.processEntities)for(let e=0;e<n.entities.length;e++){const r=n.entities[e];t=t.replace(r.regex,r.val)}return t}const Ut={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,n){return n},attributeValueProcessor:function(t,n){return n},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function Gt(t){if(this.options=Object.assign({},Ut,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];"string"==typeof n?this.stopNodeExpressions.push(new nt(n)):n instanceof nt&&this.stopNodeExpressions.push(n)}var n;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(n=this.options.ignoreAttributes)?n:Array.isArray(n)?t=>{for(const e of n){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Wt),this.processTextOrObjNode=Bt,this.options.format?(this.indentate=qt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Bt(t,n,e,r){const i=this.extractAttributes(t);if(r.push(n,i),this.checkStopNode(r)){const i=this.buildRawContent(t),o=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(i,n,o,e)}const o=this.j2x(t,e+1,r);return r.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],n,o.attrStr,e,r):this.buildObjectNode(o.val,n,o.attrStr,e)}function qt(t){return this.options.indentBy.repeat(t)}function Wt(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}function Yt(t){return g(t)?t:Number(t)}function Vt(t){const{name:n}=t;return"pi"===n||"random"===n?[{Function:[],":@":{"@_name":n}}]:"property"===n?{PropertyName:[{"#text":t.args[0]}]}:[{Function:t.args.map((t=>{if(x(t)){const n=Vt(t);return Array.isArray(n)?n[0]:n}return{Literal:[{"#text":t}]}})),":@":{"@_name":n}}]}function Ht(t){var n,e;const r=null==(e=null==(n=null==t?void 0:t[0])?void 0:n[":@"])?void 0:e["@_name"],i=null==t?void 0:t[0].Function.map((t=>{var n,e,r,i;return t.Function?Ht([t]):t.PropertyName?{name:"property",args:[null==(e=null==(n=null==t?void 0:t.PropertyName)?void 0:n[0])?void 0:e["#text"]]}:null==(i=null==(r=null==t?void 0:t.Literal)?void 0:r[0])?void 0:i["#text"]})),o={name:r};return i.length>0&&(o.args=i),o}function Kt(t,n){return null==t?void 0:t.filter((t=>Object.keys(t).includes(n)))}function Xt(t,n,e){var r,i,o,s,u,a,c,l,h,f;if(!t)return;const p=t.filter((t=>{var n;return null==(n=Object.keys(t))?void 0:n.includes(e)})).find((t=>{var e;return(null==(e=null==t?void 0:t[":@"])?void 0:e["@_name"])===n}));return null!=(i=null==(r=null==p?void 0:p[e])?void 0:r[0])&&i.Function?Ht(null==p?void 0:p[e]):null!=(s=null==(o=null==p?void 0:p[e])?void 0:o[0])&&s.Literal?null==(l=null==(c=null==(a=null==(u=null==p?void 0:p[e])?void 0:u[0])?void 0:a.Literal)?void 0:c[0])?void 0:l["#text"]:null==(f=null==(h=null==p?void 0:p[e])?void 0:h[0])?void 0:f["#text"]}function Qt(t,n,e){return Xt(t,n,"1.0.0"===e?"CssParameter":"SvgParameter")}function Zt(t,n){var e;return null==(e=null==t?void 0:t[":@"])?void 0:e[`@_${n}`]}function Jt(t){return Object.keys(t).some((t=>t.endsWith("Symbolizer")))}function tn(t,n,e){var r,i,o,s,u,a;const c=n.split(/\.(.*)/s);let l=c[0];const h=c[1];let f=t,p=0;if(null!=h&&h.startsWith("@"))return f=Kt(t,l)[p],Zt(f,h.substring(1));if(Array.isArray(t)){if("#text"===l){if(null!=(r=f[0])&&r.Function)return Ht(f);if(null!=(i=f[0])&&i.Literal)return null==(u=null==(s=null==(o=f[0])?void 0:o.Literal)?void 0:s[0])?void 0:u["#text"]}if("#text"===l&&null!=(a=f[0])&&a.Function)return Ht(f);if(l.startsWith("$")&&e)return Qt(f,l.substring(1),e);l.endsWith("]")&&(p=Number(l.split("[")[1].split("]")[0]),l=l.split("[")[0]),f=Kt(t,l)[p]}return f?h?tn(f[l],h,e):f[l]:void 0}function nn(t,n){return Object.keys(t).filter((e=>t[e]===n))}function en(t){return"number"==typeof t&&!isNaN(t)}function rn(t,n){for(const e in n)n[e]instanceof Object&&Object.assign(n[e],rn(t[e]??{},n[e]));return Object.assign(t||{},n),t}Gt.prototype.build=function(t){if(this.options.preserveOrder)return Ct(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const n=new rt;return this.j2x(t,0,n).val}},Gt.prototype.j2x=function(t,n,e){let r="",i="";if(this.options.maxNestedTags&&e.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?e.toString():e,s=this.checkStopNode(e);for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u))if(void 0===t[u])this.isAttribute(u)&&(i+="");else if(null===t[u])this.isAttribute(u)?i+="":i+=u===this.options.cdataPropName?"":"?"===u[0]?this.indentate(n)+"<"+u+"?"+this.tagEndChar:this.indentate(n)+"<"+u+"/"+this.tagEndChar;else if(t[u]instanceof Date)i+=this.buildTextValNode(t[u],u,"",n,e);else if("object"!=typeof t[u]){const a=this.isAttribute(u);if(a&&!this.ignoreAttributesFn(a,o))r+=this.buildAttrPairStr(a,""+t[u],s);else if(!a)if(u===this.options.textNodeName){let n=this.options.tagValueProcessor(u,""+t[u]);i+=this.replaceEntitiesValue(n)}else{e.push(u);const r=this.checkStopNode(e);if(e.pop(),r){const e=""+t[u];i+=""===e?this.indentate(n)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(n)+"<"+u+">"+e+"</"+u+this.tagEndChar}else i+=this.buildTextValNode(t[u],u,"",n,e)}}else if(Array.isArray(t[u])){const r=t[u].length;let o="",s="";for(let a=0;a<r;a++){const r=t[u][a];if(void 0===r);else if(null===r)i+="?"===u[0]?this.indentate(n)+"<"+u+"?"+this.tagEndChar:this.indentate(n)+"<"+u+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){e.push(u);const t=this.j2x(r,n+1,e);e.pop(),o+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(s+=t.attrStr)}else o+=this.processTextOrObjNode(r,u,n,e);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(u,r);t=this.replaceEntitiesValue(t),o+=t}else{e.push(u);const t=this.checkStopNode(e);if(e.pop(),t){const t=""+r;o+=""===t?this.indentate(n)+"<"+u+this.closeTag(u)+this.tagEndChar:this.indentate(n)+"<"+u+">"+t+"</"+u+this.tagEndChar}else o+=this.buildTextValNode(r,u,"",n,e)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,u,s,n)),i+=o}else if(this.options.attributesGroupName&&u===this.options.attributesGroupName){const n=Object.keys(t[u]),e=n.length;for(let i=0;i<e;i++)r+=this.buildAttrPairStr(n[i],""+t[u][n[i]],s)}else i+=this.processTextOrObjNode(t[u],u,n,e);return{attrStr:r,val:i}},Gt.prototype.buildAttrPairStr=function(t,n,e){return e||(n=this.options.attributeValueProcessor(t,""+n),n=this.replaceEntitiesValue(n)),this.options.suppressBooleanAttributes&&"true"===n?" "+t:" "+t+'="'+n+'"'},Gt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const n={};let e=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=r[t],e=!0)}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(n[i]=t[r],e=!0)}return e?n:null},Gt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let n="";for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;if(this.isAttribute(e))continue;if(this.options.attributesGroupName&&e===this.options.attributesGroupName)continue;const r=t[e];if(e===this.options.textNodeName)n+=r;else if(Array.isArray(r)){for(let t of r)if("string"==typeof t||"number"==typeof t)n+=`<${e}>${t}</${e}>`;else if("object"==typeof t&&null!==t){const r=this.buildRawContent(t),i=this.buildAttributesForStopNode(t);n+=""===r?`<${e}${i}/>`:`<${e}${i}>${r}</${e}>`}}else if("object"==typeof r&&null!==r){const t=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);n+=""===t?`<${e}${i}/>`:`<${e}${i}>${t}</${e}>`}else n+=`<${e}>${r}</${e}>`}return n},Gt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let n="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const e=t[this.options.attributesGroupName];for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const r=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,i=e[t];n+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}else for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const r=this.isAttribute(e);if(r){const i=t[e];n+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}return n},Gt.prototype.buildObjectNode=function(t,n,e,r){if(""===t)return"?"===n[0]?this.indentate(r)+"<"+n+e+"?"+this.tagEndChar:this.indentate(r)+"<"+n+e+this.closeTag(n)+this.tagEndChar;{let i="</"+n+this.tagEndChar,o="";return"?"===n[0]&&(o="?",i=""),!e&&""!==e||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&n===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+n+e+o+this.tagEndChar+t+this.indentate(r)+i:this.indentate(r)+"<"+n+e+o+">"+t+i}},Gt.prototype.closeTag=function(t){let n="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(n="/"):n=this.options.suppressEmptyNode?"/":`></${t}`,n},Gt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let n=0;n<this.stopNodeExpressions.length;n++)if(t.matches(this.stopNodeExpressions[n]))return!0;return!1},Gt.prototype.buildTextValNode=function(t,n,e,r){if(!1!==this.options.cdataPropName&&n===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&n===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===n[0])return this.indentate(r)+"<"+n+e+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(n,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+n+e+this.closeTag(n)+this.tagEndChar:this.indentate(r)+"<"+n+e+">"+i+"</"+n+this.tagEndChar}},Gt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let n=0;n<this.options.entities.length;n++){const e=this.options.entities[n];t=t.replace(e.regex,e.val)}return t};var on=Object.defineProperty,sn=(t,n,e)=>((t,n,e)=>n in t?on(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e)(t,"symbol"!=typeof n?n+"":n,e);const un=["1.0.0","1.1.0"],an="GeoServer",cn=/^ttf:\/\/(.+)#(.+)$/,ln={PropertyIsEqualTo:"==",PropertyIsNotEqualTo:"!=",PropertyIsLike:"*=",PropertyIsLessThan:"<",PropertyIsLessThanOrEqualTo:"<=",PropertyIsGreaterThan:">",PropertyIsGreaterThanOrEqualTo:">=",PropertyIsNull:"==",PropertyIsBetween:"<=x<="},hn={Not:"!"},fn={And:"&&",Or:"||",PropertyIsBetween:"&&"},pn="http://www.opengeospatial.org/se/units/metre",dn="http://www.opengeospatial.org/se/units/pixel",mn=["add","sub","mul","div"],yn={en:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`MarkSymbolizer cannot be parsed. WellKnownName ${t} is not supported.`,noFilterDetected:"No Filter detected.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Failed to parse SymbolizerKind ${t} from SldRule.`,colorMapEntriesParseFailedColorUndefined:"Cannot parse ColorMapEntries. color is undefined.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Cannot parse ContrastEnhancement. Histogram and Normalize are mutually exclusive.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Cannot parse ChannelSelection. RGB and Grayscale are mutually exclusive.",channelSelectionParseFailedRGBChannelsUndefined:"Cannot parse ChannelSelection. Red, Green and Blue channels must be defined."},de:{},fr:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`Échec de lecture du symbole de type MarkSymbolizer. Le WellKnownName ${t} n'est pas supporté.`,noFilterDetected:"Aucun filtre détecté.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Échec de lecture du type de symbole ${t} à partir de SldRule.`,colorMapEntriesParseFailedColorUndefined:"Lecture de ColorMapEntries échoué. color n'est pas défini.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Échec de lecture des propriétés de contraste ContrastEnhancement échoué. Histogram et Normalize sont mutuellement exclusifs.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Échec de lecture de la sélection de canaux ChannelSelection. RGB et Grayscale sont mutuellement exclusifs.",channelSelectionParseFailedRGBChannelsUndefined:"Échec de lecture de la sélection de canaux ChannelSelection. Les canaux Rouge, Vert et Bleu doivent être définis."}},vn=t=>null==t;class bn{constructor(t){sn(this,"title","SLD Style Parser"),sn(this,"unsupportedProperties",{Symbolizer:{MarkSymbolizer:{avoidEdges:"none",blur:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",pitchAlignment:"none",pitchScale:"none",visibility:"none"},FillSymbolizer:{antialias:"none",opacity:{support:"none",info:"General opacity is not supported. Use fillOpacity and strokeOpacity instead."},visibility:"none"},IconSymbolizer:{allowOverlap:"none",anchor:"none",avoidEdges:"none",color:"none",haloBlur:"none",haloColor:"none",haloOpacity:"none",haloWidth:"none",keepUpright:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",optional:"none",padding:"none",pitchAlignment:"none",rotationAlignment:"none",textFit:"none",image:{support:"partial",info:"Sprites are not supported"},textFitPadding:"none",visibility:"none"},LineSymbolizer:{blur:"none",gapWidth:"none",gradient:"none",miterLimit:"none",roundLimit:"none",spacing:"none",visibility:"none"},RasterSymbolizer:{brightnessMax:"none",brightnessMin:"none",contrast:"none",fadeDuration:"none",hueRotate:"none",resampling:"none",saturation:"none",visibility:"none"},TextSymbolizer:{placement:{support:"partial",info:'Only "line" and "point" are currently supported'}}}}),sn(this,"translations",yn),sn(this,"locale","en"),sn(this,"_parser"),sn(this,"_builder"),sn(this,"_numericFilterFields",[]),sn(this,"_boolFilterFields",[]),sn(this,"_sldVersion","1.0.0"),sn(this,"_sldEnvironment",null),sn(this,"_readingSldVersion","1.0.0"),sn(this,"_symbolizerUnits","pixel"),sn(this,"getTextSymbolizerLabelFromSldSymbolizer",(t=>{var n;if(Array.isArray(t)&&t[0]&&"object"==typeof t[0]&&(t[0].Function||t[0]["ogc:Function"])){const e=t[0],r=t=>{var n,e,r,i,o,s,u,a;return t.PropertyName||t["ogc:PropertyName"]?{name:"property",args:[(null==(e=null==(n=t.PropertyName)?void 0:n[0])?void 0:e["#text"])??(null==(i=null==(r=t["ogc:PropertyName"])?void 0:r[0])?void 0:i["#text"])]}:t.Literal||t["ogc:Literal"]?void 0!==(null==(s=null==(o=t.Literal)?void 0:o[0])?void 0:s["#text"])?t.Literal[0]["#text"]:(null==(a=null==(u=t["ogc:Literal"])?void 0:u[0])?void 0:a["#text"])??"":t.Function||t["ogc:Function"]?this.getTextSymbolizerLabelFromSldSymbolizer([t]):t};return{name:null==(n=e[":@"])?void 0:n["@_name"],args:(e.Function||e["ogc:Function"]).map(r)}}return t.map((t=>{var n,e,r,i,o,s;const u=Object.keys(t)[0];switch(u.replace("ogc:","")){case"#text":return t["#text"];case"Literal":return(null==(e=null==(n=null==t?void 0:t[u])?void 0:n[0])?void 0:e["#text"])||(null==(s=null==(o=null==(i=null==(r=null==t?void 0:t[u])?void 0:r[0])?void 0:i["#cdata"])?void 0:o[0])?void 0:s["#text"]);case"PropertyName":return`{{${t[u][0]["#text"]}}}`;default:return""}})).join("")})),sn(this,"getSldLabelFromTextSymbolizer",(t=>{if(function(t){return null!=t&&"string"==typeof t.valueOf()}(t)){const n="{{",e="}}",r=[];let i=t;for(;i.length;){let t,o=i;const s=o.indexOf(n);if(-1===s){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}s>0&&(t=o.slice(0,s)),o=o.slice(s+n.length);const u=o.indexOf(e);if(-1===u){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}const a=o.slice(0,u);o=o.slice(u+e.length),t&&(t.includes(" ")||t.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":t}]}]}):r.push({"ogc:Literal":[{"#text":t}]})),r.push({"ogc:PropertyName":[{"#text":a}]}),i=o}return r}return this.geoStylerFunctionToSldFunctionRecursive(t)})),this.parser=new At({...null==t?void 0:t.parserOptions,ignoreDeclaration:!0,removeNSPrefix:!0,ignoreAttributes:!1,preserveOrder:!0,trimValues:!0}),this.builder=new Gt({...null==t?void 0:t.builderOptions,cdataPropName:"#cdata",ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}),null!=t&&t.sldVersion&&(this.sldVersion=null==t?void 0:t.sldVersion),void 0!==(null==t?void 0:t.sldEnvironment)&&(this.sldEnvironment=t.sldEnvironment),null!=t&&t.locale&&(this.locale=t.locale),null!=t&&t.translations&&(this.translations=rn(this.translations,t.translations)),Object.assign(this,t)}translate(t,n){var e,r;const i=(null==(r=null==(e=this.translations)?void 0:e[this.locale])?void 0:r[t])??t;return"function"==typeof i?i(n):i}get parser(){return this._parser}set parser(t){this._parser=t}get builder(){return this._builder}set builder(t){this._builder=t}get numericFilterFields(){return this._numericFilterFields}set numericFilterFields(t){this._numericFilterFields=t}get boolFilterFields(){return this._boolFilterFields}set boolFilterFields(t){this._boolFilterFields=t}get sldVersion(){return this._sldVersion}set sldVersion(t){this._sldVersion=t}get sldEnvironment(){return this._sldEnvironment}set sldEnvironment(t){this._sldEnvironment=t}isSldEnv(t){return this.sldEnvironment===t}get readingSldVersion(){return this._readingSldVersion}set readingSldVersion(t){this._readingSldVersion=t}get symbolizerUnits(){return this._symbolizerUnits}set symbolizerUnits(t){this._symbolizerUnits=t}readStyle(t){return new Promise((n=>{try{const e=this.parser.parse(t),r=Zt(e[0],"version");if(!un.includes(r))throw new Error(`SLD version must be ${un.toString()}`);this._readingSldVersion=r,n({output:this.sldObjectToGeoStylerStyle(e)})}catch(t){n({errors:[t]})}}))}sldObjectToGeoStylerStyle(t){const n=this.getRulesFromSldObject(t);return{name:this.getStyleNameFromSldObject(t),rules:n}}getRulesFromSldObject(t){const n=Kt(t[0].StyledLayerDescriptor,"NamedLayer"),e=[];return n.forEach((({NamedLayer:t})=>{Kt(t,"UserStyle").forEach((({UserStyle:t})=>{Kt(t,"FeatureTypeStyle").forEach((({FeatureTypeStyle:t})=>{Kt(t,"Rule").forEach((({Rule:t})=>{const n=this.getFilterFromRule(t),r=this.getScaleDenominatorFromRule(t),i=this.getSymbolizersFromRule(t),o=tn(t,"Title.#text"),s=tn(t,"Name.#text"),u={name:void 0!==o?o:void 0!==s?s:""};n&&(u.filter=n),r&&(u.scaleDenominator=r),i&&(u.symbolizers=i),e.push(u)}))}))}))})),e}getStyleNameFromSldObject(t){const n=tn(t,"StyledLayerDescriptor.NamedLayer[0].UserStyle.Name.#text"),e=tn(t,"StyledLayerDescriptor.NamedLayer.Name.#text");return n||e||""}getFilterFromRule(t){var n;const e=tn(t,"Filter");if(!e||0===e.length)return;const r=null==(n=Object.keys(e[0]))?void 0:n[0];return r?this.getFilterFromOperatorAndComparison(r,e):void 0}getScaleDenominatorFromRule(t){const n={},e=tn(t,"MinScaleDenominator.#text");e&&(n.min=Number(e));const r=tn(t,"MaxScaleDenominator.#text");return r&&(n.max=Number(r)),Number.isFinite(n.min)||Number.isFinite(n.max)?n:void 0}getSymbolizersFromRule(t){return t.filter(Jt).map((t=>{const n=Object.keys(t)[0];switch(n){case"PointSymbolizer":return this.getPointSymbolizerFromSldSymbolizer(t);case"LineSymbolizer":return this.getLineSymbolizerFromSldSymbolizer(t);case"TextSymbolizer":return this.getTextSymbolizerFromSldSymbolizer(t);case"PolygonSymbolizer":return this.getFillSymbolizerFromSldSymbolizer(t);case"RasterSymbolizer":return this.getRasterSymbolizerFromSldSymbolizer(t);default:throw new Error(this.translate("symbolizerKindParseFailed",{sldSymbolizerName:n}))}}))}getFilterFromOperatorAndComparison(t,n){var e;let r;if("Function"===t){const e=Array.isArray(n)?n[0][":@"]["@_name"]:n[":@"]["@_name"];t=`PropertyIs${e.charAt(0).toUpperCase()+e.slice(1)}`}if("PropertyIsBetween"===t)r=["<=x<=",tn(n,"PropertyIsBetween.PropertyName.#text"),Number(tn(n,"PropertyIsBetween.LowerBoundary.Literal.#text")),Number(tn(n,"PropertyIsBetween.UpperBoundary.Literal.#text"))];else if(Object.keys(ln).includes(t))r=this.getFilterFromComparisonOperator(t,n);else if(Object.keys(fn).includes(t)){const i=fn[t],o=null==(e=tn(n,t))?void 0:e.map((t=>{var n;const e=null==(n=Object.keys(t))?void 0:n[0];return this.getFilterFromOperatorAndComparison(e,t)}));r=[i,...o]}else{if(!Object.keys(hn).includes(t))throw new Error(this.translate("noFilterDetected"));{const e=hn[t],i=Object.keys(n[t][0])[0];r=[e,this.getFilterFromOperatorAndComparison(i,n[t][0])]}}return r}getFilterFromComparisonOperator(t,n){if("Function"===t){const e=Array.isArray(n)?n[0][":@"]["@_name"]:n[":@"]["@_name"];t=`PropertyIs${e.charAt(0).toUpperCase()+e.slice(1)}`}const e=ln[t],r=!!tn(n,"Function");let i=[];const o=tn(n,r?"Function":t)||[];return i=o.map(((t,n)=>{var e;const r=null==(e=Object.keys(t))?void 0:e[0];return mn.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,o,n)})),"PropertyIsNull"===t&&(i[1]=null),[e,...i]}getFilterArgsFromArithmeticOperators(t,n){const[e,r]=n;return{name:t.toLowerCase(),args:[this.processArithmeticOperand(e,n),this.processArithmeticOperand(r,n)]}}processArithmeticOperand(t,n){var e;const r=null==(e=Object.keys(t))?void 0:e[0];return r&&mn.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,n,0)}getFilterArgsFromPropertyName(t,n,e){const r=tn([t],"PropertyName.#text");return void 0!==r?1===n.length||0===e&&void 0===tn([n[1]],"PropertyName.#text")?r:{name:"property",args:[r]}:tn([t],"#text")}getOffsetFromDisplacement(t){if(vn(t))return;const n=Number(tn(t,"DisplacementX.#text")),e=Number(tn(t,"DisplacementY.#text"));return[Number.isFinite(n)?Yt(n):0,Number.isFinite(e)&&0!==e?-Yt(e):0]}getPointSymbolizerFromSldSymbolizer(t,n){const e=t.PointSymbolizer;let r;return tn(e,"Graphic.Mark.WellKnownName.#text"),r=tn(e,"Graphic.ExternalGraphic")?this.getIconSymbolizerFromSldSymbolizer(t):this.getMarkSymbolizerFromSldSymbolizer(t),r}getLineSymbolizerFromSldSymbolizer(t){const n=t.LineSymbolizer,e=this.getDistanceUnit(t),r={kind:"Line"},i=tn(n,"Stroke",this.readingSldVersion),o=Qt(i,"stroke",this.readingSldVersion),s=Qt(i,"stroke-width",this.readingSldVersion),u=Qt(i,"stroke-opacity",this.readingSldVersion),a=Qt(i,"stroke-linejoin",this.readingSldVersion),c=Qt(i,"stroke-linecap",this.readingSldVersion),l=Qt(i,"stroke-dasharray",this.readingSldVersion),h=Qt(i,"stroke-dashoffset",this.readingSldVersion);if(vn(o)||(r.color=o),vn(s)||(r.width=Yt(s)),vn(e)||(r.widthUnit=e),vn(u)||(r.opacity=Yt(u)),vn(a)||(r.join="mitre"===a?"miter":a),vn(c)||(r.cap=c),!vn(l)){const t=l.split(" ").map(Yt);r.dasharray=t}vn(h)||(r.dashOffset=Yt(h));const f=tn(i,"GraphicStroke");vn(f)||(r.graphicStroke=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:f},e));const p=tn(i,"GraphicFill");vn(p)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:p},e));const d=tn(n,"PerpendicularOffset.#text");return vn(d)||(r.perpendicularOffset=Yt(d)),r}getTextSymbolizerFromSldSymbolizer(t){const n=t.TextSymbolizer,e=this.getDistanceUnit(t),r={kind:"Text"},i=tn(n,"Font"),o=tn(n,"Fill"),s=tn(n,"Label"),u=tn(n,"Halo"),a=tn(u,"Fill"),c=Qt(o,"fill",this.readingSldVersion),l=Qt(o,"fill-opacity",this.readingSldVersion),h=Qt(i,"font-family",this.readingSldVersion),f=Qt(i,"font-style",this.readingSldVersion),p=Qt(i,"font-size",this.readingSldVersion),d=Qt(i,"font-weight",this.readingSldVersion),m=Qt(a,"fill",this.readingSldVersion);vn(s)||(r.label=this.getTextSymbolizerLabelFromSldSymbolizer(s)),r.color=c||"#000000",vn(l)||(r.opacity=Yt(l));const y=tn(n,"Halo.Radius.#text");vn(y)||(r.haloWidth=Yt(y)),vn(e)||(r.haloWidthUnit=e);const v=Qt(a,"fill-opacity",this.readingSldVersion);vn(v)||(r.haloOpacity=Yt(v)),vn(m)||(r.haloColor=m);const b=tn(n,"LabelPlacement");if(!vn(b)){const t=tn(b,"PointPlacement"),n=tn(b,"LinePlacement");if(vn(t)){if(!vn(n)&&(r.placement="line","1.1.0"===this.readingSldVersion)){const t=tn(n,"IsRepeated.#text"),e=tn(n,"Gap.#text");t&&!vn(e)&&(r.repeat=Yt(e))}}else{r.placement="point";const n=tn(t,"AnchorPoint");if(!vn(n)){const t=tn(n,"AnchorPointX.#text"),e=tn(n,"AnchorPointY.#text");r.anchor=this.getAnchorFromSldAnchorPoint(t,e)}const e=tn(t,"Displacement"),i=this.getOffsetFromDisplacement(e);vn(i)||(r.offset=i);const o=tn(t,"Rotation.#text");vn(o)||(r.rotate=Yt(o))}}return vn(h)||(r.font=[h]),vn(f)||(r.fontStyle=f.toLowerCase()),vn(d)||(r.fontWeight=d.toLowerCase()),vn(p)||(r.size=Yt(p)),vn(e)||(r.sizeUnit=e),r}getFillSymbolizerFromSldSymbolizer(t){const n=t.PolygonSymbolizer,e=this.getDistanceUnit(t),r={kind:"Fill"},i=tn(n,"Stroke"),o=tn(n,"Fill"),s=Qt(o,"fill-opacity",this.readingSldVersion),u=Qt(o,"fill",this.readingSldVersion),a=Qt(i,"stroke",this.readingSldVersion),c=Qt(i,"stroke-width",this.readingSldVersion),l=Qt(i,"stroke-opacity",this.readingSldVersion),h=Qt(i,"stroke-dasharray",this.readingSldVersion),f=Qt(i,"stroke-linecap",this.readingSldVersion),p=Qt(i,"stroke-linejoin",this.readingSldVersion),d=tn(n,"Fill.GraphicFill");if(vn(d)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:d})),this.isSldEnv(an)){const t=function(t){return Xt(t,"graphic-margin","VendorOption")}(n);vn(t)||(r.graphicFillPadding=t.split(/\s/).map(Yt))}return vn(u)||(r.color=u),vn(s)||(r.fillOpacity=Yt(s)),vn(a)||(r.outlineColor=a),vn(c)||(r.outlineWidth=Yt(c)),vn(e)||(r.outlineWidthUnit=e),vn(l)||(r.outlineOpacity=Yt(l)),vn(h)||(r.outlineDasharray=h.split(" ").map(Yt)),vn(f)||(r.outlineCap=f),vn(p)||(r.outlineJoin=p),r}getRasterSymbolizerFromSldSymbolizer(t){const n=t.RasterSymbolizer,e={kind:"Raster"};let r=tn(n,"Opacity.#text");vn(r)||(r=Yt(r),e.opacity=r);const i=tn(n,"ColorMap"),o=tn(n,"ColorMap.@type"),s=tn(n,"ColorMap.@extended");if(!vn(i)){const t=this.getColorMapFromSldColorMap(i,o,s);e.colorMap=t}const u=tn(n,"ChannelSelection");if(!vn(u)){const t=this.getChannelSelectionFromSldChannelSelection(u);e.channelSelection=t}const a=tn(n,"ContrastEnhancement");if(!vn(a)){const t=this.getContrastEnhancementFromSldContrastEnhancement(a);e.contrastEnhancement=t}return e}getMarkSymbolizerFromSldSymbolizer(t){const n=t.PointSymbolizer,e=this.getDistanceUnit(t),r=tn(n,"Graphic.Mark.WellKnownName.#text"),i=tn(n,"Graphic.Mark.Stroke"),o=tn(n,"Graphic.Mark.Fill"),s=tn(n,"Graphic.Opacity.#text"),u=tn(n,"Graphic.Size.#text"),a=tn(n,"Graphic.Rotation.#text"),c=Qt(o,"fill-opacity",this.readingSldVersion),l=Qt(o,"fill",this.readingSldVersion),h=tn(n,"Graphic.Displacement"),f={kind:"Mark",wellKnownName:"circle"};vn(s)||(f.opacity=Yt(s)),vn(c)||(f.fillOpacity=Yt(c)),vn(l)||(f.color=l),vn(a)||(f.rotate=Yt(a)),vn(u)||(f.radius=g(u)?u:Number(u)/2),vn(e)||(f.radiusUnit=e);const p=this.getOffsetFromDisplacement(h);switch(vn(p)||(f.offset=p),r){case"arrow":case"arrowhead":case"asterisk_fill":case"backslash":case"circle":case"cross":case"cross2":case"cross_fill":case"decagon":case"diagonal_half_square":case"diamond":case"equilateral_triangle":case"filled_arrowhead":case"half_arc":case"half_square":case"heart":case"hexagon":case"horline":case"left_half_triangle":case"line":case"octagon":case"parallelogram_left":case"parallelogram_right":case"pentagon":case"quarter_arc":case"quarter_circle":case"quarter_square":case"right_half_triangle":case"rounded_square":case"semi_circle":case"shield":case"slash":case"square":case"square_with_corners":case"star":case"star_diamond":case"third_arc":case"third_circle":case"trapezoid":case"triangle":case"x":case"shape://vertline":case"shape://horline":case"shape://slash":case"shape://backslash":case"shape://dot":case"shape://plus":case"shape://times":case"shape://oarrow":case"shape://carrow":case"brush://dense1":case"brush://dense2":case"brush://dense3":case"brush://dense4":case"brush://dense5":case"brush://dense6":case"brush://dense7":f.wellKnownName=r;break;default:if(cn.test(r)){f.wellKnownName=r;break}throw new Error(this.translate("marksymbolizerParseFailedUnknownWellknownName",{wellKnownName:r}))}const d=Qt(i,"stroke",this.readingSldVersion);vn(d)||(f.strokeColor=d);const m=Qt(i,"stroke-width",this.readingSldVersion);vn(m)||(f.strokeWidth=Yt(m)),vn(e)||(f.strokeWidthUnit=e);const y=Qt(i,"stroke-opacity",this.readingSldVersion);vn(y)||(f.strokeOpacity=Yt(y));const v=Qt(i,"stroke-dasharray",this.readingSldVersion);if(!vn(v)){const t=v.split(" ").map(Yt);f.strokeDasharray=t}return f}getIconSymbolizerFromSldSymbolizer(t,n){const e=t.PointSymbolizer,r=n||this.getDistanceUnit(t);let i=tn(e,"Graphic.ExternalGraphic.OnlineResource.@href");i||"1.1.0"!==this.sldVersion||"base64"!==tn(e,"Graphic.ExternalGraphic.InlineContent.@encoding")||(i=`data:${tn(e,"Graphic.ExternalGraphic.Format.#text")};base64,${tn(e,"Graphic.ExternalGraphic.InlineContent.#text")}`);const o={kind:"Icon",image:i},s=tn(e,"Graphic.Opacity.#text"),u=tn(e,"Graphic.Size.#text"),a=tn(e,"Graphic.Rotation.#text"),c=tn(e,"Graphic.Displacement");vn(s)||(o.opacity=Yt(s)),vn(u)||(o.size=Yt(u)),vn(r)||(o.sizeUnit=r),vn(a)||(o.rotate=Yt(a));const l=this.getOffsetFromDisplacement(c);return vn(l)||(o.offset=l),o}getColorMapFromSldColorMap(t,n="ramp",e){const r={type:n};e&&(r.extended="true"===e);const i=Kt(t,"ColorMapEntry");if(Array.isArray(i)){const t=i.map((t=>{const n=Zt(t,"color");if(!n)throw new Error(this.translate("colorMapEntriesParseFailedColorUndefined"));let e=Zt(t,"quantity");e&&(e=Yt(e));const r=Zt(t,"label");let i=Zt(t,"opacity");return vn(i)||(i=Yt(i)),{color:n,quantity:e,label:r,opacity:i}}));r.colorMapEntries=t}return r}getContrastEnhancementFromSldContrastEnhancement(t){const n={},e=!!tn(t,"Histogram"),r=!!tn(t,"Normalize");if(e&&r)throw new Error(this.translate("contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive"));e?n.enhancementType="histogram":r&&(n.enhancementType="normalize");let i=tn(t,"GammaValue.#text");return i&&(i=Yt(i)),n.gammaValue=i,n}getChannelFromSldChannel(t){var n;const e={sourceChannelName:null==(n=tn(t,"SourceChannelName.#text"))?void 0:n.toString()},r=tn(t,"ContrastEnhancement");return r&&(e.contrastEnhancement=this.getContrastEnhancementFromSldContrastEnhancement(r)),e}getChannelSelectionFromSldChannelSelection(t){let n;const e=tn(t,"RedChannel"),r=tn(t,"BlueChannel"),i=tn(t,"GreenChannel"),o=tn(t,"GrayChannel");if(o&&e&&r&&i)throw new Error(this.translate("channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive"));if(o)n={grayChannel:this.getChannelFromSldChannel(o)};else{if(!(e&&i&&r))throw new Error(this.translate("channelSelectionParseFailedRGBChannelsUndefined"));n={redChannel:this.getChannelFromSldChannel(e),blueChannel:this.getChannelFromSldChannel(r),greenChannel:this.getChannelFromSldChannel(i)}}return n}writeStyle(t){return new Promise((n=>{const e=this.checkForUnsupportedProperties(t);try{const r=this.geoStylerStyleToSldObject(t);n({output:this.builder.build(r),unsupportedProperties:e,warnings:e&&["Your style contains unsupportedProperties!"]})}catch(t){n({errors:[t]})}}))}getTagName(t){return["Filter"].includes(t)?t:"CssParameter"===t?"1.1.0"===this.sldVersion?"se:SvgParameter":"CssParameter":"1.1.0"===this.sldVersion?`se:${t}`:t}geoStylerStyleToSldObject(t){const n=this.getSldRulesFromRules(t.rules);n.forEach((t=>{const n=Kt(tn(t,this.getTagName("Rule")),"Filter").at(0);n&&(n[":@"]={"@_xmlns":"http://www.opengis.net/ogc"})}));const e=[...n],r=this.getTagName("Name"),i=this.getTagName("Title"),o=this.getTagName("FeatureTypeStyle"),s={"@_version":this.sldVersion,"@_xsi:schemaLocation":"http://www.opengis.net/sld StyledLayerDescriptor.xsd","@_xmlns":"http://www.opengis.net/sld","@_xmlns:ogc":"http://www.opengis.net/ogc","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xmlns:se":"http://www.opengis.net/se"},u=[];return u.push({[r]:[{"#text":t.name||""}]}),"1.0.0"===this.sldVersion&&u.push({[i]:[{"#text":t.name||""}]}),u.push({[o]:e}),[{"?xml":[{"#text":""}],":@":{"@_version":"1.0","@_encoding":"UTF-8","@_standalone":"yes"}},{StyledLayerDescriptor:[{NamedLayer:[{[r]:[{"#text":t.name||""}]},{UserStyle:u}]}],":@":s}]}getSldRulesFromRules(t){const n=this.getTagName("Name"),e=this.getTagName("Filter"),r=this.getTagName("Rule"),i=this.getTagName("MinScaleDenominator"),o=this.getTagName("MaxScaleDenominator");return t.map((t=>{const s={[r]:[]};if(t.name&&s[r].push({[n]:[{"#text":t.name}]}),t.filter){const n=this.getSldFilterFromFilter(t.filter);s[r].push({[e]:n})}if(t.scaleDenominator){const{min:n,max:e}=t.scaleDenominator;n&&Number.isFinite(n)&&s[r].push({[i]:[{"#text":n}]}),e&&Number.isFinite(e)&&s[r].push({[o]:[{"#text":e}]})}const u=this.getSldSymbolizersFromSymbolizers(t.symbolizers);let a=[];return u.length>0&&(a=Object.keys(u[0])),a.forEach((t=>{0===u[0][t].length&&delete u[0][t]})),u.length>0&&0!==a.length&&(s[r]=[...s[r],...u]),s}))}getSldComparisonFilterFromComparisonFilter(t){const n=[],e=t[1],r=t[2],i=nn(ln,t[0]),o=i.length>1&&null===r?i[1]:i[0],s="PropertyName";if(x(e)||x(r)){const t=o.replace("PropertyIs",""),n=t.charAt(0).toLowerCase()+t.slice(1),i=x(e)?Vt(e):e,s=x(r)?Vt(r):r,u=[];return x(e)?u.unshift(Array.isArray(i)?null==i?void 0:i[0]:i):u.unshift({Literal:[{"#text":i}]}),x(r)?u.push(Array.isArray(s)?null==s?void 0:s[0]:s):u.push({Literal:[{"#text":s}]}),[{Function:u,":@":{"@_name":n}}]}if("PropertyIsNull"===o)n.push({[o]:[{[s]:[{"#text":e}]}]});else if("PropertyIsLike"===o)n.push({[o]:[{[s]:[{"#text":e}]},{Literal:[{"#text":r}]}],":@":{"@_wildCard":"*","@_singleChar":".","@_escape":"!"}});else if("PropertyIsBetween"===o){const r=t;n.push({[o]:[{[s]:[{"#text":e}]},{LowerBoundary:[{Literal:[{"#text":r[2]}]}]},{UpperBoundary:[{Literal:[{"#text":r[3]}]}]}]})}else n.push({[o]:[{[s]:[{"#text":e}]},{Literal:[{"#text":r}]}]});return n}getSldFilterFromFilter(t){let n=[];if(y(t))n=this.getSldComparisonFilterFromComparisonFilter(t);else if(b(t))n.push({Not:this.getSldFilterFromFilter(t[1])});else if(v(t)){const[e,...r]=t,i=nn(fn,e)[0],o=r.map((t=>this.getSldFilterFromFilter(t)[0]));n.push({[i]:o})}return n}moveUomEntryToAttributes(t,n){const e=n[n.length-1].uom;e&&("1.1.0"===this.sldVersion&&(t[":@"]={"@_uom":e}),n.pop())}addUomEntry(t,n){"m"===n&&t.push({uom:pn}),"px"===n&&t.push({uom:dn})}getDistanceUnit(t){if(!t)return;const n=Zt(t,"uom");if(n){if(n===pn)return"m";if(n===dn)return"px"}}getSldSymbolizersFromSymbolizers(t){const n=[],e=this.getTagName("PointSymbolizer"),r=this.getTagName("TextSymbolizer"),i=this.getTagName("LineSymbolizer"),o=this.getTagName("PolygonSymbolizer"),s=this.getTagName("RasterSymbolizer");return t.forEach((t=>{const u={};let a;switch(t.kind){case"Mark":a=this.getSldPointSymbolizerFromMarkSymbolizer(t),u[e]=a;break;case"Icon":a=this.getSldPointSymbolizerFromIconSymbolizer(t),u[e]=a;break;case"Text":a=this.getSldTextSymbolizerFromTextSymbolizer(t),u[r]=a;break;case"Line":a=this.getSldLineSymbolizerFromLineSymbolizer(t),u[i]=a;break;case"Fill":a=this.getSldPolygonSymbolizerFromFillSymbolizer(t),u[o]=a;break;case"Raster":a=this.getSldRasterSymbolizerFromRasterSymbolizer(t),u[s]=a}u&&a&&this.moveUomEntryToAttributes(u,a),n.push(u)})),n}getDisplacementFromOffset(t){const n=this.getTagName("Displacement"),e=this.getTagName("DisplacementX"),r=this.getTagName("DisplacementY"),i=x(t[0])?Vt(t[0]):[{"#text":t[0].toString()}],o=x(t[1])?Vt(t[1]):[{"#text":(-1*t[1]).toString()}];return{[n]:[{[e]:i},{[r]:o}]}}getSldPointSymbolizerFromMarkSymbolizer(t){var n;const e=this.getTagName("WellKnownName"),r=this.getTagName("CssParameter"),i=this.getTagName("Fill"),o=this.getTagName("Mark"),s=this.getTagName("Stroke"),u=this.getTagName("Opacity"),a=this.getTagName("Rotation"),c=this.getTagName("Size"),l=this.getTagName("Graphic"),h=cn.test(t.wellKnownName),f=[{[e]:[{"#text":h?t.wellKnownName:t.wellKnownName.toLowerCase()}]}];if(t.color||!vn(t.fillOpacity)){const n=[];if(t.color)if(x(t.color)){const e=Vt(t.color);n.push({[r]:e,":@":{"@_name":"fill"}})}else n.push({[r]:[{"#text":t.color}],":@":{"@_name":"fill"}});if(!vn(t.fillOpacity))if(x(t.fillOpacity)){const e=Vt(t.fillOpacity);n.push({[r]:e,":@":{"@_name":"fill-opacity"}})}else n.push({[r]:[{"#text":t.fillOpacity}],":@":{"@_name":"fill-opacity"}});f.push({[i]:n})}if(t.strokeColor||Number.isFinite(t.strokeWidth)||Number.isFinite(t.strokeOpacity)){const e=[];if(t.strokeColor)if(x(t.strokeColor)){const n=Vt(t.strokeColor);e.push({[r]:n,":@":{"@_name":"stroke"}})}else e.push({[r]:[{"#text":t.strokeColor}],":@":{"@_name":"stroke"}});if(!vn(t.strokeWidth))if(x(t.strokeWidth)){const n=Vt(t.strokeWidth);e.push({[r]:n,":@":{"@_name":"stroke-width"}})}else e.push({[r]:[{"#text":t.strokeWidth}],":@":{"@_name":"stroke-width"}});if(!vn(t.strokeOpacity))if(x(t.strokeOpacity)){const n=Vt(t.strokeOpacity);e.push({[r]:n,":@":{"@_name":"stroke-opacity"}})}else e.push({[r]:[{"#text":t.strokeOpacity}],":@":{"@_name":"stroke-opacity"}});if(!vn(t.strokeDasharray))if(x(t.strokeDasharray)){const n=Vt(t.strokeDasharray);e.push({[r]:n,":@":{"@_name":"stroke-dasharray"}})}else e.push({[r]:[{"#text":null==(n=t.strokeDasharray)?void 0:n.join(" ")}],":@":{"@_name":"stroke-dasharray"}});f.push({[s]:e})}const p=[{[o]:f}];vn(t.opacity)||p.push({[u]:[{"#text":t.opacity.toString()}]}),void 0!==t.radius&&(x(t.radius)?p.push({[c]:Vt(t.radius)}):p.push({[c]:[{"#text":(2*t.radius).toString()}]})),t.rotate&&p.push({[a]:[{"#text":t.rotate.toString()}]}),t.offset&&("1.1.0"===this.sldVersion||this.isSldEnv(an))&&p.push(this.getDisplacementFromOffset(t.offset));const d=[{[l]:p}];return this.addUomEntry(d,t.radiusUnit),d}pushGeoServerVendorOption(t,n,e){this.isSldEnv(an)&&t.push(this.createGeoServerVendorOption(n,e))}createGeoServerVendorOption(t,n){return{[this.getTagName("VendorOption")]:[{"#text":n}],":@":{"@_name":t}}}getSldPointSymbolizerFromIconSymbolizer(t){const n=this.getTagName("Opacity"),e=this.getTagName("Rotation"),r=this.getTagName("Size"),i=this.getTagName("Graphic"),o=this.getTagName("Displacement"),s=this.getTagName("DisplacementX"),u=this.getTagName("DisplacementY"),a=[];if("string"==typeof t.image||t.image instanceof String){const n=function(t){const n=t.split(",");if(2!==n.length||!n[0].startsWith("data:image/")||!n[0].endsWith(";base64"))return;const e=n[0].split(";");if(2!==e.length)return;const r=e[0].split("/").pop();return r?{data:n[1],extension:r}:void 0}(t.image);a.push(n?this.getSldExternalResourceInlineContent(n):this.getSldExternalResourceOnlineResource(t.image))}return vn(t.opacity)||a.push({[n]:[{"#text":t.opacity}]}),t.size&&a.push({[r]:[{"#text":t.size}]}),t.rotate&&a.push({[e]:[{"#text":t.rotate}]}),t.offset&&"1.1.0"===this.sldVersion&&a.push({[o]:[{[s]:[{"#text":t.offset[0].toString()}]},{[u]:[{"#text":t.offset[1].toString()}]}]}),[{[i]:a}]}getSldExternalResourceInlineContent(t){const n=this.getTagName("ExternalGraphic"),e=this.getTagName("Format"),r=this.getTagName("InlineContent");return{[n]:[{[r]:[{"#text":t.data}],":@":{"@_encoding":"base64"}},{[e]:[{"#text":`image/${t.extension}`}]}]}}getSldExternalResourceOnlineResource(t){const n=this.getTagName("ExternalGraphic"),e=this.getTagName("Format"),r=this.getTagName("OnlineResource"),i={[n]:[{[r]:[],":@":{"@_xlink:type":"simple","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xlink:href":t}},{[e]:[]}]},o=t.split(".").pop();switch(o){case"png":case"jpeg":case"gif":i[n][1][e]=[{"#text":`image/${o}`}];break;case"jpg":i[n][1][e]=[{"#text":"image/jpeg"}];break;case"svg":i[n][1][e]=[{"#text":"image/svg+xml"}]}return i}getSldAnchorPointFromAnchor(t,n){return!t||x(t)?0:"x"===n?t.indexOf("left")>=0?0:t.indexOf("right")>=0?1:.5:t.indexOf("bottom")>=0?0:t.indexOf("top")>=0?1:.5}getAnchorFromSldAnchorPoint(t,n){if(!en(t)||!en(n))return;const e=t<.25?"left":t>.75?"right":"",r=n<.25?"bottom":n>.75?"top":"";return(e&&r?r+"-"+e:r+e)||void 0}getSldTextSymbolizerFromTextSymbolizer(t){const n=this.getTagName("CssParameter"),e=this.getTagName("Fill"),r=this.getTagName("Halo"),i=this.getTagName("Font"),o=this.getTagName("Displacement"),s=this.getTagName("DisplacementX"),u=this.getTagName("DisplacementY"),a=this.getTagName("AnchorPoint"),c=this.getTagName("AnchorPointX"),l=this.getTagName("AnchorPointY"),h=this.getTagName("LabelPlacement"),f=this.getTagName("PointPlacement"),p=this.getTagName("LinePlacement"),d=this.getTagName("Rotation"),m=this.getTagName("Radius"),y=this.getTagName("Label"),v=this.getTagName("PerpendicularOffset"),b=this.getTagName("IsRepeated"),g=this.getTagName("Gap"),w=[{[y]:t.label?this.getSldLabelFromTextSymbolizer(t.label):void 0}],E={font:"font-family",size:"font-size",fontStyle:"font-style",fontWeight:"font-weight"},S=Object.keys(t).filter((t=>"kind"!==t&&E[t])).map((e=>{var r;if(x(t[e])){const r=Vt(t[e]);return{[n]:r,":@":{"@_name":E[e]}}}return{[n]:[{"#text":"font"===e?null==(r=t[e])?void 0:r[0]:t[e]}],":@":{"@_name":E[e]}}}));if(S.length>0&&w.push({[i]:S}),"line"===t.placement){const n=[];if(void 0!==t.perpendicularOffset)if(x(t.perpendicularOffset)){const e=Vt(t.perpendicularOffset);n.push({[v]:e})}else n.push({[v]:[{"#text":t.perpendicularOffset.toString()}]});if("1.1.0"===this.sldVersion&&void 0!==t.repeat)if(n.push({[b]:[{"#text":!0}]}),x(t.repeat)){const e=Vt(t.repeat);n.push({[g]:e})}else n.push({[g]:[{"#text":t.repeat.toString()}]});w.push({[h]:[{[p]:n}]})}else if(Number.isFinite(t.offset)||t.anchor||void 0!==t.rotate||"point"===t.placement){const n=[];t.offset&&n.push({[o]:[{[s]:[{"#text":t.offset[0].toString()}]},{[u]:[{"#text":(-t.offset[1]).toString()}]}]}),t.anchor&&n.push({[a]:[{[c]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"x").toString()}]},{[l]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"y").toString()}]}]}),void 0!==t.rotate&&n.push({[d]:[{"#text":t.rotate.toString()}]}),w.push({[h]:[{[f]:n}]})}if(Number.isFinite(t.haloWidth)||t.haloColor){const i=[],o=[];t.haloWidth&&i.push({[m]:[{"#text":t.haloWidth.toString()}]}),t.haloColor&&o.push({[n]:[{"#text":t.haloColor}],":@":{"@_name":"fill"}}),t.haloOpacity&&o.push({[n]:[{"#text":t.haloOpacity}],":@":{"@_name":"fill-opacity"}}),o.length>0&&i.push({[e]:o}),w.push({[r]:i})}if(t.color||Number.isFinite(t.opacity)){const r=[{[n]:[{"#text":t.color||"#000000"}],":@":{"@_name":"fill"}}];Number.isFinite(t.opacity)&&r.push({[n]:[{"#text":`${t.opacity}`}],":@":{"@_name":"fill-opacity"}}),w.push({[e]:r})}return this.addUomEntry(w,t.sizeUnit),w}geoStylerFunctionToSldFunctionRecursive(t){if(null===t)return t;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return{"ogc:Literal":[{"#text":t}]};if("object"==typeof t){if("string"==typeof t.name||Array.isArray(t.args))return[{"ogc:Function":t.args.map((t=>"object"==typeof t&&null!==t&&"property"===t.name&&Array.isArray(t.args)?{"ogc:PropertyName":[{"#text":t.args[0]}]}:"object"==typeof t&&null!==t&&"string"==typeof t.name&&Array.isArray(t.args)?this.geoStylerFunctionToSldFunctionRecursive(t)[0]:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?{"ogc:Literal":[{"#text":t}]}:t)),":@":{"@_name":t.name}}];if("property"===t.name&&Array.isArray(t.args))return{"ogc:PropertyName":[{"#text":t.args[0]}]}}return t}getSldLineSymbolizerFromLineSymbolizer(t){var n,e,r,i,o,s,u;const a=this.getTagName("CssParameter"),c=this.getTagName("Stroke"),l=this.getTagName("GraphicStroke"),h=this.getTagName("GraphicFill"),f=this.getTagName("PerpendicularOffset"),p={color:"stroke",width:"stroke-width",opacity:"stroke-opacity",join:"stroke-linejoin",cap:"stroke-linecap",dasharray:"stroke-dasharray",dashOffset:"stroke-dashoffset"},d=[],m=Object.keys(t).filter((n=>"kind"!==n&&p[n]&&null!=t[n])).map((n=>{let e=t[n];if("dasharray"===n)return e=t.dasharray?t.dasharray.join(" "):void 0,{[a]:[{"#text":e}],":@":{"@_name":p[n]}};if("join"===n&&"miter"===e&&(e="mitre"),x(t[n])){const e=Vt(t[n]);return{[a]:e,":@":{"@_name":p[n]}}}return{[a]:[{"#text":t[n]}],":@":{"@_name":p[n]}}}));if(null!=t&&t.graphicStroke)if(Array.isArray(null==(n=null==d?void 0:d[0])?void 0:n[c])||(d[0]={[c]:[]}),"Mark"===(null==(e=null==t?void 0:t.graphicStroke)?void 0:e.kind)){const n=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicStroke);d[0][c].push({[l]:n})}else if("Icon"===(null==(r=null==t?void 0:t.graphicStroke)?void 0:r.kind)){const n=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicStroke);d[0][c].push({[l]:n})}if(null!=t&&t.graphicFill)if(Array.isArray(null==(i=null==d?void 0:d[0])?void 0:i[c])||(d[0]={[c]:[]}),"Mark"===(null==(o=null==t?void 0:t.graphicFill)?void 0:o.kind)){const n=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill);d[0][c].push({[h]:n})}else if("Icon"===(null==(s=null==t?void 0:t.graphicFill)?void 0:s.kind)){const n=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill);d[0][c].push({[h]:n})}return 0!==m.length&&(Array.isArray(null==(u=null==d?void 0:d[0])?void 0:u[c])||(d[0]={[c]:[]}),d[0][c].push(...m)),t.perpendicularOffset&&d.push({[f]:[{"#text":t.perpendicularOffset}]}),0===d.length&&d.push({[c]:{}}),this.addUomEntry(d,t.widthUnit),d}getSldPolygonSymbolizerFromFillSymbolizer(t){const n=this.getTagName("CssParameter"),e=this.getTagName("Stroke"),r=this.getTagName("Fill"),i={outlineColor:"stroke",outlineWidth:"stroke-width",outlineOpacity:"stroke-opacity",outlineDasharray:"stroke-dasharray",outlineCap:"stroke-linecap",outlineJoin:"stroke-linejoin"},o={color:"fill",fillOpacity:"fill-opacity"},s=[],u=[];let a;null!=t&&t.graphicFill&&("Mark"===(null==t?void 0:t.graphicFill.kind)?a=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill):"Icon"===(null==t?void 0:t.graphicFill.kind)&&(a=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill))),Object.keys(t).filter((t=>"kind"!==t)).filter((n=>null!=t[n])).forEach((e=>{if(Object.keys(o).includes(e))if(x(t[e])){const r=Vt(t[e]);u.push({[n]:r,":@":{"@_name":o[e]}})}else u.push({[n]:[{"#text":t[e]}],":@":{"@_name":o[e]}});else if(Object.keys(i).includes(e)){let r="";if("outlineDasharray"===e){const n=t[e];r="",n.forEach(((t,e)=>{r+=t,e<n.length-1&&(r+=" ")}))}else r="outlineWidth"===e||"outlineOpacity"===e?t[e]+"":t[e];if(x(t[e])){const r=Vt(t[e]);s.push({[n]:r,":@":{"@_name":i[e]}})}else s.push({[n]:[{"#text":r}],":@":{"@_name":i[e]}})}}));const c=[];if(u.length>0||a){const n=[],e=t.graphicFillPadding;e&&this.pushGeoServerVendorOption(c,"graphic-margin",e.join(" ")),c.push({[r]:n}),a&&n.push({[this.getTagName("GraphicFill")]:a}),u.length>0&&n.push(...u)}return s.length>0&&c.push({[e]:s}),this.addUomEntry(c,t.outlineWidthUnit),c}getSldRasterSymbolizerFromRasterSymbolizer(t){const n=[];let e,r,i;return void 0!==t.opacity&&(n.push({}),n[0].Opacity=[{"#text":t.opacity}]),t.colorMap&&(e=this.getSldColorMapFromColorMap(t.colorMap),null!=e&&e[0]&&n.push({ColorMap:e})),t.channelSelection&&(r=this.getSldChannelSelectionFromChannelSelection(t.channelSelection),null!=r&&r[0]&&n.push({ChannelSelection:r})),t.contrastEnhancement&&(i=this.getSldContrastEnhancementFromContrastEnhancement(t.contrastEnhancement),null!=i&&i[0]&&n.push({ContrastEnhancement:i})),n}getSldColorMapFromColorMap(t){const n=[];if(t.type&&(n[":@"]={"@_type":t.type}),void 0!==t.extended){const e=t.extended.toString();n[":@"]||(n[":@"]={}),n[":@"]["@_extended"]=e}if(t.colorMapEntries&&t.colorMapEntries.length>0){const e=t.colorMapEntries.map((t=>{const n={ColorMapEntry:[],":@":{}};return t.color&&(n[":@"]["@_color"]=t.color),typeof t.quantity<"u"&&(n[":@"]["@_quantity"]=t.quantity.toString()),t.label&&(n[":@"]["@_label"]=t.label),typeof t.opacity<"u"&&(n[":@"]["@_opacity"]=t.opacity.toString()),n})).filter((t=>Object.keys(t).length>0));n.push(...e)}return n}getSldChannelSelectionFromChannelSelection(t){const n={redChannel:"RedChannel",blueChannel:"BlueChannel",greenChannel:"GreenChannel",grayChannel:"GrayChannel"},e=Object.keys(t),r=[];return e.forEach((e=>{var i,o;const s=[],u=null==(i=null==t?void 0:t[e])?void 0:i.sourceChannelName,a=n[e],c=null==(o=null==t?void 0:t[e])?void 0:o.contrastEnhancement;(u||c)&&(u&&s.push({SourceChannelName:[{"#text":u}]}),c&&s.push({ContrastEnhancement:this.getSldContrastEnhancementFromContrastEnhancement(c)}),r.push({[a]:s}))})),r}getSldContrastEnhancementFromContrastEnhancement(t){const n=[],e=null==t?void 0:t.enhancementType;return"normalize"===e?n.push({Normalize:[]}):"histogram"===e&&n.push({Histogram:[]}),void 0!==t.gammaValue&&n.push({GammaValue:[{"#text":t.gammaValue}]}),n}checkForUnsupportedProperties(t){const n={};if(t.rules.forEach((t=>{t.symbolizers.forEach((t=>{var e,r;const i=(t=>t[0].toUpperCase()+t.slice(1))(`${t.kind}Symbolizer`),o=null==(r=null==(e=this.unsupportedProperties)?void 0:e.Symbolizer)?void 0:r[i];o&&("string"==typeof o||o instanceof String?(n.Symbolizer||(n.Symbolizer={}),n.Symbolizer[i]=o):Object.keys(t).forEach((e=>{if(o[e]){const r=String(t[e]).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(`["']${r}["']`);if("partial"===o[e].support&&s.test(o[e].info))return;n.Symbolizer||(n.Symbolizer={}),n.Symbolizer[i]||(n.Symbolizer[i]={}),n.Symbolizer[i][e]=o[e]}})))}))})),Object.keys(n).length>0)return n}}function gn(t){return null!=t&&"number"==typeof t.valueOf()}function wn(t){return null!=t&&"boolean"==typeof t.valueOf()}sn(bn,"title","SLD Style Parser");const xn=t=>Dn(t)||En(t),En=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||gn(t)||wn(t)||null===t,Sn=t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t),On=t=>["&&","||"].includes(t),Fn=t=>"!"===t,Tn=t=>Mn(t)||kn(t)||Nn(t)||In(t)||Nn(t)||wn(t),Mn=t=>{const n=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===n&&Sn(t[0])&&xn(t[1])&&xn(t[2])&&("<=x<="!==t[0]||gn(t[3]))},kn=t=>Array.isArray(t)&&t.length>=3&&On(t[0])&&t.every(((t,n)=>0===n||Tn(t))),In=t=>Array.isArray(t)&&2===t.length&&Fn(t[0])&&Tn(t[1]),_n=t=>"Fill"===(null==t?void 0:t.kind),An=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(null==t?void 0:t.name),Cn=t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(null==t?void 0:t.name),Nn=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(null==t?void 0:t.name),Dn=t=>Nn(t)||An(t)||Cn(t)||(t=>["case","property","step"].includes(null==t?void 0:t.name))(t);class jn{static getResolutions(){const t=[];let n=78271.51696402048;for(t.push(2*n);t.length<=24;n/=2)t.push(n);return t}static getScaleForResolution(t){return 1*t*39.37008*(25.4/.28)}static getZoomForResolution(t){let n=0;const e=jn.getResolutions(),r=e.length;for(;n<r;++n)if(e[n]<t&&n+1<r){const r=e[n]/e[n+1];return n+Math.log(e[n]/t)/Math.log(r)}return r-1}static getResolutionForScale(t){return t/3571.428685714285}static zoomToScale(t){const n=jn.getResolutions();if(t>=n.length)throw new Error("Cannot parse scaleDenominator. ZoomLevel does not exist.");let e;if(Number.isInteger(t))e=n[t];else{const r=Math.floor(t),i=n[r];e=Math.pow(2,r)*i/Math.pow(2,t)}return this.getScaleForResolution(e)}static allUndefined(t){return!t||!Object.keys(t).some((n=>void 0!==t[n]))}static symbolizerAllUndefined(t){return!Object.keys(t).filter((t=>"kind"!==t&&"visibility"!==t)).some((n=>void 0!==t[n]))}static getUrlForMbPlaceholder(t){const n="mapbox://";return t&&t.startsWith(n)?t.replace(n,"https://api.mapbox.com/"):t}static getMbPlaceholderForUrl(t){const n="https://api.mapbox.com/";return t&&t.startsWith(n)?t.replace(n,"mapbox://"):t}static resolveMbTextPlaceholder(t){let n=new RegExp("\\{.*?\\}","g");return t.replace(n,(t=>`{${t}}`))}static getSpriteName(t,n){if(!n?.sprite||!t)throw new Error("Cannot retrieve sprite name. Sprite or metadata missing.");const e=Object.keys(n.sprite).find((e=>{const r=n.sprite[e];return r.position[0]===t.position[0]&&r.position[1]===t.position[1]&&r.size[0]===t.size[0]&&r.size[1]===t.size[1]}));if(!e)throw new Error("Cannot retrieve sprite name. No matching sprite in metadata.");return e||""}static splitRgbaColor(t){const n=t.substring(t.indexOf("(")+1,t.lastIndexOf(")")).split(/,\s*/);return[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10),parseFloat(n[3])]}static getHexCodeFromRgbArray(t){return"#"+t.map(((t,n)=>{const e=t.toString(16);return n<3?1===e.length?"0"+e:e:""})).join("")}static getHexColor(t){if(t.startsWith("#"))return t;if(t.startsWith("rgb")){const n=this.splitRgbaColor(t);return this.getHexCodeFromRgbArray(n)}}}var Pn,Ln,Rn,$n={exports:{}},zn=(Pn||(Pn=1,Ln=$n,Rn=$n.exports,function(){var t,n="Expected a function",e="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,s=128,u=1/0,a=9007199254740991,c=NaN,l=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",256]],f="[object Arguments]",p="[object Array]",d="[object Boolean]",m="[object Date]",y="[object Error]",v="[object Function]",b="[object GeneratorFunction]",g="[object Map]",w="[object Number]",x="[object Object]",E="[object Promise]",S="[object RegExp]",O="[object Set]",F="[object String]",T="[object Symbol]",M="[object WeakMap]",k="[object ArrayBuffer]",I="[object DataView]",_="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",N="[object Int16Array]",D="[object Int32Array]",j="[object Uint8Array]",P="[object Uint8ClampedArray]",L="[object Uint16Array]",R="[object Uint32Array]",$=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,q=RegExp(G.source),W=RegExp(B.source),Y=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,J=RegExp(Z.source),tt=/^\s+/,nt=/\s/,et=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rt=/\{\n\/\* \[wrapped with (.+)\] \*/,it=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,st=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,at=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ct=/\w*$/,lt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,pt=/^0o[0-7]+$/i,dt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",gt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",wt="\\u2700-\\u27bf",xt="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",St="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ft="["+bt+"]",Tt="["+Ot+"]",Mt="["+gt+"]",kt="\\d+",It="["+wt+"]",_t="["+xt+"]",At="[^"+bt+Ot+kt+wt+xt+Et+"]",Ct="\\ud83c[\\udffb-\\udfff]",Nt="[^"+bt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt="["+Et+"]",Lt="\\u200d",Rt="(?:"+_t+"|"+At+")",$t="(?:"+Pt+"|"+At+")",zt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+Mt+"|"+Ct+")?",Bt="["+St+"]?",qt=Bt+Gt+"(?:"+Lt+"(?:"+[Nt,Dt,jt].join("|")+")"+Bt+Gt+")*",Wt="(?:"+[It,Dt,jt].join("|")+")"+qt,Yt="(?:"+[Nt+Mt+"?",Mt,Dt,jt,Ft].join("|")+")",Vt=RegExp("['’]","g"),Ht=RegExp(Mt,"g"),Kt=RegExp(Ct+"(?="+Ct+")|"+Yt+qt,"g"),Xt=RegExp([Pt+"?"+_t+"+"+zt+"(?="+[Tt,Pt,"$"].join("|")+")",$t+"+"+Ut+"(?="+[Tt,Pt+Rt,"$"].join("|")+")",Pt+"?"+Rt+"+"+zt,Pt+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kt,Wt].join("|"),"g"),Qt=RegExp("["+Lt+bt+gt+St+"]"),Zt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Jt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tn=-1,nn={};nn[_]=nn[A]=nn[C]=nn[N]=nn[D]=nn[j]=nn[P]=nn[L]=nn[R]=!0,nn[f]=nn[p]=nn[k]=nn[d]=nn[I]=nn[m]=nn[y]=nn[v]=nn[g]=nn[w]=nn[x]=nn[S]=nn[O]=nn[F]=nn[M]=!1;var en={};en[f]=en[p]=en[k]=en[I]=en[d]=en[m]=en[_]=en[A]=en[C]=en[N]=en[D]=en[g]=en[w]=en[x]=en[S]=en[O]=en[F]=en[T]=en[j]=en[P]=en[L]=en[R]=!0,en[y]=en[v]=en[M]=!1;var rn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},on=parseFloat,sn=parseInt,un="object"==typeof o&&o&&o.Object===Object&&o,an="object"==typeof self&&self&&self.Object===Object&&self,cn=un||an||Function("return this")(),ln=Rn&&!Rn.nodeType&&Rn,hn=ln&&Ln&&!Ln.nodeType&&Ln,fn=hn&&hn.exports===ln,pn=fn&&un.process,dn=function(){try{return hn&&hn.require&&hn.require("util").types||pn&&pn.binding&&pn.binding("util")}catch(t){}}(),mn=dn&&dn.isArrayBuffer,yn=dn&&dn.isDate,vn=dn&&dn.isMap,bn=dn&&dn.isRegExp,gn=dn&&dn.isSet,wn=dn&&dn.isTypedArray;function xn(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}function En(t,n,e,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];n(r,s,e(s),t)}return r}function Sn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r&&!1!==n(t[e],e,t););return t}function On(t,n){for(var e=null==t?0:t.length;e--&&!1!==n(t[e],e,t););return t}function Fn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(!n(t[e],e,t))return!1;return!0}function Tn(t,n){for(var e=-1,r=null==t?0:t.length,i=0,o=[];++e<r;){var s=t[e];n(s,e,t)&&(o[i++]=s)}return o}function Mn(t,n){return!(null==t||!t.length)&&$n(t,n,0)>-1}function kn(t,n,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(n,t[r]))return!0;return!1}function In(t,n){for(var e=-1,r=null==t?0:t.length,i=Array(r);++e<r;)i[e]=n(t[e],e,t);return i}function _n(t,n){for(var e=-1,r=n.length,i=t.length;++e<r;)t[i+e]=n[e];return t}function An(t,n,e,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(e=t[++i]);++i<o;)e=n(e,t[i],i,t);return e}function Cn(t,n,e,r){var i=null==t?0:t.length;for(r&&i&&(e=t[--i]);i--;)e=n(e,t[i],i,t);return e}function Nn(t,n){for(var e=-1,r=null==t?0:t.length;++e<r;)if(n(t[e],e,t))return!0;return!1}var Dn=Bn("length");function jn(t,n,e){var r;return e(t,(function(t,e,i){if(n(t,e,i))return r=e,!1})),r}function Pn(t,n,e,r){for(var i=t.length,o=e+(r?1:-1);r?o--:++o<i;)if(n(t[o],o,t))return o;return-1}function $n(t,n,e){return n==n?function(t,n,e){for(var r=e-1,i=t.length;++r<i;)if(t[r]===n)return r;return-1}(t,n,e):Pn(t,Un,e)}function zn(t,n,e,r){for(var i=e-1,o=t.length;++i<o;)if(r(t[i],n))return i;return-1}function Un(t){return t!=t}function Gn(t,n){var e=null==t?0:t.length;return e?Yn(t,n)/e:c}function Bn(n){return function(e){return null==e?t:e[n]}}function qn(n){return function(e){return null==n?t:n[e]}}function Wn(t,n,e,r,i){return i(t,(function(t,i,o){e=r?(r=!1,t):n(e,t,i,o)})),e}function Yn(n,e){for(var r,i=-1,o=n.length;++i<o;){var s=e(n[i]);s!==t&&(r=r===t?s:r+s)}return r}function Vn(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r}function Hn(t){return t?t.slice(0,he(t)+1).replace(tt,""):t}function Kn(t){return function(n){return t(n)}}function Xn(t,n){return In(n,(function(n){return t[n]}))}function Qn(t,n){return t.has(n)}function Zn(t,n){for(var e=-1,r=t.length;++e<r&&$n(n,t[e],0)>-1;);return e}function Jn(t,n){for(var e=t.length;e--&&$n(n,t[e],0)>-1;);return e}var te=qn({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),ne=qn({"&":"&","<":"<",">":">",'"':""","'":"'"});function ee(t){return"\\"+rn[t]}function re(t){return Qt.test(t)}function ie(t){var n=-1,e=Array(t.size);return t.forEach((function(t,r){e[++n]=[r,t]})),e}function oe(t,n){return function(e){return t(n(e))}}function se(t,n){for(var e=-1,i=t.length,o=0,s=[];++e<i;){var u=t[e];u!==n&&u!==r||(t[e]=r,s[o++]=e)}return s}function ue(t){var n=-1,e=Array(t.size);return t.forEach((function(t){e[++n]=t})),e}function ae(t){var n=-1,e=Array(t.size);return t.forEach((function(t){e[++n]=[t,t]})),e}function ce(t){return re(t)?function(t){for(var n=Kt.lastIndex=0;Kt.test(t);)++n;return n}(t):Dn(t)}function le(t){return re(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function he(t){for(var n=t.length;n--&&nt.test(t.charAt(n)););return n}var fe=qn({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pe=function o(nt){var bt,gt=(nt=null==nt?cn:pe.defaults(cn.Object(),nt,pe.pick(cn,Jt))).Array,wt=nt.Date,xt=nt.Error,Et=nt.Function,St=nt.Math,Ot=nt.Object,Ft=nt.RegExp,Tt=nt.String,Mt=nt.TypeError,kt=gt.prototype,It=Ot.prototype,_t=nt["__core-js_shared__"],At=Et.prototype.toString,Ct=It.hasOwnProperty,Nt=0,Dt=(bt=/[^.]+$/.exec(_t&&_t.keys&&_t.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",jt=It.toString,Pt=At.call(Ot),Lt=cn._,Rt=Ft("^"+At.call(Ct).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$t=fn?nt.Buffer:t,zt=nt.Symbol,Ut=nt.Uint8Array,Gt=$t?$t.allocUnsafe:t,Bt=oe(Ot.getPrototypeOf,Ot),qt=Ot.create,Wt=It.propertyIsEnumerable,Yt=kt.splice,Kt=zt?zt.isConcatSpreadable:t,Qt=zt?zt.iterator:t,rn=zt?zt.toStringTag:t,un=function(){try{var t=uo(Ot,"defineProperty");return t({},"",{}),t}catch(t){}}(),an=nt.clearTimeout!==cn.clearTimeout&&nt.clearTimeout,ln=wt&&wt.now!==cn.Date.now&&wt.now,hn=nt.setTimeout!==cn.setTimeout&&nt.setTimeout,pn=St.ceil,dn=St.floor,Dn=Ot.getOwnPropertySymbols,Ln=$t?$t.isBuffer:t,Rn=nt.isFinite,qn=kt.join,de=oe(Ot.keys,Ot),me=St.max,ye=St.min,ve=wt.now,be=nt.parseInt,ge=St.random,we=kt.reverse,xe=uo(nt,"DataView"),Ee=uo(nt,"Map"),Se=uo(nt,"Promise"),Oe=uo(nt,"Set"),Fe=uo(nt,"WeakMap"),Te=uo(Ot,"create"),Me=Fe&&new Fe,ke={},Ie=Po(xe),_e=Po(Ee),Ae=Po(Se),Ce=Po(Oe),Ne=Po(Fe),De=zt?zt.prototype:t,je=De?De.valueOf:t,Pe=De?De.toString:t;function Le(t){if(Js(t)&&!Gs(t)&&!(t instanceof Ue)){if(t instanceof ze)return t;if(Ct.call(t,"__wrapped__"))return Lo(t)}return new ze(t)}var Re=function(){function n(){}return function(e){if(!Zs(e))return{};if(qt)return qt(e);n.prototype=e;var r=new n;return n.prototype=t,r}}();function $e(){}function ze(n,e){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Ue(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Ge(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function Be(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function qe(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function We(t){var n=-1,e=null==t?0:t.length;for(this.__data__=new qe;++n<e;)this.add(t[n])}function Ye(t){var n=this.__data__=new Be(t);this.size=n.size}function Ve(t,n){var e=Gs(t),r=!e&&Us(t),i=!e&&!r&&Ys(t),o=!e&&!r&&!i&&uu(t),s=e||r||i||o,u=s?Vn(t.length,Tt):[],a=u.length;for(var c in t)!n&&!Ct.call(t,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,a))||u.push(c);return u}function He(n){var e=n.length;return e?n[qr(0,e-1)]:t}function Ke(t,n){return Ao(Fi(t),ir(n,0,t.length))}function Xe(t){return Ao(Fi(t))}function Qe(n,e,r){(r!==t&&!Rs(n[e],r)||r===t&&!(e in n))&&er(n,e,r)}function Ze(n,e,r){var i=n[e];Ct.call(n,e)&&Rs(i,r)&&(r!==t||e in n)||er(n,e,r)}function Je(t,n){for(var e=t.length;e--;)if(Rs(t[e][0],n))return e;return-1}function tr(t,n,e,r){return cr(t,(function(t,i,o){n(r,t,e(t),o)})),r}function nr(t,n){return t&&Ti(n,Iu(n),t)}function er(t,n,e){"__proto__"==n&&un?un(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}function rr(n,e){for(var r=-1,i=e.length,o=gt(i),s=null==n;++r<i;)o[r]=s?t:Ou(n,e[r]);return o}function ir(n,e,r){return n==n&&(r!==t&&(n=n<=r?n:r),e!==t&&(n=n>=e?n:e)),n}function or(n,e,r,i,o,s){var u,a=1&e,c=2&e,l=4&e;if(r&&(u=o?r(n,i,o,s):r(n)),u!==t)return u;if(!Zs(n))return n;var h=Gs(n);if(h){if(u=function(t){var n=t.length,e=new t.constructor(n);return n&&"string"==typeof t[0]&&Ct.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(n),!a)return Fi(n,u)}else{var p=lo(n),y=p==v||p==b;if(Ys(n))return gi(n,a);if(p==x||p==f||y&&!o){if(u=c||y?{}:fo(n),!a)return c?function(t,n){return Ti(t,co(t),n)}(n,function(t,n){return t&&Ti(n,_u(n),t)}(u,n)):function(t,n){return Ti(t,ao(t),n)}(n,nr(u,n))}else{if(!en[p])return o?n:{};u=function(t,n,e){var r=t.constructor;switch(n){case k:return wi(t);case d:case m:return new r(+t);case I:return function(t,n){var e=n?wi(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case _:case A:case C:case N:case D:case j:case P:case L:case R:return xi(t,e);case g:return new r;case w:case F:return new r(t);case S:return function(t){var n=new t.constructor(t.source,ct.exec(t));return n.lastIndex=t.lastIndex,n}(t);case O:return new r;case T:return je?Ot(je.call(t)):{}}}(n,p,a)}}s||(s=new Ye);var E=s.get(n);if(E)return E;s.set(n,u),iu(n)?n.forEach((function(t){u.add(or(t,e,r,t,n,s))})):tu(n)&&n.forEach((function(t,i){u.set(i,or(t,e,r,i,n,s))}));var M=h?t:(l?c?to:Ji:c?_u:Iu)(n);return Sn(M||n,(function(t,i){M&&(t=n[i=t]),Ze(u,i,or(t,e,r,i,n,s))})),u}function sr(n,e,r){var i=r.length;if(null==n)return!i;for(n=Ot(n);i--;){var o=r[i],s=n[o];if(s===t&&!(o in n)||!(0,e[o])(s))return!1}return!0}function ur(e,r,i){if("function"!=typeof e)throw new Mt(n);return Mo((function(){e.apply(t,i)}),r)}function ar(t,n,e,r){var i=-1,o=Mn,s=!0,u=t.length,a=[],c=n.length;if(!u)return a;e&&(n=In(n,Kn(e))),r?(o=kn,s=!1):n.length>=200&&(o=Qn,s=!1,n=new We(n));t:for(;++i<u;){var l=t[i],h=null==e?l:e(l);if(l=r||0!==l?l:0,s&&h==h){for(var f=c;f--;)if(n[f]===h)continue t;a.push(l)}else o(n,h,r)||a.push(l)}return a}Le.templateSettings={escape:Y,evaluate:V,interpolate:H,variable:"",imports:{_:Le}},(Le.prototype=$e.prototype).constructor=Le,(ze.prototype=Re($e.prototype)).constructor=ze,(Ue.prototype=Re($e.prototype)).constructor=Ue,Ge.prototype.clear=function(){this.__data__=Te?Te(null):{},this.size=0},Ge.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},Ge.prototype.get=function(n){var r=this.__data__;if(Te){var i=r[n];return i===e?t:i}return Ct.call(r,n)?r[n]:t},Ge.prototype.has=function(n){var e=this.__data__;return Te?e[n]!==t:Ct.call(e,n)},Ge.prototype.set=function(n,r){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=Te&&r===t?e:r,this},Be.prototype.clear=function(){this.__data__=[],this.size=0},Be.prototype.delete=function(t){var n=this.__data__,e=Je(n,t);return!(e<0||(e==n.length-1?n.pop():Yt.call(n,e,1),--this.size,0))},Be.prototype.get=function(n){var e=this.__data__,r=Je(e,n);return r<0?t:e[r][1]},Be.prototype.has=function(t){return Je(this.__data__,t)>-1},Be.prototype.set=function(t,n){var e=this.__data__,r=Je(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this},qe.prototype.clear=function(){this.size=0,this.__data__={hash:new Ge,map:new(Ee||Be),string:new Ge}},qe.prototype.delete=function(t){var n=oo(this,t).delete(t);return this.size-=n?1:0,n},qe.prototype.get=function(t){return oo(this,t).get(t)},qe.prototype.has=function(t){return oo(this,t).has(t)},qe.prototype.set=function(t,n){var e=oo(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this},We.prototype.add=We.prototype.push=function(t){return this.__data__.set(t,e),this},We.prototype.has=function(t){return this.__data__.has(t)},Ye.prototype.clear=function(){this.__data__=new Be,this.size=0},Ye.prototype.delete=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e},Ye.prototype.get=function(t){return this.__data__.get(t)},Ye.prototype.has=function(t){return this.__data__.has(t)},Ye.prototype.set=function(t,n){var e=this.__data__;if(e instanceof Be){var r=e.__data__;if(!Ee||r.length<199)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new qe(r)}return e.set(t,n),this.size=e.size,this};var cr=Ii(vr),lr=Ii(br,!0);function hr(t,n){var e=!0;return cr(t,(function(t,r,i){return e=!!n(t,r,i)})),e}function fr(n,e,r){for(var i=-1,o=n.length;++i<o;){var s=n[i],u=e(s);if(null!=u&&(a===t?u==u&&!su(u):r(u,a)))var a=u,c=s}return c}function pr(t,n){var e=[];return cr(t,(function(t,r,i){n(t,r,i)&&e.push(t)})),e}function dr(t,n,e,r,i){var o=-1,s=t.length;for(e||(e=po),i||(i=[]);++o<s;){var u=t[o];n>0&&e(u)?n>1?dr(u,n-1,e,r,i):_n(i,u):r||(i[i.length]=u)}return i}var mr=_i(),yr=_i(!0);function vr(t,n){return t&&mr(t,n,Iu)}function br(t,n){return t&&yr(t,n,Iu)}function gr(t,n){return Tn(n,(function(n){return Ks(t[n])}))}function wr(n,e){for(var r=0,i=(e=mi(e,n)).length;null!=n&&r<i;)n=n[jo(e[r++])];return r&&r==i?n:t}function xr(t,n,e){var r=n(t);return Gs(t)?r:_n(r,e(t))}function Er(n){return null==n?n===t?"[object Undefined]":"[object Null]":rn&&rn in Ot(n)?function(n){var e=Ct.call(n,rn),r=n[rn];try{n[rn]=t;var i=!0}catch(t){}var o=jt.call(n);return i&&(e?n[rn]=r:delete n[rn]),o}(n):function(t){return jt.call(t)}(n)}function Sr(t,n){return t>n}function Or(t,n){return null!=t&&Ct.call(t,n)}function Fr(t,n){return null!=t&&n in Ot(t)}function Tr(n,e,r){for(var i=r?kn:Mn,o=n[0].length,s=n.length,u=s,a=gt(s),c=1/0,l=[];u--;){var h=n[u];u&&e&&(h=In(h,Kn(e))),c=ye(h.length,c),a[u]=!r&&(e||o>=120&&h.length>=120)?new We(u&&h):t}h=n[0];var f=-1,p=a[0];t:for(;++f<o&&l.length<c;){var d=h[f],m=e?e(d):d;if(d=r||0!==d?d:0,!(p?Qn(p,m):i(l,m,r))){for(u=s;--u;){var y=a[u];if(!(y?Qn(y,m):i(n[u],m,r)))continue t}p&&p.push(m),l.push(d)}}return l}function Mr(n,e,r){var i=null==(n=Oo(n,e=mi(e,n)))?n:n[jo(Ho(e))];return null==i?t:xn(i,n,r)}function kr(t){return Js(t)&&Er(t)==f}function Ir(n,e,r,i,o){return n===e||(null==n||null==e||!Js(n)&&!Js(e)?n!=n&&e!=e:function(n,e,r,i,o,s){var u=Gs(n),a=Gs(e),c=u?p:lo(n),l=a?p:lo(e),h=(c=c==f?x:c)==x,v=(l=l==f?x:l)==x,b=c==l;if(b&&Ys(n)){if(!Ys(e))return!1;u=!0,h=!1}if(b&&!h)return s||(s=new Ye),u||uu(n)?Qi(n,e,r,i,o,s):function(t,n,e,r,i,o,s){switch(e){case I:if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case k:return!(t.byteLength!=n.byteLength||!o(new Ut(t),new Ut(n)));case d:case m:case w:return Rs(+t,+n);case y:return t.name==n.name&&t.message==n.message;case S:case F:return t==n+"";case g:var u=ie;case O:if(u||(u=ue),t.size!=n.size&&!(1&r))return!1;var a=s.get(t);if(a)return a==n;r|=2,s.set(t,n);var c=Qi(u(t),u(n),r,i,o,s);return s.delete(t),c;case T:if(je)return je.call(t)==je.call(n)}return!1}(n,e,c,r,i,o,s);if(!(1&r)){var E=h&&Ct.call(n,"__wrapped__"),M=v&&Ct.call(e,"__wrapped__");if(E||M){var _=E?n.value():n,A=M?e.value():e;return s||(s=new Ye),o(_,A,r,i,s)}}return!!b&&(s||(s=new Ye),function(n,e,r,i,o,s){var u=1&r,a=Ji(n),c=a.length;if(c!=Ji(e).length&&!u)return!1;for(var l=c;l--;){var h=a[l];if(!(u?h in e:Ct.call(e,h)))return!1}var f=s.get(n),p=s.get(e);if(f&&p)return f==e&&p==n;var d=!0;s.set(n,e),s.set(e,n);for(var m=u;++l<c;){var y=n[h=a[l]],v=e[h];if(i)var b=u?i(v,y,h,e,n,s):i(y,v,h,n,e,s);if(!(b===t?y===v||o(y,v,r,i,s):b)){d=!1;break}m||(m="constructor"==h)}if(d&&!m){var g=n.constructor,w=e.constructor;g==w||!("constructor"in n)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof w&&w instanceof w||(d=!1)}return s.delete(n),s.delete(e),d}(n,e,r,i,o,s))}(n,e,r,i,Ir,o))}function _r(n,e,r,i){var o=r.length,s=o,u=!i;if(null==n)return!s;for(n=Ot(n);o--;){var a=r[o];if(u&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++o<s;){var c=(a=r[o])[0],l=n[c],h=a[1];if(u&&a[2]){if(l===t&&!(c in n))return!1}else{var f=new Ye;if(i)var p=i(l,h,c,n,e,f);if(!(p===t?Ir(h,l,3,i,f):p))return!1}}return!0}function Ar(t){return!(!Zs(t)||(n=t,Dt&&Dt in n))&&(Ks(t)?Rt:ft).test(Po(t));var n}function Cr(t){return"function"==typeof t?t:null==t?na:"object"==typeof t?Gs(t)?Lr(t[0],t[1]):Pr(t):la(t)}function Nr(t){if(!wo(t))return de(t);var n=[];for(var e in Ot(t))Ct.call(t,e)&&"constructor"!=e&&n.push(e);return n}function Dr(t,n){return t<n}function jr(t,n){var e=-1,r=qs(t)?gt(t.length):[];return cr(t,(function(t,i,o){r[++e]=n(t,i,o)})),r}function Pr(t){var n=so(t);return 1==n.length&&n[0][2]?Eo(n[0][0],n[0][1]):function(e){return e===t||_r(e,t,n)}}function Lr(n,e){return vo(n)&&xo(e)?Eo(jo(n),e):function(r){var i=Ou(r,n);return i===t&&i===e?Fu(r,n):Ir(e,i,3)}}function Rr(n,e,r,i,o){n!==e&&mr(e,(function(s,u){if(o||(o=new Ye),Zs(s))!function(n,e,r,i,o,s,u){var a=Fo(n,r),c=Fo(e,r),l=u.get(c);if(l)Qe(n,r,l);else{var h=s?s(a,c,r+"",n,e,u):t,f=h===t;if(f){var p=Gs(c),d=!p&&Ys(c),m=!p&&!d&&uu(c);h=c,p||d||m?Gs(a)?h=a:Ws(a)?h=Fi(a):d?(f=!1,h=gi(c,!0)):m?(f=!1,h=xi(c,!0)):h=[]:eu(c)||Us(c)?(h=a,Us(a)?h=mu(a):Zs(a)&&!Ks(a)||(h=fo(c))):f=!1}f&&(u.set(c,h),o(h,c,i,s,u),u.delete(c)),Qe(n,r,h)}}(n,e,u,r,Rr,i,o);else{var a=i?i(Fo(n,u),s,u+"",n,e,o):t;a===t&&(a=s),Qe(n,u,a)}}),_u)}function $r(n,e){var r=n.length;if(r)return mo(e+=e<0?r:0,r)?n[e]:t}function zr(t,n,e){n=n.length?In(n,(function(t){return Gs(t)?function(n){return wr(n,1===t.length?t[0]:t)}:t})):[na];var r=-1;n=In(n,Kn(io()));var i=jr(t,(function(t){var e=In(n,(function(n){return n(t)}));return{criteria:e,index:++r,value:t}}));return function(t){var n=t.length;for(t.sort((function(t,n){return function(t,n,e){for(var r=-1,i=t.criteria,o=n.criteria,s=i.length,u=e.length;++r<s;){var a=Ei(i[r],o[r]);if(a)return r>=u?a:a*("desc"==e[r]?-1:1)}return t.index-n.index}(t,n,e)}));n--;)t[n]=t[n].value;return t}(i)}function Ur(t,n,e){for(var r=-1,i=n.length,o={};++r<i;){var s=n[r],u=wr(t,s);e(u,s)&&Kr(o,mi(s,t),u)}return o}function Gr(t,n,e,r){var i=r?zn:$n,o=-1,s=n.length,u=t;for(t===n&&(n=Fi(n)),e&&(u=In(t,Kn(e)));++o<s;)for(var a=0,c=n[o],l=e?e(c):c;(a=i(u,l,a,r))>-1;)u!==t&&Yt.call(u,a,1),Yt.call(t,a,1);return t}function Br(t,n){for(var e=t?n.length:0,r=e-1;e--;){var i=n[e];if(e==r||i!==o){var o=i;mo(i)?Yt.call(t,i,1):ui(t,i)}}return t}function qr(t,n){return t+dn(ge()*(n-t+1))}function Wr(t,n){var e="";if(!t||n<1||n>a)return e;do{n%2&&(e+=t),(n=dn(n/2))&&(t+=t)}while(n);return e}function Yr(t,n){return ko(So(t,n,na),t+"")}function Vr(t){return He(Ru(t))}function Hr(t,n){var e=Ru(t);return Ao(e,ir(n,0,e.length))}function Kr(n,e,r,i){if(!Zs(n))return n;for(var o=-1,s=(e=mi(e,n)).length,u=s-1,a=n;null!=a&&++o<s;){var c=jo(e[o]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(o!=u){var h=a[c];(l=i?i(h,c,a):t)===t&&(l=Zs(h)?h:mo(e[o+1])?[]:{})}Ze(a,c,l),a=a[c]}return n}var Xr=Me?function(t,n){return Me.set(t,n),t}:na,Qr=un?function(t,n){return un(t,"toString",{configurable:!0,enumerable:!1,value:Zu(n),writable:!0})}:na;function Zr(t){return Ao(Ru(t))}function Jr(t,n,e){var r=-1,i=t.length;n<0&&(n=-n>i?0:i+n),(e=e>i?i:e)<0&&(e+=i),i=n>e?0:e-n>>>0,n>>>=0;for(var o=gt(i);++r<i;)o[r]=t[r+n];return o}function ti(t,n){var e;return cr(t,(function(t,r,i){return!(e=n(t,r,i))})),!!e}function ni(t,n,e){var r=0,i=null==t?r:t.length;if("number"==typeof n&&n==n&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!su(s)&&(e?s<=n:s<n)?r=o+1:i=o}return i}return ei(t,n,na,e)}function ei(n,e,r,i){var o=0,s=null==n?0:n.length;if(0===s)return 0;for(var u=(e=r(e))!=e,a=null===e,c=su(e),l=e===t;o<s;){var h=dn((o+s)/2),f=r(n[h]),p=f!==t,d=null===f,m=f==f,y=su(f);if(u)var v=i||m;else v=l?m&&(i||p):a?m&&p&&(i||!d):c?m&&p&&!d&&(i||!y):!d&&!y&&(i?f<=e:f<e);v?o=h+1:s=h}return ye(s,4294967294)}function ri(t,n){for(var e=-1,r=t.length,i=0,o=[];++e<r;){var s=t[e],u=n?n(s):s;if(!e||!Rs(u,a)){var a=u;o[i++]=0===s?0:s}}return o}function ii(t){return"number"==typeof t?t:su(t)?c:+t}function oi(t){if("string"==typeof t)return t;if(Gs(t))return In(t,oi)+"";if(su(t))return Pe?Pe.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function si(t,n,e){var r=-1,i=Mn,o=t.length,s=!0,u=[],a=u;if(e)s=!1,i=kn;else if(o>=200){var c=n?null:Wi(t);if(c)return ue(c);s=!1,i=Qn,a=new We}else a=n?[]:u;t:for(;++r<o;){var l=t[r],h=n?n(l):l;if(l=e||0!==l?l:0,s&&h==h){for(var f=a.length;f--;)if(a[f]===h)continue t;n&&a.push(h),u.push(l)}else i(a,h,e)||(a!==u&&a.push(h),u.push(l))}return u}function ui(t,n){return null==(t=Oo(t,n=mi(n,t)))||delete t[jo(Ho(n))]}function ai(t,n,e,r){return Kr(t,n,e(wr(t,n)),r)}function ci(t,n,e,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&n(t[o],o,t););return e?Jr(t,r?0:o,r?o+1:i):Jr(t,r?o+1:0,r?i:o)}function li(t,n){var e=t;return e instanceof Ue&&(e=e.value()),An(n,(function(t,n){return n.func.apply(n.thisArg,_n([t],n.args))}),e)}function hi(t,n,e){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=gt(r);++i<r;)for(var s=t[i],u=-1;++u<r;)u!=i&&(o[i]=ar(o[i]||s,t[u],n,e));return si(dr(o,1),n,e)}function fi(n,e,r){for(var i=-1,o=n.length,s=e.length,u={};++i<o;)r(u,n[i],i<s?e[i]:t);return u}function pi(t){return Ws(t)?t:[]}function di(t){return"function"==typeof t?t:na}function mi(t,n){return Gs(t)?t:vo(t,n)?[t]:Do(yu(t))}var yi=Yr;function vi(n,e,r){var i=n.length;return r=r===t?i:r,!e&&r>=i?n:Jr(n,e,r)}var bi=an||function(t){return cn.clearTimeout(t)};function gi(t,n){if(n)return t.slice();var e=t.length,r=Gt?Gt(e):new t.constructor(e);return t.copy(r),r}function wi(t){var n=new t.constructor(t.byteLength);return new Ut(n).set(new Ut(t)),n}function xi(t,n){var e=n?wi(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}function Ei(n,e){if(n!==e){var r=n!==t,i=null===n,o=n==n,s=su(n),u=e!==t,a=null===e,c=e==e,l=su(e);if(!a&&!l&&!s&&n>e||s&&u&&c&&!a&&!l||i&&u&&c||!r&&c||!o)return 1;if(!i&&!s&&!l&&n<e||l&&r&&o&&!i&&!s||a&&r&&o||!u&&o||!c)return-1}return 0}function Si(t,n,e,r){for(var i=-1,o=t.length,s=e.length,u=-1,a=n.length,c=me(o-s,0),l=gt(a+c),h=!r;++u<a;)l[u]=n[u];for(;++i<s;)(h||i<o)&&(l[e[i]]=t[i]);for(;c--;)l[u++]=t[i++];return l}function Oi(t,n,e,r){for(var i=-1,o=t.length,s=-1,u=e.length,a=-1,c=n.length,l=me(o-u,0),h=gt(l+c),f=!r;++i<l;)h[i]=t[i];for(var p=i;++a<c;)h[p+a]=n[a];for(;++s<u;)(f||i<o)&&(h[p+e[s]]=t[i++]);return h}function Fi(t,n){var e=-1,r=t.length;for(n||(n=gt(r));++e<r;)n[e]=t[e];return n}function Ti(n,e,r,i){var o=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var a=e[s],c=i?i(r[a],n[a],a,r,n):t;c===t&&(c=n[a]),o?er(r,a,c):Ze(r,a,c)}return r}function Mi(t,n){return function(e,r){var i=Gs(e)?En:tr,o=n?n():{};return i(e,t,io(r,2),o)}}function ki(n){return Yr((function(e,r){var i=-1,o=r.length,s=o>1?r[o-1]:t,u=o>2?r[2]:t;for(s=n.length>3&&"function"==typeof s?(o--,s):t,u&&yo(r[0],r[1],u)&&(s=o<3?t:s,o=1),e=Ot(e);++i<o;){var a=r[i];a&&n(e,a,i,s)}return e}))}function Ii(t,n){return function(e,r){if(null==e)return e;if(!qs(e))return t(e,r);for(var i=e.length,o=n?i:-1,s=Ot(e);(n?o--:++o<i)&&!1!==r(s[o],o,s););return e}}function _i(t){return function(n,e,r){for(var i=-1,o=Ot(n),s=r(n),u=s.length;u--;){var a=s[t?u:++i];if(!1===e(o[a],a,o))break}return n}}function Ai(n){return function(e){var r=re(e=yu(e))?le(e):t,i=r?r[0]:e.charAt(0),o=r?vi(r,1).join(""):e.slice(1);return i[n]()+o}}function Ci(t){return function(n){return An(Ku(Uu(n).replace(Vt,"")),t,"")}}function Ni(t){return function(){var n=arguments;switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3]);case 5:return new t(n[0],n[1],n[2],n[3],n[4]);case 6:return new t(n[0],n[1],n[2],n[3],n[4],n[5]);case 7:return new t(n[0],n[1],n[2],n[3],n[4],n[5],n[6])}var e=Re(t.prototype),r=t.apply(e,n);return Zs(r)?r:e}}function Di(n){return function(e,r,i){var o=Ot(e);if(!qs(e)){var s=io(r,3);e=Iu(e),r=function(t){return s(o[t],t,o)}}var u=n(e,r,i);return u>-1?o[s?e[u]:u]:t}}function ji(e){return Zi((function(r){var i=r.length,o=i,s=ze.prototype.thru;for(e&&r.reverse();o--;){var u=r[o];if("function"!=typeof u)throw new Mt(n);if(s&&!a&&"wrapper"==eo(u))var a=new ze([],!0)}for(o=a?o:i;++o<i;){var c=eo(u=r[o]),l="wrapper"==c?no(u):t;a=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[eo(l[0])].apply(a,l[3]):1==u.length&&bo(u)?a[c]():a.thru(u)}return function(){var t=arguments,n=t[0];if(a&&1==t.length&&Gs(n))return a.plant(n).value();for(var e=0,o=i?r[e].apply(this,t):n;++e<i;)o=r[e].call(this,o);return o}}))}function Pi(n,e,r,i,o,u,a,c,l,h){var f=e&s,p=1&e,d=2&e,m=24&e,y=512&e,v=d?t:Ni(n);return function s(){for(var b=arguments.length,g=gt(b),w=b;w--;)g[w]=arguments[w];if(m)var x=ro(s),E=function(t,n){for(var e=t.length,r=0;e--;)t[e]===n&&++r;return r}(g,x);if(i&&(g=Si(g,i,o,m)),u&&(g=Oi(g,u,a,m)),b-=E,m&&b<h){var S=se(g,x);return Bi(n,e,Pi,s.placeholder,r,g,S,c,l,h-b)}var O=p?r:this,F=d?O[n]:n;return b=g.length,c?g=function(n,e){for(var r=n.length,i=ye(e.length,r),o=Fi(n);i--;){var s=e[i];n[i]=mo(s,r)?o[s]:t}return n}(g,c):y&&b>1&&g.reverse(),f&&l<b&&(g.length=l),this&&this!==cn&&this instanceof s&&(F=v||Ni(F)),F.apply(O,g)}}function Li(t,n){return function(e,r){return function(t,n,e,r){return vr(t,(function(t,i,o){n(r,e(t),i,o)})),r}(e,t,n(r),{})}}function Ri(n,e){return function(r,i){var o;if(r===t&&i===t)return e;if(r!==t&&(o=r),i!==t){if(o===t)return i;"string"==typeof r||"string"==typeof i?(r=oi(r),i=oi(i)):(r=ii(r),i=ii(i)),o=n(r,i)}return o}}function $i(t){return Zi((function(n){return n=In(n,Kn(io())),Yr((function(e){var r=this;return t(n,(function(t){return xn(t,r,e)}))}))}))}function zi(n,e){var r=(e=e===t?" ":oi(e)).length;if(r<2)return r?Wr(e,n):e;var i=Wr(e,pn(n/ce(e)));return re(e)?vi(le(i),0,n).join(""):i.slice(0,n)}function Ui(n){return function(e,r,i){return i&&"number"!=typeof i&&yo(e,r,i)&&(r=i=t),e=hu(e),r===t?(r=e,e=0):r=hu(r),function(t,n,e,r){for(var i=-1,o=me(pn((n-t)/(e||1)),0),s=gt(o);o--;)s[r?o:++i]=t,t+=e;return s}(e,r,i=i===t?e<r?1:-1:hu(i),n)}}function Gi(t){return function(n,e){return"string"==typeof n&&"string"==typeof e||(n=du(n),e=du(e)),t(n,e)}}function Bi(n,e,r,o,s,u,a,c,l,h){var f=8&e;e|=f?i:64,4&(e&=~(f?64:i))||(e&=-4);var p=[n,e,s,f?u:t,f?a:t,f?t:u,f?t:a,c,l,h],d=r.apply(t,p);return bo(n)&&To(d,p),d.placeholder=o,Io(d,n,e)}function qi(t){var n=St[t];return function(t,e){if(t=du(t),(e=null==e?0:ye(fu(e),292))&&Rn(t)){var r=(yu(t)+"e").split("e");return+((r=(yu(n(r[0]+"e"+(+r[1]+e)))+"e").split("e"))[0]+"e"+(+r[1]-e))}return n(t)}}var Wi=Oe&&1/ue(new Oe([,-0]))[1]==u?function(t){return new Oe(t)}:sa;function Yi(t){return function(n){var e=lo(n);return e==g?ie(n):e==O?ae(n):function(t,n){return In(n,(function(n){return[n,t[n]]}))}(n,t(n))}}function Vi(e,o,u,a,c,l,h,f){var p=2&o;if(!p&&"function"!=typeof e)throw new Mt(n);var d=a?a.length:0;if(d||(o&=-97,a=c=t),h=h===t?h:me(fu(h),0),f=f===t?f:fu(f),d-=c?c.length:0,64&o){var m=a,y=c;a=c=t}var v=p?t:no(e),b=[e,o,u,a,c,m,y,l,h,f];if(v&&function(t,n){var e=t[1],i=n[1],o=e|i;if(!(o<131||(i==s&&8==e||i==s&&256==e&&t[7].length<=n[8]||384==i&&n[7].length<=n[8]&&8==e)))return t;1&i&&(t[2]=n[2],o|=1&e?0:4);var u=n[3];if(u){var a=t[3];t[3]=a?Si(a,u,n[4]):u,t[4]=a?se(t[3],r):n[4]}(u=n[5])&&(t[5]=(a=t[5])?Oi(a,u,n[6]):u,t[6]=a?se(t[5],r):n[6]),(u=n[7])&&(t[7]=u),i&s&&(t[8]=null==t[8]?n[8]:ye(t[8],n[8])),null==t[9]&&(t[9]=n[9]),t[0]=n[0],t[1]=o}(b,v),e=b[0],o=b[1],u=b[2],a=b[3],c=b[4],!(f=b[9]=b[9]===t?p?0:e.length:me(b[9]-d,0))&&24&o&&(o&=-25),o&&1!=o)g=8==o||16==o?function(n,e,r){var i=Ni(n);return function o(){for(var s=arguments.length,u=gt(s),a=s,c=ro(o);a--;)u[a]=arguments[a];var l=s<3&&u[0]!==c&&u[s-1]!==c?[]:se(u,c);return(s-=l.length)<r?Bi(n,e,Pi,o.placeholder,t,u,l,t,t,r-s):xn(this&&this!==cn&&this instanceof o?i:n,this,u)}}(e,o,f):o!=i&&33!=o||c.length?Pi.apply(t,b):function(t,n,e,r){var i=1&n,o=Ni(t);return function n(){for(var s=-1,u=arguments.length,a=-1,c=r.length,l=gt(c+u),h=this&&this!==cn&&this instanceof n?o:t;++a<c;)l[a]=r[a];for(;u--;)l[a++]=arguments[++s];return xn(h,i?e:this,l)}}(e,o,u,a);else var g=function(t,n,e){var r=1&n,i=Ni(t);return function n(){return(this&&this!==cn&&this instanceof n?i:t).apply(r?e:this,arguments)}}(e,o,u);return Io((v?Xr:To)(g,b),e,o)}function Hi(n,e,r,i){return n===t||Rs(n,It[r])&&!Ct.call(i,r)?e:n}function Ki(n,e,r,i,o,s){return Zs(n)&&Zs(e)&&(s.set(e,n),Rr(n,e,t,Ki,s),s.delete(e)),n}function Xi(n){return eu(n)?t:n}function Qi(n,e,r,i,o,s){var u=1&r,a=n.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var l=s.get(n),h=s.get(e);if(l&&h)return l==e&&h==n;var f=-1,p=!0,d=2&r?new We:t;for(s.set(n,e),s.set(e,n);++f<a;){var m=n[f],y=e[f];if(i)var v=u?i(y,m,f,e,n,s):i(m,y,f,n,e,s);if(v!==t){if(v)continue;p=!1;break}if(d){if(!Nn(e,(function(t,n){if(!Qn(d,n)&&(m===t||o(m,t,r,i,s)))return d.push(n)}))){p=!1;break}}else if(m!==y&&!o(m,y,r,i,s)){p=!1;break}}return s.delete(n),s.delete(e),p}function Zi(n){return ko(So(n,t,Bo),n+"")}function Ji(t){return xr(t,Iu,ao)}function to(t){return xr(t,_u,co)}var no=Me?function(t){return Me.get(t)}:sa;function eo(t){for(var n=t.name+"",e=ke[n],r=Ct.call(ke,n)?e.length:0;r--;){var i=e[r],o=i.func;if(null==o||o==t)return i.name}return n}function ro(t){return(Ct.call(Le,"placeholder")?Le:t).placeholder}function io(){var t=Le.iteratee||ea;return t=t===ea?Cr:t,arguments.length?t(arguments[0],arguments[1]):t}function oo(t,n){var e,r,i=t.__data__;return("string"==(r=typeof(e=n))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e)?i["string"==typeof n?"string":"hash"]:i.map}function so(t){for(var n=Iu(t),e=n.length;e--;){var r=n[e],i=t[r];n[e]=[r,i,xo(i)]}return n}function uo(n,e){var r=function(n,e){return null==n?t:n[e]}(n,e);return Ar(r)?r:t}var ao=Dn?function(t){return null==t?[]:(t=Ot(t),Tn(Dn(t),(function(n){return Wt.call(t,n)})))}:pa,co=Dn?function(t){for(var n=[];t;)_n(n,ao(t)),t=Bt(t);return n}:pa,lo=Er;function ho(t,n,e){for(var r=-1,i=(n=mi(n,t)).length,o=!1;++r<i;){var s=jo(n[r]);if(!(o=null!=t&&e(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Qs(i)&&mo(s,i)&&(Gs(t)||Us(t))}function fo(t){return"function"!=typeof t.constructor||wo(t)?{}:Re(Bt(t))}function po(t){return Gs(t)||Us(t)||!!(Kt&&t&&t[Kt])}function mo(t,n){var e=typeof t;return!!(n=null==n?a:n)&&("number"==e||"symbol"!=e&&dt.test(t))&&t>-1&&t%1==0&&t<n}function yo(t,n,e){if(!Zs(e))return!1;var r=typeof n;return!!("number"==r?qs(e)&&mo(n,e.length):"string"==r&&n in e)&&Rs(e[n],t)}function vo(t,n){if(Gs(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!su(t))||X.test(t)||!K.test(t)||null!=n&&t in Ot(n)}function bo(t){var n=eo(t),e=Le[n];if("function"!=typeof e||!(n in Ue.prototype))return!1;if(t===e)return!0;var r=no(e);return!!r&&t===r[0]}(xe&&lo(new xe(new ArrayBuffer(1)))!=I||Ee&&lo(new Ee)!=g||Se&&lo(Se.resolve())!=E||Oe&&lo(new Oe)!=O||Fe&&lo(new Fe)!=M)&&(lo=function(n){var e=Er(n),r=e==x?n.constructor:t,i=r?Po(r):"";if(i)switch(i){case Ie:return I;case _e:return g;case Ae:return E;case Ce:return O;case Ne:return M}return e});var go=_t?Ks:da;function wo(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||It)}function xo(t){return t==t&&!Zs(t)}function Eo(n,e){return function(r){return null!=r&&r[n]===e&&(e!==t||n in Ot(r))}}function So(n,e,r){return e=me(e===t?n.length-1:e,0),function(){for(var t=arguments,i=-1,o=me(t.length-e,0),s=gt(o);++i<o;)s[i]=t[e+i];i=-1;for(var u=gt(e+1);++i<e;)u[i]=t[i];return u[e]=r(s),xn(n,this,u)}}function Oo(t,n){return n.length<2?t:wr(t,Jr(n,0,-1))}function Fo(t,n){if(("constructor"!==n||"function"!=typeof t[n])&&"__proto__"!=n)return t[n]}var To=_o(Xr),Mo=hn||function(t,n){return cn.setTimeout(t,n)},ko=_o(Qr);function Io(t,n,e){var r=n+"";return ko(t,function(t,n){var e=n.length;if(!e)return t;var r=e-1;return n[r]=(e>1?"& ":"")+n[r],n=n.join(e>2?", ":" "),t.replace(et,"{\n/* [wrapped with "+n+"] */\n")}(r,function(t,n){return Sn(h,(function(e){var r="_."+e[0];n&e[1]&&!Mn(t,r)&&t.push(r)})),t.sort()}(function(t){var n=t.match(rt);return n?n[1].split(it):[]}(r),e)))}function _o(n){var e=0,r=0;return function(){var i=ve(),o=16-(i-r);if(r=i,o>0){if(++e>=800)return arguments[0]}else e=0;return n.apply(t,arguments)}}function Ao(n,e){var r=-1,i=n.length,o=i-1;for(e=e===t?i:e;++r<e;){var s=qr(r,o),u=n[s];n[s]=n[r],n[r]=u}return n.length=e,n}var Co,No,Do=(Co=Cs((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(Q,(function(t,e,r,i){n.push(r?i.replace(ut,"$1"):e||t)})),n}),(function(t){return 500===No.size&&No.clear(),t})),No=Co.cache,Co);function jo(t){if("string"==typeof t||su(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function Po(t){if(null!=t){try{return At.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Lo(t){if(t instanceof Ue)return t.clone();var n=new ze(t.__wrapped__,t.__chain__);return n.__actions__=Fi(t.__actions__),n.__index__=t.__index__,n.__values__=t.__values__,n}var Ro=Yr((function(t,n){return Ws(t)?ar(t,dr(n,1,Ws,!0)):[]})),$o=Yr((function(n,e){var r=Ho(e);return Ws(r)&&(r=t),Ws(n)?ar(n,dr(e,1,Ws,!0),io(r,2)):[]})),zo=Yr((function(n,e){var r=Ho(e);return Ws(r)&&(r=t),Ws(n)?ar(n,dr(e,1,Ws,!0),t,r):[]}));function Uo(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:fu(e);return i<0&&(i=me(r+i,0)),Pn(t,io(n,3),i)}function Go(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i-1;return r!==t&&(o=fu(r),o=r<0?me(i+o,0):ye(o,i-1)),Pn(n,io(e,3),o,!0)}function Bo(t){return null!=t&&t.length?dr(t,1):[]}function qo(n){return n&&n.length?n[0]:t}var Wo=Yr((function(t){var n=In(t,pi);return n.length&&n[0]===t[0]?Tr(n):[]})),Yo=Yr((function(n){var e=Ho(n),r=In(n,pi);return e===Ho(r)?e=t:r.pop(),r.length&&r[0]===n[0]?Tr(r,io(e,2)):[]})),Vo=Yr((function(n){var e=Ho(n),r=In(n,pi);return(e="function"==typeof e?e:t)&&r.pop(),r.length&&r[0]===n[0]?Tr(r,t,e):[]}));function Ho(n){var e=null==n?0:n.length;return e?n[e-1]:t}var Ko=Yr(Xo);function Xo(t,n){return t&&t.length&&n&&n.length?Gr(t,n):t}var Qo=Zi((function(t,n){var e=null==t?0:t.length,r=rr(t,n);return Br(t,In(n,(function(t){return mo(t,e)?+t:t})).sort(Ei)),r}));function Zo(t){return null==t?t:we.call(t)}var Jo=Yr((function(t){return si(dr(t,1,Ws,!0))})),ts=Yr((function(n){var e=Ho(n);return Ws(e)&&(e=t),si(dr(n,1,Ws,!0),io(e,2))})),ns=Yr((function(n){var e=Ho(n);return e="function"==typeof e?e:t,si(dr(n,1,Ws,!0),t,e)}));function es(t){if(!t||!t.length)return[];var n=0;return t=Tn(t,(function(t){if(Ws(t))return n=me(t.length,n),!0})),Vn(n,(function(n){return In(t,Bn(n))}))}function rs(n,e){if(!n||!n.length)return[];var r=es(n);return null==e?r:In(r,(function(n){return xn(e,t,n)}))}var is=Yr((function(t,n){return Ws(t)?ar(t,n):[]})),os=Yr((function(t){return hi(Tn(t,Ws))})),ss=Yr((function(n){var e=Ho(n);return Ws(e)&&(e=t),hi(Tn(n,Ws),io(e,2))})),us=Yr((function(n){var e=Ho(n);return e="function"==typeof e?e:t,hi(Tn(n,Ws),t,e)})),as=Yr(es),cs=Yr((function(n){var e=n.length,r=e>1?n[e-1]:t;return r="function"==typeof r?(n.pop(),r):t,rs(n,r)}));function ls(t){var n=Le(t);return n.__chain__=!0,n}function hs(t,n){return n(t)}var fs=Zi((function(n){var e=n.length,r=e?n[0]:0,i=this.__wrapped__,o=function(t){return rr(t,n)};return!(e>1||this.__actions__.length)&&i instanceof Ue&&mo(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:hs,args:[o],thisArg:t}),new ze(i,this.__chain__).thru((function(n){return e&&!n.length&&n.push(t),n}))):this.thru(o)})),ps=Mi((function(t,n,e){Ct.call(t,e)?++t[e]:er(t,e,1)})),ds=Di(Uo),ms=Di(Go);function ys(t,n){return(Gs(t)?Sn:cr)(t,io(n,3))}function vs(t,n){return(Gs(t)?On:lr)(t,io(n,3))}var bs=Mi((function(t,n,e){Ct.call(t,e)?t[e].push(n):er(t,e,[n])})),gs=Yr((function(t,n,e){var r=-1,i="function"==typeof n,o=qs(t)?gt(t.length):[];return cr(t,(function(t){o[++r]=i?xn(n,t,e):Mr(t,n,e)})),o})),ws=Mi((function(t,n,e){er(t,e,n)}));function xs(t,n){return(Gs(t)?In:jr)(t,io(n,3))}var Es=Mi((function(t,n,e){t[e?0:1].push(n)}),(function(){return[[],[]]})),Ss=Yr((function(t,n){if(null==t)return[];var e=n.length;return e>1&&yo(t,n[0],n[1])?n=[]:e>2&&yo(n[0],n[1],n[2])&&(n=[n[0]]),zr(t,dr(n,1),[])})),Os=ln||function(){return cn.Date.now()};function Fs(n,e,r){return e=r?t:e,Vi(n,s,t,t,t,t,e=n&&null==e?n.length:e)}function Ts(e,r){var i;if("function"!=typeof r)throw new Mt(n);return e=fu(e),function(){return--e>0&&(i=r.apply(this,arguments)),e<=1&&(r=t),i}}var Ms=Yr((function(t,n,e){var r=1;if(e.length){var o=se(e,ro(Ms));r|=i}return Vi(t,r,n,e,o)})),ks=Yr((function(t,n,e){var r=3;if(e.length){var o=se(e,ro(ks));r|=i}return Vi(n,r,t,e,o)}));function Is(e,r,i){var o,s,u,a,c,l,h=0,f=!1,p=!1,d=!0;if("function"!=typeof e)throw new Mt(n);function m(n){var r=o,i=s;return o=s=t,h=n,a=e.apply(i,r)}function y(n){var e=n-l;return l===t||e>=r||e<0||p&&n-h>=u}function v(){var t=Os();if(y(t))return b(t);c=Mo(v,function(t){var n=r-(t-l);return p?ye(n,u-(t-h)):n}(t))}function b(n){return c=t,d&&o?m(n):(o=s=t,a)}function g(){var n=Os(),e=y(n);if(o=arguments,s=this,l=n,e){if(c===t)return function(t){return h=t,c=Mo(v,r),f?m(t):a}(l);if(p)return bi(c),c=Mo(v,r),m(l)}return c===t&&(c=Mo(v,r)),a}return r=du(r)||0,Zs(i)&&(f=!!i.leading,u=(p="maxWait"in i)?me(du(i.maxWait)||0,r):u,d="trailing"in i?!!i.trailing:d),g.cancel=function(){c!==t&&bi(c),h=0,o=l=s=c=t},g.flush=function(){return c===t?a:b(Os())},g}var _s=Yr((function(t,n){return ur(t,1,n)})),As=Yr((function(t,n,e){return ur(t,du(n)||0,e)}));function Cs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Mt(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Cs.Cache||qe),r}function Ns(t){if("function"!=typeof t)throw new Mt(n);return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}Cs.Cache=qe;var Ds=yi((function(t,n){var e=(n=1==n.length&&Gs(n[0])?In(n[0],Kn(io())):In(dr(n,1),Kn(io()))).length;return Yr((function(r){for(var i=-1,o=ye(r.length,e);++i<o;)r[i]=n[i].call(this,r[i]);return xn(t,this,r)}))})),js=Yr((function(n,e){var r=se(e,ro(js));return Vi(n,i,t,e,r)})),Ps=Yr((function(n,e){var r=se(e,ro(Ps));return Vi(n,64,t,e,r)})),Ls=Zi((function(n,e){return Vi(n,256,t,t,t,e)}));function Rs(t,n){return t===n||t!=t&&n!=n}var $s=Gi(Sr),zs=Gi((function(t,n){return t>=n})),Us=kr(function(){return arguments}())?kr:function(t){return Js(t)&&Ct.call(t,"callee")&&!Wt.call(t,"callee")},Gs=gt.isArray,Bs=mn?Kn(mn):function(t){return Js(t)&&Er(t)==k};function qs(t){return null!=t&&Qs(t.length)&&!Ks(t)}function Ws(t){return Js(t)&&qs(t)}var Ys=Ln||da,Vs=yn?Kn(yn):function(t){return Js(t)&&Er(t)==m};function Hs(t){if(!Js(t))return!1;var n=Er(t);return n==y||"[object DOMException]"==n||"string"==typeof t.message&&"string"==typeof t.name&&!eu(t)}function Ks(t){if(!Zs(t))return!1;var n=Er(t);return n==v||n==b||"[object AsyncFunction]"==n||"[object Proxy]"==n}function Xs(t){return"number"==typeof t&&t==fu(t)}function Qs(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Zs(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}function Js(t){return null!=t&&"object"==typeof t}var tu=vn?Kn(vn):function(t){return Js(t)&&lo(t)==g};function nu(t){return"number"==typeof t||Js(t)&&Er(t)==w}function eu(t){if(!Js(t)||Er(t)!=x)return!1;var n=Bt(t);if(null===n)return!0;var e=Ct.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&At.call(e)==Pt}var ru=bn?Kn(bn):function(t){return Js(t)&&Er(t)==S},iu=gn?Kn(gn):function(t){return Js(t)&&lo(t)==O};function ou(t){return"string"==typeof t||!Gs(t)&&Js(t)&&Er(t)==F}function su(t){return"symbol"==typeof t||Js(t)&&Er(t)==T}var uu=wn?Kn(wn):function(t){return Js(t)&&Qs(t.length)&&!!nn[Er(t)]},au=Gi(Dr),cu=Gi((function(t,n){return t<=n}));function lu(t){if(!t)return[];if(qs(t))return ou(t)?le(t):Fi(t);if(Qt&&t[Qt])return function(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}(t[Qt]());var n=lo(t);return(n==g?ie:n==O?ue:Ru)(t)}function hu(t){return t?(t=du(t))===u||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function fu(t){var n=hu(t),e=n%1;return n==n?e?n-e:n:0}function pu(t){return t?ir(fu(t),0,l):0}function du(t){if("number"==typeof t)return t;if(su(t))return c;if(Zs(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=Zs(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=Hn(t);var e=ht.test(t);return e||pt.test(t)?sn(t.slice(2),e?2:8):lt.test(t)?c:+t}function mu(t){return Ti(t,_u(t))}function yu(t){return null==t?"":oi(t)}var vu=ki((function(t,n){if(wo(n)||qs(n))Ti(n,Iu(n),t);else for(var e in n)Ct.call(n,e)&&Ze(t,e,n[e])})),bu=ki((function(t,n){Ti(n,_u(n),t)})),gu=ki((function(t,n,e,r){Ti(n,_u(n),t,r)})),wu=ki((function(t,n,e,r){Ti(n,Iu(n),t,r)})),xu=Zi(rr),Eu=Yr((function(n,e){n=Ot(n);var r=-1,i=e.length,o=i>2?e[2]:t;for(o&&yo(e[0],e[1],o)&&(i=1);++r<i;)for(var s=e[r],u=_u(s),a=-1,c=u.length;++a<c;){var l=u[a],h=n[l];(h===t||Rs(h,It[l])&&!Ct.call(n,l))&&(n[l]=s[l])}return n})),Su=Yr((function(n){return n.push(t,Ki),xn(Cu,t,n)}));function Ou(n,e,r){var i=null==n?t:wr(n,e);return i===t?r:i}function Fu(t,n){return null!=t&&ho(t,n,Fr)}var Tu=Li((function(t,n,e){null!=n&&"function"!=typeof n.toString&&(n=jt.call(n)),t[n]=e}),Zu(na)),Mu=Li((function(t,n,e){null!=n&&"function"!=typeof n.toString&&(n=jt.call(n)),Ct.call(t,n)?t[n].push(e):t[n]=[e]}),io),ku=Yr(Mr);function Iu(t){return qs(t)?Ve(t):Nr(t)}function _u(t){return qs(t)?Ve(t,!0):function(t){if(!Zs(t))return function(t){var n=[];if(null!=t)for(var e in Ot(t))n.push(e);return n}(t);var n=wo(t),e=[];for(var r in t)("constructor"!=r||!n&&Ct.call(t,r))&&e.push(r);return e}(t)}var Au=ki((function(t,n,e){Rr(t,n,e)})),Cu=ki((function(t,n,e,r){Rr(t,n,e,r)})),Nu=Zi((function(t,n){var e={};if(null==t)return e;var r=!1;n=In(n,(function(n){return n=mi(n,t),r||(r=n.length>1),n})),Ti(t,to(t),e),r&&(e=or(e,7,Xi));for(var i=n.length;i--;)ui(e,n[i]);return e})),Du=Zi((function(t,n){return null==t?{}:function(t,n){return Ur(t,n,(function(n,e){return Fu(t,e)}))}(t,n)}));function ju(t,n){if(null==t)return{};var e=In(to(t),(function(t){return[t]}));return n=io(n),Ur(t,e,(function(t,e){return n(t,e[0])}))}var Pu=Yi(Iu),Lu=Yi(_u);function Ru(t){return null==t?[]:Xn(t,Iu(t))}var $u=Ci((function(t,n,e){return n=n.toLowerCase(),t+(e?zu(n):n)}));function zu(t){return Hu(yu(t).toLowerCase())}function Uu(t){return(t=yu(t))&&t.replace(mt,te).replace(Ht,"")}var Gu=Ci((function(t,n,e){return t+(e?"-":"")+n.toLowerCase()})),Bu=Ci((function(t,n,e){return t+(e?" ":"")+n.toLowerCase()})),qu=Ai("toLowerCase"),Wu=Ci((function(t,n,e){return t+(e?"_":"")+n.toLowerCase()})),Yu=Ci((function(t,n,e){return t+(e?" ":"")+Hu(n)})),Vu=Ci((function(t,n,e){return t+(e?" ":"")+n.toUpperCase()})),Hu=Ai("toUpperCase");function Ku(n,e,r){return n=yu(n),(e=r?t:e)===t?function(t){return Zt.test(t)}(n)?function(t){return t.match(Xt)||[]}(n):function(t){return t.match(ot)||[]}(n):n.match(e)||[]}var Xu=Yr((function(n,e){try{return xn(n,t,e)}catch(t){return Hs(t)?t:new xt(t)}})),Qu=Zi((function(t,n){return Sn(n,(function(n){n=jo(n),er(t,n,Ms(t[n],t))})),t}));function Zu(t){return function(){return t}}var Ju=ji(),ta=ji(!0);function na(t){return t}function ea(t){return Cr("function"==typeof t?t:or(t,1))}var ra=Yr((function(t,n){return function(e){return Mr(e,t,n)}})),ia=Yr((function(t,n){return function(e){return Mr(t,e,n)}}));function oa(t,n,e){var r=Iu(n),i=gr(n,r);null!=e||Zs(n)&&(i.length||!r.length)||(e=n,n=t,t=this,i=gr(n,Iu(n)));var o=!(Zs(e)&&"chain"in e&&!e.chain),s=Ks(t);return Sn(i,(function(e){var r=n[e];t[e]=r,s&&(t.prototype[e]=function(){var n=this.__chain__;if(o||n){var e=t(this.__wrapped__);return(e.__actions__=Fi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),e.__chain__=n,e}return r.apply(t,_n([this.value()],arguments))})})),t}function sa(){}var ua=$i(In),aa=$i(Fn),ca=$i(Nn);function la(t){return vo(t)?Bn(jo(t)):function(t){return function(n){return wr(n,t)}}(t)}var ha=Ui(),fa=Ui(!0);function pa(){return[]}function da(){return!1}var ma,ya=Ri((function(t,n){return t+n}),0),va=qi("ceil"),ba=Ri((function(t,n){return t/n}),1),ga=qi("floor"),wa=Ri((function(t,n){return t*n}),1),xa=qi("round"),Ea=Ri((function(t,n){return t-n}),0);return Le.after=function(t,e){if("function"!=typeof e)throw new Mt(n);return t=fu(t),function(){if(--t<1)return e.apply(this,arguments)}},Le.ary=Fs,Le.assign=vu,Le.assignIn=bu,Le.assignInWith=gu,Le.assignWith=wu,Le.at=xu,Le.before=Ts,Le.bind=Ms,Le.bindAll=Qu,Le.bindKey=ks,Le.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Gs(t)?t:[t]},Le.chain=ls,Le.chunk=function(n,e,r){e=(r?yo(n,e,r):e===t)?1:me(fu(e),0);var i=null==n?0:n.length;if(!i||e<1)return[];for(var o=0,s=0,u=gt(pn(i/e));o<i;)u[s++]=Jr(n,o,o+=e);return u},Le.compact=function(t){for(var n=-1,e=null==t?0:t.length,r=0,i=[];++n<e;){var o=t[n];o&&(i[r++]=o)}return i},Le.concat=function(){var t=arguments.length;if(!t)return[];for(var n=gt(t-1),e=arguments[0],r=t;r--;)n[r-1]=arguments[r];return _n(Gs(e)?Fi(e):[e],dr(n,1))},Le.cond=function(t){var e=null==t?0:t.length,r=io();return t=e?In(t,(function(t){if("function"!=typeof t[1])throw new Mt(n);return[r(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(xn(i[0],this,n))return xn(i[1],this,n)}}))},Le.conforms=function(t){return function(t){var n=Iu(t);return function(e){return sr(e,t,n)}}(or(t,1))},Le.constant=Zu,Le.countBy=ps,Le.create=function(t,n){var e=Re(t);return null==n?e:nr(e,n)},Le.curry=function n(e,r,i){var o=Vi(e,8,t,t,t,t,t,r=i?t:r);return o.placeholder=n.placeholder,o},Le.curryRight=function n(e,r,i){var o=Vi(e,16,t,t,t,t,t,r=i?t:r);return o.placeholder=n.placeholder,o},Le.debounce=Is,Le.defaults=Eu,Le.defaultsDeep=Su,Le.defer=_s,Le.delay=As,Le.difference=Ro,Le.differenceBy=$o,Le.differenceWith=zo,Le.drop=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,(e=r||e===t?1:fu(e))<0?0:e,i):[]},Le.dropRight=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,0,(e=i-(e=r||e===t?1:fu(e)))<0?0:e):[]},Le.dropRightWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!0,!0):[]},Le.dropWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!0):[]},Le.fill=function(n,e,r,i){var o=null==n?0:n.length;return o?(r&&"number"!=typeof r&&yo(n,e,r)&&(r=0,i=o),function(n,e,r,i){var o=n.length;for((r=fu(r))<0&&(r=-r>o?0:o+r),(i=i===t||i>o?o:fu(i))<0&&(i+=o),i=r>i?0:pu(i);r<i;)n[r++]=e;return n}(n,e,r,i)):[]},Le.filter=function(t,n){return(Gs(t)?Tn:pr)(t,io(n,3))},Le.flatMap=function(t,n){return dr(xs(t,n),1)},Le.flatMapDeep=function(t,n){return dr(xs(t,n),u)},Le.flatMapDepth=function(n,e,r){return r=r===t?1:fu(r),dr(xs(n,e),r)},Le.flatten=Bo,Le.flattenDeep=function(t){return null!=t&&t.length?dr(t,u):[]},Le.flattenDepth=function(n,e){return null!=n&&n.length?dr(n,e=e===t?1:fu(e)):[]},Le.flip=function(t){return Vi(t,512)},Le.flow=Ju,Le.flowRight=ta,Le.fromPairs=function(t){for(var n=-1,e=null==t?0:t.length,r={};++n<e;){var i=t[n];r[i[0]]=i[1]}return r},Le.functions=function(t){return null==t?[]:gr(t,Iu(t))},Le.functionsIn=function(t){return null==t?[]:gr(t,_u(t))},Le.groupBy=bs,Le.initial=function(t){return null!=t&&t.length?Jr(t,0,-1):[]},Le.intersection=Wo,Le.intersectionBy=Yo,Le.intersectionWith=Vo,Le.invert=Tu,Le.invertBy=Mu,Le.invokeMap=gs,Le.iteratee=ea,Le.keyBy=ws,Le.keys=Iu,Le.keysIn=_u,Le.map=xs,Le.mapKeys=function(t,n){var e={};return n=io(n,3),vr(t,(function(t,r,i){er(e,n(t,r,i),t)})),e},Le.mapValues=function(t,n){var e={};return n=io(n,3),vr(t,(function(t,r,i){er(e,r,n(t,r,i))})),e},Le.matches=function(t){return Pr(or(t,1))},Le.matchesProperty=function(t,n){return Lr(t,or(n,1))},Le.memoize=Cs,Le.merge=Au,Le.mergeWith=Cu,Le.method=ra,Le.methodOf=ia,Le.mixin=oa,Le.negate=Ns,Le.nthArg=function(t){return t=fu(t),Yr((function(n){return $r(n,t)}))},Le.omit=Nu,Le.omitBy=function(t,n){return ju(t,Ns(io(n)))},Le.once=function(t){return Ts(2,t)},Le.orderBy=function(n,e,r,i){return null==n?[]:(Gs(e)||(e=null==e?[]:[e]),Gs(r=i?t:r)||(r=null==r?[]:[r]),zr(n,e,r))},Le.over=ua,Le.overArgs=Ds,Le.overEvery=aa,Le.overSome=ca,Le.partial=js,Le.partialRight=Ps,Le.partition=Es,Le.pick=Du,Le.pickBy=ju,Le.property=la,Le.propertyOf=function(n){return function(e){return null==n?t:wr(n,e)}},Le.pull=Ko,Le.pullAll=Xo,Le.pullAllBy=function(t,n,e){return t&&t.length&&n&&n.length?Gr(t,n,io(e,2)):t},Le.pullAllWith=function(n,e,r){return n&&n.length&&e&&e.length?Gr(n,e,t,r):n},Le.pullAt=Qo,Le.range=ha,Le.rangeRight=fa,Le.rearg=Ls,Le.reject=function(t,n){return(Gs(t)?Tn:pr)(t,Ns(io(n,3)))},Le.remove=function(t,n){var e=[];if(!t||!t.length)return e;var r=-1,i=[],o=t.length;for(n=io(n,3);++r<o;){var s=t[r];n(s,r,t)&&(e.push(s),i.push(r))}return Br(t,i),e},Le.rest=function(e,r){if("function"!=typeof e)throw new Mt(n);return Yr(e,r=r===t?r:fu(r))},Le.reverse=Zo,Le.sampleSize=function(n,e,r){return e=(r?yo(n,e,r):e===t)?1:fu(e),(Gs(n)?Ke:Hr)(n,e)},Le.set=function(t,n,e){return null==t?t:Kr(t,n,e)},Le.setWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:Kr(n,e,r,i)},Le.shuffle=function(t){return(Gs(t)?Xe:Zr)(t)},Le.slice=function(n,e,r){var i=null==n?0:n.length;return i?(r&&"number"!=typeof r&&yo(n,e,r)?(e=0,r=i):(e=null==e?0:fu(e),r=r===t?i:fu(r)),Jr(n,e,r)):[]},Le.sortBy=Ss,Le.sortedUniq=function(t){return t&&t.length?ri(t):[]},Le.sortedUniqBy=function(t,n){return t&&t.length?ri(t,io(n,2)):[]},Le.split=function(n,e,r){return r&&"number"!=typeof r&&yo(n,e,r)&&(e=r=t),(r=r===t?l:r>>>0)?(n=yu(n))&&("string"==typeof e||null!=e&&!ru(e))&&!(e=oi(e))&&re(n)?vi(le(n),0,r):n.split(e,r):[]},Le.spread=function(t,e){if("function"!=typeof t)throw new Mt(n);return e=null==e?0:me(fu(e),0),Yr((function(n){var r=n[e],i=vi(n,0,e);return r&&_n(i,r),xn(t,this,i)}))},Le.tail=function(t){var n=null==t?0:t.length;return n?Jr(t,1,n):[]},Le.take=function(n,e,r){return n&&n.length?Jr(n,0,(e=r||e===t?1:fu(e))<0?0:e):[]},Le.takeRight=function(n,e,r){var i=null==n?0:n.length;return i?Jr(n,(e=i-(e=r||e===t?1:fu(e)))<0?0:e,i):[]},Le.takeRightWhile=function(t,n){return t&&t.length?ci(t,io(n,3),!1,!0):[]},Le.takeWhile=function(t,n){return t&&t.length?ci(t,io(n,3)):[]},Le.tap=function(t,n){return n(t),t},Le.throttle=function(t,e,r){var i=!0,o=!0;if("function"!=typeof t)throw new Mt(n);return Zs(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Is(t,e,{leading:i,maxWait:e,trailing:o})},Le.thru=hs,Le.toArray=lu,Le.toPairs=Pu,Le.toPairsIn=Lu,Le.toPath=function(t){return Gs(t)?In(t,jo):su(t)?[t]:Fi(Do(yu(t)))},Le.toPlainObject=mu,Le.transform=function(t,n,e){var r=Gs(t),i=r||Ys(t)||uu(t);if(n=io(n,4),null==e){var o=t&&t.constructor;e=i?r?new o:[]:Zs(t)&&Ks(o)?Re(Bt(t)):{}}return(i?Sn:vr)(t,(function(t,r,i){return n(e,t,r,i)})),e},Le.unary=function(t){return Fs(t,1)},Le.union=Jo,Le.unionBy=ts,Le.unionWith=ns,Le.uniq=function(t){return t&&t.length?si(t):[]},Le.uniqBy=function(t,n){return t&&t.length?si(t,io(n,2)):[]},Le.uniqWith=function(n,e){return e="function"==typeof e?e:t,n&&n.length?si(n,t,e):[]},Le.unset=function(t,n){return null==t||ui(t,n)},Le.unzip=es,Le.unzipWith=rs,Le.update=function(t,n,e){return null==t?t:ai(t,n,di(e))},Le.updateWith=function(n,e,r,i){return i="function"==typeof i?i:t,null==n?n:ai(n,e,di(r),i)},Le.values=Ru,Le.valuesIn=function(t){return null==t?[]:Xn(t,_u(t))},Le.without=is,Le.words=Ku,Le.wrap=function(t,n){return js(di(n),t)},Le.xor=os,Le.xorBy=ss,Le.xorWith=us,Le.zip=as,Le.zipObject=function(t,n){return fi(t||[],n||[],Ze)},Le.zipObjectDeep=function(t,n){return fi(t||[],n||[],Kr)},Le.zipWith=cs,Le.entries=Pu,Le.entriesIn=Lu,Le.extend=bu,Le.extendWith=gu,oa(Le,Le),Le.add=ya,Le.attempt=Xu,Le.camelCase=$u,Le.capitalize=zu,Le.ceil=va,Le.clamp=function(n,e,r){return r===t&&(r=e,e=t),r!==t&&(r=(r=du(r))==r?r:0),e!==t&&(e=(e=du(e))==e?e:0),ir(du(n),e,r)},Le.clone=function(t){return or(t,4)},Le.cloneDeep=function(t){return or(t,5)},Le.cloneDeepWith=function(n,e){return or(n,5,e="function"==typeof e?e:t)},Le.cloneWith=function(n,e){return or(n,4,e="function"==typeof e?e:t)},Le.conformsTo=function(t,n){return null==n||sr(t,n,Iu(n))},Le.deburr=Uu,Le.defaultTo=function(t,n){return null==t||t!=t?n:t},Le.divide=ba,Le.endsWith=function(n,e,r){n=yu(n),e=oi(e);var i=n.length,o=r=r===t?i:ir(fu(r),0,i);return(r-=e.length)>=0&&n.slice(r,o)==e},Le.eq=Rs,Le.escape=function(t){return(t=yu(t))&&W.test(t)?t.replace(B,ne):t},Le.escapeRegExp=function(t){return(t=yu(t))&&J.test(t)?t.replace(Z,"\\$&"):t},Le.every=function(n,e,r){var i=Gs(n)?Fn:hr;return r&&yo(n,e,r)&&(e=t),i(n,io(e,3))},Le.find=ds,Le.findIndex=Uo,Le.findKey=function(t,n){return jn(t,io(n,3),vr)},Le.findLast=ms,Le.findLastIndex=Go,Le.findLastKey=function(t,n){return jn(t,io(n,3),br)},Le.floor=ga,Le.forEach=ys,Le.forEachRight=vs,Le.forIn=function(t,n){return null==t?t:mr(t,io(n,3),_u)},Le.forInRight=function(t,n){return null==t?t:yr(t,io(n,3),_u)},Le.forOwn=function(t,n){return t&&vr(t,io(n,3))},Le.forOwnRight=function(t,n){return t&&br(t,io(n,3))},Le.get=Ou,Le.gt=$s,Le.gte=zs,Le.has=function(t,n){return null!=t&&ho(t,n,Or)},Le.hasIn=Fu,Le.head=qo,Le.identity=na,Le.includes=function(t,n,e,r){t=qs(t)?t:Ru(t),e=e&&!r?fu(e):0;var i=t.length;return e<0&&(e=me(i+e,0)),ou(t)?e<=i&&t.indexOf(n,e)>-1:!!i&&$n(t,n,e)>-1},Le.indexOf=function(t,n,e){var r=null==t?0:t.length;if(!r)return-1;var i=null==e?0:fu(e);return i<0&&(i=me(r+i,0)),$n(t,n,i)},Le.inRange=function(n,e,r){return e=hu(e),r===t?(r=e,e=0):r=hu(r),function(t,n,e){return t>=ye(n,e)&&t<me(n,e)}(n=du(n),e,r)},Le.invoke=ku,Le.isArguments=Us,Le.isArray=Gs,Le.isArrayBuffer=Bs,Le.isArrayLike=qs,Le.isArrayLikeObject=Ws,Le.isBoolean=function(t){return!0===t||!1===t||Js(t)&&Er(t)==d},Le.isBuffer=Ys,Le.isDate=Vs,Le.isElement=function(t){return Js(t)&&1===t.nodeType&&!eu(t)},Le.isEmpty=function(t){if(null==t)return!0;if(qs(t)&&(Gs(t)||"string"==typeof t||"function"==typeof t.splice||Ys(t)||uu(t)||Us(t)))return!t.length;var n=lo(t);if(n==g||n==O)return!t.size;if(wo(t))return!Nr(t).length;for(var e in t)if(Ct.call(t,e))return!1;return!0},Le.isEqual=function(t,n){return Ir(t,n)},Le.isEqualWith=function(n,e,r){var i=(r="function"==typeof r?r:t)?r(n,e):t;return i===t?Ir(n,e,t,r):!!i},Le.isError=Hs,Le.isFinite=function(t){return"number"==typeof t&&Rn(t)},Le.isFunction=Ks,Le.isInteger=Xs,Le.isLength=Qs,Le.isMap=tu,Le.isMatch=function(t,n){return t===n||_r(t,n,so(n))},Le.isMatchWith=function(n,e,r){return r="function"==typeof r?r:t,_r(n,e,so(e),r)},Le.isNaN=function(t){return nu(t)&&t!=+t},Le.isNative=function(t){if(go(t))throw new xt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ar(t)},Le.isNil=function(t){return null==t},Le.isNull=function(t){return null===t},Le.isNumber=nu,Le.isObject=Zs,Le.isObjectLike=Js,Le.isPlainObject=eu,Le.isRegExp=ru,Le.isSafeInteger=function(t){return Xs(t)&&t>=-9007199254740991&&t<=a},Le.isSet=iu,Le.isString=ou,Le.isSymbol=su,Le.isTypedArray=uu,Le.isUndefined=function(n){return n===t},Le.isWeakMap=function(t){return Js(t)&&lo(t)==M},Le.isWeakSet=function(t){return Js(t)&&"[object WeakSet]"==Er(t)},Le.join=function(t,n){return null==t?"":qn.call(t,n)},Le.kebabCase=Gu,Le.last=Ho,Le.lastIndexOf=function(n,e,r){var i=null==n?0:n.length;if(!i)return-1;var o=i;return r!==t&&(o=(o=fu(r))<0?me(i+o,0):ye(o,i-1)),e==e?function(t,n,e){for(var r=e+1;r--;)if(t[r]===n)return r;return r}(n,e,o):Pn(n,Un,o,!0)},Le.lowerCase=Bu,Le.lowerFirst=qu,Le.lt=au,Le.lte=cu,Le.max=function(n){return n&&n.length?fr(n,na,Sr):t},Le.maxBy=function(n,e){return n&&n.length?fr(n,io(e,2),Sr):t},Le.mean=function(t){return Gn(t,na)},Le.meanBy=function(t,n){return Gn(t,io(n,2))},Le.min=function(n){return n&&n.length?fr(n,na,Dr):t},Le.minBy=function(n,e){return n&&n.length?fr(n,io(e,2),Dr):t},Le.stubArray=pa,Le.stubFalse=da,Le.stubObject=function(){return{}},Le.stubString=function(){return""},Le.stubTrue=function(){return!0},Le.multiply=wa,Le.nth=function(n,e){return n&&n.length?$r(n,fu(e)):t},Le.noConflict=function(){return cn._===this&&(cn._=Lt),this},Le.noop=sa,Le.now=Os,Le.pad=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;if(!n||r>=n)return t;var i=(n-r)/2;return zi(dn(i),e)+t+zi(pn(i),e)},Le.padEnd=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;return n&&r<n?t+zi(n-r,e):t},Le.padStart=function(t,n,e){t=yu(t);var r=(n=fu(n))?ce(t):0;return n&&r<n?zi(n-r,e)+t:t},Le.parseInt=function(t,n,e){return e||null==n?n=0:n&&(n=+n),be(yu(t).replace(tt,""),n||0)},Le.random=function(n,e,r){if(r&&"boolean"!=typeof r&&yo(n,e,r)&&(e=r=t),r===t&&("boolean"==typeof e?(r=e,e=t):"boolean"==typeof n&&(r=n,n=t)),n===t&&e===t?(n=0,e=1):(n=hu(n),e===t?(e=n,n=0):e=hu(e)),n>e){var i=n;n=e,e=i}if(r||n%1||e%1){var o=ge();return ye(n+o*(e-n+on("1e-"+((o+"").length-1))),e)}return qr(n,e)},Le.reduce=function(t,n,e){var r=Gs(t)?An:Wn,i=arguments.length<3;return r(t,io(n,4),e,i,cr)},Le.reduceRight=function(t,n,e){var r=Gs(t)?Cn:Wn,i=arguments.length<3;return r(t,io(n,4),e,i,lr)},Le.repeat=function(n,e,r){return e=(r?yo(n,e,r):e===t)?1:fu(e),Wr(yu(n),e)},Le.replace=function(){var t=arguments,n=yu(t[0]);return t.length<3?n:n.replace(t[1],t[2])},Le.result=function(n,e,r){var i=-1,o=(e=mi(e,n)).length;for(o||(o=1,n=t);++i<o;){var s=null==n?t:n[jo(e[i])];s===t&&(i=o,s=r),n=Ks(s)?s.call(n):s}return n},Le.round=xa,Le.runInContext=o,Le.sample=function(t){return(Gs(t)?He:Vr)(t)},Le.size=function(t){if(null==t)return 0;if(qs(t))return ou(t)?ce(t):t.length;var n=lo(t);return n==g||n==O?t.size:Nr(t).length},Le.snakeCase=Wu,Le.some=function(n,e,r){var i=Gs(n)?Nn:ti;return r&&yo(n,e,r)&&(e=t),i(n,io(e,3))},Le.sortedIndex=function(t,n){return ni(t,n)},Le.sortedIndexBy=function(t,n,e){return ei(t,n,io(e,2))},Le.sortedIndexOf=function(t,n){var e=null==t?0:t.length;if(e){var r=ni(t,n);if(r<e&&Rs(t[r],n))return r}return-1},Le.sortedLastIndex=function(t,n){return ni(t,n,!0)},Le.sortedLastIndexBy=function(t,n,e){return ei(t,n,io(e,2),!0)},Le.sortedLastIndexOf=function(t,n){if(null!=t&&t.length){var e=ni(t,n,!0)-1;if(Rs(t[e],n))return e}return-1},Le.startCase=Yu,Le.startsWith=function(t,n,e){return t=yu(t),e=null==e?0:ir(fu(e),0,t.length),n=oi(n),t.slice(e,e+n.length)==n},Le.subtract=Ea,Le.sum=function(t){return t&&t.length?Yn(t,na):0},Le.sumBy=function(t,n){return t&&t.length?Yn(t,io(n,2)):0},Le.template=function(n,e,r){var i=Le.templateSettings;r&&yo(n,e,r)&&(e=t),n=yu(n),e=gu({},e,i,Hi);var o,s,u=gu({},e.imports,i.imports,Hi),a=Iu(u),c=Xn(u,a),l=0,h=e.interpolate||yt,f="__p += '",p=Ft((e.escape||yt).source+"|"+h.source+"|"+(h===H?at:yt).source+"|"+(e.evaluate||yt).source+"|$","g"),d="//# sourceURL="+(Ct.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tn+"]")+"\n";n.replace(p,(function(t,e,r,i,u,a){return r||(r=i),f+=n.slice(l,a).replace(vt,ee),e&&(o=!0,f+="' +\n__e("+e+") +\n'"),u&&(s=!0,f+="';\n"+u+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=a+t.length,t})),f+="';\n";var m=Ct.call(e,"variable")&&e.variable;if(m){if(st.test(m))throw new xt("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace($,""):f).replace(z,"$1").replace(U,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Xu((function(){return Et(a,d+"return "+f).apply(t,c)}));if(y.source=f,Hs(y))throw y;return y},Le.times=function(t,n){if((t=fu(t))<1||t>a)return[];var e=l,r=ye(t,l);n=io(n),t-=l;for(var i=Vn(r,n);++e<t;)n(e);return i},Le.toFinite=hu,Le.toInteger=fu,Le.toLength=pu,Le.toLower=function(t){return yu(t).toLowerCase()},Le.toNumber=du,Le.toSafeInteger=function(t){return t?ir(fu(t),-9007199254740991,a):0===t?t:0},Le.toString=yu,Le.toUpper=function(t){return yu(t).toUpperCase()},Le.trim=function(n,e,r){if((n=yu(n))&&(r||e===t))return Hn(n);if(!n||!(e=oi(e)))return n;var i=le(n),o=le(e);return vi(i,Zn(i,o),Jn(i,o)+1).join("")},Le.trimEnd=function(n,e,r){if((n=yu(n))&&(r||e===t))return n.slice(0,he(n)+1);if(!n||!(e=oi(e)))return n;var i=le(n);return vi(i,0,Jn(i,le(e))+1).join("")},Le.trimStart=function(n,e,r){if((n=yu(n))&&(r||e===t))return n.replace(tt,"");if(!n||!(e=oi(e)))return n;var i=le(n);return vi(i,Zn(i,le(e))).join("")},Le.truncate=function(n,e){var r=30,i="...";if(Zs(e)){var o="separator"in e?e.separator:o;r="length"in e?fu(e.length):r,i="omission"in e?oi(e.omission):i}var s=(n=yu(n)).length;if(re(n)){var u=le(n);s=u.length}if(r>=s)return n;var a=r-ce(i);if(a<1)return i;var c=u?vi(u,0,a).join(""):n.slice(0,a);if(o===t)return c+i;if(u&&(a+=c.length-a),ru(o)){if(n.slice(a).search(o)){var l,h=c;for(o.global||(o=Ft(o.source,yu(ct.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var f=l.index;c=c.slice(0,f===t?a:f)}}else if(n.indexOf(oi(o),a)!=a){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+i},Le.unescape=function(t){return(t=yu(t))&&q.test(t)?t.replace(G,fe):t},Le.uniqueId=function(t){var n=++Nt;return yu(t)+n},Le.upperCase=Vu,Le.upperFirst=Hu,Le.each=ys,Le.eachRight=vs,Le.first=qo,oa(Le,(ma={},vr(Le,(function(t,n){Ct.call(Le.prototype,n)||(ma[n]=t)})),ma),{chain:!1}),Le.VERSION="4.17.21",Sn(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Le[t].placeholder=Le})),Sn(["drop","take"],(function(n,e){Ue.prototype[n]=function(r){r=r===t?1:me(fu(r),0);var i=this.__filtered__&&!e?new Ue(this):this.clone();return i.__filtered__?i.__takeCount__=ye(r,i.__takeCount__):i.__views__.push({size:ye(r,l),type:n+(i.__dir__<0?"Right":"")}),i},Ue.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),Sn(["filter","map","takeWhile"],(function(t,n){var e=n+1,r=1==e||3==e;Ue.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:io(t,3),type:e}),n.__filtered__=n.__filtered__||r,n}})),Sn(["head","last"],(function(t,n){var e="take"+(n?"Right":"");Ue.prototype[t]=function(){return this[e](1).value()[0]}})),Sn(["initial","tail"],(function(t,n){var e="drop"+(n?"":"Right");Ue.prototype[t]=function(){return this.__filtered__?new Ue(this):this[e](1)}})),Ue.prototype.compact=function(){return this.filter(na)},Ue.prototype.find=function(t){return this.filter(t).head()},Ue.prototype.findLast=function(t){return this.reverse().find(t)},Ue.prototype.invokeMap=Yr((function(t,n){return"function"==typeof t?new Ue(this):this.map((function(e){return Mr(e,t,n)}))})),Ue.prototype.reject=function(t){return this.filter(Ns(io(t)))},Ue.prototype.slice=function(n,e){n=fu(n);var r=this;return r.__filtered__&&(n>0||e<0)?new Ue(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),e!==t&&(r=(e=fu(e))<0?r.dropRight(-e):r.take(e-n)),r)},Ue.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ue.prototype.toArray=function(){return this.take(l)},vr(Ue.prototype,(function(n,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Le[i?"take"+("last"==e?"Right":""):e],s=i||/^find/.test(e);o&&(Le.prototype[e]=function(){var e=this.__wrapped__,u=i?[1]:arguments,a=e instanceof Ue,c=u[0],l=a||Gs(e),h=function(t){var n=o.apply(Le,_n([t],u));return i&&f?n[0]:n};l&&r&&"function"==typeof c&&1!=c.length&&(a=l=!1);var f=this.__chain__,p=s&&!f,d=a&&!this.__actions__.length;if(!s&&l){e=d?e:new Ue(this);var m=n.apply(e,u);return m.__actions__.push({func:hs,args:[h],thisArg:t}),new ze(m,f)}return p&&d?n.apply(this,u):(m=this.thru(h),p?i?m.value()[0]:m.value():m)})})),Sn(["pop","push","shift","sort","splice","unshift"],(function(t){var n=kt[t],e=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Le.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return n.apply(Gs(i)?i:[],t)}return this[e]((function(e){return n.apply(Gs(e)?e:[],t)}))}})),vr(Ue.prototype,(function(t,n){var e=Le[n];if(e){var r=e.name+"";Ct.call(ke,r)||(ke[r]=[]),ke[r].push({name:n,func:e})}})),ke[Pi(t,2).name]=[{name:"wrapper",func:t}],Ue.prototype.clone=function(){var t=new Ue(this.__wrapped__);return t.__actions__=Fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Fi(this.__views__),t},Ue.prototype.reverse=function(){if(this.__filtered__){var t=new Ue(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ue.prototype.value=function(){var t=this.__wrapped__.value(),n=this.__dir__,e=Gs(t),r=n<0,i=e?t.length:0,o=function(t,n,e){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":n-=s;break;case"take":n=ye(n,t+s);break;case"takeRight":t=me(t,n-s)}}return{start:t,end:n}}(0,i,this.__views__),s=o.start,u=o.end,a=u-s,c=r?u:s-1,l=this.__iteratees__,h=l.length,f=0,p=ye(a,this.__takeCount__);if(!e||!r&&i==a&&p==a)return li(t,this.__actions__);var d=[];t:for(;a--&&f<p;){for(var m=-1,y=t[c+=n];++m<h;){var v=l[m],b=v.type,g=(0,v.iteratee)(y);if(2==b)y=g;else if(!g){if(1==b)continue t;break t}}d[f++]=y}return d},Le.prototype.at=fs,Le.prototype.chain=function(){return ls(this)},Le.prototype.commit=function(){return new ze(this.value(),this.__chain__)},Le.prototype.next=function(){this.__values__===t&&(this.__values__=lu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?t:this.__values__[this.__index__++]}},Le.prototype.plant=function(n){for(var e,r=this;r instanceof $e;){var i=Lo(r);i.__index__=0,i.__values__=t,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=n,e},Le.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ue){var e=n;return this.__actions__.length&&(e=new Ue(this)),(e=e.reverse()).__actions__.push({func:hs,args:[Zo],thisArg:t}),new ze(e,this.__chain__)}return this.thru(Zo)},Le.prototype.toJSON=Le.prototype.valueOf=Le.prototype.value=function(){return li(this.__wrapped__,this.__actions__)},Le.prototype.first=Le.prototype.head,Qt&&(Le.prototype[Qt]=function(){return this}),Le}();hn?((hn.exports=pe)._=pe,ln._=pe):cn._=pe}.call($n.exports)),$n.exports);
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -7,4 +7,4 @@ import{transformTag as t,proxyCustomElement as n,HTMLElement as e,createEvent as
|
|
|
7
7
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
8
8
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
9
9
|
*/const Un=["array","boolean","collator","format","literal","number","number-format","object","string","image","to-boolean","to-color","to-number","to-string","typeof","feature-state","geometry-type","id","line-progress","properties","at","get","has","in","index-of","length","slice","!","!=","<","<=","==",">",">=","all","any","case","match","coalesce","within","interpolate","interpolate-hcl","interpolate-lab","step","let","var","concat","downcase","is-supported-script","resolved-locale","upcase","rgb","rgba","to-rgba","-","*","/","%","^","+","abs","acos","asin","atan","ceil","cos","e","floor","ln","ln2","log10","log2","max","min","pi","round","sin","sqrt","tan","zoom","heatmap-density"],Gn={numberFormat:null,strAbbreviate:null,strCapitalize:null,strConcat:"concat",strDefaultIfBlank:null,strEndsWith:null,strEqualsIgnoreCase:null,strIndexOf:null,strLastIndexOf:null,strLength:"length",strMatches:null,strReplace:null,strStartsWith:null,strStripAccents:null,strSubstring:"slice",strSubstringStart:null,strToLowerCase:"downcase",strToUpperCase:"upcase",strToString:null,strTrim:null,add:"+",abs:"abs",acos:"acos",asin:"asin",atan:"atan",atan2:null,ceil:"ceil",cos:"cos",div:"/",exp:"e",floor:"floor",interpolate:"interpolate",log:"ln",max:"max",min:"min",modulo:"%",mul:"*",pi:"pi",pow:"^",random:null,rint:null,round:"round",sin:"sin",sqrt:"sqrt",sub:"-",tan:"tan",toDegrees:null,toNumber:null,toRadians:null,all:"all",any:"any",between:"within",double2bool:null,equalTo:"==",greaterThan:">",greaterThanOrEqualTo:">=",in:"in",lessThan:"<",lessThanOrEqualTo:"<=",not:"!",notEqualTo:"!=",parseBoolean:"to-boolean",case:"case",property:"get",step:null},Bn=zn.invert(Gn);function qn(t){if(!Dn(t))return t;const n="args"in t?t.args:[];switch(t.name){case"case":{const e=[];let r;return n.forEach(((n,i)=>{if(0!==i){if(null==n.case||null==n.value)throw new Error("Could not translate GeoStyler Expression: "+t);e.push(qn(n.case)),e.push(qn(n.value))}else r=qn(n)})),["case",...e,r]}case"interpolate":{const e=[];return n.forEach(((n,r)=>{if(0!==r)if(1!==r){if(null==n.stop||null==n.value)throw new Error("Could not translate GeoStyler Expression: "+t);e.push(qn(n.stop)),e.push(qn(n.value))}else e.push(qn(n));else e.push([n.name])})),["interpolate",...e]}case"exp":if(1===n[0])return["e"];break;case"pi":return["pi"];default:const e=Gn[t.name];if(!e)throw new Error("Could not translate GeoStyler Expression: "+t);return[e,...n.map((t=>qn(t)))]}throw new Error("Could not translate GeoStyler Expression: "+t)}function Wn(t,n){if(!Array.isArray(t)||!Un.includes(t[0]))return"string"==typeof t&&n?jn.getHexColor(t):t;const e=t[0],r=t.slice(1);let i;switch(e){case"e":i={name:"exp",args:[1]};break;case"case":{const t=[],e=Wn(r.pop(),n);r.forEach(((e,r)=>{var i=Math.floor(r/2);t[i]=r%2==0?{case:Wn(e)}:{...t[i],value:Wn(e,n)}})),t.unshift(e),i={name:"case",args:t};break}case"interpolate":{const t=r.shift()[0],n=Wn(r.shift()),e=[];r.forEach(((t,n)=>{const r=Math.floor(n/2);e[r]=n%2==0?{stop:Wn(t)}:{...e[r],value:Wn(t)}})),e.unshift({name:t},n),i={name:"interpolate",args:e};break}case"pi":i={name:"pi"};break;default:const o=Bn[e];if(!o)throw new Error("Could not translate Mapbox Expression: "+t);i={name:o,args:r.map((t=>Wn(t)))}}return i}class Yn{static title="Mapbox";static fillSymbolizerStrokeProperties=["outlineOpacity","outlineWidth","outlineCap","outlineJoin","outlineDasharray"];title="Mapbox";unsupportedProperties={Symbolizer:{FillSymbolizer:{fillOpacity:{support:"none",info:"Use opacity instead."},outlineWidthUnit:"none",graphicFill:{support:"partial",info:"Only Sprite is supported."}},LineSymbolizer:{dashOffset:"none",graphicStroke:"none",gapWidthUnit:"none",spacing:"none",spacingUnit:"none",widthUnit:"none",graphicFill:{support:"partial",info:"Only Sprite is supported."}},MarkSymbolizer:{support:"partial",wellKnownName:{support:"partial",info:"Only circle symbolizers are supported for the moment."},opacity:{support:"none",info:"General opacity is not supported. Use fillOpacity and strokeOpacity instead."}},IconSymbolizer:{haloOpacity:"none",haloWidthUnit:"none",sizeUnit:"none",image:{support:"partial",info:"Only Sprite is supported."}},RasterSymbolizer:"none",TextSymbolizer:{fontStyle:"none",fontWeight:"none",haloOpacity:"none",haloWidthUnit:"none",letterSpacingUnit:"none",lineHeightUnit:"none"}},Function:{numberFormat:"none",strAbbreviate:"none",strCapitalize:"none",strDefaultIfBlank:"none",strEndsWith:"none",strEqualsIgnoreCase:"none",strIndexOf:"none",strLastIndexOf:"none",strMatches:"none",strReplace:"none",strStartsWith:"none",strStripAccents:"none",strSubstringStart:"none",strSubstring:{support:"partial",info:"end index is mandatory"},strTrim:"none",exp:{support:"partial",info:"only for x = 1"},atan2:"none",random:"none",rint:"none",toDegrees:"none",toRadians:"none",double2bool:"none"}};ignoreConversionErrors=!1;replaceGraphicFillWithColor=!1;pretty=!1;mbMetadata;gsMetadata;spriteBaseUrl;spriteCache;constructor(t){this.ignoreConversionErrors=!!t?.ignoreConversionErrors,this.pretty=!!t?.pretty,this.replaceGraphicFillWithColor=!!t?.replaceGraphicFillWithColor}isSymbolType(t){return!!t.iconSymbolizer||!!t.textSymbolizer}getSymbolizerKindFromMapboxLayerType(t){switch(t){case"fill":return"Fill";case"line":return"Line";case"symbol":return"Symbol";case"circle":return"Circle";default:if(this.ignoreConversionErrors)return"Circle";throw new Error("Could not parse mapbox style. Unsupported layer type.\n We support types 'fill', 'line', 'circle' and 'symbol' only.")}}getLabelFromTextField(t){if(void 0===t)return;if("string"==typeof t)return jn.resolveMbTextPlaceholder(t);if("format"!==t[0])return Wn(t);let n="";for(let e=1;e<t.length;e+=2)if("string"==typeof t[e])n+=t[e];else{if("get"!==t[e][0]&&!this.ignoreConversionErrors)throw new Error("Cannot parse mapbox style. Unsupported lookup type.");n+="{{"+t[e][1]+"}}"}return n}async getSpriteData(t){if(this.spriteCache?.[t])return this.spriteCache[t];{const n=await fetch(this.spriteBaseUrl+".json"),e=await n.json();return this.spriteCache=e,e[t]}}async getIconImage(t){if(!t)return;if(!this.spriteBaseUrl)throw new Error(`Could not resolve sprite ${t}. No base url found.`);if(!zn.isString(t))throw new Error("Cannot handle mapbox expressions for sprite names (e.g. icon-image).");const n=await this.getSpriteData(t),e=[n.x,n.y],r=[n.width,n.height];return zn.set(this.gsMetadata["mapbox:ref"],`sprite.${t}`,{position:e,size:r}),{source:this.spriteBaseUrl+".png",position:e,size:r}}getMarkSymbolizerFromMapboxCircleLayer(t,n){const e={kind:"Mark",blur:Wn(t?.["circle-blur"]),color:Wn(t?.["circle-color"],!0),offset:t?.["circle-translate"],offsetAnchor:t?.["circle-translate-anchor"],fillOpacity:Wn(t?.["circle-opacity"]),pitchAlignment:t?.["circle-pitch-alignment"],pitchScale:t?.["circle-pitch-scale"],radius:Wn(t?.["circle-radius"]),strokeColor:Wn(t?.["circle-stroke-color"],!0),strokeOpacity:Wn(t?.["circle-stroke-opacity"]),strokeWidth:Wn(t?.["circle-stroke-width"]),visibility:n?.visibility&&"none"!==n?.visibility,wellKnownName:"circle"};if(!jn.symbolizerAllUndefined(e))return zn.omitBy(e,zn.isUndefined)}async getIconSymbolizerFromMapboxSymbolLayer(t,n){const e=await this.getIconImage(n?.["icon-image"]),r={kind:"Icon",allowOverlap:Wn(n?.["icon-allow-overlap"]),anchor:n?.["icon-anchor"],avoidEdges:n?.["symbol-avoid-edges"],color:Wn(t?.["icon-color"],!0),haloBlur:Wn(t?.["icon-halo-blur"]),haloColor:Wn(t?.["icon-halo-color"],!0),haloWidth:Wn(t?.["icon-halo-width"]),image:e,keepUpright:Wn(n?.["icon-keep-upright"]),offset:n?.["icon-offset"],offsetAnchor:t?.["icon-translate-anchor"],opacity:Wn(t?.["icon-opacity"]),optional:Wn(n?.["icon-optional"]),padding:Wn(n?.["icon-padding"]),pitchAlignment:n?.["icon-pitch-alignment"],rotate:Wn(n?.["icon-rotate"]),rotationAlignment:n?.["icon-rotation-alignment"],textFit:n?.["icon-text-fit"],textFitPadding:n?.["icon-text-fit-padding"],visibility:n?.visibility&&"none"!==n?.visibility};if(n?.["icon-size"]&&e){const t=Wn(n["icon-size"]);Dn(t)?r.size={name:"mul",args:[t,e.size[0]]}:t&&(r.size=t*e.size[0]),zn.set(this.gsMetadata["mapbox:ref"],`sprite.${n?.["icon-image"]}.icon-size`,n["icon-size"])}if(!jn.symbolizerAllUndefined(r))return r}getTextSymbolizerFromMapboxLayer(t,n){const e={kind:"Text",allowOverlap:Wn(n?.["text-allow-overlap"]),anchor:n?.["text-anchor"],avoidEdges:Wn(n?.["symbol-avoid-edges"]),color:Wn(t?.["text-color"],!0),font:n?.["text-font"],haloBlur:Wn(t?.["text-halo-blur"]),haloColor:Wn(t?.["text-halo-color"],!0),haloWidth:Wn(t?.["text-halo-width"]),justify:n?.["text-justify"],keepUpright:Wn(n?.["text-keep-upright"]),label:this.getLabelFromTextField(n?.["text-field"]),letterSpacing:Wn(n?.["text-letter-spacing"]),lineHeight:Wn(n?.["text-line-height"]),maxAngle:Wn(n?.["text-max-angle"]),maxWidth:Wn(n?.["text-max-width"]),offset:n?.["text-offset"],offsetAnchor:t?.["text-translate-anchor"],opacity:Wn(t?.["text-opacity"]),optional:Wn(n?.["text-optional"]),padding:Wn(n?.["text-padding"]),pitchAlignment:n?.["text-pitch-alignment"],rotate:Wn(n?.["text-rotate"]),rotationAlignment:n?.["text-rotation-alignment"],size:Wn(n?.["text-size"]),transform:n?.["text-transform"],visibility:n?.visibility&&"none"!==n?.visibility,placement:Wn(n?.["symbol-placement"])};if(!jn.symbolizerAllUndefined(e))return zn.omitBy(e,zn.isUndefined)}async getFillSymbolizerFromMapboxFillLayer(t,n){const e=await this.getPatternOrGradientFromMapboxLayer(t?.["fill-pattern"]),r={kind:"Fill",visibility:n?.visibility&&"none"!==n?.visibility,antialias:Wn(t?.["fill-antialias"]),opacity:Wn(t?.["fill-opacity"]),color:Wn(t?.["fill-color"],!0),outlineColor:Wn(t?.["fill-outline-color"],!0),graphicFill:e};return zn.omitBy(r,zn.isUndefined)}async getPatternOrGradientFromMapboxLayer(t){if(Array.isArray(t)&&!this.ignoreConversionErrors)throw new Error("Cannot parse pattern or gradient. No Mapbox expressions allowed");if(t)return await this.getIconSymbolizerFromMapboxSymbolLayer({},{"icon-image":t})}async getLineSymbolizerFromMapboxLineLayer(t,n){const e=await this.getPatternOrGradientFromMapboxLayer(t?.["line-pattern"]),r={kind:"Line",visibility:n?.visibility&&"none"!==n?.visibility,cap:n?.["line-cap"],join:n?.["line-join"],miterLimit:Wn(n?.["line-miter-limit"]),roundLimit:Wn(n?.["line-round-limit"]),opacity:Wn(t?.["line-opacity"]),color:Wn(t?.["line-color"],!0),width:Wn(t?.["line-width"]),gapWidth:Wn(t?.["line-gap-width"]),perpendicularOffset:Wn(t?.["line-offset"]),blur:Wn(t?.["line-blur"]),dasharray:t?.["line-dasharray"],gradient:t?.["line-gradient"],graphicFill:e};return zn.omitBy(r,zn.isUndefined)}async getIconTextSymbolizersFromMapboxSymbolLayer(t,n){return[this.getTextSymbolizerFromMapboxLayer(t,n),await this.getIconSymbolizerFromMapboxSymbolLayer(t,n)].filter((t=>!!t))}async getSymbolizersFromMapboxLayer({paint:t,layout:n,type:e}){let r={};switch(this.getSymbolizerKindFromMapboxLayerType(e)){case"Fill":r=await this.getFillSymbolizerFromMapboxFillLayer(t,n);break;case"Line":r=await this.getLineSymbolizerFromMapboxLineLayer(t,n);break;case"Symbol":return await this.getIconTextSymbolizersFromMapboxSymbolLayer(t,n);case"Circle":const e=this.getMarkSymbolizerFromMapboxCircleLayer(t,n);return e?[e]:[];default:if(this.ignoreConversionErrors)return[];throw new Error("Cannot parse mapbox style. Unsupported Symbolizer kind.")}return[zn.omitBy(r,zn.isUndefined)]}getFilterFromMapboxFilter(t){if(!t)return;let n=!1;if(t[0]in{all:!0,any:!0,"!":!0}&&(n=!0),n){switch(t[0]){case"all":t[0]="&&";break;case"any":t[0]="||"}t.slice(1).forEach((t=>{this.getFilterFromMapboxFilter(t)}))}return t}getScaleDenominatorFromMapboxZoom(t,n){let e={};if(void 0!==t&&(e.max=jn.zoomToScale(t)),void 0!==n&&(e.min=jn.zoomToScale(n)),void 0!==e.min||void 0!==e.max)return e}mergeSymbolizers(t){return 1===t.length?t[0]:t.reduce(((t,n,e)=>{if(0===e)return t;let r=Object.assign({},t,n);if(t.kind!==n.kind){const e=_n(t),o=_n(n);if(!e&&!o)throw new Error(`Trying to merge two symbolizers of different kinds: ${t.kind}, ${n.kind}`);{const o="Line"===(null==(i=t)?void 0:i.kind)?t:n;r=e?t:n,r.outlineColor=o.color,r.outlineOpacity=o.opacity,r.outlineCap=o.cap,r.outlineJoin=o.join,r.outlineWidth=o.width,r.outlineDasharray=o.dasharray}}var i;return r}),t[0])}async mapboxLayersToGeoStylerRules(t){const n=this.mbMetadata?.["geostyler:ref"],e=[],r=[],i={},o={};if(n){const s=async()=>Promise.all(n.rules.map((async(n,s)=>{const u=n?.name||"";let a,c,l,h,f=[];Array.isArray(n.symbolizers)&&(await Promise.all(n.symbolizers.map((async(n,e)=>{const u=t.filter((t=>n.includes(t.id))),p=u.map((async t=>{const n=await this.getSymbolizersFromMapboxLayer(t);return n.length>1&&r.push({rule:s,symbolizers:n.map(((t,n)=>n))}),n})),d=(await Promise.all(p)).flat();f[e]=this.mergeSymbolizers(d),u?.[0]&&(a=this.getFilterFromMapboxFilter(u[0].filter),c=this.getScaleDenominatorFromMapboxZoom(u[0].minzoom,u[0].maxzoom),l=u[0].source,h=u[0]["source-layer"],l&&"string"==typeof l&&(i[l]||(i[l]=[]),i[l].push(s)),h&&(o[h]||(o[h]=[]),o[h].push(s)))}))),e[s]=zn.omitBy({filter:a,name:u,scaleDenominator:c,symbolizers:f},zn.isUndefined))})));await s()}else{const n=async()=>Promise.all(t.map((async t=>{const n=await this.getSymbolizersFromMapboxLayer(t);if(n.length<1)return;const s=this.getFilterFromMapboxFilter(t.filter),u=this.getScaleDenominatorFromMapboxZoom(t.minzoom,t.maxzoom);e.push({filter:s,name:t.id,scaleDenominator:u,symbolizers:n}),t.source&&"string"==typeof t.source&&(i[t.source]||(i[t.source]=[]),i[t.source].push(e.length-1)),t["source-layer"]&&(o[t["source-layer"]]||(o[t["source-layer"]]=[]),o[t["source-layer"]].push(e.length-1)),n.length>1&&r.push({rule:e.length-1,symbolizers:n.map(((t,n)=>n))})})));await n()}return r.length>0&&zn.set(this.gsMetadata["mapbox:ref"],"splitSymbolizers",r),Object.keys(i).length&&zn.set(this.gsMetadata["mapbox:ref"],"sourceMapping",i),Object.keys(o).length&&zn.set(this.gsMetadata["mapbox:ref"],"sourceLayerMapping",o),{rules:e}}async mapboxStyleToGeoStylerStyle(t){let n={};if(n.name=t.name||"",n.rules=[],this.mbMetadata=t.metadata,this.gsMetadata={"mapbox:ref":{sources:t.sources||{}}},t.sprite&&(this.spriteBaseUrl=jn.getUrlForMbPlaceholder(t.sprite)),t.layers){const e=t.layers.filter((t=>!("custom"===t.type))),r=await this.mapboxLayersToGeoStylerRules(e);n.rules=n.rules.concat(r.rules)}return n.metadata=this.gsMetadata,n}readStyle(t){return new Promise((async n=>{try{const e=structuredClone(t);n({output:await this.mapboxStyleToGeoStylerStyle(e)})}catch(t){n({errors:[t]})}}))}writeStyle(t){return new Promise((n=>{const e=this.checkForUnsupportedProperties(t);try{const r=structuredClone(t);n({output:this.geoStylerStyleToMapboxObject(r),unsupportedProperties:e,warnings:e&&["Your style contains unsupportedProperties!"]})}catch(t){n({errors:[t]})}}))}geoStylerStyleToMapboxObject(t){const n=t.name;this.gsMetadata={"mapbox:ref":t.metadata?.["mapbox:ref"]};const{layers:e,geoStylerRef:r}=this.getMapboxLayersFromRules(t.rules),i=jn.getMbPlaceholderForUrl(this.spriteBaseUrl);let o=zn.omitBy({version:8,name:n,layers:e,sprite:i,sources:this.gsMetadata["mapbox:ref"]?.sources||{}},zn.isUndefined);return r&&(o={...o,metadata:{"geostyler:ref":r}}),o}getMapboxLayersFromRules(t){const n=[],e={rules:[]};return t.forEach(((t,r)=>{let i={};if(Tn(t.filter)){const n=structuredClone(t.filter);i.filter=this.getMapboxFilterFromFilter(n)}var o;!(null!=(o=t.scaleDenominator)&&o.min||null!=o&&o.max)||o.min&&!An(o.min)&&!gn(o.min)||o.max&&!An(o.max)&&!gn(o.max)||(void 0!==t.scaleDenominator.min&&(Dn(t.scaleDenominator.min)||(i.maxzoom=this.getMapboxZoomFromScaleDenominator(t.scaleDenominator.min))),void 0!==t.scaleDenominator.max&&(Dn(t.scaleDenominator.max)||(i.minzoom=this.getMapboxZoomFromScaleDenominator(t.scaleDenominator.max)))),e.rules[r]={name:t.name,symbolizers:[]},t.symbolizers.forEach(((t,o)=>{let s={};s.filter=i.filter,s.minzoom=i.minzoom,s.maxzoom=i.maxzoom;const u=this.getStyleFromSymbolizer(t),a=this.gsMetadata["mapbox:ref"]?.splitSymbolizers?.some((t=>t.rule===r&&t.symbolizers.length>1&&t.symbolizers.slice(1).includes(o)));u.forEach(((t,i)=>{const{type:u,paint:c,layout:l}=t;let h=structuredClone(s);if(a)return h=n.at(-1),h.paint={...h.paint,...c},void(h.layout={...h.layout,...l});h.type=u,jn.allUndefined(c)||(h.paint=c),jn.allUndefined(l)||(h.layout=l),h.id=`r${r}_sy${o}_st${i}`;const f=this.gsMetadata["mapbox:ref"]?.sourceMapping;if(f){const t=Object.keys(f).filter((t=>f[t].includes(r))).pop();void 0!==t&&(h.source=t)}const p=this.gsMetadata["mapbox:ref"]?.sourceLayerMapping;if(p){const t=Object.keys(p).filter((t=>p[t].includes(r))).pop();void 0!==t&&(h["source-layer"]=t)}n.push(zn.omitBy(h,zn.isUndefined));let d=e.rules[r].symbolizers;d||(d=[]),d[o]||(d[o]=[]),d[o].push(h.id),e.rules[r].symbolizers=d}))}))})),{layers:n,geoStylerRef:e}}getMapboxZoomFromScaleDenominator(t){const n=jn.getResolutionForScale(t);let e;return e=jn.getResolutions().indexOf(n),-1===e&&(e=jn.getZoomForResolution(n)),e}getMapboxFilterFromFilter(t){if(Nn(t)||zn.isBoolean(t))return qn(t);let n=[...t];const e=n[0];if(["&&","||","!"].includes(e)){switch(e){case"&&":n[0]="all";break;case"||":n[0]="any"}n=n.map(((t,n)=>n>1?this.getMapboxFilterFromFilter(t):t))}return n}getStyleFromSymbolizer(t){const n=structuredClone(t);let e,r,i,o=[];switch(t.kind){case"Fill":e="fill",Yn.fillSymbolizerStrokeProperties.filter((n=>Object.keys(t).includes(n))).length>0?o=this.getSplitStyleFromFillSymbolizer(t):(r=this.getPaintFromFillSymbolizer(n),i=this.getLayoutFromFillSymbolizer(n));break;case"Line":e="line",r=this.getPaintFromLineSymbolizer(n),i=this.getLayoutFromLineSymbolizer(n);break;case"Icon":e="symbol",r=this.getPaintFromIconSymbolizer(n),i=this.getLayoutFromIconSymbolizer(n);break;case"Text":e="symbol",r=this.getPaintFromTextSymbolizer(n),i=this.getLayoutFromTextSymbolizer(n);break;case"Mark":if("circle"===t.wellKnownName){e="circle",r=this.getCirclePaintFromMarkSymbolizer(n),i=this.getCircleLayoutFromMarkSymbolizer(n);break}if(!this.ignoreConversionErrors)throw new Error("Cannot get Style. Unsupported MarkSymbolizer");e="symbol";break;default:if(!this.ignoreConversionErrors)throw new Error("Cannot get Style. Unsupported kind.");e="symbol"}return 2===o.length?o:[{type:e,paint:r,layout:i}]}getSplitStyleFromFillSymbolizer(t){let n=structuredClone(t);delete n?.outlineColor;const e={type:"fill",paint:this.getPaintFromFillSymbolizer(n),layout:this.getLayoutFromFillSymbolizer(n)};n=structuredClone(t);const r={kind:"Line",visibility:n?.visibility,color:n?.outlineColor,opacity:n?.outlineOpacity,width:n?.outlineWidth,join:n?.outlineJoin,cap:n?.outlineCap,dasharray:n?.outlineDasharray};return[e,{type:"line",paint:this.getPaintFromLineSymbolizer(r),layout:this.getLayoutFromLineSymbolizer(r)}]}getPaintFromFillSymbolizer(t){const{opacity:n,color:e,outlineColor:r,graphicFill:i,antialias:o}=t,s={"fill-antialias":qn(o),"fill-opacity":qn(n),"fill-color":qn(e),"fill-outline-color":qn(r),"fill-pattern":this.getPatternOrGradientFromPointSymbolizer(i)};return i&&this.replaceGraphicFillWithColor&&!s["fill-color"]&&"Mark"===i.kind&&(s["fill-color"]=this.getColorFromMarkSymbolizer(i),s["fill-color"]&&!s["fill-opacity"]&&(s["fill-opacity"]=.5)),zn.omitBy(s,zn.isUndefined)}getColorFromMarkSymbolizer(t){const n=t.color??t.strokeColor;if(!n){if(this.ignoreConversionErrors)return;throw new Error("Encountered a colorless mark symbolizer.")}if("string"!=typeof n){if(this.ignoreConversionErrors)return;throw new Error("Mark fill color expressions not supported.")}return n}getLayoutFromFillSymbolizer(t){const{visibility:n}=t,e={visibility:this.getVisibility(n)};return zn.omitBy(e,zn.isUndefined)}getPatternOrGradientFromPointSymbolizer(t){if(t){if("Icon"!==t.kind){if(this.replaceGraphicFillWithColor)return;if(this.ignoreConversionErrors)return;throw new Error("Cannot parse pattern or gradient. Mapbox only supports Icons.")}if(t.image)return this.handleSprite(t.image)}}handleSprite(t){if("string"!=typeof t&&!Dn(t)&&!Cn(t.source))return this.spriteBaseUrl=t.source.replace(/\.[^/.]+$/,""),jn.getSpriteName(t,this.gsMetadata["mapbox:ref"])}getVisibility(t){return!0===t?"visible":!1===t?"none":void 0}getPaintFromLineSymbolizer(t){const{opacity:n,color:e,perpendicularOffset:r,width:i,blur:o,dasharray:s,graphicFill:u,gapWidth:a,gradient:c}=t,l={"line-opacity":qn(n),"line-color":e,"line-width":qn(i),"line-gap-width":qn(a),"line-offset":qn(r),"line-blur":qn(o),"line-dasharray":s,"line-pattern":this.getPatternOrGradientFromPointSymbolizer(u),"line-gradient":c};return u&&this.replaceGraphicFillWithColor&&!l["line-color"]&&"Mark"===u.kind&&(l["line-color"]=this.getColorFromMarkSymbolizer(u)),zn.omitBy(l,zn.isUndefined)}getLayoutFromLineSymbolizer(t){const{cap:n,join:e,miterLimit:r,roundLimit:i,visibility:o}=t,s={"line-cap":qn(n),"line-join":qn(e),"line-miter-limit":qn(r),"line-round-limit":qn(i),visibility:this.getVisibility(o)};return zn.omitBy(s,zn.isUndefined)}getPaintFromIconSymbolizer(t){const{haloBlur:n,haloColor:e,haloWidth:r,color:i,opacity:o}=t,s={"icon-opacity":qn(o),"icon-color":qn(i),"icon-halo-color":qn(e),"icon-halo-width":qn(r),"icon-halo-blur":qn(n)};return zn.omitBy(s,zn.isUndefined)}getLayoutFromIconSymbolizer(t){const{avoidEdges:n,allowOverlap:e,optional:r,rotationAlignment:i,size:o,textFit:s,textFitPadding:u,image:a,rotate:c,padding:l,keepUpright:h,offset:f,anchor:p,pitchAlignment:d,visibility:m}=t,y=a?this.handleSprite(a):void 0,v=y?this.gsMetadata["mapbox:ref"].sprite?.[y]["icon-size"]:qn(o),b={"symbol-avoid-edges":n,"icon-allow-overlap":qn(e),"icon-optional":r,"icon-rotation-alignment":qn(i),"icon-size":v,"icon-text-fit":qn(s),"icon-text-fit-padding":u,"icon-image":y,"icon-rotate":qn(c),"icon-padding":qn(l),"icon-keep-upright":h,"icon-offset":f,"icon-anchor":qn(p),"icon-pitch-alignment":qn(d),visibility:this.getVisibility(m)};return zn.omitBy(b,zn.isUndefined)}getPaintFromTextSymbolizer(t){const{haloBlur:n,haloColor:e,haloWidth:r,color:i,opacity:o}=t,s={"text-opacity":qn(o),"text-color":qn(i),"text-halo-color":qn(e),"text-halo-width":qn(r),"text-halo-blur":qn(n)};return zn.omitBy(s,zn.isUndefined)}getLayoutFromTextSymbolizer(t){const{allowOverlap:n,anchor:e,label:r,font:i,justify:o,keepUpright:s,letterSpacing:u,lineHeight:a,maxAngle:c,maxWidth:l,offset:h,optional:f,padding:p,pitchAlignment:d,rotate:m,rotationAlignment:y,size:v,transform:b,avoidEdges:g,placement:w,visibility:x}=t,E={"symbol-avoid-edges":g,"text-pitch-alignment":qn(d),"text-rotation-alignment":qn(y),"text-field":this.getTextFieldFromLabel(r),"text-font":i,"text-size":qn(v),"text-max-width":qn(l),"text-line-height":qn(a),"text-letter-spacing":qn(u),"text-justify":qn(o),"text-anchor":qn(e),"text-max-angle":qn(c),"text-rotate":qn(m),"text-padding":qn(p),"text-keep-upright":s,"text-transform":qn(b),"text-offset":h,"text-allow-overlap":n,"text-optional":f,"symbol-placement":w,visibility:this.getVisibility(x)};return zn.omitBy(E,zn.isUndefined)}getTextFieldFromLabel(t){if(!t)return;if(Dn(t))return qn(t);let n=new RegExp("\\{\\{.*?\\}\\}","g");return t.replace(n,(t=>t.slice(1,-1)))}getCirclePaintFromMarkSymbolizer(t){const{radius:n,color:e,fillOpacity:r,blur:i,offset:o,offsetAnchor:s,pitchScale:u,pitchAlignment:a,strokeWidth:c,strokeColor:l,strokeOpacity:h}=t,f={"circle-radius":qn(n),"circle-color":qn(e),"circle-blur":qn(i),"circle-opacity":qn(r),"circle-translate":o,"circle-translate-anchor":qn(s),"circle-pitch-scale":qn(u),"circle-pitch-alignment":qn(a),"circle-stroke-width":qn(c),"circle-stroke-color":qn(l),"circle-stroke-opacity":qn(h)};return zn.omitBy(f,zn.isUndefined)}getCircleLayoutFromMarkSymbolizer(t){const{visibility:n}=t,e={visibility:this.getVisibility(n)};return zn.omitBy(e,zn.isUndefined)}checkForUnsupportedProperties(t){const n={};if(t.rules.forEach((t=>{t.symbolizers.forEach((t=>{const e=`${t.kind}Symbolizer`;if(e in this.unsupportedProperties.Symbolizer){const r=this.unsupportedProperties.Symbolizer[e];r&&(zn.isString(r)?zn.set(n,`Symbolizer.${e}`,r):Object.keys(t).forEach((t=>{r[t]&&zn.set(n,`Symbolizer.${e}.${t}`,r)})))}}))})),Object.keys(n).length>0)return n}}var Vn;Vn||(Vn=1,("undefined"!=typeof window?window:o).cqlParser=function(){var t=function(t,n,e,r){for(e=e||{},r=t.length;r--;e[t[r]]=n);return e},n=[1,29],e=[1,30],r=[1,31],i=[1,32],o=[1,33],s=[1,34],u=[1,21],a=[1,22],c=[1,13],l=[1,28],h=[1,23],f=[1,24],p=[1,25],d=[1,26],m=[1,27],y=[1,14],v=[1,15],b=[1,5],g=[1,39],w=[1,36],x=[1,37],E=[1,38],S=[5,24,25,33,34,36,39,50,70,86,87,88],O=[5,24,25,33,34,36,39,50,70,75,76,77,78,79,80,81,83,86,87,88],F=[1,56],T=[1,57],M=[1,52],k=[1,53],I=[1,54],_=[1,55],A=[1,58],C=[1,59],N=[1,60],D=[1,61],j=[1,62],P=[1,63],L=[1,64],R=[2,57],$=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],z=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],U=[1,65],G=[2,20],B=[9,11,12,14,15,17,19,21,22,38,41,43,44,45,46,48,49],q=[1,104],W=[24,25],Y=[2,18],V=[5,24,25,33,34,36,39,50,87,88],H=[5,24,25,33,34,36,39,50,52,53,54,55,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],K=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],X=[33,36,39],Q={trace:function(){},yy:{},symbols_:{error:2,main:3,where_opt:4,EOF:5,semicolonOpt:6,";":7,string:8,STRING:9,number:10,NUMERIC:11,EXPONENT_NUMERIC:12,boolean:13,TRUE:14,FALSE:15,null:16,NULL:17,literal:18,place_holder:19,function_call:20,IDENTIFIER:21,"(":22,function_call_param_list:23,")":24,",":25,function_call_param:26,expr:27,identifier:28,DOT:29,identifier_list:30,case_expr_opt:31,when_then_list:32,WHEN:33,THEN:34,case_when_else:35,ELSE:36,case_when:37,CASE:38,END:39,simple_expr_prefix:40,"+":41,simple_expr:42,"-":43,"~":44,"!":45,BINARY:46,expr_list:47,ROW:48,"{":49,"}":50,bit_expr:51,"|":52,"&":53,"<<":54,">>":55,"*":56,"/":57,DIV:58,MOD:59,"%":60,"^":61,not_opt:62,NOT:63,escape_opt:64,ESCAPE:65,predicate:66,IN:67,selectClause:68,BETWEEN:69,AND:70,SOUNDS:71,LIKE:72,REGEXP:73,comparison_operator:74,"=":75,">=":76,">":77,"<=":78,"<":79,"<>":80,"!=":81,boolean_primary:82,IS:83,boolean_extra:84,UNKNOWN:85,"&&":86,"||":87,OR:88,group_by_opt:89,group_by:90,roll_up_opt:91,WITH:92,ROLLUP:93,order_by_opt:94,order_by:95,ORDER_BY:96,group_by_order_by_item_list:97,group_by_order_by_item:98,sort_opt:99,ASC:100,DESC:101,limit:102,LIMIT:103,OFFSET:104,limit_opt:105,procedure_opt:106,procedure:107,PROCEDURE:108,for_update_lock_in_share_mode_opt:109,FOR:110,UPDATE:111,LOCK:112,SHARE:113,MODE:114,left_right:115,LEFT:116,RIGHT:117,out_opt:118,OUTER:119,left_right_out_opt:120,table_reference:121,table_factor:122,join_table:123,identifier_list_opt:124,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:";",9:"STRING",11:"NUMERIC",12:"EXPONENT_NUMERIC",14:"TRUE",15:"FALSE",17:"NULL",19:"place_holder",21:"IDENTIFIER",22:"(",24:")",25:",",29:"DOT",33:"WHEN",34:"THEN",36:"ELSE",38:"CASE",39:"END",41:"+",43:"-",44:"~",45:"!",46:"BINARY",48:"ROW",49:"{",50:"}",52:"|",53:"&",54:"<<",55:">>",56:"*",57:"/",58:"DIV",59:"MOD",60:"%",61:"^",63:"NOT",65:"ESCAPE",67:"IN",68:"selectClause",69:"BETWEEN",70:"AND",71:"SOUNDS",72:"LIKE",73:"REGEXP",75:"=",76:">=",77:">",78:"<=",79:"<",80:"<>",81:"!=",83:"IS",85:"UNKNOWN",86:"&&",87:"||",88:"OR",90:"group_by",92:"WITH",93:"ROLLUP",96:"ORDER_BY",98:"group_by_order_by_item",100:"ASC",101:"DESC",103:"LIMIT",104:"OFFSET",108:"PROCEDURE",110:"FOR",111:"UPDATE",112:"LOCK",113:"SHARE",114:"MODE",116:"LEFT",117:"RIGHT",119:"OUTER",122:"table_factor",123:"join_table"},productions_:[0,[3,2],[6,1],[6,0],[8,1],[10,1],[10,1],[13,1],[13,1],[16,1],[18,1],[18,1],[18,1],[18,1],[18,1],[20,4],[23,3],[23,1],[26,0],[26,1],[28,1],[28,3],[30,1],[30,3],[31,0],[31,1],[32,4],[32,5],[35,0],[35,2],[37,5],[40,2],[40,2],[40,2],[40,2],[40,2],[42,1],[42,1],[42,1],[42,1],[42,3],[42,4],[42,4],[42,1],[51,1],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[62,0],[62,1],[64,0],[64,2],[66,1],[66,6],[66,6],[66,6],[66,4],[66,5],[66,4],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[82,1],[82,4],[82,3],[84,1],[84,1],[27,1],[27,2],[27,3],[27,3],[27,3],[27,3],[47,1],[47,3],[4,1],[89,0],[89,1],[91,0],[91,2],[94,0],[94,1],[95,3],[97,1],[97,3],[99,0],[99,1],[99,1],[102,2],[102,4],[102,4],[105,0],[105,1],[106,0],[106,1],[107,2],[109,0],[109,2],[109,4],[115,1],[115,1],[118,0],[118,1],[120,0],[120,2],[121,1],[121,1],[124,0],[124,1]],performAction:function(t,n,e,r,i,o){var s=o.length-1;switch(i){case 1:return this.$=o[s-1];case 2:case 7:case 92:this.$=!0;break;case 3:case 8:this.$=!1;break;case 4:this.$=o[s].startsWith("'")||o[s].startsWith('"')?o[s].substring(1,o[s].length-1):o[s];break;case 5:case 6:this.$=Number(o[s]);break;case 9:case 18:case 24:case 28:case 57:case 59:case 89:case 91:case 93:case 98:case 104:case 106:case 109:case 114:case 120:this.$=null;break;case 10:case 11:case 12:case 13:case 14:case 19:case 20:case 25:case 29:case 36:case 37:case 38:case 39:case 43:case 44:case 58:case 60:case 61:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 78:case 80:case 88:case 90:case 94:case 99:case 100:case 105:case 107:case 108:case 112:case 113:case 115:case 118:case 119:case 121:this.$=o[s];break;case 15:this.$={name:o[s-3],args:o[s-1]};break;case 16:o[s-2].push(o[s]),this.$=o[s-2];break;case 17:case 86:case 96:this.$=[o[s]];break;case 21:this.$=o[s-2],o[s-2].value+="."+o[s];break;case 22:this.$={type:"IdentifierList",value:[o[s]]};break;case 23:this.$=o[s-2],o[s-2].value.push(o[s]);break;case 26:this.$={type:"WhenThenList",value:[{when:o[s-2],then:o[s]}]};break;case 27:this.$=o[s-4],this.$.value.push({when:o[s-2],then:o[s]});break;case 30:this.$={type:"CaseWhen",caseExprOpt:o[s-3],whenThenList:o[s-2],else:o[s-1]};break;case 31:case 32:case 33:case 34:case 35:this.$={type:"Prefix",prefix:o[s-1],value:o[s]};break;case 40:this.$=1===o[s-1].length?o[s-1][0]:o[s-1];break;case 41:this.$=o[s-2];break;case 42:this.$={type:"IdentifierExpr",identifier:o[s-2],value:o[s-1]};break;case 45:this.$={type:"BitExpression",operator:"|",left:o[s-2],right:o[s]};break;case 46:this.$={type:"BitExpression",operator:"&",left:o[s-2],right:o[s]};break;case 47:this.$={type:"BitExpression",operator:"<<",left:o[s-2],right:o[s]};break;case 48:this.$={type:"BitExpression",operator:">>",left:o[s-2],right:o[s]};break;case 49:this.$={type:"BitExpression",operator:"+",left:o[s-2],right:o[s]};break;case 50:this.$={type:"BitExpression",operator:"-",left:o[s-2],right:o[s]};break;case 51:this.$={type:"BitExpression",operator:"*",left:o[s-2],right:o[s]};break;case 52:this.$={type:"BitExpression",operator:"/",left:o[s-2],right:o[s]};break;case 53:this.$={type:"BitExpression",operator:"DIV",left:o[s-2],right:o[s]};break;case 54:this.$={type:"BitExpression",operator:"MOD",left:o[s-2],right:o[s]};break;case 55:this.$={type:"BitExpression",operator:"%",left:o[s-2],right:o[s]};break;case 56:this.$={type:"BitExpression",operator:"^",left:o[s-2],right:o[s]};break;case 62:this.$={type:"InSubQueryPredicate",hasNot:o[s-4],left:o[s-5],right:o[s-1]};break;case 63:this.$={type:"InExpressionListPredicate",hasNot:o[s-4],left:o[s-5],right:o[s-1]};break;case 64:this.$=["<=x<=",o[s-5],o[s-2],o[s]];break;case 65:this.$={type:"SoundsLikePredicate",hasNot:!1,left:o[s-3],right:o[s]};break;case 66:this.$={type:"LikePredicate",hasNot:o[s-3],left:o[s-4],right:o[s-1],escape:o[s]};break;case 67:this.$={type:"RegexpPredicate",hasNot:o[s-2],left:o[s-3],right:o[s]};break;case 68:this.$="==";break;case 76:this.$=["==",o[s-3],null];break;case 77:this.$=[o[s-1],o[s-2],o[s]];break;case 79:this.$={type:"BooleanExtra",value:o[s]};break;case 81:this.$=["!",o[s]];break;case 82:case 85:this.$=["&&",o[s-2],o[s]];break;case 83:case 84:this.$=["||",o[s-2],o[s]];break;case 87:this.$=o[s-2],this.$.push(o[s]);break;case 95:this.$={type:"OrderBy",value:o[s-1],rollUp:o[s]};break;case 97:this.$=o[s-2],o[s-2].push(o[s]);break;case 101:this.$={type:"Limit",value:[o[s]]};break;case 102:this.$={type:"Limit",value:[o[s-2],o[s]]};break;case 103:this.$={type:"Limit",value:[o[s],o[s-2]],offsetMode:!0};break;case 110:this.$=o[s-1]+" "+o[s];break;case 111:this.$=o[s-3]+" "+o[s-2]+" "+o[s-1]+" "+o[s];break;case 116:this.$={leftRight:null,outOpt:null};break;case 117:this.$={leftRight:o[s-1],outOpt:o[s]}}},table:[{3:1,4:2,8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:3,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{1:[3]},{5:[1,35]},{5:[2,88],70:g,86:w,87:x,88:E},t(S,[2,80],{74:41,75:[1,42],76:[1,43],77:[1,44],78:[1,45],79:[1,46],80:[1,47],81:[1,48],83:[1,40]}),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:49,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t(O,[2,75]),t(O,[2,61],{62:50,41:F,43:T,52:M,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j,61:P,63:L,67:R,69:R,72:R,73:R,71:[1,51]}),t($,[2,44]),t(z,[2,36]),t(z,[2,37],{29:U}),t(z,[2,38]),t(z,[2,39]),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,47:66,48:y,49:v,51:7,63:b,66:6,82:4},{22:[1,68]},{21:[1,70],28:69},t(z,[2,43]),t(z,[2,10]),t(z,[2,11]),t(z,[2,12]),t(z,[2,13]),t(z,[2,14]),t([5,24,25,29,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],G,{22:[1,71]}),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:72,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:73,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:74,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:75,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:76,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:78,28:10,31:77,33:[2,24],37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t(z,[2,4]),t(z,[2,5]),t(z,[2,6]),t(z,[2,7]),t(z,[2,8]),t(z,[2,9]),{1:[2,1]},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:79,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:80,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:81,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:82,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{17:R,62:83,63:L},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,66:84},t(B,[2,68]),t(B,[2,69]),t(B,[2,70]),t(B,[2,71]),t(B,[2,72]),t(B,[2,73]),t(B,[2,74]),t(S,[2,81]),{67:[1,85],69:[1,86],72:[1,87],73:[1,88]},{72:[1,89]},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:90},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:91},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:92},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:93},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:94},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:95},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:96},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:97},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:98},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:99},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:100},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:101},t([17,67,69,72,73],[2,58]),{21:[1,102]},{24:[1,103],25:q},t(W,[2,86],{70:g,86:w,87:x,88:E}),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,47:105,48:y,49:v,51:7,63:b,66:6,82:4},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:106,28:10,29:U,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t([9,11,12,14,15,17,19,21,22,29,38,41,43,44,45,46,48,49,63],G),t(W,Y,{82:4,66:6,51:7,42:8,18:9,28:10,20:11,40:12,37:16,8:17,10:18,13:19,16:20,23:107,26:108,27:109,9:n,11:e,12:r,14:i,15:o,17:s,19:u,21:a,22:c,38:l,41:h,43:f,44:p,45:d,46:m,48:y,49:v,63:b}),t(z,[2,31]),t(z,[2,32]),t(z,[2,33]),t(z,[2,34]),t(z,[2,35]),{32:110,33:[1,111]},{33:[2,25],70:g,86:w,87:x,88:E},t(S,[2,82]),t(V,[2,83],{70:g,86:w}),t(V,[2,84],{70:g,86:w}),t(S,[2,85]),{17:[1,112]},t(O,[2,77]),{22:[1,113]},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:114},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:115,43:f,44:p,45:d,46:m,48:y,49:v},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:116},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:117},t([5,24,25,33,34,36,39,50,52,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,45],{41:F,43:T,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j,61:P}),t([5,24,25,33,34,36,39,50,52,53,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,46],{41:F,43:T,54:I,55:_,56:A,57:C,58:N,59:D,60:j}),t(H,[2,47],{41:F,43:T,56:A,57:C,58:N,59:D,60:j}),t(H,[2,48],{41:F,43:T,56:A,57:C,58:N,59:D,60:j}),t(K,[2,49],{56:A,57:C,58:N,59:D,60:j}),t(K,[2,50],{56:A,57:C,58:N,59:D,60:j}),t($,[2,51]),t($,[2,52]),t($,[2,53]),t($,[2,54]),t($,[2,55]),t([5,24,25,33,34,36,39,50,52,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,56],{41:F,43:T,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j}),t([5,9,11,12,14,15,17,19,21,22,24,25,29,33,34,36,38,39,41,43,44,45,46,48,49,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,21]),t(z,[2,40]),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:118,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{24:[1,119],25:q},{50:[1,120],70:g,86:w,87:x,88:E},{24:[1,121],25:[1,122]},t(W,[2,17]),t(W,[2,19],{70:g,86:w,87:x,88:E}),{33:[1,124],35:123,36:[1,125],39:[2,28]},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:126,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t(O,[2,76]),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,47:128,48:y,49:v,51:7,63:b,66:6,68:[1,127],82:4},{41:F,43:T,52:M,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j,61:P,70:[1,129]},t(O,[2,59],{64:130,65:[1,131]}),t(O,[2,67],{41:F,43:T,52:M,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j,61:P}),t(O,[2,65],{41:F,43:T,52:M,53:k,54:I,55:_,56:A,57:C,58:N,59:D,60:j,61:P}),t(W,[2,87],{70:g,86:w,87:x,88:E}),t(z,[2,41]),t(z,[2,42]),t(z,[2,15]),t(W,Y,{82:4,66:6,51:7,42:8,18:9,28:10,20:11,40:12,37:16,8:17,10:18,13:19,16:20,27:109,26:132,9:n,11:e,12:r,14:i,15:o,17:s,19:u,21:a,22:c,38:l,41:h,43:f,44:p,45:d,46:m,48:y,49:v,63:b}),{39:[1,133]},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:134,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:135,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},{34:[1,136],70:g,86:w,87:x,88:E},{24:[1,137]},{24:[1,138],25:q},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,66:139},t(O,[2,66]),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,28:10,37:16,38:l,40:12,41:h,42:140,43:f,44:p,45:d,46:m,48:y,49:v},t(W,[2,16]),t(z,[2,30]),{34:[1,141],70:g,86:w,87:x,88:E},{39:[2,29],70:g,86:w,87:x,88:E},{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:142,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t(O,[2,62]),t(O,[2,63]),t(O,[2,64]),t(O,[2,60]),{8:17,9:n,10:18,11:e,12:r,13:19,14:i,15:o,16:20,17:s,18:9,19:u,20:11,21:a,22:c,27:143,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:p,45:d,46:m,48:y,49:v,51:7,63:b,66:6,82:4},t(X,[2,26],{70:g,86:w,87:x,88:E}),t(X,[2,27],{70:g,86:w,87:x,88:E})],defaultActions:{35:[2,1]},parseError:function(t,n){if(!n.recoverable){var e=new Error(t);throw e.hash=n,e}this.trace(t)},parse:function(t){var n=[0],e=[null],r=[],i=this.table,o="",s=0,u=0,a=r.slice.call(arguments,1),c=Object.create(this.lexer),l={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(l.yy[h]=this.yy[h]);c.setInput(t,l.yy),l.yy.lexer=c,l.yy.parser=this,void 0===c.yylloc&&(c.yylloc={});var f=c.yylloc;r.push(f);var p=c.options&&c.options.ranges;this.parseError="function"==typeof l.yy.parseError?l.yy.parseError:Object.getPrototypeOf(this).parseError;for(var d,m,y,v,b,g,w,x,E={};;){if(this.defaultActions[m=n[n.length-1]]?y=this.defaultActions[m]:(null==d&&(x=void 0,"number"!=typeof(x=c.lex()||1)&&(x=this.symbols_[x]||x),d=x),y=i[m]&&i[m][d]),void 0===y||!y.length||!y[0]){var S;for(b in w=[],i[m])this.terminals_[b]&&b>2&&w.push("'"+this.terminals_[b]+"'");S=c.showPosition?"Parse error on line "+(s+1)+":\n"+c.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(S,{text:c.match,token:this.terminals_[d]||d,line:c.yylineno,loc:f,expected:w})}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+d);switch(y[0]){case 1:n.push(d),e.push(c.yytext),r.push(c.yylloc),n.push(y[1]),d=null,u=c.yyleng,o=c.yytext,s=c.yylineno,f=c.yylloc;break;case 2:if(E.$=e[e.length-(g=this.productions_[y[1]][1])],E._$={first_line:r[r.length-(g||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(g||1)].first_column,last_column:r[r.length-1].last_column},p&&(E._$.range=[r[r.length-(g||1)].range[0],r[r.length-1].range[1]]),void 0!==(v=this.performAction.apply(E,[o,u,s,l.yy,y[1],e,r].concat(a))))return v;g&&(n=n.slice(0,-1*g*2),e=e.slice(0,-1*g),r=r.slice(0,-1*g)),n.push(this.productions_[y[1]][0]),e.push(E.$),r.push(E._$),n.push(i[n[n.length-2]][n[n.length-1]]);break;case 3:return!0}}return!0}},Z=function(){var t={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(t,n){return this.yy=n||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var n=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),e.length-1&&(this.yylineno-=e.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:e?(e.length===r.length?this.yylloc.first_column:0)+r[r.length-e.length].length-e[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),n=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+n+"^"},test_match:function(t,n){var e,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var o in i)this[o]=i[o];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,n,e,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),o=0;o<i.length;o++)if((e=this._input.match(this.rules[i[o]]))&&(!n||e[0].length>n[0].length)){if(n=e,r=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,i[o])))return t;if(this._backtrack){n=!1;continue}return!1}if(!this.options.flex)break}return n?!1!==(t=this.test_match(n,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,n,e){switch(e){case 0:case 1:case 2:case 3:break;case 4:case 5:case 124:case 128:return 21;case 6:return 14;case 7:return 15;case 8:case 66:return 17;case 9:return 38;case 10:return 33;case 11:return 34;case 12:return 36;case 13:return 39;case 14:return 58;case 15:return 59;case 16:case 61:return 63;case 17:return 69;case 18:case 72:return 67;case 19:return 71;case 20:case 64:return 72;case 21:return 65;case 22:return 73;case 23:case 65:return 83;case 24:return 85;case 25:case 62:return 70;case 26:case 63:return 88;case 27:return"XOR";case 28:return"FROM";case 29:return"PARTITION";case 30:return"USE";case 31:return"INDEX";case 32:return"KEY";case 33:return 110;case 34:return"JOIN";case 35:return 96;case 36:return"GROUP_BY";case 37:return"IGNORE";case 38:return"FORCE";case 39:return"CROSS";case 40:return"ON";case 41:return"USING";case 42:return 116;case 43:return 117;case 44:return 119;case 45:return"NATURAL";case 46:return"WHERE";case 47:return 100;case 48:return 101;case 49:return 92;case 50:return 93;case 51:return"HAVING";case 52:return 104;case 53:return 108;case 54:return 111;case 55:return 112;case 56:return 113;case 57:return 114;case 58:return"OJ";case 59:return 103;case 60:return"UNION";case 67:return"EXISTS";case 68:return"DOES-NOT-EXIST";case 69:return"DURING";case 70:return"AFTER";case 71:return"BEFORE";case 73:return"INCLUDE";case 74:return"EXCLUDE";case 75:return"EQUALS";case 76:return"DISJOINT";case 77:return"INTERSECTS";case 78:return"TOUCHES";case 79:return"CROSSES";case 80:return"WITHIN";case 81:return"CONTAINS";case 82:return"OVERLAPS";case 83:return"RELATE";case 84:return"DWITHIN";case 85:return"BEYOND";case 86:return"POINT";case 87:return"LINESTRING";case 88:return"POLYGON";case 89:return"MULTIPOINT";case 90:return"MULTILINESTRING";case 91:return"MULTIPOLYGON";case 92:return"GEOMETRYCOLLECTION";case 93:return 25;case 94:return 75;case 95:return 22;case 96:return 24;case 97:return 44;case 98:return 81;case 99:return 45;case 100:return 52;case 101:return 53;case 102:return 41;case 103:return 43;case 104:return 56;case 105:return 57;case 106:return 60;case 107:return 61;case 108:return 55;case 109:return 76;case 110:return 77;case 111:return 54;case 112:return"<=>";case 113:return 78;case 114:return 80;case 115:return 79;case 116:return 49;case 117:return 50;case 118:return 7;case 119:case 120:case 126:case 127:return 9;case 121:return"HEX_NUMERIC";case 122:return 11;case 123:return 12;case 125:return 29;case 129:return 5;case 130:return"INVALID"}},rules:[/^(?:[/][*](.|\n)*?[*][/])/i,/^(?:[-][-]\s.*\n)/i,/^(?:[#]\s.*\n)/i,/^(?:\s+)/i,/^(?:[\w]+[\u4e00-\u9fa5]+[0-9a-zA-Z_\u4e00-\u9fa5]*)/i,/^(?:[\u4e00-\u9fa5][0-9a-zA-Z_\u4e00-\u9fa5]*)/i,/^(?:TRUE\b)/i,/^(?:FALSE\b)/i,/^(?:NULL\b)/i,/^(?:CASE\b)/i,/^(?:WHEN\b)/i,/^(?:THEN\b)/i,/^(?:ELSE\b)/i,/^(?:END\b)/i,/^(?:DIV\b)/i,/^(?:MOD\b)/i,/^(?:NOT\b)/i,/^(?:BETWEEN\b)/i,/^(?:IN\b)/i,/^(?:SOUNDS\b)/i,/^(?:LIKE\b)/i,/^(?:ESCAPE\b)/i,/^(?:REGEXP\b)/i,/^(?:IS\b)/i,/^(?:UNKNOWN\b)/i,/^(?:AND\b)/i,/^(?:OR\b)/i,/^(?:XOR\b)/i,/^(?:FROM\b)/i,/^(?:PARTITION\b)/i,/^(?:USE\b)/i,/^(?:INDEX\b)/i,/^(?:KEY\b)/i,/^(?:FOR\b)/i,/^(?:JOIN\b)/i,/^(?:ORDER\s+BY\b)/i,/^(?:GROUP\s+BY\b)/i,/^(?:IGNORE\b)/i,/^(?:FORCE\b)/i,/^(?:CROSS\b)/i,/^(?:ON\b)/i,/^(?:USING\b)/i,/^(?:LEFT\b)/i,/^(?:RIGHT\b)/i,/^(?:OUTER\b)/i,/^(?:NATURAL\b)/i,/^(?:WHERE\b)/i,/^(?:ASC\b)/i,/^(?:DESC\b)/i,/^(?:WITH\b)/i,/^(?:ROLLUP\b)/i,/^(?:HAVING\b)/i,/^(?:OFFSET\b)/i,/^(?:PROCEDURE\b)/i,/^(?:UPDATE\b)/i,/^(?:LOCK\b)/i,/^(?:SHARE\b)/i,/^(?:MODE\b)/i,/^(?:OJ\b)/i,/^(?:LIMIT\b)/i,/^(?:UNION\b)/i,/^(?:NOT\b)/i,/^(?:AND\b)/i,/^(?:OR\b)/i,/^(?:LIKE\b)/i,/^(?:IS\b)/i,/^(?:NULL\b)/i,/^(?:EXISTS\b)/i,/^(?:DOESNOTEXIST\b)/i,/^(?:DURING\b)/i,/^(?:AFTER\b)/i,/^(?:BEFORE\b)/i,/^(?:IN\b)/i,/^(?:INCLUDE\b)/i,/^(?:EXCLUDE\b)/i,/^(?:EQUALS\b)/i,/^(?:DISJOINT\b)/i,/^(?:INTERSECTS\b)/i,/^(?:TOUCHES\b)/i,/^(?:CROSSES\b)/i,/^(?:WITHIN\b)/i,/^(?:CONTAINS\b)/i,/^(?:OVERLAPS\b)/i,/^(?:RELATE\b)/i,/^(?:DWITHIN\b)/i,/^(?:BEYOND\b)/i,/^(?:POINT\b)/i,/^(?:LINESTRING\b)/i,/^(?:POLYGON\b)/i,/^(?:MULTIPOINT\b)/i,/^(?:MULTILINESTRING\b)/i,/^(?:MULTIPOLYGON\b)/i,/^(?:GEOMETRYCOLLECTION\b)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:~)/i,/^(?:!=)/i,/^(?:!)/i,/^(?:\|)/i,/^(?:&)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:\^)/i,/^(?:>>)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<<)/i,/^(?:<=>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:;)/i,/^(?:['](\\.|[^'])*['])/i,/^(?:["](\\.|[^"])*["])/i,/^(?:[0][x][0-9a-fA-F]+)/i,/^(?:[-]?[0-9]+(\.[0-9]+)?)/i,/^(?:[-]?[0-9]+(\.[0-9]+)?[eE][-][0-9]+(\.[0-9]+)?)/i,/^(?:[a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)/i,/^(?:\.)/i,/^(?:["]([a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)["])/i,/^(?:[']([a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)['])/i,/^(?:([`])(?:(?=(\\?))\2.)*?\1)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130],inclusive:!0}}};return t}();function J(){this.yy={}}return Q.lexer=Z,J.prototype=Q,Q.Parser=J,new J}());class Hn{tokens=["PROPERTY","COMPARISON","VALUE","LOGICAL"];operatorsMap={"=":"==","<>":"!=","<":"<","<=":"<=",">":">",">=":">=",LIKE:"*=",BETWEEN:"<=x<="};operatorReverseMap={};combinationOperatorsMap={AND:"&&",OR:"||"};combinationOperatorsReverseMap={};precedence={RPAREN:3,LOGICAL:2,COMPARISON:1};constructor(){const{combinationOperatorsMap:t,combinationOperatorsReverseMap:n,operatorsMap:e,operatorReverseMap:r}=this;Object.keys(e).forEach((t=>{r[e[t]]=t})),Object.keys(t).forEach((e=>{n[t[e]]=e})),this.read=this.read.bind(this),this.write=this.write.bind(this)}read(t){try{return("undefined"!=typeof window?window:global).cqlParser.parse(t)}catch(t){return}}write(t,n){const{operatorReverseMap:e,combinationOperatorsReverseMap:r,write:i}=this;if(t&&Dn(t)){if("pi"===t.name||"random"===t.name)return t.name;{const n=t.args.map((t=>this.write(t))).join(", ");return`${t.name}(${n})`}}if(Array.isArray(t)){if(t.length<2)return;if(!(Sn(o=t[0])||On(o)||Fn(o)))throw new Error(`Can't encode: ${t}`)}var o;if(Tn(t)){const o=t,s=o[0],u=e[s];switch(s){case"!":return`NOT ( ${i(o[1])} )`;case"&&":case"||":let t="";const e=r[s];return t+=o.slice(1).map((t=>i(t,!0))).join(` ${e} `),n?`(${t})`:t;case"==":case"*=":case"!=":case"<":case"<=":case">":case">=":const a=(t=>"string"==typeof t)(o[2]);let c=o[2];return a&&(c=`'${c}'`),`${o[1]} ${u} ${c}`;case"<=x<=":return`${o[1]} ${u} ${this.write(o[2])} AND ${this.write(o[3])}`}}return t}}var Kn,Xn,Qn={exports:{}};function Zn(){return Xn?Kn:(Xn=1,Kn={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]})}var Jn,te,ne,ee,re,ie,oe,se,ue,ae,ce,le,he={exports:{}};function fe(){return te?Jn:(te=1,Jn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))})}function pe(){if(ee)return Qn.exports;ee=1;var t=Zn(),n=function(){if(ne)return he.exports;ne=1;var t=fe(),n=Array.prototype.concat,e=Array.prototype.slice,r=he.exports=function(r){for(var i=[],o=0,s=r.length;o<s;o++){var u=r[o];t(u)?i=n.call(i,e.call(u)):i.push(u)}return i};return r.wrap=function(t){return function(){return t(r(arguments))}},he.exports}(),e=Object.hasOwnProperty,r=Object.create(null);for(var i in t)e.call(t,i)&&(r[t[i]]=i);var o=Qn.exports={to:{},get:{}};function s(t,n,e){return Math.min(Math.max(n,t),e)}function u(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}return o.get=function(t){var n,e;switch(t.substring(0,3).toLowerCase()){case"hsl":n=o.get.hsl(t),e="hsl";break;case"hwb":n=o.get.hwb(t),e="hwb";break;default:n=o.get.rgb(t),e="rgb"}return n?{model:e,value:n}:null},o.get.rgb=function(n){if(!n)return null;var r,i,o,u=[0,0,0,1];if(r=n.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=r[2],r=r[1],i=0;i<3;i++){var a=2*i;u[i]=parseInt(r.slice(a,a+2),16)}o&&(u[3]=parseInt(o,16)/255)}else if(r=n.match(/^#([a-f0-9]{3,4})$/i)){for(o=(r=r[1])[3],i=0;i<3;i++)u[i]=parseInt(r[i]+r[i],16);o&&(u[3]=parseInt(o+o,16)/255)}else if(r=n.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(i=0;i<3;i++)u[i]=parseInt(r[i+1],0);r[4]&&(u[3]=r[5]?.01*parseFloat(r[4]):parseFloat(r[4]))}else{if(!(r=n.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(r=n.match(/^(\w+)$/))?"transparent"===r[1]?[0,0,0,0]:e.call(t,r[1])?((u=t[r[1]])[3]=1,u):null:null;for(i=0;i<3;i++)u[i]=Math.round(2.55*parseFloat(r[i+1]));r[4]&&(u[3]=r[5]?.01*parseFloat(r[4]):parseFloat(r[4]))}for(i=0;i<3;i++)u[i]=s(u[i],0,255);return u[3]=s(u[3],0,1),u},o.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(n){var e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,s(parseFloat(n[2]),0,100),s(parseFloat(n[3]),0,100),s(isNaN(e)?1:e,0,1)]}return null},o.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(n){var e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,s(parseFloat(n[2]),0,100),s(parseFloat(n[3]),0,100),s(isNaN(e)?1:e,0,1)]}return null},o.to.hex=function(){var t=n(arguments);return"#"+u(t[0])+u(t[1])+u(t[2])+(t[3]<1?u(Math.round(255*t[3])):"")},o.to.rgb=function(){var t=n(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},o.to.rgb.percent=function(){var t=n(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),i=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+i+"%)":"rgba("+e+"%, "+r+"%, "+i+"%, "+t[3]+")"},o.to.hsl=function(){var t=n(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},o.to.hwb=function(){var t=n(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},o.to.keyword=function(t){return r[t.slice(0,3)]},Qn.exports}function de(){if(ie)return re;ie=1;const t=Zn(),n={};for(const e of Object.keys(t))n[t[e]]=e;const e={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};re=e;for(const t of Object.keys(e)){if(!("channels"in e[t]))throw new Error("missing channels property: "+t);if(!("labels"in e[t]))throw new Error("missing channel labels property: "+t);if(e[t].labels.length!==e[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:n,labels:r}=e[t];delete e[t].channels,delete e[t].labels,Object.defineProperty(e[t],"channels",{value:n}),Object.defineProperty(e[t],"labels",{value:r})}function r(t,n){return(t[0]-n[0])**2+(t[1]-n[1])**2+(t[2]-n[2])**2}return e.rgb.hsl=function(t){const n=t[0]/255,e=t[1]/255,r=t[2]/255,i=Math.min(n,e,r),o=Math.max(n,e,r),s=o-i;let u,a;o===i?u=0:n===o?u=(e-r)/s:e===o?u=2+(r-n)/s:r===o&&(u=4+(n-e)/s),u=Math.min(60*u,360),u<0&&(u+=360);const c=(i+o)/2;return a=o===i?0:c<=.5?s/(o+i):s/(2-o-i),[u,100*a,100*c]},e.rgb.hsv=function(t){let n,e,r,i,o;const s=t[0]/255,u=t[1]/255,a=t[2]/255,c=Math.max(s,u,a),l=c-Math.min(s,u,a),h=function(t){return(c-t)/6/l+.5};return 0===l?(i=0,o=0):(o=l/c,n=h(s),e=h(u),r=h(a),s===c?i=r-e:u===c?i=1/3+n-r:a===c&&(i=2/3+e-n),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},e.rgb.hwb=function(t){const n=t[0],r=t[1];let i=t[2];const o=e.rgb.hsl(t)[0],s=1/255*Math.min(n,Math.min(r,i));return i=1-1/255*Math.max(n,Math.max(r,i)),[o,100*s,100*i]},e.rgb.cmyk=function(t){const n=t[0]/255,e=t[1]/255,r=t[2]/255,i=Math.min(1-n,1-e,1-r);return[100*((1-n-i)/(1-i)||0),100*((1-e-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*i]},e.rgb.keyword=function(e){const i=n[e];if(i)return i;let o,s=1/0;for(const n of Object.keys(t)){const i=r(e,t[n]);i<s&&(s=i,o=n)}return o},e.keyword.rgb=function(n){return t[n]},e.rgb.xyz=function(t){let n=t[0]/255,e=t[1]/255,r=t[2]/255;return n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,[100*(.4124*n+.3576*e+.1805*r),100*(.2126*n+.7152*e+.0722*r),100*(.0193*n+.1192*e+.9505*r)]},e.rgb.lab=function(t){const n=e.rgb.xyz(t);let r=n[0],i=n[1],o=n[2];return r/=95.047,i/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*i-16,500*(r-i),200*(i-o)]},e.hsl.rgb=function(t){const n=t[0]/360,e=t[1]/100,r=t[2]/100;let i,o,s;if(0===e)return s=255*r,[s,s,s];i=r<.5?r*(1+e):r+e-r*e;const u=2*r-i,a=[0,0,0];for(let t=0;t<3;t++)o=n+1/3*-(t-1),o<0&&o++,o>1&&o--,s=6*o<1?u+6*(i-u)*o:2*o<1?i:3*o<2?u+(i-u)*(2/3-o)*6:u,a[t]=255*s;return a},e.hsl.hsv=function(t){const n=t[0];let e=t[1]/100,r=t[2]/100,i=e;const o=Math.max(r,.01);return r*=2,e*=r<=1?r:2-r,i*=o<=1?o:2-o,[n,100*(0===r?2*i/(o+i):2*e/(r+e)),(r+e)/2*100]},e.hsv.rgb=function(t){const n=t[0]/60,e=t[1]/100;let r=t[2]/100;const i=Math.floor(n)%6,o=n-Math.floor(n),s=255*r*(1-e),u=255*r*(1-e*o),a=255*r*(1-e*(1-o));switch(r*=255,i){case 0:return[r,a,s];case 1:return[u,r,s];case 2:return[s,r,a];case 3:return[s,u,r];case 4:return[a,s,r];case 5:return[r,s,u]}},e.hsv.hsl=function(t){const n=t[0],e=t[1]/100,r=t[2]/100,i=Math.max(r,.01);let o,s;s=(2-e)*r;const u=(2-e)*i;return o=e*i,o/=u<=1?u:2-u,o=o||0,s/=2,[n,100*o,100*s]},e.hwb.rgb=function(t){const n=t[0]/360;let e=t[1]/100,r=t[2]/100;const i=e+r;let o;i>1&&(e/=i,r/=i);const s=Math.floor(6*n),u=1-r;o=6*n-s,1&s&&(o=1-o);const a=e+o*(u-e);let c,l,h;switch(s){default:case 6:case 0:c=u,l=a,h=e;break;case 1:c=a,l=u,h=e;break;case 2:c=e,l=u,h=a;break;case 3:c=e,l=a,h=u;break;case 4:c=a,l=e,h=u;break;case 5:c=u,l=e,h=a}return[255*c,255*l,255*h]},e.cmyk.rgb=function(t){const n=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,t[0]/100*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},e.xyz.rgb=function(t){const n=t[0]/100,e=t[1]/100,r=t[2]/100;let i,o,s;return i=3.2406*n+-1.5372*e+-.4986*r,o=-.9689*n+1.8758*e+.0415*r,s=.0557*n+-.204*e+1.057*r,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*i,255*o,255*s]},e.xyz.lab=function(t){let n=t[0],e=t[1],r=t[2];return n/=95.047,e/=100,r/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*e-16,500*(n-e),200*(e-r)]},e.lab.xyz=function(t){let n,e,r;e=(t[0]+16)/116,n=t[1]/500+e,r=e-t[2]/200;const i=e**3,o=n**3,s=r**3;return e=i>.008856?i:(e-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,r=s>.008856?s:(r-16/116)/7.787,n*=95.047,e*=100,r*=108.883,[n,e,r]},e.lab.lch=function(t){const n=t[0],e=t[1],r=t[2];let i;return i=360*Math.atan2(r,e)/2/Math.PI,i<0&&(i+=360),[n,Math.sqrt(e*e+r*r),i]},e.lch.lab=function(t){const n=t[1],e=t[2]/360*2*Math.PI;return[t[0],n*Math.cos(e),n*Math.sin(e)]},e.rgb.ansi16=function(t,n=null){const[r,i,o]=t;let s=null===n?e.rgb.hsv(t)[2]:n;if(s=Math.round(s/50),0===s)return 30;let u=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(r/255));return 2===s&&(u+=60),u},e.hsv.ansi16=function(t){return e.rgb.ansi16(e.hsv.rgb(t),t[2])},e.rgb.ansi256=function(t){const n=t[0],e=t[1],r=t[2];return n===e&&e===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},e.ansi16.rgb=function(t){let n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const e=.5*(1+~~(t>50));return[(1&n)*e*255,(n>>1&1)*e*255,(n>>2&1)*e*255]},e.ansi256.rgb=function(t){if(t>=232){const n=10*(t-232)+8;return[n,n,n]}let n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},e.rgb.hex=function(t){const n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},e.hex.rgb=function(t){const n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let e=n[0];3===n[0].length&&(e=e.split("").map((t=>t+t)).join(""));const r=parseInt(e,16);return[r>>16&255,r>>8&255,255&r]},e.rgb.hcg=function(t){const n=t[0]/255,e=t[1]/255,r=t[2]/255,i=Math.max(Math.max(n,e),r),o=Math.min(Math.min(n,e),r),s=i-o;let u,a;return u=s<1?o/(1-s):0,a=s<=0?0:i===n?(e-r)/s%6:i===e?2+(r-n)/s:4+(n-e)/s,a/=6,a%=1,[360*a,100*s,100*u]},e.hsl.hcg=function(t){const n=t[1]/100,e=t[2]/100,r=e<.5?2*n*e:2*n*(1-e);let i=0;return r<1&&(i=(e-.5*r)/(1-r)),[t[0],100*r,100*i]},e.hsv.hcg=function(t){const n=t[2]/100,e=t[1]/100*n;let r=0;return e<1&&(r=(n-e)/(1-e)),[t[0],100*e,100*r]},e.hcg.rgb=function(t){const n=t[1]/100,e=t[2]/100;if(0===n)return[255*e,255*e,255*e];const r=[0,0,0],i=t[0]/360%1*6,o=i%1,s=1-o;let u=0;switch(Math.floor(i)){case 0:r[0]=1,r[1]=o,r[2]=0;break;case 1:r[0]=s,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=o;break;case 3:r[0]=0,r[1]=s,r[2]=1;break;case 4:r[0]=o,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=s}return u=(1-n)*e,[255*(n*r[0]+u),255*(n*r[1]+u),255*(n*r[2]+u)]},e.hcg.hsv=function(t){const n=t[1]/100,e=n+t[2]/100*(1-n);let r=0;return e>0&&(r=n/e),[t[0],100*r,100*e]},e.hcg.hsl=function(t){const n=t[1]/100,e=t[2]/100*(1-n)+.5*n;let r=0;return e>0&&e<.5?r=n/(2*e):e>=.5&&e<1&&(r=n/(2*(1-e))),[t[0],100*r,100*e]},e.hcg.hwb=function(t){const n=t[1]/100,e=n+t[2]/100*(1-n);return[t[0],100*(e-n),100*(1-e)]},e.hwb.hcg=function(t){const n=1-t[2]/100,e=n-t[1]/100;let r=0;return e<1&&(r=(n-e)/(1-e)),[t[0],100*e,100*r]},e.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},e.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},e.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},e.gray.hsl=function(t){return[0,0,t[0]]},e.gray.hsv=e.gray.hsl,e.gray.hwb=function(t){return[0,100,t[0]]},e.gray.cmyk=function(t){return[0,0,0,t[0]]},e.gray.lab=function(t){return[t[0],0,0]},e.gray.hex=function(t){const n=255&Math.round(t[0]/100*255),e=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(e.length)+e},e.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},re}function me(){if(se)return oe;se=1;const t=de();function n(t,n){return function(e){return n(t(e))}}function e(e,r){const i=[r[e].parent,e];let o=t[r[e].parent][e],s=r[e].parent;for(;r[s].parent;)i.unshift(r[s].parent),o=n(t[r[s].parent][s],o),s=r[s].parent;return o.conversion=i,o}return oe=function(n){const r=function(n){const e=function(){const n={},e=Object.keys(t);for(let t=e.length,r=0;r<t;r++)n[e[r]]={distance:-1,parent:null};return n}(),r=[n];for(e[n].distance=0;r.length;){const n=r.pop(),i=Object.keys(t[n]);for(let t=i.length,o=0;o<t;o++){const t=i[o],s=e[t];-1===s.distance&&(s.distance=e[n].distance+1,s.parent=n,r.unshift(t))}}return e}(n),i={},o=Object.keys(r);for(let t=o.length,n=0;n<t;n++){const t=o[n];null!==r[t].parent&&(i[t]=e(t,r))}return i},oe}function ye(){if(le)return ce;le=1;const t=pe(),n=function(){if(ae)return ue;ae=1;const t=de(),n=me(),e={};return Object.keys(t).forEach((r=>{e[r]={},Object.defineProperty(e[r],"channels",{value:t[r].channels}),Object.defineProperty(e[r],"labels",{value:t[r].labels});const i=n(r);Object.keys(i).forEach((t=>{const n=i[t];e[r][t]=function(t){const n=function(...n){const e=n[0];if(null==e)return e;e.length>1&&(n=e);const r=t(n);if("object"==typeof r)for(let t=r.length,n=0;n<t;n++)r[n]=Math.round(r[n]);return r};return"conversion"in t&&(n.conversion=t.conversion),n}(n),e[r][t].raw=function(t){const n=function(...n){const e=n[0];return null==e?e:(e.length>1&&(n=e),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(n)}))})),ue=e}(),e=["keyword","gray","hex"],r={};for(const t of Object.keys(n))r[[...n[t].labels].sort().join("")]=t;const i={};function o(s,u){if(!(this instanceof o))return new o(s,u);if(u&&u in e&&(u=null),u&&!(u in n))throw new Error("Unknown model: "+u);let a,l;if(null==s)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(s instanceof o)this.model=s.model,this.color=[...s.color],this.valpha=s.valpha;else if("string"==typeof s){const e=t.get(s);if(null===e)throw new Error("Unable to parse color from string: "+s);this.model=e.model,l=n[this.model].channels,this.color=e.value.slice(0,l),this.valpha="number"==typeof e.value[l]?e.value[l]:1}else if(s.length>0){this.model=u||"rgb",l=n[this.model].channels;const t=Array.prototype.slice.call(s,0,l);this.color=c(t,l),this.valpha="number"==typeof s[l]?s[l]:1}else if("number"==typeof s)this.model="rgb",this.color=[s>>16&255,s>>8&255,255&s],this.valpha=1;else{this.valpha=1;const t=Object.keys(s);"alpha"in s&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof s.alpha?s.alpha:0);const e=t.sort().join("");if(!(e in r))throw new Error("Unable to parse color from object: "+JSON.stringify(s));this.model=r[e];const{labels:i}=n[this.model],o=[];for(a=0;a<i.length;a++)o.push(s[i[a]]);this.color=c(o)}if(i[this.model])for(l=n[this.model].channels,a=0;a<l;a++){const t=i[this.model][a];t&&(this.color[a]=t(this.color[a]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}o.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(n){let e=this.model in t.to?this:this.rgb();e=e.round("number"==typeof n?n:1);const r=1===e.valpha?e.color:[...e.color,this.valpha];return t.to[e.model](r)},percentString(n){const e=this.rgb().round("number"==typeof n?n:1),r=1===e.valpha?e.color:[...e.color,this.valpha];return t.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=n[this.model],{labels:r}=n[this.model];for(let n=0;n<e;n++)t[r[n]]=this.color[n];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new o([...this.color.map(s(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new o([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:u("rgb",0,a(255)),green:u("rgb",1,a(255)),blue:u("rgb",2,a(255)),hue:u(["hsl","hsv","hsl","hwb","hcg"],0,(t=>(t%360+360)%360)),saturationl:u("hsl",1,a(100)),lightness:u("hsl",2,a(100)),saturationv:u("hsv",1,a(100)),value:u("hsv",2,a(100)),chroma:u("hcg",1,a(100)),gray:u("hcg",2,a(100)),white:u("hwb",1,a(100)),wblack:u("hwb",2,a(100)),cyan:u("cmyk",0,a(100)),magenta:u("cmyk",1,a(100)),yellow:u("cmyk",2,a(100)),black:u("cmyk",3,a(100)),x:u("xyz",0,a(95.047)),y:u("xyz",1,a(100)),z:u("xyz",2,a(108.833)),l:u("lab",0,a(100)),a:u("lab",1),b:u("lab",2),keyword(t){return void 0!==t?new o(t):n[this.model].keyword(this.color)},hex(n){return void 0!==n?new o(n):t.to.hex(this.rgb().round().color)},hexa(n){if(void 0!==n)return new o(n);const e=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),t.to.hex(e)+r},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,n=[];for(const[e,r]of t.entries()){const t=r/255;n[e]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast(t){const n=this.luminosity(),e=t.luminosity();return n>e?(n+.05)/(e+.05):(e+.05)/(n+.05)},level(t){const n=this.contrast(t);return n>=7?"AAA":n>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten(t){const n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken(t){const n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate(t){const n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate(t){const n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten(t){const n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken(t){const n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale(){const t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return o.rgb(n,n,n)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const n=this.hsl();let e=n.color[0];return e=(e+t)%360,e=e<0?360+e:e,n.color[0]=e,n},mix(t,n){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const e=t.rgb(),r=this.rgb(),i=void 0===n?.5:n,s=2*i-1,u=e.alpha()-r.alpha(),a=((s*u==-1?s:(s+u)/(1+s*u))+1)/2,c=1-a;return o.rgb(a*e.red()+c*r.red(),a*e.green()+c*r.green(),a*e.blue()+c*r.blue(),e.alpha()*i+r.alpha()*(1-i))}};for(const t of Object.keys(n)){if(e.includes(t))continue;const{channels:r}=n[t];o.prototype[t]=function(...e){return this.model===t?new o(this):new o(e.length>0?e:[...(r=n[this.model][t].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],t);var r},o[t]=function(...n){let e=n[0];return"number"==typeof e&&(e=c(n,r)),new o(e,t)}}function s(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}function u(t,n,e){t=Array.isArray(t)?t:[t];for(const r of t)(i[r]||(i[r]=[]))[n]=e;return t=t[0],function(r){let i;return void 0!==r?(e&&(r=e(r)),i=this[t](),i.color[n]=r,i):(i=this[t]().color[n],e&&(i=e(i)),i)}}function a(t){return function(n){return Math.max(0,Math.min(t,n))}}function c(t,n){for(let e=0;e<n;e++)"number"!=typeof t[e]&&(t[e]=0);return t}return ce=o}var ve,be=s(ye()),ge={},we={};function xe(){return ve||(ve=1,function(){we.defaults={.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:""},.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:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(we)),we}var Ee,Se={},Oe={},Fe={};function Te(){return Ee||(Ee=1,function(){var t,n,e,r,i,o,s,u=[].slice,a={}.hasOwnProperty;t=function(){var t,n,e,r,o,s;if(s=arguments[0],o=2<=arguments.length?u.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(t=0,e=o.length;t<e;t++)if(null!=(r=o[t]))for(n in r)a.call(r,n)&&(s[n]=r[n]);return s},i=function(t){return!!t&&"[object Function]"===Object.prototype.toString.call(t)},o=function(t){var n;return!!t&&("function"==(n=typeof t)||"object"===n)},e=function(t){return i(Array.isArray)?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},r=function(t){var n;if(e(t))return!t.length;for(n in t)if(a.call(t,n))return!1;return!0},s=function(t){var n,e;return o(t)&&(e=Object.getPrototypeOf(t))&&(n=e.constructor)&&"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)},n=function(t){return i(t.valueOf)?t.valueOf():t},Fe.assign=t,Fe.isFunction=i,Fe.isObject=o,Fe.isArray=e,Fe.isEmpty=r,Fe.isPlainObject=s,Fe.getValue=n}.call(Fe)),Fe}var Me,ke={exports:{}},Ie=ke.exports;function _e(){return Me||(Me=1,function(){ke.exports=function(){function t(){}return t.prototype.hasFeature=function(){return!0},t.prototype.createDocumentType=function(){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(){throw new Error("This DOM method is not implemented.")},t}()}.call(Ie)),ke.exports}var Ae,Ce={exports:{}},Ne={exports:{}},De={exports:{}},je=De.exports;function Pe(){return Ae||(Ae=1,function(){De.exports=function(){function t(){}return t.prototype.handleError=function(t){throw new Error(t)},t}()}.call(je)),De.exports}var Le,Re={exports:{}},$e=Re.exports;function ze(){return Le||(Le=1,function(){Re.exports=function(){function t(t){this.arr=t||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(t){return this.arr[t]||null},t.prototype.contains=function(t){return-1!==this.arr.indexOf(t)},t}()}.call($e)),Re.exports}var Ue,Ge=Ne.exports;function Be(){return Ue||(Ue=1,function(){var t,n;t=Pe(),n=ze(),Ne.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new t,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(e.prototype,"parameterNames",{get:function(){return new n(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(t){return this.params.hasOwnProperty(t)?this.params[t]:null},e.prototype.canSetParameter=function(){return!0},e.prototype.setParameter=function(t,n){return null!=n?this.params[t]=n:delete this.params[t]},e}()}.call(Ge)),Ne.exports}var qe,We={exports:{}},Ye={exports:{}},Ve={exports:{}},He=Ve.exports;function Ke(){return qe||(qe=1,function(){Ve.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(He)),Ve.exports}var Xe,Qe={exports:{}},Ze=Qe.exports;function Je(){return Xe||(Xe=1,function(){var t;t=Ke(),mi(),Qe.exports=function(){function n(n,e,r){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),null==e)throw new Error("Missing attribute name. "+this.debugInfo(e));this.name=this.stringify.name(e),this.value=this.stringify.attValue(r),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(t){return this.options.writer.attribute(this,this.options.writer.filterOptions(t))},n.prototype.debugInfo=function(t){return null==(t=t||this.name)?"parent: <"+this.parent.name+">":"attribute: {"+t+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(t){return t.namespaceURI===this.namespaceURI&&t.prefix===this.prefix&&t.localName===this.localName&&t.value===this.value},n}()}.call(Ze)),Qe.exports}var tr,nr={exports:{}},er=nr.exports;function rr(){return tr||(tr=1,function(){nr.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(t){return this.nodes[t]},t.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},t.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},t.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},t.prototype.getNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t}()}.call(er)),nr.exports}var ir,or=Ye.exports;function sr(){return ir||(ir=1,function(){var t,n,e,r,i,o,s,u,a={}.hasOwnProperty;u=Te(),s=u.isObject,o=u.isFunction,i=u.getValue,r=mi(),t=Ke(),n=Je(),e=rr(),Ye.exports=function(r){function u(n,e,r){var i,o,s,a;if(u.__super__.constructor.call(this,n),null==e)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(e),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,null!=r&&this.attribute(r),n.type===t.Document&&(this.isRoot=!0,this.documentObject=n,n.rootObject=this,n.children))for(o=0,s=(a=n.children).length;o<s;o++)if((i=a[o]).type===t.DocType){i.name=this.name;break}}return function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(u,r),Object.defineProperty(u.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(u.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(u.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(u.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(u.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(u.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(u.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(u.prototype,"attributes",{get:function(){return this.attributeMap&&this.attributeMap.nodes||(this.attributeMap=new e(this.attribs)),this.attributeMap}}),u.prototype.clone=function(){var t,n,e;for(t in(n=Object.create(this)).isRoot&&(n.documentObject=null),n.attribs={},e=this.attribs)a.call(e,t)&&(n.attribs[t]=e[t].clone());return n.children=[],this.children.forEach((function(t){var e;return(e=t.clone()).parent=n,n.children.push(e)})),n},u.prototype.attribute=function(t,e){var r;if(null!=t&&(t=i(t)),s(t))for(r in t)a.call(t,r)&&this.attribute(r,t[r]);else o(e)&&(e=e.apply()),this.options.keepNullAttributes&&null==e?this.attribs[t]=new n(this,t,""):null!=e&&(this.attribs[t]=new n(this,t,e));return this},u.prototype.removeAttribute=function(t){var n,e;if(null==t)throw new Error("Missing attribute name. "+this.debugInfo());if(t=i(t),Array.isArray(t))for(n=0,e=t.length;n<e;n++)delete this.attribs[t[n]];else delete this.attribs[t];return this},u.prototype.toString=function(t){return this.options.writer.element(this,this.options.writer.filterOptions(t))},u.prototype.att=function(t,n){return this.attribute(t,n)},u.prototype.a=function(t,n){return this.attribute(t,n)},u.prototype.getAttribute=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t].value:null},u.prototype.setAttribute=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getAttributeNode=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t]:null},u.prototype.setAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.removeAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.setAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.removeAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getAttributeNodeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.setAttributeNodeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.hasAttribute=function(t){return this.attribs.hasOwnProperty(t)},u.prototype.hasAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.setIdAttribute=function(t,n){return this.attribs.hasOwnProperty(t)?this.attribs[t].isId:n},u.prototype.setIdAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.setIdAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByClassName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.isEqualNode=function(t){var n,e,r;if(!u.__super__.isEqualNode.apply(this,arguments).isEqualNode(t))return!1;if(t.namespaceURI!==this.namespaceURI)return!1;if(t.prefix!==this.prefix)return!1;if(t.localName!==this.localName)return!1;if(t.attribs.length!==this.attribs.length)return!1;for(n=e=0,r=this.attribs.length-1;0<=r?e<=r:e>=r;n=0<=r?++e:--e)if(!this.attribs[n].isEqualNode(t.attribs[n]))return!1;return!0},u}(r)}.call(or)),Ye.exports}var ur,ar={exports:{}},cr={exports:{}},lr=cr.exports;function hr(){return ur||(ur=1,function(){var t,n={}.hasOwnProperty;t=mi(),cr.exports=function(t){function e(t){e.__super__.constructor.call(this,t),this.value=""}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(e.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),e.prototype.clone=function(){return Object.create(this)},e.prototype.substringData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.insertData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.deleteData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.replaceData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(t){return!!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.data===this.data},e}(t)}.call(lr)),cr.exports}var fr,pr=ar.exports;function dr(){return fr||(fr=1,function(){var t,n,e={}.hasOwnProperty;t=Ke(),n=hr(),ar.exports=function(n){function r(n,e){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(e)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},r}(n)}.call(pr)),ar.exports}var mr,yr={exports:{}},vr=yr.exports;function br(){return mr||(mr=1,function(){var t,n,e={}.hasOwnProperty;t=Ke(),n=hr(),yr.exports=function(n){function r(n,e){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(e)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},r}(n)}.call(vr)),yr.exports}var gr,wr={exports:{}},xr=wr.exports;function Er(){return gr||(gr=1,function(){var t,n,e,r={}.hasOwnProperty;e=Te().isObject,n=mi(),t=Ke(),wr.exports=function(n){function i(n,r,o,s){var u;i.__super__.constructor.call(this,n),e(r)&&(r=(u=r).version,o=u.encoding,s=u.standalone),r||(r="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(r),null!=o&&(this.encoding=this.stringify.xmlEncoding(o)),null!=s&&(this.standalone=this.stringify.xmlStandalone(s))}return function(t,n){for(var e in n)r.call(n,e)&&(t[e]=n[e]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(i,n),i.prototype.toString=function(t){return this.options.writer.declaration(this,this.options.writer.filterOptions(t))},i}(n)}.call(xr)),wr.exports}var Sr,Or={exports:{}},Fr={exports:{}},Tr=Fr.exports;function Mr(){return Sr||(Sr=1,function(){var t,n,e={}.hasOwnProperty;n=mi(),t=Ke(),Fr.exports=function(n){function r(n,e,i,o,s,u){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==i)throw new Error("Missing DTD attribute name. "+this.debugInfo(e));if(!o)throw new Error("Missing DTD attribute type. "+this.debugInfo(e));if(!s)throw new Error("Missing DTD attribute default. "+this.debugInfo(e));if(0!==s.indexOf("#")&&(s="#"+s),!s.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(e));if(u&&!s.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(e));this.elementName=this.stringify.name(e),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(i),this.attributeType=this.stringify.dtdAttType(o),u&&(this.defaultValue=this.stringify.dtdAttDefault(u)),this.defaultValueType=s}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.toString=function(t){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(t))},r}(n)}.call(Tr)),Fr.exports}var kr,Ir={exports:{}},_r=Ir.exports;function Ar(){return kr||(kr=1,function(){var t,n,e,r={}.hasOwnProperty;e=Te().isObject,n=mi(),t=Ke(),Ir.exports=function(n){function i(n,r,o,s){if(i.__super__.constructor.call(this,n),null==o)throw new Error("Missing DTD entity name. "+this.debugInfo(o));if(null==s)throw new Error("Missing DTD entity value. "+this.debugInfo(o));if(this.pe=!!r,this.name=this.stringify.name(o),this.type=t.EntityDeclaration,e(s)){if(!s.pubID&&!s.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(o));if(s.pubID&&!s.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(o));if(this.internal=!1,null!=s.pubID&&(this.pubID=this.stringify.dtdPubID(s.pubID)),null!=s.sysID&&(this.sysID=this.stringify.dtdSysID(s.sysID)),null!=s.nData&&(this.nData=this.stringify.dtdNData(s.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(o))}else this.value=this.stringify.dtdEntityValue(s),this.internal=!0}return function(t,n){for(var e in n)r.call(n,e)&&(t[e]=n[e]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(i,n),Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(i.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(i.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlVersion",{get:function(){return null}}),i.prototype.toString=function(t){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(t))},i}(n)}.call(_r)),Ir.exports}var Cr,Nr={exports:{}},Dr=Nr.exports;function jr(){return Cr||(Cr=1,function(){var t,n,e={}.hasOwnProperty;n=mi(),t=Ke(),Nr.exports=function(n){function r(n,e,i){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing DTD element name. "+this.debugInfo());i||(i="(#PCDATA)"),Array.isArray(i)&&(i="("+i.join(",")+")"),this.name=this.stringify.name(e),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(i)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.toString=function(t){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(t))},r}(n)}.call(Dr)),Nr.exports}var Pr,Lr={exports:{}},Rr=Lr.exports;function $r(){return Pr||(Pr=1,function(){var t,n,e={}.hasOwnProperty;n=mi(),t=Ke(),Lr.exports=function(n){function r(n,e,i){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing DTD notation name. "+this.debugInfo(e));if(!i.pubID&&!i.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(e));this.name=this.stringify.name(e),this.type=t.NotationDeclaration,null!=i.pubID&&(this.pubID=this.stringify.dtdPubID(i.pubID)),null!=i.sysID&&(this.sysID=this.stringify.dtdSysID(i.sysID))}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),r.prototype.toString=function(t){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(t))},r}(n)}.call(Rr)),Lr.exports}var zr,Ur=Or.exports;function Gr(){return zr||(zr=1,function(){var t,n,e,r,i,o,s,u,a={}.hasOwnProperty;u=Te().isObject,s=mi(),t=Ke(),n=Mr(),r=Ar(),e=jr(),i=$r(),o=rr(),Or.exports=function(s){function c(n,e,r){var i,o,s,a,l,h;if(c.__super__.constructor.call(this,n),this.type=t.DocType,n.children)for(o=0,s=(a=n.children).length;o<s;o++)if((i=a[o]).type===t.Element){this.name=i.name;break}this.documentObject=n,u(e)&&(e=(l=e).pubID,r=l.sysID),null==r&&(r=(h=[e,r])[0],e=h[1]),null!=e&&(this.pubID=this.stringify.dtdPubID(e)),null!=r&&(this.sysID=this.stringify.dtdSysID(r))}return function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(c,s),Object.defineProperty(c.prototype,"entities",{get:function(){var n,e,r,i,s;for(i={},e=0,r=(s=this.children).length;e<r;e++)(n=s[e]).type!==t.EntityDeclaration||n.pe||(i[n.name]=n);return new o(i)}}),Object.defineProperty(c.prototype,"notations",{get:function(){var n,e,r,i,s;for(i={},e=0,r=(s=this.children).length;e<r;e++)(n=s[e]).type===t.NotationDeclaration&&(i[n.name]=n);return new o(i)}}),Object.defineProperty(c.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(c.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(c.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),c.prototype.element=function(t,n){var r;return r=new e(this,t,n),this.children.push(r),this},c.prototype.attList=function(t,e,r,i,o){var s;return s=new n(this,t,e,r,i,o),this.children.push(s),this},c.prototype.entity=function(t,n){var e;return e=new r(this,!1,t,n),this.children.push(e),this},c.prototype.pEntity=function(t,n){var e;return e=new r(this,!0,t,n),this.children.push(e),this},c.prototype.notation=function(t,n){var e;return e=new i(this,t,n),this.children.push(e),this},c.prototype.toString=function(t){return this.options.writer.docType(this,this.options.writer.filterOptions(t))},c.prototype.ele=function(t,n){return this.element(t,n)},c.prototype.att=function(t,n,e,r,i){return this.attList(t,n,e,r,i)},c.prototype.ent=function(t,n){return this.entity(t,n)},c.prototype.pent=function(t,n){return this.pEntity(t,n)},c.prototype.not=function(t,n){return this.notation(t,n)},c.prototype.up=function(){return this.root()||this.documentObject},c.prototype.isEqualNode=function(t){return!!c.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.name===this.name&&t.publicId===this.publicId&&t.systemId===this.systemId},c}(s)}.call(Ur)),Or.exports}var Br,qr={exports:{}},Wr=qr.exports;function Yr(){return Br||(Br=1,function(){var t,n,e={}.hasOwnProperty;t=Ke(),n=mi(),qr.exports=function(n){function r(n,e){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(e)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.raw(this,this.options.writer.filterOptions(t))},r}(n)}.call(Wr)),qr.exports}var Vr,Hr={exports:{}},Kr=Hr.exports;function Xr(){return Vr||(Vr=1,function(){var t,n,e={}.hasOwnProperty;t=Ke(),n=hr(),Hr.exports=function(n){function r(n,e){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(e)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),Object.defineProperty(r.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(r.prototype,"wholeText",{get:function(){var t,n,e;for(e="",n=this.previousSibling;n;)e=n.data+e,n=n.previousSibling;for(e+=this.data,t=this.nextSibling;t;)e+=t.data,t=t.nextSibling;return e}}),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.text(this,this.options.writer.filterOptions(t))},r.prototype.splitText=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},r.prototype.replaceWholeText=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},r}(n)}.call(Kr)),Hr.exports}var Qr,Zr={exports:{}},Jr=Zr.exports;function ti(){return Qr||(Qr=1,function(){var t,n,e={}.hasOwnProperty;t=Ke(),n=hr(),Zr.exports=function(n){function r(n,e,i){if(r.__super__.constructor.call(this,n),null==e)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(e),this.name=this.target,i&&(this.value=this.stringify.insValue(i))}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(t))},r.prototype.isEqualNode=function(t){return!!r.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.target===this.target},r}(n)}.call(Jr)),Zr.exports}var ni,ei={exports:{}},ri=ei.exports;function ii(){return ni||(ni=1,function(){var t,n,e={}.hasOwnProperty;n=mi(),t=Ke(),ei.exports=function(n){function r(n){r.__super__.constructor.call(this,n),this.type=t.Dummy}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(r,n),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(){return""},r}(n)}.call(ri)),ei.exports}var oi,si={exports:{}},ui=si.exports;function ai(){return oi||(oi=1,function(){si.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(t){return this.nodes[t]||null},t}()}.call(ui)),si.exports}var ci,li={exports:{}},hi=li.exports;function fi(){return ci||(ci=1,function(){li.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(hi)),li.exports}var pi,di=We.exports;function mi(){return pi||(pi=1,function(){var t,n,e,r,i,o,s,u,a,c,l,h,f,p,d,m,y,v={}.hasOwnProperty;y=Te(),m=y.isObject,d=y.isFunction,p=y.isEmpty,f=y.getValue,u=null,e=null,r=null,i=null,o=null,l=null,h=null,c=null,s=null,n=null,a=null,t=null,We.exports=function(){function y(f){this.parent=f,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=sr(),e=dr(),r=br(),i=Er(),o=Gr(),l=Yr(),h=Xr(),c=ti(),s=ii(),n=Ke(),a=ai(),rr(),t=fi())}return Object.defineProperty(y.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(y.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(y.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(y.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(y.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new a(this.children)),this.childNodeList}}),Object.defineProperty(y.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(y.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(y.prototype,"previousSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t-1]||null}}),Object.defineProperty(y.prototype,"nextSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t+1]||null}}),Object.defineProperty(y.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(y.prototype,"textContent",{get:function(){var t,e,r,i,o;if(this.nodeType===n.Element||this.nodeType===n.DocumentFragment){for(o="",e=0,r=(i=this.children).length;e<r;e++)(t=i[e]).textContent&&(o+=t.textContent);return o}return null},set:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),y.prototype.setParent=function(t){var n,e,r,i;for(this.parent=t,t&&(this.options=t.options,this.stringify=t.stringify),i=[],n=0,e=(r=this.children).length;n<e;n++)i.push(r[n].setParent(this));return i},y.prototype.element=function(t,n,e){var r,i,o,s,u,a,c,l,h,y;if(u=null,null===n&&null==e&&(n=(l=[{},null])[0],e=l[1]),null==n&&(n={}),n=f(n),m(n)||(e=(h=[n,e])[0],n=h[1]),null!=t&&(t=f(t)),Array.isArray(t))for(i=0,a=t.length;i<a;i++)u=this.element(t[i]);else if(d(t))u=this.element(t.apply());else if(m(t)){for(s in t)if(v.call(t,s))if(d(y=t[s])&&(y=y.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===s.indexOf(this.stringify.convertAttKey))u=this.attribute(s.substr(this.stringify.convertAttKey.length),y);else if(!this.options.separateArrayItems&&Array.isArray(y)&&p(y))u=this.dummy();else if(m(y)&&p(y))u=this.element(s);else if(this.options.keepNullNodes||null!=y)if(!this.options.separateArrayItems&&Array.isArray(y))for(o=0,c=y.length;o<c;o++)(r={})[s]=y[o],u=this.element(r);else m(y)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===s.indexOf(this.stringify.convertTextKey)?u=this.element(y):(u=this.element(s)).element(y):u=this.element(s,y);else u=this.dummy()}else u=this.options.keepNullNodes||null!==e?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===t.indexOf(this.stringify.convertTextKey)?this.text(e):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===t.indexOf(this.stringify.convertCDataKey)?this.cdata(e):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===t.indexOf(this.stringify.convertCommentKey)?this.comment(e):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===t.indexOf(this.stringify.convertRawKey)?this.raw(e):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===t.indexOf(this.stringify.convertPIKey)?this.instruction(t.substr(this.stringify.convertPIKey.length),e):this.node(t,n,e):this.dummy();if(null==u)throw new Error("Could not create any elements with: "+t+". "+this.debugInfo());return u},y.prototype.insertBefore=function(t,n,e){var r,i,o,s,u;if(null!=t?t.type:void 0)return s=n,(o=t).setParent(this),s?(i=children.indexOf(s),u=children.splice(i),children.push(o),Array.prototype.push.apply(children,u)):children.push(o),o;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return i=this.parent.children.indexOf(this),u=this.parent.children.splice(i),r=this.parent.element(t,n,e),Array.prototype.push.apply(this.parent.children,u),r},y.prototype.insertAfter=function(t,n,e){var r,i,o;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return i=this.parent.children.indexOf(this),o=this.parent.children.splice(i+1),r=this.parent.element(t,n,e),Array.prototype.push.apply(this.parent.children,o),r},y.prototype.remove=function(){var t;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return t=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[t,t-t+1].concat([])),this.parent},y.prototype.node=function(t,n,e){var r,i;return null!=t&&(t=f(t)),n||(n={}),n=f(n),m(n)||(e=(i=[n,e])[0],n=i[1]),r=new u(this,t,n),null!=e&&r.text(e),this.children.push(r),r},y.prototype.text=function(t){var n;return m(t)&&this.element(t),n=new h(this,t),this.children.push(n),this},y.prototype.cdata=function(t){var n;return n=new e(this,t),this.children.push(n),this},y.prototype.comment=function(t){var n;return n=new r(this,t),this.children.push(n),this},y.prototype.commentBefore=function(t){var n,e;return n=this.parent.children.indexOf(this),e=this.parent.children.splice(n),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,e),this},y.prototype.commentAfter=function(t){var n,e;return n=this.parent.children.indexOf(this),e=this.parent.children.splice(n+1),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,e),this},y.prototype.raw=function(t){var n;return n=new l(this,t),this.children.push(n),this},y.prototype.dummy=function(){return new s(this)},y.prototype.instruction=function(t,n){var e,r,i,o;if(null!=t&&(t=f(t)),null!=n&&(n=f(n)),Array.isArray(t))for(i=0,o=t.length;i<o;i++)this.instruction(e=t[i]);else if(m(t))for(e in t)v.call(t,e)&&this.instruction(e,t[e]);else d(n)&&(n=n.apply()),r=new c(this,t,n),this.children.push(r);return this},y.prototype.instructionBefore=function(t,n){var e,r;return e=this.parent.children.indexOf(this),r=this.parent.children.splice(e),this.parent.instruction(t,n),Array.prototype.push.apply(this.parent.children,r),this},y.prototype.instructionAfter=function(t,n){var e,r;return e=this.parent.children.indexOf(this),r=this.parent.children.splice(e+1),this.parent.instruction(t,n),Array.prototype.push.apply(this.parent.children,r),this},y.prototype.declaration=function(t,e,r){var o,s;return o=this.document(),s=new i(o,t,e,r),0===o.children.length?o.children.unshift(s):o.children[0].type===n.Declaration?o.children[0]=s:o.children.unshift(s),o.root()||o},y.prototype.dtd=function(t,e){var r,i,s,u,a,c,l,h,f;for(r=this.document(),i=new o(r,t,e),s=u=0,c=(h=r.children).length;u<c;s=++u)if(h[s].type===n.DocType)return r.children[s]=i,i;for(s=a=0,l=(f=r.children).length;a<l;s=++a)if(f[s].isRoot)return r.children.splice(s,0,i),i;return r.children.push(i),i},y.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},y.prototype.root=function(){var t;for(t=this;t;){if(t.type===n.Document)return t.rootObject;if(t.isRoot)return t;t=t.parent}},y.prototype.document=function(){var t;for(t=this;t;){if(t.type===n.Document)return t;t=t.parent}},y.prototype.end=function(t){return this.document().end(t)},y.prototype.prev=function(){var t;if((t=this.parent.children.indexOf(this))<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[t-1]},y.prototype.next=function(){var t;if(-1===(t=this.parent.children.indexOf(this))||t===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[t+1]},y.prototype.importDocument=function(t){var n;return(n=t.root().clone()).parent=this,n.isRoot=!1,this.children.push(n),this},y.prototype.debugInfo=function(t){var n,e;return null!=(t=t||this.name)||(null!=(n=this.parent)?n.name:void 0)?null==t?"parent: <"+this.parent.name+">":(null!=(e=this.parent)?e.name:void 0)?"node: <"+t+">, parent: <"+this.parent.name+">":"node: <"+t+">":""},y.prototype.ele=function(t,n,e){return this.element(t,n,e)},y.prototype.nod=function(t,n,e){return this.node(t,n,e)},y.prototype.txt=function(t){return this.text(t)},y.prototype.dat=function(t){return this.cdata(t)},y.prototype.com=function(t){return this.comment(t)},y.prototype.ins=function(t,n){return this.instruction(t,n)},y.prototype.doc=function(){return this.document()},y.prototype.dec=function(t,n,e){return this.declaration(t,n,e)},y.prototype.e=function(t,n,e){return this.element(t,n,e)},y.prototype.n=function(t,n,e){return this.node(t,n,e)},y.prototype.t=function(t){return this.text(t)},y.prototype.d=function(t){return this.cdata(t)},y.prototype.c=function(t){return this.comment(t)},y.prototype.r=function(t){return this.raw(t)},y.prototype.i=function(t,n){return this.instruction(t,n)},y.prototype.u=function(){return this.up()},y.prototype.importXMLBuilder=function(t){return this.importDocument(t)},y.prototype.replaceChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.appendChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.hasChildNodes=function(){return 0!==this.children.length},y.prototype.cloneNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isSupported=function(){return!0},y.prototype.hasAttributes=function(){return 0!==this.attribs.length},y.prototype.compareDocumentPosition=function(n){var e,r;return(e=this)===n?0:this.document()!==n.document()?(r=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?r|=t.Preceding:r|=t.Following,r):e.isAncestor(n)?t.Contains|t.Preceding:e.isDescendant(n)?t.Contains|t.Following:e.isPreceding(n)?t.Preceding:t.Following},y.prototype.isSameNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupPrefix=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isDefaultNamespace=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupNamespaceURI=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isEqualNode=function(t){var n,e,r;if(t.nodeType!==this.nodeType)return!1;if(t.children.length!==this.children.length)return!1;for(n=e=0,r=this.children.length-1;0<=r?e<=r:e>=r;n=0<=r?++e:--e)if(!this.children[n].isEqualNode(t.children[n]))return!1;return!0},y.prototype.getFeature=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setUserData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getUserData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.contains=function(t){return!!t&&(t===this||this.isDescendant(t))},y.prototype.isDescendant=function(t){var n,e,r,i;for(e=0,r=(i=this.children).length;e<r;e++){if(t===(n=i[e]))return!0;if(n.isDescendant(t))return!0}return!1},y.prototype.isAncestor=function(t){return t.isDescendant(this)},y.prototype.isPreceding=function(t){var n,e;return n=this.treePosition(t),e=this.treePosition(this),-1!==n&&-1!==e&&n<e},y.prototype.isFollowing=function(t){var n,e;return n=this.treePosition(t),e=this.treePosition(this),-1!==n&&-1!==e&&n>e},y.prototype.treePosition=function(t){var n,e;return e=0,n=!1,this.foreachTreeNode(this.document(),(function(r){if(e++,!n&&r===t)return n=!0})),n?e:-1},y.prototype.foreachTreeNode=function(t,n){var e,r,i,o,s;for(t||(t=this.document()),r=0,i=(o=t.children).length;r<i;r++){if(s=n(e=o[r]))return s;if(s=this.foreachTreeNode(e,n))return s}},y}()}.call(di)),We.exports}var yi,vi={exports:{}},bi=vi.exports;function gi(){return yi||(yi=1,function(){var t=function(t,n){return function(){return t.apply(n,arguments)}},n={}.hasOwnProperty;vi.exports=function(){function e(e){var r,i;for(r in this.assertLegalName=t(this.assertLegalName,this),this.assertLegalChar=t(this.assertLegalChar,this),e||(e={}),this.options=e,this.options.version||(this.options.version="1.0"),i=e.stringify||{})n.call(i,r)&&(this[r]=i[r])}return e.prototype.name=function(t){return this.options.noValidation?t:this.assertLegalName(""+t||"")},e.prototype.text=function(t){return this.options.noValidation?t:this.assertLegalChar(this.textEscape(""+t||""))},e.prototype.cdata=function(t){return this.options.noValidation?t:(t=(t=""+t||"").replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(t))},e.prototype.comment=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+t);return this.assertLegalChar(t)},e.prototype.raw=function(t){return this.options.noValidation?t:""+t||""},e.prototype.attValue=function(t){return this.options.noValidation?t:this.assertLegalChar(this.attEscape(t=""+t||""))},e.prototype.insTarget=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.insValue=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+t);return this.assertLegalChar(t)},e.prototype.xmlVersion=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+t);return t},e.prototype.xmlEncoding=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+t);return this.assertLegalChar(t)},e.prototype.xmlStandalone=function(t){return this.options.noValidation?t:t?"yes":"no"},e.prototype.dtdPubID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdSysID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdElementValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdAttType=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdAttDefault=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdEntityValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdNData=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(t){var n;if(this.options.noValidation)return t;if("1.0"===this.options.version){if(n=t.match(/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/))throw new Error("Invalid character in string: "+t+" at index "+n.index)}else if("1.1"===this.options.version&&(n=t.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/)))throw new Error("Invalid character in string: "+t+" at index "+n.index);return t},e.prototype.assertLegalName=function(t){if(this.options.noValidation)return t;if(this.assertLegalChar(t),!t.match(/^([: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])*$/))throw new Error("Invalid character in name");return t},e.prototype.textEscape=function(t){return this.options.noValidation?t:t.replace(this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")},e.prototype.attEscape=function(t){return this.options.noValidation?t:t.replace(this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")},e}()}.call(bi)),vi.exports}var wi,xi={exports:{}},Ei={exports:{}},Si={exports:{}},Oi=Si.exports;function Fi(){return wi||(wi=1,function(){Si.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(Oi)),Si.exports}var Ti,Mi=Ei.exports;function ki(){return Ti||(Ti=1,function(){var t,n,e,r={}.hasOwnProperty;e=Te().assign,t=Ke(),Er(),Gr(),dr(),br(),sr(),Yr(),Xr(),ti(),ii(),Mr(),jr(),Ar(),$r(),n=Fi(),Ei.exports=function(){function i(t){var n,e,i;for(n in t||(t={}),this.options=t,e=t.writer||{})r.call(e,n)&&(i=e[n],this["_"+n]=this[n],this[n]=i)}return i.prototype.filterOptions=function(t){var r,i,o,s,u,a,c,l;return t||(t={}),t=e({},this.options,t),(r={writer:this}).pretty=t.pretty||!1,r.allowEmpty=t.allowEmpty||!1,r.indent=null!=(i=t.indent)?i:" ",r.newline=null!=(o=t.newline)?o:"\n",r.offset=null!=(s=t.offset)?s:0,r.dontPrettyTextNodes=null!=(u=null!=(a=t.dontPrettyTextNodes)?a:t.dontprettytextnodes)?u:0,r.spaceBeforeSlash=null!=(c=null!=(l=t.spaceBeforeSlash)?l:t.spacebeforeslash)?c:"",!0===r.spaceBeforeSlash&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=n.None,r},i.prototype.indent=function(t,n,e){var r;return!n.pretty||n.suppressPrettyCount?"":n.pretty&&(r=(e||0)+n.offset+1)>0?new Array(r).join(n.indent):""},i.prototype.endline=function(t,n){return!n.pretty||n.suppressPrettyCount?"":n.newline},i.prototype.attribute=function(t,n,e){var r;return this.openAttribute(t,n,e),r=" "+t.name+'="'+t.value+'"',this.closeAttribute(t,n,e),r},i.prototype.cdata=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<![CDATA[",e.state=n.InsideTag,i+=t.value,e.state=n.CloseTag,i+="]]>"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.comment=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"\x3c!-- ",e.state=n.InsideTag,i+=t.value,e.state=n.CloseTag,i+=" --\x3e"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.declaration=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<?xml",e.state=n.InsideTag,i+=' version="'+t.version+'"',null!=t.encoding&&(i+=' encoding="'+t.encoding+'"'),null!=t.standalone&&(i+=' standalone="'+t.standalone+'"'),e.state=n.CloseTag,i+=e.spaceBeforeSlash+"?>",i+=this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.docType=function(t,e,r){var i,o,s,u;if(r||(r=0),this.openNode(t,e,r),e.state=n.OpenTag,s=this.indent(t,e,r),s+="<!DOCTYPE "+t.root().name,t.pubID&&t.sysID?s+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(s+=' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(s+=" [",s+=this.endline(t,e,r),e.state=n.InsideTag,i=0,o=(u=t.children).length;i<o;i++)s+=this.writeChildNode(u[i],e,r+1);e.state=n.CloseTag,s+="]"}return e.state=n.CloseTag,s+=e.spaceBeforeSlash+">",s+=this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),s},i.prototype.element=function(e,i,o){var s,u,a,c,l,h,f,p,d,m,y,v,b;for(p in o||(o=0),d=!1,m="",this.openNode(e,i,o),i.state=n.OpenTag,m+=this.indent(e,i,o)+"<"+e.name,y=e.attribs)r.call(y,p)&&(m+=this.attribute(y[p],i,o));if(a=0===(u=e.children.length)?null:e.children[0],0===u||e.children.every((function(n){return(n.type===t.Text||n.type===t.Raw)&&""===n.value})))i.allowEmpty?(m+=">",i.state=n.CloseTag,m+="</"+e.name+">"+this.endline(e,i,o)):(i.state=n.CloseTag,m+=i.spaceBeforeSlash+"/>"+this.endline(e,i,o));else if(!i.pretty||1!==u||a.type!==t.Text&&a.type!==t.Raw||null==a.value){if(i.dontPrettyTextNodes)for(c=0,h=(v=e.children).length;c<h;c++)if(((s=v[c]).type===t.Text||s.type===t.Raw)&&null!=s.value){i.suppressPrettyCount++,d=!0;break}for(m+=">"+this.endline(e,i,o),i.state=n.InsideTag,l=0,f=(b=e.children).length;l<f;l++)m+=this.writeChildNode(s=b[l],i,o+1);i.state=n.CloseTag,m+=this.indent(e,i,o)+"</"+e.name+">",d&&i.suppressPrettyCount--,m+=this.endline(e,i,o),i.state=n.None}else m+=">",i.state=n.InsideTag,i.suppressPrettyCount++,d=!0,m+=this.writeChildNode(a,i,o+1),i.suppressPrettyCount--,d=!1,i.state=n.CloseTag,m+="</"+e.name+">"+this.endline(e,i,o);return this.closeNode(e,i,o),m},i.prototype.writeChildNode=function(n,e,r){switch(n.type){case t.CData:return this.cdata(n,e,r);case t.Comment:return this.comment(n,e,r);case t.Element:return this.element(n,e,r);case t.Raw:return this.raw(n,e,r);case t.Text:return this.text(n,e,r);case t.ProcessingInstruction:return this.processingInstruction(n,e,r);case t.Dummy:return"";case t.Declaration:return this.declaration(n,e,r);case t.DocType:return this.docType(n,e,r);case t.AttributeDeclaration:return this.dtdAttList(n,e,r);case t.ElementDeclaration:return this.dtdElement(n,e,r);case t.EntityDeclaration:return this.dtdEntity(n,e,r);case t.NotationDeclaration:return this.dtdNotation(n,e,r);default:throw new Error("Unknown XML node type: "+n.constructor.name)}},i.prototype.processingInstruction=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<?",e.state=n.InsideTag,i+=t.target,t.value&&(i+=" "+t.value),e.state=n.CloseTag,i+=e.spaceBeforeSlash+"?>",i+=this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.raw=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r),e.state=n.InsideTag,i+=t.value,e.state=n.CloseTag,i+=this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.text=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r),e.state=n.InsideTag,i+=t.value,e.state=n.CloseTag,i+=this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.dtdAttList=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<!ATTLIST",e.state=n.InsideTag,i+=" "+t.elementName+" "+t.attributeName+" "+t.attributeType,"#DEFAULT"!==t.defaultValueType&&(i+=" "+t.defaultValueType),t.defaultValue&&(i+=' "'+t.defaultValue+'"'),e.state=n.CloseTag,i+=e.spaceBeforeSlash+">"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.dtdElement=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<!ELEMENT",e.state=n.InsideTag,i+=" "+t.name+" "+t.value,e.state=n.CloseTag,i+=e.spaceBeforeSlash+">"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.dtdEntity=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<!ENTITY",e.state=n.InsideTag,t.pe&&(i+=" %"),i+=" "+t.name,t.value?i+=' "'+t.value+'"':(t.pubID&&t.sysID?i+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(i+=' SYSTEM "'+t.sysID+'"'),t.nData&&(i+=" NDATA "+t.nData)),e.state=n.CloseTag,i+=e.spaceBeforeSlash+">"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.dtdNotation=function(t,e,r){var i;return this.openNode(t,e,r),e.state=n.OpenTag,i=this.indent(t,e,r)+"<!NOTATION",e.state=n.InsideTag,i+=" "+t.name,t.pubID&&t.sysID?i+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.pubID?i+=' PUBLIC "'+t.pubID+'"':t.sysID&&(i+=' SYSTEM "'+t.sysID+'"'),e.state=n.CloseTag,i+=e.spaceBeforeSlash+">"+this.endline(t,e,r),e.state=n.None,this.closeNode(t,e,r),i},i.prototype.openNode=function(){},i.prototype.closeNode=function(){},i.prototype.openAttribute=function(){},i.prototype.closeAttribute=function(){},i}()}.call(Mi)),Ei.exports}var Ii,_i=xi.exports;function Ai(){return Ii||(Ii=1,function(){var t,n={}.hasOwnProperty;t=ki(),xi.exports=function(t){function e(t){e.__super__.constructor.call(this,t)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(e,t),e.prototype.document=function(t,n){var e,r,i,o;for(n=this.filterOptions(n),i="",e=0,r=(o=t.children).length;e<r;e++)i+=this.writeChildNode(o[e],n,0);return n.pretty&&i.slice(-n.newline.length)===n.newline&&(i=i.slice(0,-n.newline.length)),i},e}(t)}.call(_i)),xi.exports}var Ci,Ni=Ce.exports;function Di(){return Ci||(Ci=1,function(){var t,n,e,r,i,o,s,u={}.hasOwnProperty;s=Te().isPlainObject,e=_e(),n=Be(),r=mi(),t=Ke(),o=gi(),i=Ai(),Ce.exports=function(r){function a(e){a.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new n,e||(e={}),e.writer||(e.writer=new i),this.options=e,this.stringify=new o(e)}return function(t,n){for(var e in n)u.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(a,r),Object.defineProperty(a.prototype,"implementation",{value:new e}),Object.defineProperty(a.prototype,"doctype",{get:function(){var n,e,r,i;for(e=0,r=(i=this.children).length;e<r;e++)if((n=i[e]).type===t.DocType)return n;return null}}),Object.defineProperty(a.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(a.prototype,"xmlStandalone",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration&&"yes"===this.children[0].standalone}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(a.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(a.prototype,"origin",{get:function(){return null}}),Object.defineProperty(a.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(a.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(a.prototype,"contentType",{get:function(){return null}}),a.prototype.end=function(t){var n;return n={},t?s(t)&&(n=t,t=this.options.writer):t=this.options.writer,t.document(this,t.filterOptions(n))},a.prototype.toString=function(t){return this.options.writer.document(this,this.options.writer.filterOptions(t))},a.prototype.createElement=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createTextNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createComment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createCDATASection=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createProcessingInstruction=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createAttribute=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createEntityReference=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.importNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createElementNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementById=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.adoptNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.renameNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByClassName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createEvent=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createNodeIterator=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.createTreeWalker=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a}(r)}.call(Ni)),Ce.exports}var ji,Pi={exports:{}},Li=Pi.exports;function Ri(){return ji||(ji=1,function(){var t,n,e,r,i,o,s,u,a,c,l,h,f,p,d,m,y,v,b,g,w,x,E,S={}.hasOwnProperty;E=Te(),w=E.isObject,g=E.isFunction,x=E.isPlainObject,b=E.getValue,t=Ke(),h=Di(),f=sr(),r=dr(),i=br(),d=Yr(),v=Xr(),p=ti(),c=Er(),l=Gr(),o=Mr(),u=Ar(),s=jr(),a=$r(),e=Je(),y=gi(),m=Ai(),n=Fi(),Pi.exports=function(){function E(n,e,r){var i;this.name="?xml",this.type=t.Document,n||(n={}),i={},n.writer?x(n.writer)&&(i=n.writer,n.writer=new m):n.writer=new m,this.options=n,this.writer=n.writer,this.writerOptions=this.writer.filterOptions(i),this.stringify=new y(n),this.onDataCallback=e||function(){},this.onEndCallback=r||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return E.prototype.createChildNode=function(n){var e,r,i,o,s,u,a;switch(n.type){case t.CData:this.cdata(n.value);break;case t.Comment:this.comment(n.value);break;case t.Element:for(e in r={},u=n.attribs)S.call(u,e)&&(r[e]=u[e].value);this.node(n.name,r);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(n.value);break;case t.Text:this.text(n.value);break;case t.ProcessingInstruction:this.instruction(n.target,n.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+n.constructor.name)}for(o=0,s=(a=n.children).length;o<s;o++)this.createChildNode(i=a[o]),i.type===t.Element&&this.up();return this},E.prototype.dummy=function(){return this},E.prototype.node=function(t,n,e){var r;if(null==t)throw new Error("Missing node name.");if(this.root&&-1===this.currentLevel)throw new Error("Document can only have one root node. "+this.debugInfo(t));return this.openCurrent(),t=b(t),null==n&&(n={}),n=b(n),w(n)||(e=(r=[n,e])[0],n=r[1]),this.currentNode=new f(this,t,n),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,null!=e&&this.text(e),this},E.prototype.element=function(n,e,r){var i,o,s,u,a,c;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(n)||w(n)||g(n))for(u=this.options.noValidation,this.options.noValidation=!0,(c=new h(this.options).element("TEMP_ROOT")).element(n),this.options.noValidation=u,o=0,s=(a=c.children).length;o<s;o++)this.createChildNode(i=a[o]),i.type===t.Element&&this.up();else this.node(n,e,r);return this},E.prototype.attribute=function(t,n){var r;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(t));if(null!=t&&(t=b(t)),w(t))for(r in t)S.call(t,r)&&this.attribute(r,t[r]);else g(n)&&(n=n.apply()),this.options.keepNullAttributes&&null==n?this.currentNode.attribs[t]=new e(this,t,""):null!=n&&(this.currentNode.attribs[t]=new e(this,t,n));return this},E.prototype.text=function(t){var n;return this.openCurrent(),n=new v(this,t),this.onData(this.writer.text(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.cdata=function(t){var n;return this.openCurrent(),n=new r(this,t),this.onData(this.writer.cdata(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.comment=function(t){var n;return this.openCurrent(),n=new i(this,t),this.onData(this.writer.comment(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.raw=function(t){var n;return this.openCurrent(),n=new d(this,t),this.onData(this.writer.raw(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.instruction=function(t,n){var e,r,i,o;if(this.openCurrent(),null!=t&&(t=b(t)),null!=n&&(n=b(n)),Array.isArray(t))for(e=0,i=t.length;e<i;e++)this.instruction(r=t[e]);else if(w(t))for(r in t)S.call(t,r)&&this.instruction(r,t[r]);else g(n)&&(n=n.apply()),o=new p(this,t,n),this.onData(this.writer.processingInstruction(o,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},E.prototype.declaration=function(t,n,e){var r;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return r=new c(this,t,n,e),this.onData(this.writer.declaration(r,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.doctype=function(t,n,e){if(this.openCurrent(),null==t)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,n,e),this.currentNode.rootNodeName=t,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},E.prototype.dtdElement=function(t,n){var e;return this.openCurrent(),e=new s(this,t,n),this.onData(this.writer.dtdElement(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.attList=function(t,n,e,r,i){var s;return this.openCurrent(),s=new o(this,t,n,e,r,i),this.onData(this.writer.dtdAttList(s,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.entity=function(t,n){var e;return this.openCurrent(),e=new u(this,!1,t,n),this.onData(this.writer.dtdEntity(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.pEntity=function(t,n){var e;return this.openCurrent(),e=new u(this,!0,t,n),this.onData(this.writer.dtdEntity(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.prototype.notation=function(t,n){var e;return this.openCurrent(),e=new a(this,t,n),this.onData(this.writer.dtdNotation(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},E.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},E.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},E.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},E.prototype.openNode=function(e){var r,i,o;if(!e.isOpen){if(this.root||0!==this.currentLevel||e.type!==t.Element||(this.root=e),r="",e.type===t.Element){for(i in this.writerOptions.state=n.OpenTag,r=this.writer.indent(e,this.writerOptions,this.currentLevel)+"<"+e.name,o=e.attribs)S.call(o,i)&&(r+=this.writer.attribute(o[i],this.writerOptions,this.currentLevel));r+=(e.children?">":"/>")+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=n.InsideTag}else this.writerOptions.state=n.OpenTag,r=this.writer.indent(e,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+e.rootNodeName,e.pubID&&e.sysID?r+=' PUBLIC "'+e.pubID+'" "'+e.sysID+'"':e.sysID&&(r+=' SYSTEM "'+e.sysID+'"'),e.children?(r+=" [",this.writerOptions.state=n.InsideTag):(this.writerOptions.state=n.CloseTag,r+=">"),r+=this.writer.endline(e,this.writerOptions,this.currentLevel);return this.onData(r,this.currentLevel),e.isOpen=!0}},E.prototype.closeNode=function(e){var r;if(!e.isClosed)return"",this.writerOptions.state=n.CloseTag,r=e.type===t.Element?this.writer.indent(e,this.writerOptions,this.currentLevel)+"</"+e.name+">"+this.writer.endline(e,this.writerOptions,this.currentLevel):this.writer.indent(e,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(e,this.writerOptions,this.currentLevel),this.writerOptions.state=n.None,this.onData(r,this.currentLevel),e.isClosed=!0},E.prototype.onData=function(t,n){return this.documentStarted=!0,this.onDataCallback(t,n+1)},E.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},E.prototype.debugInfo=function(t){return null==t?"":"node: <"+t+">"},E.prototype.ele=function(){return this.element.apply(this,arguments)},E.prototype.nod=function(t,n,e){return this.node(t,n,e)},E.prototype.txt=function(t){return this.text(t)},E.prototype.dat=function(t){return this.cdata(t)},E.prototype.com=function(t){return this.comment(t)},E.prototype.ins=function(t,n){return this.instruction(t,n)},E.prototype.dec=function(t,n,e){return this.declaration(t,n,e)},E.prototype.dtd=function(t,n,e){return this.doctype(t,n,e)},E.prototype.e=function(t,n,e){return this.element(t,n,e)},E.prototype.n=function(t,n,e){return this.node(t,n,e)},E.prototype.t=function(t){return this.text(t)},E.prototype.d=function(t){return this.cdata(t)},E.prototype.c=function(t){return this.comment(t)},E.prototype.r=function(t){return this.raw(t)},E.prototype.i=function(t,n){return this.instruction(t,n)},E.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},E.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},E.prototype.ent=function(t,n){return this.entity(t,n)},E.prototype.pent=function(t,n){return this.pEntity(t,n)},E.prototype.not=function(t,n){return this.notation(t,n)},E}()}.call(Li)),Pi.exports}var $i,zi,Ui,Gi={exports:{}},Bi=Gi.exports;function qi(){return $i||($i=1,function(){var t,n,e,r={}.hasOwnProperty;t=Ke(),e=ki(),n=Fi(),Gi.exports=function(e){function i(t,n){this.stream=t,i.__super__.constructor.call(this,n)}return function(t,n){for(var e in n)r.call(n,e)&&(t[e]=n[e]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(i,e),i.prototype.endline=function(t,e,r){return t.isLastRootNode&&e.state===n.CloseTag?"":i.__super__.endline.call(this,t,e,r)},i.prototype.document=function(t,n){var e,r,i,o,s,u,a,c;for(e=r=0,o=(u=t.children).length;r<o;e=++r)u[e].isLastRootNode=e===t.children.length-1;for(n=this.filterOptions(n),c=[],i=0,s=(a=t.children).length;i<s;i++)c.push(this.writeChildNode(a[i],n,0));return c},i.prototype.attribute=function(t,n,e){return this.stream.write(i.__super__.attribute.call(this,t,n,e))},i.prototype.cdata=function(t,n,e){return this.stream.write(i.__super__.cdata.call(this,t,n,e))},i.prototype.comment=function(t,n,e){return this.stream.write(i.__super__.comment.call(this,t,n,e))},i.prototype.declaration=function(t,n,e){return this.stream.write(i.__super__.declaration.call(this,t,n,e))},i.prototype.docType=function(t,e,r){var i,o,s;if(r||(r=0),this.openNode(t,e,r),e.state=n.OpenTag,this.stream.write(this.indent(t,e,r)),this.stream.write("<!DOCTYPE "+t.root().name),t.pubID&&t.sysID?this.stream.write(' PUBLIC "'+t.pubID+'" "'+t.sysID+'"'):t.sysID&&this.stream.write(' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(t,e,r)),e.state=n.InsideTag,i=0,o=(s=t.children).length;i<o;i++)this.writeChildNode(s[i],e,r+1);e.state=n.CloseTag,this.stream.write("]")}return e.state=n.CloseTag,this.stream.write(e.spaceBeforeSlash+">"),this.stream.write(this.endline(t,e,r)),e.state=n.None,this.closeNode(t,e,r)},i.prototype.element=function(e,i,o){var s,u,a,c,l,h,f;for(l in o||(o=0),this.openNode(e,i,o),i.state=n.OpenTag,this.stream.write(this.indent(e,i,o)+"<"+e.name),h=e.attribs)r.call(h,l)&&this.attribute(h[l],i,o);if(u=0===(s=e.children.length)?null:e.children[0],0===s||e.children.every((function(n){return(n.type===t.Text||n.type===t.Raw)&&""===n.value})))i.allowEmpty?(this.stream.write(">"),i.state=n.CloseTag,this.stream.write("</"+e.name+">")):(i.state=n.CloseTag,this.stream.write(i.spaceBeforeSlash+"/>"));else if(!i.pretty||1!==s||u.type!==t.Text&&u.type!==t.Raw||null==u.value){for(this.stream.write(">"+this.endline(e,i,o)),i.state=n.InsideTag,a=0,c=(f=e.children).length;a<c;a++)this.writeChildNode(f[a],i,o+1);i.state=n.CloseTag,this.stream.write(this.indent(e,i,o)+"</"+e.name+">")}else this.stream.write(">"),i.state=n.InsideTag,i.suppressPrettyCount++,this.writeChildNode(u,i,o+1),i.suppressPrettyCount--,i.state=n.CloseTag,this.stream.write("</"+e.name+">");return this.stream.write(this.endline(e,i,o)),i.state=n.None,this.closeNode(e,i,o)},i.prototype.processingInstruction=function(t,n,e){return this.stream.write(i.__super__.processingInstruction.call(this,t,n,e))},i.prototype.raw=function(t,n,e){return this.stream.write(i.__super__.raw.call(this,t,n,e))},i.prototype.text=function(t,n,e){return this.stream.write(i.__super__.text.call(this,t,n,e))},i.prototype.dtdAttList=function(t,n,e){return this.stream.write(i.__super__.dtdAttList.call(this,t,n,e))},i.prototype.dtdElement=function(t,n,e){return this.stream.write(i.__super__.dtdElement.call(this,t,n,e))},i.prototype.dtdEntity=function(t,n,e){return this.stream.write(i.__super__.dtdEntity.call(this,t,n,e))},i.prototype.dtdNotation=function(t,n,e){return this.stream.write(i.__super__.dtdNotation.call(this,t,n,e))},i}(e)}.call(Bi)),Gi.exports}function Wi(){return Ui||(Ui=1,function(){var t,n,e,r,i,o={}.hasOwnProperty;zi||(zi=1,function(){var t,n,e,r,i,o,s,u,a,c;c=Te(),u=c.assign,a=c.isFunction,e=_e(),r=Di(),i=Ri(),s=Ai(),o=qi(),t=Ke(),n=Fi(),Oe.create=function(t,n,e,i){var o,s;if(null==t)throw new Error("Root element needs a name.");return i=u({},n,e,i),s=(o=new r(i)).element(t),i.headless||(o.declaration(i),null==i.pubID&&null==i.sysID||o.dtd(i)),s},Oe.begin=function(t,n,e){var o;return a(t)&&(n=(o=[t,n])[0],e=o[1],t={}),n?new i(t,n,e):new r(t)},Oe.stringWriter=function(t){return new s(t)},Oe.streamWriter=function(t,n){return new o(t,n)},Oe.implementation=new e,Oe.nodeType=t,Oe.writerState=n}.call(Oe)),t=Oe,n=xe().defaults,r=function(t){return"string"==typeof t&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},i=function(t){return"<![CDATA["+e(t)+"]]>"},e=function(t){return t.replace("]]>","]]]]><![CDATA[>")},Se.Builder=function(){function e(t){var e,r;for(e in this.options={},r=n[.2])o.call(r,e)&&(this.options[e]=r[e]);for(e in t)o.call(t,e)&&(this.options[e]=t[e])}return e.prototype.buildObject=function(e){var s,u,a,c,l,h;return s=this.options.attrkey,u=this.options.charkey,1===Object.keys(e).length&&this.options.rootName===n[.2].rootName?e=e[l=Object.keys(e)[0]]:l=this.options.rootName,h=this,a=function(t,n){var e,c,l,f,p;if("object"!=typeof n)h.options.cdata&&r(n)?t.raw(i(n)):t.txt(n);else if(Array.isArray(n)){for(f in n)if(o.call(n,f))for(p in c=n[f])l=c[p],t=a(t.ele(p),l).up()}else for(p in n)if(o.call(n,p))if(c=n[p],p===s){if("object"==typeof c)for(e in c)t=t.att(e,c[e])}else if(p===u)t=h.options.cdata&&r(c)?t.raw(i(c)):t.txt(c);else if(Array.isArray(c))for(f in c)o.call(c,f)&&(t="string"==typeof(l=c[f])?h.options.cdata&&r(l)?t.ele(p).raw(i(l)).up():t.ele(p,l).up():a(t.ele(p),l).up());else"object"==typeof c?t=a(t.ele(p),c).up():"string"==typeof c&&h.options.cdata&&r(c)?t=t.ele(p).raw(i(c)).up():(null==c&&(c=""),t=t.ele(p,c.toString()).up());return t},c=t.create(l,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),a(c,e).end(this.options.renderOpts)},e}()}.call(Se)),Se}var Yi={},Vi={};class Hi{constructor(t="utf8"){this.encoding=(t=>{if(!t)return"utf8";const n=String(t).toLowerCase();switch(n){case"utf-8":return"utf8";case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";default:return n}})(t),this._decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"===this.encoding?"utf-8":this.encoding):null}write(t){if(null==t)return"";if("string"==typeof t)return t;const n=(t=>t instanceof Uint8Array?t:t&&void 0!==t.buffer?new Uint8Array(t.buffer,t.byteOffset||0,t.byteLength||t.buffer.byteLength||0):t instanceof ArrayBuffer?new Uint8Array(t):Array.isArray(t)?Uint8Array.from(t):"number"==typeof t?Uint8Array.of(255&t):new Uint8Array)(t);if(0===n.length)return"";if(this._decoder)try{return this._decoder.decode(n,{stream:!0})}catch(t){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[string_decoder polyfill] Falling back to charCode decoding",t)}return(t=>{let n="";for(let e=0;e<t.length;e+=1)n+=String.fromCharCode(t[e]);return n})(n)}end(t){return null==t?"":this.write(t)}}var Ki,Xi=u(Object.freeze({__proto__:null,StringDecoder:Hi,default:{StringDecoder:Hi}}));function Qi(){return Ki||(Ki=1,function(t){t.parser=function(t,n){return new r(t,n)},t.SAXParser=r,t.SAXStream=o,t.createStream=function(t,n){return new o(t,n)},t.MAX_BUFFER_LENGTH=65536;var n,e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function r(n,i){if(!(this instanceof r))return new r(n,i);var o=this;!function(t){for(var n=0,r=e.length;n<r;n++)t[e[n]]=""}(o),o.q=o.c="",o.bufferCheckPosition=t.MAX_BUFFER_LENGTH,o.opt=i||{},o.opt.lowercase=o.opt.lowercase||o.opt.lowercasetags,o.looseCase=o.opt.lowercase?"toLowerCase":"toUpperCase",o.tags=[],o.closed=o.closedRoot=o.sawRoot=!1,o.tag=o.error=null,o.strict=!!n,o.noscript=!(!n&&!o.opt.noscript),o.state=w.BEGIN,o.strictEntities=o.opt.strictEntities,o.ENTITIES=Object.create(o.strictEntities?t.XML_ENTITIES:t.ENTITIES),o.attribList=[],o.opt.xmlns&&(o.ns=Object.create(l)),void 0===o.opt.unquotedAttributeValues&&(o.opt.unquotedAttributeValues=!n),o.trackPosition=!1!==o.opt.position,o.trackPosition&&(o.position=o.line=o.column=0),E(o,"onready")}t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function n(){}return n.prototype=t,new n}),Object.keys||(Object.keys=function(t){var n=[];for(var e in t)t.hasOwnProperty(e)&&n.push(e);return n}),r.prototype={end:function(){M(this)},write:function(n){var r=this;if(this.error)throw this.error;if(r.closed)return T(r,"Cannot write after close. Assign an onready handler.");if(null===n)return M(r);"object"==typeof n&&(n=n.toString());for(var i=0,o="";o=P(n,i++),r.c=o,o;)switch(r.trackPosition&&(r.position++,"\n"===o?(r.line++,r.column=0):r.column++),r.state){case w.BEGIN:if(r.state=w.BEGIN_WHITESPACE,"\ufeff"===o)continue;j(r,o);continue;case w.BEGIN_WHITESPACE:j(r,o);continue;case w.TEXT:if(r.sawRoot&&!r.closedRoot){for(var a=i-1;o&&"<"!==o&&"&"!==o;)(o=P(n,i++))&&r.trackPosition&&(r.position++,"\n"===o?(r.line++,r.column=0):r.column++);r.textNode+=n.substring(a,i-1)}"<"!==o||r.sawRoot&&r.closedRoot&&!r.strict?(m(o)||r.sawRoot&&!r.closedRoot||k(r,"Text data outside of root node."),"&"===o?r.state=w.TEXT_ENTITY:r.textNode+=o):(r.state=w.OPEN_WAKA,r.startTagPosition=r.position);continue;case w.SCRIPT:"<"===o?r.state=w.SCRIPT_ENDING:r.script+=o;continue;case w.SCRIPT_ENDING:"/"===o?r.state=w.CLOSE_TAG:(r.script+="<"+o,r.state=w.SCRIPT);continue;case w.OPEN_WAKA:"!"===o?(r.state=w.SGML_DECL,r.sgmlDecl=""):m(o)||(b(h,o)?(r.state=w.OPEN_TAG,r.tagName=o):"/"===o?(r.state=w.CLOSE_TAG,r.tagName=""):"?"===o?(r.state=w.PROC_INST,r.procInstName=r.procInstBody=""):(k(r,"Unencoded <"),r.startTagPosition+1<r.position&&(o=new Array(r.position-r.startTagPosition).join(" ")+o),r.textNode+="<"+o,r.state=w.TEXT));continue;case w.SGML_DECL:if(r.sgmlDecl+o==="--"){r.state=w.COMMENT,r.comment="",r.sgmlDecl="";continue}r.doctype&&!0!==r.doctype&&r.sgmlDecl?(r.state=w.DOCTYPE_DTD,r.doctype+="<!"+r.sgmlDecl+o,r.sgmlDecl=""):(r.sgmlDecl+o).toUpperCase()===s?(S(r,"onopencdata"),r.state=w.CDATA,r.sgmlDecl="",r.cdata=""):(r.sgmlDecl+o).toUpperCase()===u?(r.state=w.DOCTYPE,(r.doctype||r.sawRoot)&&k(r,"Inappropriately located doctype declaration"),r.doctype="",r.sgmlDecl=""):">"===o?(S(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=w.TEXT):y(o)?(r.state=w.SGML_DECL_QUOTED,r.sgmlDecl+=o):r.sgmlDecl+=o;continue;case w.SGML_DECL_QUOTED:o===r.q&&(r.state=w.SGML_DECL,r.q=""),r.sgmlDecl+=o;continue;case w.DOCTYPE:">"===o?(r.state=w.TEXT,S(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=o,"["===o?r.state=w.DOCTYPE_DTD:y(o)&&(r.state=w.DOCTYPE_QUOTED,r.q=o));continue;case w.DOCTYPE_QUOTED:r.doctype+=o,o===r.q&&(r.q="",r.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:"]"===o?(r.doctype+=o,r.state=w.DOCTYPE):"<"===o?(r.state=w.OPEN_WAKA,r.startTagPosition=r.position):y(o)?(r.doctype+=o,r.state=w.DOCTYPE_DTD_QUOTED,r.q=o):r.doctype+=o;continue;case w.DOCTYPE_DTD_QUOTED:r.doctype+=o,o===r.q&&(r.state=w.DOCTYPE_DTD,r.q="");continue;case w.COMMENT:"-"===o?r.state=w.COMMENT_ENDING:r.comment+=o;continue;case w.COMMENT_ENDING:"-"===o?(r.state=w.COMMENT_ENDED,r.comment=F(r.opt,r.comment),r.comment&&S(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+o,r.state=w.COMMENT);continue;case w.COMMENT_ENDED:">"!==o?(k(r,"Malformed comment"),r.comment+="--"+o,r.state=w.COMMENT):r.state=r.doctype&&!0!==r.doctype?w.DOCTYPE_DTD:w.TEXT;continue;case w.CDATA:"]"===o?r.state=w.CDATA_ENDING:r.cdata+=o;continue;case w.CDATA_ENDING:"]"===o?r.state=w.CDATA_ENDING_2:(r.cdata+="]"+o,r.state=w.CDATA);continue;case w.CDATA_ENDING_2:">"===o?(r.cdata&&S(r,"oncdata",r.cdata),S(r,"onclosecdata"),r.cdata="",r.state=w.TEXT):"]"===o?r.cdata+="]":(r.cdata+="]]"+o,r.state=w.CDATA);continue;case w.PROC_INST:"?"===o?r.state=w.PROC_INST_ENDING:m(o)?r.state=w.PROC_INST_BODY:r.procInstName+=o;continue;case w.PROC_INST_BODY:if(!r.procInstBody&&m(o))continue;"?"===o?r.state=w.PROC_INST_ENDING:r.procInstBody+=o;continue;case w.PROC_INST_ENDING:">"===o?(S(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=w.TEXT):(r.procInstBody+="?"+o,r.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:b(f,o)?r.tagName+=o:(I(r),">"===o?C(r):"/"===o?r.state=w.OPEN_TAG_SLASH:(m(o)||k(r,"Invalid character in tag name"),r.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:">"===o?(C(r,!0),N(r)):(k(r,"Forward-slash in opening tag not followed by >"),r.state=w.ATTRIB);continue;case w.ATTRIB:if(m(o))continue;">"===o?C(r):"/"===o?r.state=w.OPEN_TAG_SLASH:b(h,o)?(r.attribName=o,r.attribValue="",r.state=w.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case w.ATTRIB_NAME:"="===o?r.state=w.ATTRIB_VALUE:">"===o?(k(r,"Attribute without value"),r.attribValue=r.attribName,A(r),C(r)):m(o)?r.state=w.ATTRIB_NAME_SAW_WHITE:b(f,o)?r.attribName+=o:k(r,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if("="===o)r.state=w.ATTRIB_VALUE;else{if(m(o))continue;k(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",S(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===o?C(r):b(h,o)?(r.attribName=o,r.state=w.ATTRIB_NAME):(k(r,"Invalid attribute name"),r.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(m(o))continue;y(o)?(r.q=o,r.state=w.ATTRIB_VALUE_QUOTED):(r.opt.unquotedAttributeValues||T(r,"Unquoted attribute value"),r.state=w.ATTRIB_VALUE_UNQUOTED,r.attribValue=o);continue;case w.ATTRIB_VALUE_QUOTED:if(o!==r.q){"&"===o?r.state=w.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=o;continue}A(r),r.q="",r.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:m(o)?r.state=w.ATTRIB:">"===o?C(r):"/"===o?r.state=w.OPEN_TAG_SLASH:b(h,o)?(k(r,"No whitespace between attributes"),r.attribName=o,r.attribValue="",r.state=w.ATTRIB_NAME):k(r,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!v(o)){"&"===o?r.state=w.ATTRIB_VALUE_ENTITY_U:r.attribValue+=o;continue}A(r),">"===o?C(r):r.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(r.tagName)">"===o?N(r):b(f,o)?r.tagName+=o:r.script?(r.script+="</"+r.tagName,r.tagName="",r.state=w.SCRIPT):(m(o)||k(r,"Invalid tagname in closing tag"),r.state=w.CLOSE_TAG_SAW_WHITE);else{if(m(o))continue;g(h,o)?r.script?(r.script+="</"+o,r.state=w.SCRIPT):k(r,"Invalid tagname in closing tag."):r.tagName=o}continue;case w.CLOSE_TAG_SAW_WHITE:if(m(o))continue;">"===o?N(r):k(r,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var c,l;switch(r.state){case w.TEXT_ENTITY:c=w.TEXT,l="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:c=w.ATTRIB_VALUE_QUOTED,l="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:c=w.ATTRIB_VALUE_UNQUOTED,l="attribValue"}if(";"===o){var x=D(r);r.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(x)?(r.entity="",r.state=c,r.write(x)):(r[l]+=x,r.entity="",r.state=c)}else b(r.entity.length?d:p,o)?r.entity+=o:(k(r,"Invalid character in entity name"),r[l]+="&"+r.entity+o,r.entity="",r.state=c);continue;default:throw new Error(r,"Unknown state: "+r.state)}return r.position>=r.bufferCheckPosition&&function(n){for(var r=Math.max(t.MAX_BUFFER_LENGTH,10),i=0,o=0,s=e.length;o<s;o++){var u=n[e[o]].length;if(u>r)switch(e[o]){case"textNode":O(n);break;case"cdata":S(n,"oncdata",n.cdata),n.cdata="";break;case"script":S(n,"onscript",n.script),n.script="";break;default:T(n,"Max buffer length exceeded: "+e[o])}i=Math.max(i,u)}n.bufferCheckPosition=t.MAX_BUFFER_LENGTH-i+n.position}(r),r}
|
|
10
|
-
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){!function(t){O(t),""!==t.cdata&&(S(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(S(t,"onscript",t.script),t.script="")}(this)}};try{n=require("stream").Stream}catch(t){n=function(){}}n||(n=function(){});var i=t.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function o(t,e){if(!(this instanceof o))return new o(t,e);n.apply(this),this._parser=new r(t,e),this.writable=!0,this.readable=!0;var s=this;this._parser.onend=function(){s.emit("end")},this._parser.onerror=function(t){s.emit("error",t),s._parser.error=null},this._decoder=null,i.forEach((function(t){Object.defineProperty(s,"on"+t,{get:function(){return s._parser["on"+t]},set:function(n){if(!n)return s.removeAllListeners(t),s._parser["on"+t]=n,n;s.on(t,n)},enumerable:!0,configurable:!1})}))}(o.prototype=Object.create(n.prototype,{constructor:{value:o}})).write=function(t){return"function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)&&(this._decoder||(this._decoder=new(0,Xi.StringDecoder)("utf8")),t=this._decoder.write(t)),this._parser.write(t.toString()),this.emit("data",t),!0},o.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},o.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===i.indexOf(t)||(r._parser["on"+t]=function(){var n=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);n.splice(0,0,t),r.emit.apply(r,n)}),n.prototype.on.call(r,t,e)};var s="[CDATA[",u="DOCTYPE",a="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/2000/xmlns/",l={xml:a,xmlns:c},h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,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 m(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function y(t){return'"'===t||"'"===t}function v(t){return">"===t||m(t)}function b(t,n){return t.test(n)}function g(t,n){return!b(t,n)}var w=0;for(var x in t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},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(n){var e=t.ENTITIES[n],r="number"==typeof e?String.fromCharCode(e):e;t.ENTITIES[n]=r})),t.STATE)t.STATE[t.STATE[x]]=x;function E(t,n,e){t[n]&&t[n](e)}function S(t,n,e){t.textNode&&O(t),E(t,n,e)}function O(t){t.textNode=F(t.opt,t.textNode),t.textNode&&E(t,"ontext",t.textNode),t.textNode=""}function F(t,n){return t.trim&&(n=n.trim()),t.normalize&&(n=n.replace(/\s+/g," ")),n}function T(t,n){return O(t),t.trackPosition&&(n+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),n=new Error(n),t.error=n,E(t,"onerror",n),t}function M(t){return t.sawRoot&&!t.closedRoot&&k(t,"Unclosed root tag"),t.state!==w.BEGIN&&t.state!==w.BEGIN_WHITESPACE&&t.state!==w.TEXT&&T(t,"Unexpected end"),O(t),t.c="",t.closed=!0,E(t,"onend"),r.call(t,t.strict,t.opt),t}function k(t,n){if("object"!=typeof t||!(t instanceof r))throw new Error("bad call to strictFail");t.strict&&T(t,n)}function I(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var n=t.tags[t.tags.length-1]||t,e=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(e.ns=n.ns),t.attribList.length=0,S(t,"onopentagstart",e)}function _(t,n){var e=t.indexOf(":")<0?["",t]:t.split(":"),r=e[0],i=e[1];return n&&"xmlns"===t&&(r="xmlns",i=""),{prefix:r,local:i}}function A(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var n=_(t.attribName,!0),e=n.local;if("xmlns"===n.prefix)if("xml"===e&&t.attribValue!==a)k(t,"xml: prefix must be bound to "+a+"\nActual: "+t.attribValue);else if("xmlns"===e&&t.attribValue!==c)k(t,"xmlns: prefix must be bound to "+c+"\nActual: "+t.attribValue);else{var r=t.tag,i=t.tags[t.tags.length-1]||t;r.ns===i.ns&&(r.ns=Object.create(i.ns)),r.ns[e]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,S(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function C(t,n){if(t.opt.xmlns){var e=t.tag,r=_(t.tagName);e.prefix=r.prefix,e.local=r.local,e.uri=e.ns[r.prefix]||"",e.prefix&&!e.uri&&(k(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),e.uri=r.prefix),e.ns&&(t.tags[t.tags.length-1]||t).ns!==e.ns&&Object.keys(e.ns).forEach((function(n){S(t,"onopennamespace",{prefix:n,uri:e.ns[n]})}));for(var i=0,o=t.attribList.length;i<o;i++){var s=t.attribList[i],u=s[0],a=s[1],c=_(u,!0),l=c.prefix,h=""===l?"":e.ns[l]||"",f={name:u,value:a,prefix:l,local:c.local,uri:h};l&&"xmlns"!==l&&!h&&(k(t,"Unbound namespace prefix: "+JSON.stringify(l)),f.uri=l),t.tag.attributes[u]=f,S(t,"onattribute",f)}t.attribList.length=0}t.tag.isSelfClosing=!!n,t.sawRoot=!0,t.tags.push(t.tag),S(t,"onopentag",t.tag),n||(t.state=t.noscript||"script"!==t.tagName.toLowerCase()?w.TEXT:w.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function N(t){if(!t.tagName)return k(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=w.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=w.SCRIPT);S(t,"onscript",t.script),t.script=""}var n=t.tags.length,e=t.tagName;t.strict||(e=e[t.looseCase]());for(var r=e;n--&&t.tags[n].name!==r;)k(t,"Unexpected close tag");if(n<0)return k(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=w.TEXT);t.tagName=e;for(var i=t.tags.length;i-- >n;){var o=t.tag=t.tags.pop();t.tagName=t.tag.name,S(t,"onclosetag",t.tagName);var s={};for(var u in o.ns)s[u]=o.ns[u];t.opt.xmlns&&o.ns!==(t.tags[t.tags.length-1]||t).ns&&Object.keys(o.ns).forEach((function(n){S(t,"onclosenamespace",{prefix:n,uri:o.ns[n]})}))}0===n&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=w.TEXT}function D(t){var n,e=t.entity,r=e.toLowerCase(),i="";return t.ENTITIES[e]?t.ENTITIES[e]:t.ENTITIES[r]?t.ENTITIES[r]:("#"===(e=r).charAt(0)&&("x"===e.charAt(1)?(e=e.slice(2),i=(n=parseInt(e,16)).toString(16)):(e=e.slice(1),i=(n=parseInt(e,10)).toString(10))),e=e.replace(/^0+/,""),isNaN(n)||i.toLowerCase()!==e?(k(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(n))}function j(t,n){"<"===n?(t.state=w.OPEN_WAKA,t.startTagPosition=t.position):m(n)||(k(t,"Non-whitespace before first tag."),t.textNode=n,t.state=w.TEXT)}function P(t,n){var e="";return n<t.length&&(e=t.charAt(n)),e}w=t.STATE,String.fromCodePoint||function(){var t=String.fromCharCode,n=Math.floor,e=function(){var e=[],r=-1,i=arguments.length;if(!i)return"";for(var o="";++r<i;){var s=Number(arguments[r]);if(!isFinite(s)||s<0||s>1114111||n(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?e.push(s):e.push(55296+((s-=65536)>>10),s%1024+56320),(r+1===i||e.length>16384)&&(o+=t.apply(null,e),e.length=0)}return o};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:e,configurable:!0,writable:!0}):String.fromCodePoint=e}()}(Vi)),Vi}const Zi=Symbol("listenersMap");class Ji{constructor(){this[Zi]=new Map}addListener(t,n){return this.on(t,n)}on(t,n){if("function"!=typeof n)throw new TypeError("listener must be a function");const e=this[Zi],r=e.get(t);return r?r.push(n):e.set(t,[n]),this}once(t,n){if("function"!=typeof n)throw new TypeError("listener must be a function");const e=(...r)=>{this.off(t,e),n.apply(this,r)};return e.listener=n,this.on(t,e)}removeListener(t,n){if(!n)return this;const e=this[Zi],r=e.get(t);if(!r)return this;for(let t=r.length-1;t>=0;t-=1){const e=r[t];e!==n&&e.listener!==n||r.splice(t,1)}return 0===r.length&&e.delete(t),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){const n=this[Zi];return void 0===t?n.clear():n.delete(t),this}emit(t,...n){const e=this[Zi].get(t);return!(!e||0===e.length||(e.slice().forEach((t=>t.apply(this,n))),0))}listeners(t){const n=this[Zi].get(t);return n?n.slice():[]}listenerCount(t){return this.listeners(t).length}}Ji.prototype.addListener=Ji.prototype.on;var to,no=u(Object.freeze({__proto__:null,EventEmitter:Ji,default:{EventEmitter:Ji,defaultMaxListeners:10},defaultMaxListeners:10})),eo={};function ro(){return to||(to=1,function(){eo.stripBOM=function(t){return"\ufeff"===t[0]?t.substring(1):t}}.call(eo)),eo}var io,oo={};function so(){return io||(io=1,function(){var t;t=new RegExp(/(?!xmlns)^.*:/),oo.normalize=function(t){return t.toLowerCase()},oo.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},oo.stripPrefix=function(n){return n.replace(t,"")},oo.parseNumbers=function(t){return isNaN(t)||(t=t%1==0?parseInt(t,10):parseFloat(t)),t},oo.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t="true"===t.toLowerCase()),t}}.call(oo)),oo}var uo,ao,co,lo={};function ho(){return ao||(ao=1,function(t){(function(){var n,e,r,i,o,s,u,a,c,l=function(t,n){return function(){return t.apply(n,arguments)}},h={}.hasOwnProperty;a=Qi(),i=no,n=ro(),u=so(),c=function(){if(uo)return lo;uo=1,lo.every=function(t){return new e(t)};var t={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5};for(var n in t)"millisecond"===n?t.ms=t[n]:t[n.charAt(0)]=t[n],t[n+"s"]=t[n];function e(n){this.count=0;var e=function(n){var e=n.match(r);return e&&t[e[2]]?e.slice(1):null}(n);e&&(this.time=Number(e[0])*t[e[1]],this.type=e[1])}e.prototype.do=function(t){this.time&&(this.interval=setInterval((function(){n.count++,t.call(n)}),this.time));var n=this;return this},e.prototype.stop=function(){return this.interval&&(clearInterval(this.interval),delete this.interval),this};var r=/^\s*(\d+(?:\.\d+)?)\s*([a-z]+)\s*$/;return lo}().setImmediate,e=xe().defaults,o=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},s=function(t,n,e){var r,i;for(r=0,i=t.length;r<i;r++)n=(0,t[r])(n,e);return n},r=function(t,n,e){var r;return(r=Object.create(null)).value=e,r.writable=!0,r.enumerable=!0,r.configurable=!0,Object.defineProperty(t,n,r)},t.Parser=function(i){function f(n){var r,i;if(this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this),!(this instanceof t.Parser))return new t.Parser(n);for(r in this.options={},i=e[.2])h.call(i,r)&&(this.options[r]=i[r]);for(r in n)h.call(n,r)&&(this.options[r]=n[r]);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 function(t,n){for(var e in n)h.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(f,i),f.prototype.processAsync=function(){var t,n;try{return this.remaining.length<=this.options.chunkSize?(t=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(t),this.saxParser.close()):(t=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(t),c(this.processAsync))}catch(t){if(n=t,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(n)}},f.prototype.assignOrPush=function(t,n,e){return n in t?(t[n]instanceof Array||r(t,n,[t[n]]),t[n].push(e)):r(t,n,this.options.explicitArray?[e]:e)},f.prototype.reset=function(){var t,n,e,i,u;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(u=this,function(t){if(u.saxParser.resume(),!u.saxParser.errThrown)return u.saxParser.errThrown=!0,u.emit("error",t)}),this.saxParser.onend=function(t){return function(){if(!t.saxParser.ended)return t.saxParser.ended=!0,t.emit("end",t.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,i=[],t=this.options.attrkey,n=this.options.charkey,this.saxParser.onopentag=function(e){return function(o){var u,a,c,l,f;if((c={})[n]="",!e.options.ignoreAttrs)for(u in f=o.attributes)h.call(f,u)&&(t in c||e.options.mergeAttrs||(c[t]={}),a=e.options.attrValueProcessors?s(e.options.attrValueProcessors,o.attributes[u],u):o.attributes[u],l=e.options.attrNameProcessors?s(e.options.attrNameProcessors,u):u,e.options.mergeAttrs?e.assignOrPush(c,l,a):r(c[t],l,a));return c["#name"]=e.options.tagNameProcessors?s(e.options.tagNameProcessors,o.name):o.name,e.options.xmlns&&(c[e.options.xmlnskey]={uri:o.uri,local:o.local}),i.push(c)}}(this),this.saxParser.onclosetag=function(t){return function(){var e,u,a,c,l,f,p,d,m,y;if(f=i.pop(),l=f["#name"],t.options.explicitChildren&&t.options.preserveChildrenOrder||delete f["#name"],!0===f.cdata&&(e=f.cdata,delete f.cdata),m=i[i.length-1],f[n].match(/^\s*$/)&&!e?(u=f[n],delete f[n]):(t.options.trim&&(f[n]=f[n].trim()),t.options.normalize&&(f[n]=f[n].replace(/\s{2,}/g," ").trim()),f[n]=t.options.valueProcessors?s(t.options.valueProcessors,f[n],l):f[n],1===Object.keys(f).length&&n in f&&!t.EXPLICIT_CHARKEY&&(f=f[n])),o(f)&&(f="function"==typeof t.options.emptyTag?t.options.emptyTag():""!==t.options.emptyTag?t.options.emptyTag:u),null!=t.options.validator&&(y="/"+function(){var t,n,e;for(e=[],t=0,n=i.length;t<n;t++)e.push((c=i[t])["#name"]);return e}().concat(l).join("/"),function(){try{return f=t.options.validator(y,m&&m[l],f)}catch(n){return t.emit("error",n)}}()),t.options.explicitChildren&&!t.options.mergeAttrs&&"object"==typeof f)if(t.options.preserveChildrenOrder){if(m){for(a in m[t.options.childkey]=m[t.options.childkey]||[],p={},f)h.call(f,a)&&r(p,a,f[a]);m[t.options.childkey].push(p),delete f["#name"],1===Object.keys(f).length&&n in f&&!t.EXPLICIT_CHARKEY&&(f=f[n])}}else c={},t.options.attrkey in f&&(c[t.options.attrkey]=f[t.options.attrkey],delete f[t.options.attrkey]),!t.options.charsAsChildren&&t.options.charkey in f&&(c[t.options.charkey]=f[t.options.charkey],delete f[t.options.charkey]),Object.getOwnPropertyNames(f).length>0&&(c[t.options.childkey]=f),f=c;return i.length>0?t.assignOrPush(m,l,f):(t.options.explicitRoot&&(d=f,r(f={},l,d)),t.resultObject=f,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),e=function(t){return function(e){var r,o;if(o=i[i.length-1])return o[n]+=e,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==e.replace(/\\n/g,"").trim())&&(o[t.options.childkey]=o[t.options.childkey]||[],(r={"#name":"__text__"})[n]=e,t.options.normalize&&(r[n]=r[n].replace(/\s{2,}/g," ").trim()),o[t.options.childkey].push(r)),o}}(this),this.saxParser.ontext=e,this.saxParser.oncdata=function(t){var n;if(n=e(t))return n.cdata=!0}},f.prototype.parseString=function(t,e){var r;null!=e&&"function"==typeof e&&(this.on("end",(function(t){return this.reset(),e(null,t)})),this.on("error",(function(t){return this.reset(),e(t)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=n.stripBOM(t),this.options.async?(this.remaining=t,c(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(t){if(r=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",r),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw r}},f.prototype.parseStringPromise=function(t){return new Promise((n=this,function(e,r){return n.parseString(t,(function(t,n){return t?r(t):e(n)}))}));var n},f}(i),t.parseString=function(n,e,r){var i,o;return null!=r?("function"==typeof r&&(i=r),"object"==typeof e&&(o=e)):("function"==typeof e&&(i=e),o={}),new t.Parser(o).parseString(n,i)},t.parseStringPromise=function(n,e){var r;return"object"==typeof e&&(r=e),new t.Parser(r).parseStringPromise(n)}}).call(Yi)}(Yi)),Yi}var fo=(co||(co=1,function(){var t,n,e,r,i={}.hasOwnProperty;n=xe(),t=Wi(),e=ho(),r=so(),ge.defaults=n.defaults,ge.processors=r,ge.ValidationError=function(){function t(t){this.message=t}return function(t,n){for(var e in n)i.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(t,Error),t}(),ge.Builder=t.Builder,ge.Parser=e.Parser,ge.parseString=e.parseString,ge.parseStringPromise=e.parseStringPromise}.call(ge)),ge);const po=(t,n,e)=>{const r=e=>String.prototype.split.call(n,e).filter(Boolean).reduce(((t,n)=>null!=t?t[n]:t),t),i=r(/[,[\]]+?/)||r(/[,[\].]+?/);return void 0===i||i===t?e:i},mo=[2,2],yo=[10,2],vo={solid:void 0,dot:mo,dash:yo,"dash dot":[...yo,...mo],"dash dot dot":[...yo,...mo,...mo]},bo={left:"L",right:"R",top:"T",bottom:"B","top-left":"TL","top-right":"TR","bottom-left":"BL","bottom-right":"BR"};class go{cqlParser=new Hn;static title="QGIS Style Parser";title="QGIS Style Parser";qgisVersion;writePropsAsOptions;constructor(t={}){this.qgisVersion=t.qgisVersion??"3.28.0-Firenze",this.writePropsAsOptions=this.compareVersions("3.28.0-Firenze",this.qgisVersion)>=0}compareVersions(t,n){try{const e=t=>t.split("-")[0].split(".").map(Number),[r,i,o]=e(t),[s,u,a]=e(n);return Math.sign(s-r)||Math.sign(u-i)||Math.sign(a-o)}catch(t){return 0}}readStyle=async t=>{const n={};try{let e;return fo.parseString(t,n,((t,n)=>{if(t)return void(e={errors:[t]});const r=this.qmlObjectToGeoStylerStyle(n);e={output:r}})),e||{errors:[]}}catch(t){return{errors:[t]}}};parseLabelTemplates(t){let n="";return t.split("||").forEach((t=>{const e=t.match(/[']([^']+)[']/);n+=e?e[1]:`{{${t.trim()}}}`})),n}qmlSymbolizerLayerPropsToObject(t){const n={};return t.prop&&t.prop.forEach((t=>{n[t.$.k]=t.$.v})),t.Option&&t.Option[0].Option&&t.Option[0].Option.forEach((t=>{n[t.$.name]=t.$.value})),n}qmlObjectToGeoStylerStyle(t){return{name:"QGIS Style",rules:this.getRulesFromQmlObject(t)}}qmlColorFromHexAndOpacity(t,n){n=Number.isNaN(Number(n))?1:n;const e=be(t).alpha(n||1).rgb().array(),r=void 0===e[3]||isNaN(e[3])?255:0===e[3]?0:255*e[3];return`${e[0]},${e[1]},${e[2]},${Math.round(r)}`}qmlColorToOpacity(t){const n=t.split(","),e=parseFloat(n[3])/255;return Math.round(100*e)/100}qmlColorToHex(t){const n=t.split(",");return be(`rgb(${n[0]},${n[1]},${n[2]})`).hex()}getRulesFromQmlObject(t){const n=po(t,"qgis.renderer-v2.[0]"),e=po(n,"rules[0].rule"),r=po(n,"categories[0].category"),i=po(n,"ranges[0].range"),o=po(n,"symbols[0].symbol"),s=po(t,"qgis.labeling.[0]");let u=[],a={},c={};if(Array.isArray(o)&&(a=this.parseQmlSymbolizers(o)),s&&(c=this.parseQmlLabeling(s)),Array.isArray(e)&&e.length>0)e.forEach((t=>{const n=this.getFilterFromQmlRule(t),e=this.getScaleDenominatorFromRule(t);let r={name:t.$.label||t.$.filter};n&&(r.filter=n),e&&(r.scaleDenominator=e),Object.keys(a).length>0&&a[t.$.symbol]&&(r.symbolizers=a[t.$.symbol]),u.push(r)}));else if(Array.isArray(r)&&r.length>0){const n=po(t,"qgis.renderer-v2.[0].$.attr");r.forEach((t=>{const e=t.$.value;let r={name:`${n} = ${e}`,filter:["==",n,e]};a&&a[t.$.symbol]&&(r.symbolizers=a[t.$.symbol]),u.push(r)}))}else if(Array.isArray(i)&&i.length>0){const n=po(t,"qgis.renderer-v2.[0].$.attr");i.forEach((t=>{let e={name:t.$.label,filter:["&&",[">=",n,t.$.lower],["<=",n,t.$.upper]]};a&&a[t.$.symbol]&&(e.symbolizers=a[t.$.symbol]),u.push(e)}))}else{const t={name:"QGIS Simple Symbol",symbolizers:[...a[Object.keys(a)[0]]||[],...c[Object.keys(c)[0]]||[]]};try{const n=this.cqlParser.read(Object.keys(c)[0]);n&&(t.filter=n)}catch(t){}u.push(t)}return u}getFilterFromQmlRule(t){const n=po(t,"$.filter");if(n)return this.cqlParser.read(n)}getScaleDenominatorFromRule(t){const n=po(t,"$.scalemaxdenom"),e=po(t,"$.scalemindenom");let r={};return e&&(r.min=Number(e)),n&&(r.max=Number(n)),r.min||r.max?r:void 0}parseQmlLabeling(t){const n=t.$.type,e={};if("rule-based"===n&&po(t,"rules[0].rule").forEach(((t,n)=>{const r=po(t,"settings[0]"),i=this.getTextSymbolizerFromLabelSettings(r);e[t.$.filter||n]=[i]})),"simple"===n){const n=po(t,"settings[0]"),r=this.getTextSymbolizerFromLabelSettings(n);e.a=[r]}return e}getTextSymbolizerFromLabelSettings(t){let n={kind:"Text"};const e=po(t,"text-style[0].$"),r=po(t,"placement[0].$");return e.textColor&&(n.color=this.qmlColorToHex(e.textColor)),e.fieldName&&(n.label=this.parseLabelTemplates(e.fieldName)),e.fontSize&&(n.size=parseFloat(e.fontSize)),e.fontFamily&&(n.font=[e.fontFamily]),e.fontWeight&&e.fontWeight>=70&&(n.fontWeight="bold"),e.fontItalic&&parseFloat(e.fontItalic)>0&&(n.fontStyle="italic"),e.fontLetterSpacing&&parseFloat(e.fontLetterSpacing)>0&&(n.letterSpacing=parseFloat(e.fontLetterSpacing)),e.multilineHeight&&parseFloat(e.multilineHeight)>0&&(n.lineHeight=parseFloat(e.multilineHeight)),(parseFloat(r.xOffset)>0||parseFloat(r.yOffset)>0)&&(n.offset=[parseFloat(r.xOffset),parseFloat(r.yOffset)]),n}parseQmlSymbolizers(t){const n={};return t.forEach((t=>{const e=po(t,"$.name");let r;switch(po(t,"$.type")){case"marker":r=this.getPointSymbolizersFromQmlSymbolizer(t);break;case"line":r=this.getLineSymbolizersFromQmlSymbolizer(t);break;case"fill":r=this.getFillSymbolizerFromQmlSymbolizer(t);break;default:throw new Error("Failed to parse SymbolizerKind from qmlSymbolizer")}n[e]=r})),n}getPointSymbolizersFromQmlSymbolizer(t){return t.layer.map((t=>{const n=t.$.class;switch(n){case"SimpleMarker":return this.getPointSymbolizerFromMarkLayer(t);case"SvgMarker":return this.getPointSymbolizerFromSvgLayer(t);default:throw new Error(`Failed to parse MarkerClass ${n} from qmlSymbolizer`)}}))}getPointSymbolizerFromMarkLayer(t){let n={kind:"Mark"};const e=this.qmlSymbolizerLayerPropsToObject(t);return n.wellKnownName=e.name,e.color&&(n.opacity=this.qmlColorToOpacity(e.color),n.color=this.qmlColorToHex(e.color)),e.angle&&(n.rotate=parseFloat(e.angle)),e.size&&(n.radius=parseFloat(e.size)/2),e.outline_color&&(n.strokeOpacity=this.qmlColorToOpacity(e.outline_color),n.strokeColor=this.qmlColorToHex(e.outline_color)),e.outline_width&&(n.strokeWidth=parseFloat(e.outline_width)),n}getLineSymbolizersFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:n}=this;return t.layer.map((t=>{let e={kind:"Line"};const r=n(t);if(r.line_color&&(e.opacity=this.qmlColorToOpacity(r.line_color),e.color=this.qmlColorToHex(r.line_color)),r.capstyle&&(e.cap=r.capstyle),r.joinstyle&&(e.join=r.joinstyle),r.use_custom_dash&&"0"!==r.use_custom_dash)r.customdash&&(e.dasharray=r.customdash.split(";").map(parseFloat));else{const t=vo[r?.line_style||"solid"];t&&(e.dasharray=t)}return r.offset&&(e.perpendicularOffset=parseFloat(r.offset)),r.line_width&&(e.width=parseFloat(r.line_width)),e}))}getFillSymbolizerFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:n}=this;return t.layer.flatMap((t=>{let e={kind:"Fill"};const r=n(t);let i=r?.outline_style||"solid";r.outline_color&&"no"!==i&&(e.outlineColor=this.qmlColorToHex(r.outline_color));const o=r?.line_style;!e.outlineColor&&o&&"no"!==o&&(i=o,e.outlineColor=this.qmlColorToHex(r.line_color));let s=r?.style||"solid";r.color&&"solid"===s&&(e.opacity=this.qmlColorToOpacity(r.color),e.color=this.qmlColorToHex(r.color));const u=vo[i];if(u&&(e.outlineDasharray=u),r.outline_width&&"no"!==i&&(e.outlineWidth=parseFloat(r.outline_width)),e.outlineColor&&!e.color&&"no"!==s&&(e.color="transparent"),"PointPatternFill"===t.$.class){const n=t.symbol.flatMap((t=>this.getPointSymbolizersFromQmlSymbolizer(t)));if(n.length>1)return n.map((t=>({...e,graphicFill:t})));1===n.length&&(e.graphicFill=n[0])}return[e]}))}getPointSymbolizerFromSvgLayer(t){let n={kind:"Icon"};const e=this.qmlSymbolizerLayerPropsToObject(t);if(e.color){const t=e.color.split(",");n.opacity=parseFloat(t[3])/255;const r=be(`rgb(${t[0]},${t[1]},${t[2]})`);n.color=r.hex()}if(e.angle&&(n.rotate=parseFloat(e.angle)),e.size&&(n.size=parseFloat(e.size)),e.offset){const t=e.offset.split(",").map(parseFloat);(t[0]>0||t[1]>0)&&(n.offset=e.offset.split(",").map(parseFloat))}return e.name&&(n.image=e.name),n}writeStyle(t){return new Promise((n=>{try{const e=new fo.Builder,r=this.geoStylerStyleToQmlObject(t);this.convertTextSymbolizers(r,t),n({output:e.buildObject(r).replace('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',"<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>")})}catch(t){n({errors:[t]})}}))}getQmlFilterFromFilter(t){return this.cqlParser.write(t)}getQmlRuleFromRule(t,n){const e=t.filter,r={$:{key:`renderer_rule_${n}`,symbol:`${n}`,label:t.name}};return t.scaleDenominator&&(t.scaleDenominator.min&&(r.$.scalemindenom=t.scaleDenominator.min),t.scaleDenominator.max&&(r.$.scalemaxdenom=t.scaleDenominator.max)),e&&this.getQmlFilterFromFilter(e)&&(r.$.filter=this.getQmlFilterFromFilter(e)),r}getQmlSymbolsFromStyle(t,n){return t.rules.map(((t,e)=>{const r=this.getQmlSymbolFromRule(t,e);return r&&n.push(this.getQmlRuleFromRule(t,e)),r})).filter((t=>t))}getQmlSymbolFromRule(t,n){const e=this.getQmlLayersFromRule(t);let r;if(t.symbolizers.length){switch(t.symbolizers[0].kind){case"Line":r="line";break;case"Fill":r="fill";break;default:r="marker"}return e&&e[0]?{$:{type:r,name:n.toString()},layer:e}:void 0}}getQmlLineSymbolFromSymbolizer(t){let n;Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity));const e={line_color:n,offset:t.perpendicularOffset,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",joinstyle:t.join,capstyle:t.cap,line_width:t.width,line_width_unit:"Pixel"};return t.dasharray&&(e.customdash=t.dasharray.join(";"),e.use_custom_dash="1"),{$:{class:"SimpleLine"},...this.propsObjectToQmlSymbolOptions(e)}}getQmlFillSymbolFromSymbolizer(t){const n=void 0!==t.fillOpacity?t.fillOpacity:t.opacity,e=void 0!==t.outlineOpacity?t.outlineOpacity:t.opacity;let r,i;Dn(t.color)||Dn(n)||(r=this.qmlColorFromHexAndOpacity(t.color,n)),Dn(t.outlineColor)||Dn(e)||(i=this.qmlColorFromHexAndOpacity(t.outlineColor,e));const o={color:r,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",outline_style:t.outlineDasharray?"dash":"solid",outline_width:t.outlineWidth||"0",outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",customdash:t.outlineDasharray?t.outlineDasharray.join(";"):void 0,outline_color:i};return{$:{class:"SimpleFill"},...this.propsObjectToQmlSymbolOptions(o)}}getQmlLayersFromRule(t){const n=t.symbolizers.map(this.getQmlLayerFromSymbolizer.bind(this)).filter((t=>t));return n.length?n:void 0}getQmlLayerFromSymbolizer(t){switch(t.kind){case"Fill":return this.getQmlFillSymbolFromSymbolizer(t);case"Icon":return this.getQmlMarkSymbolFromIconSymbolizer(t);case"Line":return this.getQmlLineSymbolFromSymbolizer(t);case"Mark":return this.getQmlMarkSymbolFromSymbolizer(t)}}getQmlMarkSymbolFromIconSymbolizer(t){let n;return Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),{$:{class:"SvgMarker"},...this.propsObjectToQmlSymbolOptions({angle:t.rotate||0,color:n,name:t.image,size:t.size,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"})}}getQmlMarkSymbolFromSymbolizer(t){let n,e,r;Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),Dn(t.strokeColor)||Dn(t.strokeOpacity)||(e=this.qmlColorFromHexAndOpacity(t.strokeColor,t.strokeOpacity)),Dn(t.radius)||(r=t.radius?2*t.radius:void 0);const i={angle:t.rotate||0,color:n,name:t.wellKnownName.toLowerCase(),outline_color:e,outline_style:"solid",outline_width:t.strokeWidth||0,outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",size:r,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"};return{$:{class:"SimpleMarker"},...this.propsObjectToQmlSymbolOptions(i)}}propsObjectToQmlSymbolOptions(t){return this.writePropsAsOptions?this.propsObjectToQmlSymbol_NewerOptions(t):this.propsObjectToQmlSymbol_OlderProps(t)}propsObjectToQmlSymbol_NewerOptions(t){const n=Object.keys(t).map((n=>({$:{name:n,value:t[n],type:"QString"}}))).filter((t=>void 0!==t.$.value));return{Option:{$:{type:"Map"},Option:n}}}propsObjectToQmlSymbol_OlderProps(t){const n=Object.keys(t).map((n=>({$:{k:n,v:t[n]}}))).filter((t=>void 0!==t.$.v));return{prop:n}}geoStylerStyleToQmlObject(t){const n=[],e=this.getQmlSymbolsFromStyle(t,n);return n.length>0||e.length>0?{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"RuleRenderer"},rules:[{$:{key:"renderer_rules"},rule:n}],symbols:[{symbol:e}]}]}}:{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"nullSymbol"}}]}}}convertTextSymbolizerRule(t,n){let e;n.symbolizers.forEach((r=>{if("Text"===r.kind){let i,o;e=r,e.color&&!Dn(e.color)&&(i=this.qmlColorFromHexAndOpacity(e.color,1));const s={fontSize:e.size||12,fontLetterSpacing:e.letterSpacing||0,multilineHeight:void 0!==e.lineHeight?e.lineHeight:1,textColor:e.color?i:"0,0,0,255"};e.font&&(s.fontFamily=e.font[0]),e.label&&!Dn(e.label)&&(s.fieldName=e.label.replace("{{","").replace("}}","")),o=e.anchor&&!Dn(e.anchor)&&"center"!==e.anchor?bo[e.anchor]:"TR,TL,BR,BL,R,L,TSR,BSR";const u={$:{key:`labeling_rule_${t.length}`},settings:[{"text-style":[{$:s}],placement:[{$:{predefinedPositionOrder:o,xOffset:e.offset?`${e.offset[0]}`:"0",yOffset:e.offset?`${e.offset[1]}`:"0",rotationAngle:e.rotate?e.rotate:"0"}}]}]};if(e.haloColor){let t;Dn(e.haloColor)||Dn(e.haloOpacity)||(t=this.qmlColorFromHexAndOpacity(e.haloColor,e.haloOpacity)),u.settings[0]["text-buffer"]=[{$:{bufferSize:e.haloWidth||"0",bufferColor:t,bufferDraw:1,bufferSizeUnits:"Pixel",bufferSizeMapUnitScale:"3x:0,0,0,0,0,0"}}]}n.filter&&(u.$.filter=this.cqlParser.write(n.filter)),t.push(u)}}))}convertTextSymbolizers(t,n){const e=[];n.rules.forEach((t=>{t.symbolizers.forEach((n=>{"Text"!==n.kind||e.includes(t)||e.push(t)}))})),e.length>0&&(t.qgis.labeling=[{$:{type:"rule-based"},rules:[{$:{key:"labeling_rules"},rule:[]}]}],e.forEach((n=>this.convertTextSymbolizerRule(t.qgis.labeling[0].rules[0].rule,n))))}}let wo=function(t){return t.VBScript="VBScript",t.JScript="JScript",t.Python="Python",t.Arcade="Arcade",t}({}),xo=function(t){return t.Point="Point",t.Line="Line",t.Polygon="Polygon",t}({});const Eo="ESRI Default Marker",So=2/3,Oo=["ttf://ESRI SDS 2.00","ttf://ESRI SDS 1.95"],Fo=t=>t*(4/3),To=t=>null!==t&&t.values?t.values[t.values.length-1]/100:0,Mo=t=>{if(null===t)return"#000000";let n=t.values??[0,0,0];return"CIMRGBColor"===t.type?ko(n):"CIMCMYKColor"===t.type?ko(Io(n)):"CIMHSVColor"===t.type?ko(_o(n)):"CIMGrayColor"===t.type?ko(Ao(n)):"#000000"},ko=t=>`#${((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1).split(".")[0]}`,Io=t=>{let n=t[1],e=t[2],r=t[3];return[Math.floor(255*(1-t[0]/100)*(1-r/100)),Math.floor(255*(1-n/100)*(1-r/100)),Math.floor(255*(1-e/100)*(1-r/100))]},_o=t=>{let n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return r*=255,[r,r,r];let i=Math.floor(6*n),o=6*n-i,s=r*(1-e)*255,u=r*(1-e*o)*255,a=r*(1-e*(1-o))*255;return r*=255,i%=6,0===i?[r,a,s]:1===i?[u,r,s]:2===i?[s,r,a]:3===i?[s,u,r]:4===i?[a,s,r]:5===i?[r,s,u]:[-1,-1,-1]},Ao=t=>{const n=t[0],e=n>1?n:255*n;return[e,e,e]},Co=[],No=t=>`0x${t.toString(16)}`,Do=t=>{const n={33:"circle",34:"square",35:"triangle",40:"circle",41:"square",42:"triangle",94:"star",95:"star",203:"cross",204:"cross"};return n.hasOwnProperty(t)?n[t]:(Co.push(`Unsupported symbol from ESRI font (character index ${t}) replaced by default marker`),"circle")},jo=(t,n,e,r=!0)=>{if(null===t||"object"!=typeof t||!t.hasOwnProperty(n))return e;const i=parseFloat(t[n]);if(isNaN(i))return e;const o=Fo(i);return r?o:Math.round(o)},Po=t=>{for(let n of t)if("CIMSolidStroke"===n.type)return[Mo(n.color??""),jo(n,"width",0),To(n.color??"")];return["#000000",0,0]},Lo=t=>{let n="#ffffff";return t.some((t=>{if(!t.type)return!1;if("CIMSolidFill"===t.type)return n=Mo(t.color??""),!0;if("CIMCharacterMarker"===t.type){if(t.symbol.symbolLayers)return n=Lo(t.symbol.symbolLayers),!0}else if("CIMVectorMarker"===t.type){if(t.markerGraphics?.length>0){const e=t.markerGraphics[0];if(e.symbol?.symbolLayers){const t=e.symbol.symbolLayers.filter((t=>t.enable));return n=Lo(t),!0}}return!1}return!1})),n},Ro=t=>{const n=t.find((t=>"CIMSolidFill"===t.type));return n?To(n.color):1},$o=(t,n)=>({args:[n?t.toLowerCase():t],name:"property"}),zo=t=>["&&",...t],Uo=t=>["||",...t],Go=(t,n,e)=>Bo("==",t,n,e),Bo=(t,n,e,r=!0)=>[t,Qo(n,r),Qo(e,!1)],qo=(t,n,e)=>{let r=t;n===wo.Arcade&&(r=Xo(t)),e&&(r=r.toLowerCase());const i=r.match(/\[\s*if\s*\(([^)]+)\)\s*{([^}]*)}\s*\]/is);if(i){const t=i[1],o=i[2],s=4===i.length?Xo(i[3]):"",u=Vo(t,e);return u?{name:"if_then_else",args:[u,qo(o,n,e),s]}:Ko(r)}return/round\s*\(.*\)/i.test(r)?Yo(r,e,""):r.includes("+")||r.includes("&")?(r.includes("+")?r.split("+"):r.split("&")).map((t=>{if((t=t.trimStart().trimEnd()).includes("["))return Ko(t);{const e=t.replaceAll('"',"");return Ho(e,n)}})).join(""):Ho(Ko(r),n)},Wo=(t,n)=>{if((t=t.replace("(","").replace(")","")).includes(" AND ")){const e=t.split(" AND ").map((t=>t.trim()));return zo(e.map((t=>Wo(t,n))))}if(t.includes("=")){const e=t.split("=").map((t=>t.trim()));return Bo("==",e[0],e[1],n)}if(t.includes("<>")){const e=t.split("<>").map((t=>t.trim()));return Bo("!=",e[0],e[1],n)}if(t.includes(">")){const e=t.split(">").map((t=>t.trim()));return Bo(">",e[0],e[1],n)}if(t.toLowerCase().includes(" in ")){const e=(t=t.replace(" IN "," in ")).split(" in "),r=e[0];let i=[];e[1].startsWith("() ")&&(i=e[1].substring(3).split(","));const o=[];if(i.forEach((t=>{o.push(Bo("==",`${Qo(r,n)}`,`${Qo(t,n)}`))})),1===i.length)return o[0];let s=Uo([o[0],o[1]]);for(let t of o.slice(2))s=Uo([s,t]);return s}return Co.push(`Clause skipped because it is not supported as filter: ${t}}`),["==",0,0]},Yo=(t,n,e)=>{const r=t.match(/round\s*\(\s*(?:\[(\w+)\]|{{(\w+)}})\s*,\s*(\d+)\s*\)/i);if(r){const t=r[1]||r[2],i=Number(r[3]),o=$o(t,n);let s;return s=0===i?"#":"#."+"#".repeat(i),{args:[s,o,e],name:"numberFormat"}}return t},Vo=(t,n)=>{const e=Wo(t,n);if(Array.isArray(e)&&3===e.length){let t=String(e[1]);t=t.replace(/^\[(.+)\]$/,"$1").replace(/^{{(.+)}}$/,"$1");const r=$o(t,n),i=Number(e[2]);if(">"===e[0])return{name:"greaterThan",args:[r,i]};if("=="===e[0])return{name:"equalTo",args:[r,i]};if("<"===e[0])return{name:"lessThan",args:[r,i]};if("!="===e[0])return{name:"notEqualTo",args:[r,i]}}return null},Ho=(t,n)=>{let e=t;return e=e.replace(n===wo.Arcade?/TextFormatting\.NewLine/gi:/vbNewLine/gi,"\n"),e=e.replace(/ /g," "),e},Ko=t=>t.replace("[","{{").replace("]","}}").trim(),Xo=t=>t.replace(/\$feature\.(\w+)/g,"[$1]"),Qo=(t,n)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.substring(1).substring(0,t.length-2):"<Null>"===t?null:(n&&t.match(/^[A-zÀ-ú_-][[A-zÀ-ú0-9-_]*$/)&&(t=t.toLowerCase()),t),Zo=t=>{const n=Math.min(...t.map((t=>t[0]))),e=Math.max(...t.map((t=>t[0]))),r=Math.min(...t.map((t=>t[1]))),i=Math.max(...t.map((t=>t[1]))),o=i-r,s=(n+e)/2,u=(r+i)/2;return t.map((t=>[(t[0]-s)/o,(t[1]-u)/o]))},Jo=(t,n)=>Math.sqrt((n[0]-t[0])**2+(n[1]-t[1])**2),ts=(t,n,e,r)=>{const i=[],o=Math.atan2(t[1]-e[1],t[0]-e[0]),s=Math.atan2(n[1]-e[1],n[0]-e[0]),u=Jo(t,e);let a=s-o;a>Math.PI&&(a-=2*Math.PI),a<-Math.PI&&(a+=2*Math.PI);for(let t=1;t<=r;t++){const n=o+a*(t/r),s=e[0]+u*Math.cos(n),c=e[1]+u*Math.sin(n);i.push([s,c])}return i},ns=(t,n,e,r,i)=>{const o=[];for(let s=1;s<=i;s++){const u=s/i,a=u*u,c=a*u,l=1-u,h=l*l,f=h*l;o.push([f*t[0]+3*h*u*n[0]+3*l*a*e[0]+c*r[0],f*t[1]+3*h*u*n[1]+3*l*a*e[1]+c*r[1]])}return o},es=t=>Math.max((t=>Math.abs(t.xmax-t.xmin))(t),(t=>Math.abs(t.ymax-t.ymin))(t)),rs={},is=async(t,n,e,r,i)=>{switch(t.type){case"CIMSolidStroke":return fs(t,n.type);case"CIMSolidFill":return ps(t);case"CIMCharacterMarker":return ds(t,n,e);case"CIMVectorMarker":return ms(t,n,e,r,i);case"CIMHatchFill":return ys(t);case"CIMPictureFill":case"CIMPictureMarker":return await vs(t,n,e);default:return}},os=(t,n,e,r,i=null,o=null,s=!0)=>{const u=[];if("CIMPolygonSymbol"===t.type){const t=as(e,n.markerPlacement||{},s);return t&&u.push(t),u}if("CIMLineSymbol"===t.type){if("CIMCharacterMarker"===n.type){const t=hs(n.markerPlacement);if(t){const e=t=>{const e=cs(n,t,r);e&&u.push(e)};"start"!==t&&"both"!==t||e("start"),"end"!==t&&"both"!==t||e("end")}else{const t=ss(e,n);u.push(t)}return u}const t=ss(e,n);return u.push(t),u}return u},ss=(t,n)=>{const e={kind:"Line",opacity:1,graphicStroke:t},r=n.markerPlacement;if("CIMMarkerPlacementAlongLineSameSize"===n.markerPlacement.type){const i=jo(n,"size",10),o=us(r,i);return"Mark"===t.kind&&(t.wellKnownName.startsWith("wkt://")||0!==t.strokeWidth||(delete t.strokeWidth,delete t.strokeColor,delete t.strokeOpacity)),e.width=i,e.perpendicularOffset=jo(t,"perpendicularOffset",0),e.dasharray=o,e}return e.perpendicularOffset=0,e.graphicStrokeInterval=2*jo(t,"size",0),e.graphicStrokeOffset=0,e},us=(t,n)=>{const e=t?.placementTemplate;if(!e||!e.length)return[];if(1===e.length){const t=Fo(e[0]);return t>=n+1?[t,1]:[n+1,1]}{const t=e.length*n;let r=t=>Math.ceil(Fo(t));return[t,(e?.map(r)||[]).reduce(((t,n)=>t+n),0)-t]}},as=(t,n,e)=>{const r=n.type;return"CIMMarkerPlacementInsidePolygon"===r?{kind:"Fill",fillOpacity:1,graphicFill:t,graphicFillPadding:ls(t,n,e)}:"CIMMarkerPlacementAlongLineSameSize"===r?{kind:"Line",opacity:1,width:jo(t,"size",10),perpendicularOffset:jo(t,"perpendicularOffset",0),graphicStroke:t}:null},cs=(t,n,e)=>{let r;if("start"===n)r=t?.rotation??180;else if("end"===n)r=t?.rotation??0;else{if("both"!==n)return;r=t?.rotation??90}const i=!!e?.replaceesri,o=t.fontFamilyName,s=t.characterIndex,u=No(s);let a,c,l,h,f,p,d;a=o===Eo&&i?Do(s):`ttf://${o}#${u}`;try{c=t.symbol.symbolLayers??[],l=Lo(c),h=Ro(c),[f,p,d]=Po(c)}catch(t){l="#000000",h=1,d=0,f="#000000",p=0}return{opacity:1,fillOpacity:h,strokeColor:f,strokeOpacity:d,strokeWidth:p,rotate:{args:[$o("shape",!0),r],name:"add"},kind:"Mark",color:l,wellKnownName:a,radius:jo(t,"size",10)/2,geometry:[null,["PropertyName","shape"]],inclusion:"mapOnly"}},ls=(t,n,e=!0)=>{const r=Oo.some((n=>t?.wellKnownName?.startsWith(n)));let i;i=e?r?1:So:r?1.8:1;let o=jo(n,"stepX",0),s=jo(n,"stepY",0);const u=Math.round(2*("number"==typeof t.radius?t.radius:0)*i)||1;t.radius=u/2,o<u&&(o=u),s<u&&(s=u);const a=Math.round(o/2-u/2),c=Math.round(o/2-u/2);return[Math.round(s/2-u/2),a,Math.round(s/2-u/2),c]},hs=t=>{if(t?.angleToLine)if("CIMMarkerPlacementAtRatioPositions"===t.type){if(0===t.positionArray[0]&&t.flipFirst)return"start";if(1===t.positionArray[0])return"end"}else if("CIMMarkerPlacementAtExtremities"===t.type){if("Both"===t.extremityPlacement)return"both";if("JustBegin"===t.extremityPlacement)return"start";if("JustEnd"===t.extremityPlacement)return"end"}},fs=(t,n)=>{const e=bs(t);if("CIMPolygonSymbol"===n){const n={kind:"Fill",outlineColor:Mo(t.color),outlineOpacity:To(t.color),outlineWidth:jo(t,"width",0)};return"dasharray"in e&&(n.outlineDasharray=e.dasharray),[n]}const r=t.capStyle.toLowerCase(),i=t.joinStyle.toLowerCase(),o={kind:"Line",color:Mo(t.color),opacity:To(t.color),width:jo(t,"width",0),perpendicularOffset:0,cap:["butt","round","square"].includes(r)?r:void 0,join:["round","bevel","miter"].includes(i)?i:void 0};return"dasharray"in e&&(o.dasharray=e.dasharray),"offset"in e&&(o.perpendicularOffset=e.offset),[o]},ps=t=>{let n=t.color;if(void 0!==n)return[{kind:"Fill",color:Mo(n),fillOpacity:To(n)}]},ds=(t,n,e)=>{const r=!!e.replaceesri,i=t.fontFamilyName,o=t.characterIndex,s=No(o),u=jo(t,"size",12);let a;a=i===Eo&&r?Do(o):`ttf://${i}#${s}`;let c=void 0===t.rotation?0:t.rotation;void 0!==t.rotateClockwise&&t.rotateClockwise||0===c||(c*=-1);let l="#000000",h=1,f="#000000",p=0,d=0,m=t.respectFrame;const y=t.symbol.symbolLayers;y&&(l=Lo(y),h=Ro(y),[f,p,d]=Po(y));const v={opacity:1,offset:Es(t,u),fillOpacity:h,strokeColor:f,strokeOpacity:d,strokeWidth:p,rotate:c,kind:"Mark",color:l,wellKnownName:a,radius:u/2,respectFrame:m},b=os(n,t,v,e,void 0,void 0,m);return b.length?b:[v]},ms=async(t,n,e,r,i)=>{const o=t.size??10,s=t.frame;let u="#ff0000",a="#000000",c=1,l=Fo(o),h=1,f="circle",p=null,d=null;const m=t.markerGraphics||[];if(0===m.length)return[{opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)}];const y=m[0];if(!y.symbol||!y.symbol.symbolLayers)return[{opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)}];const v=s?es(s):void 0,b=(await Ss(y,{},Fo(o),v))[0],g=y.symbol.symbolLayers.filter((t=>t.enable));if(u=Lo(g),[a,c,h]=Po(g),"CIMPointSymbol"===y.symbol.type)f=b.wellKnownName??f,"number"==typeof b.radius&&f?.startsWith("wkt://")&&(l=2*b.radius);else if(["CIMLineSymbol","CIMPolygonSymbol"].includes(y.symbol.type)){const t=y.geometry;if(t){const n=(t=>{const n={wellKnownName:"circle"};if(t.rings){let[n]=t.rings;n=Zo(n);let e=n.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${e}))`,maxX:Math.max(...n.map((t=>t[0]))),maxY:Math.max(...n.map((t=>t[1])))}}const e=t?.paths?.[0];if(e&&2===e[0][0]&&0===e[0][1]&&e[1][0]-2&&0===e[1][1])return{wellKnownName:"wkt://MULTILINESTRING((0 2, 0 0))"};if(t.curveRings){const[e]=t.curveRings,r=e[0],i=e[1];if(i&&2===e.length&&Array.isArray(r)){const t=i?.a||i?.b||i?.c;if(t){const n=t[1];if(JSON.stringify(t[0])===JSON.stringify(r)){const t=Jo(r,n),e=((t,n,e=32)=>{const r=[];for(let i=0;i<e;i++){const o=2*Math.PI*i/e,s=t[0]+n*Math.cos(o),u=t[1]+n*Math.sin(o);r.push([s,u])}return r.push(r[0]),r})(n,t,32),i=Zo(e).map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${i}))`,maxX:t,maxY:t}}}}const o=(t=>{const n=[];for(let e=0;e<t.length;e++){const r=t[e];if(Array.isArray(r)&&"number"==typeof r[0])n.push(r);else if(!Array.isArray(r)&&"object"==typeof r&&null!==r){const t=n[n.length-1]||[0,0];if(r.a&&Array.isArray(r.a)){const e=r.a,i=ts(t,e[0],e[1],16);n.push(...i)}else if(r.b&&Array.isArray(r.b)){const e=r.b,i=ns(t,e[1],e[2],e[0],16);n.push(...i)}else if(r.c&&Array.isArray(r.c)){const e=r.c,i=ts(t,e[0],e[1],16);n.push(...i)}}}return n})(e);if(o.length>0){const t=Zo(o),n=t.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${n}))`,maxX:Math.max(...t.map((t=>t[0]))),maxY:Math.max(...t.map((t=>t[1])))}}return n}return n})(t);if(f=n.wellKnownName,p=jo(n,"maxX",0),d=jo(n,"maxY",0),2===t.curveRings?.[0]?.length)l=1.5*Fo(o);else if(f?.startsWith("wkt://")&&(t.curveRings||r)){const t=r?r/(4/3):o,n=i??(s?es(s):t);l=Fo(t*(t/n))}}}const w={opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)},x=os(n,t,w,e,p,d);return x.length?x:[w]},ys=t=>{const n=t.rotation||0,e=t.lineSymbol.symbolLayers;let r="#000000",i=0,o=0;e&&([r,i,o]=Po(e));let s=xs(n);n%45&&Co.push("Rotation value different than a multiple of 45° is not possible. The nearest value is taken instead.");let u=t.separation||0,a=ws().includes(s)?Fo(u)/2:u;const c={kind:"Mark",color:r,wellKnownName:s,radius:a,strokeColor:r,strokeWidth:i,strokeOpacity:o,rotate:0},l={kind:"Fill",fillOpacity:1,graphicFill:c};if(!e)return[l];let h=bs(e[0]);if("dasharray"in h&&(c.strokeDasharray=h.dasharray,a>0)){let t=h.dasharrayValues.reduce(((t,n)=>t+n),0);if(ws().includes(s)){t/=2;let n=-1*(t-a);l.graphicFillPadding=s===ws()[0]?[n,0,n,0]:[0,n,0,n]}else t=a,Co.push("Unable to keep the original size of CIMHatchFill for line with rotation");c.radius=t}return[l]},vs=async(t,n,e)=>{const r=jo(t,"height",jo(t,"size",0)),i=await(async(t,n)=>{if(!t)return;const e=(t=>{const n=t.split(";");if(2!==n.length)return;const e=n[0].split("/").pop();return e?{data:n[1].substring(7),extension:e}:void 0})(t);if(!e)return t;const r=`image/${e.extension}`,i=Buffer.from(e.data,"base64");let o;try{const t=await rs.read(i),e=((t,n,e)=>{const r=t/Math.max(n,e)*Math.min(n,e);return[n>e?t:r,e>n?t:r]})(n,t.bitmap.height,t.bitmap.width),s=t.resize({h:e[0],w:e[1]});o=await s.getBase64(r)}catch(t){Co.push(`Could not resize image: ${t}`)}return o||t})(t.url,r)??"",o={opacity:1,rotate:0,kind:"Icon",image:i,size:r},s=os(n,t,o,e);return s.length?s:[o]},bs=t=>{let n={};return"effects"in t&&t.effects.forEach((t=>{n={...n,...gs(t)}})),n},gs=t=>{let n=t=>Math.ceil(Fo(t));if("CIMGeometricEffectDashes"===t.type){let e=t.dashTemplate?.map(n)||[];if(e.length>1)return{dasharrayValues:e,dasharray:e}}else if("CIMGeometricEffectOffset"===t.type)return{offset:-1*n(t.offset||0)};return{}},ws=()=>["shape://horline","shape://vertline"],xs=t=>{const n=(t=>(t%360+360)%360)(t),e=ws(),r=["shape://slash","shape://backslash"],i=Math.floor((n+22.5)%180/45);return[e[0],r[0],e[1],r[1]][i]},Es=(t,n)=>{let e=0,r=0;if(t.anchorPoint&&(0!==t.anchorPoint.x||0!==t.anchorPoint.y)){const{x:i,y:o}=t.anchorPoint;"Relative"===(t.anchorPointUnits||"Relative")&&void 0!==n?(e=i*n,r=o*n):(e=Fo(i),r=Fo(o))}if(0!==e||0!==r||void 0===t.offsetX&&void 0===t.offsetY||(e=(t.offsetX||0)*Fo(1)*1.5,r=(t.offsetY||0)*Fo(1)*1.5*-1),0!==e||0!==r)return[e,r]},Ss=async(t,n,e,r)=>{const i=t.symbol,o=[];if(!i||!i.symbolLayers)return o;const s=i.symbolLayers.slice().reverse();for await(const t of s){if(!t.enable)continue;const s=await is(t,i,n,e,r);s&&o.push(...s)}return o},Os=[],Fs=async(t,n)=>{const e={name:t.name,rules:[]};return n={toLowerCase:!0,replaceesri:!1,...n},"CIMFeatureLayer"===t.type?e.rules=await Ts(t,n):"CIMRasterLayer"===t.type&&(e.rules=ks()),e},Ts=async(t,n={})=>{const e=!!n.toLowerCase,r=t.renderer;if(!r)return Co.push(`No renderer on layer: ${t.name}`),[];const i=await Ms(r,n);if(t.labelVisibility)for(const n of t.labelClasses||[])i.push(_s(n,e));return Ns(r,e),i},Ms=async(t,n)=>{const e=[];if("CIMSimpleRenderer"===t.type)return e.push(await As(t,n)),e;if("CIMUniqueValueRenderer"===t.type){const r=t;if(r.groups)for await(const t of r.groups)e.push(...await Cs(r.fields,t,n));else if(r.defaultSymbol){const t={name:"",symbolizers:await Ss(r.defaultSymbol,n)};e.push(t)}return e}if("CIMClassBreaksRenderer"===t.type){const r=t;if(["GraduatedColor","GraduatedSymbol"].includes(r.classBreakType))return e.push(...await Is(r,n)),e}return Co.push(`Unsupported renderer type: ${t}`),e},ks=()=>(Co.push("CIMRasterLayer are not supported yet."),[]),Is=async(t,n={})=>{const e=[],r=[],i=t.field;let o=null;const s=!!n.toLowerCase;Ns(t,s);const u=t.breaks||[];for await(const t of u){const u=await Ss(t.symbol,n),a=t.upperBound||0;let c;c=null!==o?["&&",[">",s?i.toLowerCase():i,o],["<=",s?i.toLowerCase():i,a]]:["<=",s?i.toLowerCase():i,a],o=a;const l={filter:c,symbolizers:u,name:t.label||"classbreak"};r.push(u),e.push(l)}if(!t.showInAscendingOrder){e.reverse();for(const[t,n]of e.entries())n.symbolizers=r[t]}return e},_s=(t,n)=>{if("CIMTextSymbol"!==t.textSymbol?.symbol?.type)return{name:"",symbolizers:[]};const e=t.textSymbol?.symbol,r=qo(t?.expression??"",t.expressionEngine??wo.Arcade,n),i=e?.fontFamilyName||"Arial",o=jo(e,"height",12,!0),s=Lo(e?.symbol?.symbolLayers??[]),u=(t=>"Bold"===t.fontStyleName?"bold":"normal")(e),a=(t.maplexLabelPlacementProperties?.rotationProperties||{}).rotationField,c={kind:"Text",anchor:"right",rotate:0,color:s,font:[i],label:r,size:o,fontWeight:u},l=t.standardLabelPlacementProperties,h=l?.featureType,f=l?.pointPlacementMethod,p=t.maplexLabelPlacementProperties,d=p?.featureType,m=jo(p??{},"primaryOffset",0),y=p?.pointPlacementMethod;if(h===xo.Line&&d===xo.Line){c.placement="line";const t=m??jo(e,"primaryOffset",0);c.perpendicularOffset=0!==t?t+o/2:0}else if(d===xo.Point&&"AroundPoint"===y){const t=m+o/2;c.offset=[t,-1*t]}else if(h===xo.Point&&"AroundPoint"===f){const t=m+o/2;c.offset=[t,-1*t]}else c.offset=[0,0];if(a){const t=$o(a,n);c.rotate={args:[t,-1],name:"mul"}}else c.rotate=0;const v=jo(e,"haloSize",0);if(v&&e.haloSymbol){const t=Lo(e?.haloSymbol?.symbolLayers??[]);Object.assign(c,{haloColor:t,haloWidth:v,haloOpacity:1})}c.group=t.maplexLabelPlacementProperties?.thinDuplicateLabels||d===xo.Polygon&&"OneLabelPerName"===t.standardLabelPlacementProperties?.numLabelsOption;const b={name:"",symbolizers:[c]},g=Ds(t.minimumScale,t.maximumScale);return g&&(b.scaleDenominator=g),t.whereClause&&(b.filter=Wo(t.whereClause,n)),b},As=async(t,n)=>({name:t.label||"",symbolizers:await Ss(t.symbol,n)}),Cs=async(t,n,e)=>{const r=e.toLowerCase||!1,i=[];n.classes=n.classes||[];for await(const o of n.classes){const n=o.label||"label",s=[];o.values.filter((t=>"fieldValues"in t)).forEach((n=>{const e=n.fieldValues;let i=Go(t[0],e[0],r);for(const[n,o]of e.slice(1).map(((n,e)=>[n,t[e+1]])))i=zo([i,Go(`${o}`,`${n}`,r)]);s.push(i)}));let u=null;if(s.length){u=1===s.length?s[0]:Uo(s);const t={name:n,filter:u,symbolizers:await Ss(o.symbol,e)},r=Ds(o.symbol.minScale,o.symbol.maxScale);r&&(t.scaleDenominator=r),i.push(t)}const a=o.alternateSymbols||[];for await(const t of a){const r={name:n,symbolizers:await Ss(t,e)};u&&(r.filter=u);const o=Ds(t.minScale,t.maxScale);o&&(r.scaleDenominator=o),i.push(r)}}return i},Ns=(t,n)=>((t?.visualVariables??[]).find((t=>{if("CIMRotationVisualVariable"!==t.type)return!1;const e=t.visualVariableInfoZ?.valueExpressionInfo?.expression||t.visualVariableInfoZ?.expression;return e?((t,n,e)=>{const r=t.includes("$feature")?Xo(t):Ko(t),i=$o(r,e);return"Arithmetic"===n?{args:[i,-1],name:"mul"}:"Geographic"===n?{args:[i,90],name:"sub"}:null})(e,t.rotationTypeZ,n):null})),null),Ds=(t,n)=>{if(void 0===t&&void 0===n)return null;const e={};return void 0!==t&&(e.max=t),void 0!==n&&(e.min=n),e};class js{static title="ArcGIS Pro lyrx parser";title="ArcGIS Pro lyrx parser";unsupportedProperties={};constructor(t){this.options=t||{}}async readStyle(t){const n=await(async(t,n={})=>[await Fs(t?.layerDefinitions?.[0],n),Os,Co])(t);return Promise.resolve({output:{name:n[0].name,rules:n[0].rules},warnings:Co,errors:[]})}writeStyle(t){return console.log(t),Promise.resolve({output:{stylingRules:[]},errors:[],warnings:[]})}}const Ps="v-map-style",Ls=n(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.styleReady=r(this,"styleReady",7),this.styleError=r(this,"styleError",7)}get el(){return this}format="sld";src;content;layerTargets;autoApply=!0;styleReady;styleError;parsedStyle;isLoading=!1;error;sldParser=new bn;mapboxParser=new Yn;qgisParser=new go;lyrxParser=new js;async connectedCallback(){a(Ps+" - "+l.COMPONENT_CONNECTED_CALLBACK),this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async onStyleSourceChanged(){this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async loadAndParseStyle(){this.isLoading=!0,this.error=void 0;try{let t;if(this.src){const n=await fetch(this.src);if(!n.ok)throw new Error(`Failed to fetch style from ${this.src}: ${n.statusText}`);t=await n.text()}else{if(!this.content)throw new Error("Either src or content must be provided");t=this.content}const n=await this.parseStyle(t);this.parsedStyle=n;const e={style:n,layerIds:this.getLayerTargets()};return this.styleReady.emit(e),a(Ps+" - Style successfully parsed",n),n}catch(t){this.error=t,this.styleError.emit(this.error);const n=function(t){return t.message.startsWith("Failed to fetch style from")}(this.error)?"network":"parse";return this.el.dispatchEvent(new CustomEvent(c.Error,{detail:{type:n,message:this.error.message,cause:this.error},bubbles:!0,composed:!0})),void console.error(Ps+" - Style parsing failed:",t)}finally{this.isLoading=!1}}async parseStyle(t){switch(this.format){case"sld":return this.parseSLD(t);case"mapbox-gl":return this.parseMapboxGL(t);case"qgis":return this.parseQGIS(t);case"lyrx":return this.parseLyrx(t);case"cesium-3d-tiles":return this.parseCesium3DTiles(t);case"geostyler":return this.parseGeoStyler(t);default:throw new Error(`Unsupported style format: ${this.format}`)}}async parseSLD(t){try{const{output:n}=await this.sldParser.readStyle(t);if(!n)throw new Error("Failed to parse SLD - no style output");return n}catch(t){throw new Error(`SLD parsing failed: ${t?.message||t}`)}}async parseMapboxGL(t){try{const n="string"==typeof t?JSON.parse(t):t;if("object"!=typeof n||null===n)throw new Error("Parsed Mapbox GL style is not a valid object");const{output:e}=await this.mapboxParser.readStyle(n);if(!e)throw new Error("Failed to parse Mapbox GL Style - no style output");return e}catch(t){throw new Error(`Mapbox GL Style parsing failed: ${t?.message||t}`)}}async parseQGIS(t){try{const{output:n}=await this.qgisParser.readStyle(t);if(!n)throw new Error("Failed to parse QGIS Style - no style output");return n}catch(t){throw new Error(`QGIS Style parsing failed: ${t?.message||t}`)}}async parseLyrx(t){try{const n="string"==typeof t?JSON.parse(t):t;if("object"!=typeof n||null===n)throw new Error("Parsed LYRX style is not a valid object");const{output:e}=await this.lyrxParser.readStyle(n);if(!e)throw new Error("Failed to parse LYRX (ArcGIS Pro) Style - no style output");return e}catch(t){throw new Error(`LYRX (ArcGIS Pro) Style parsing failed: ${t?.message||t}`)}}async getStyle(){return this.parsedStyle}async parseCesium3DTiles(t){try{const n=JSON.parse(t);if("object"!=typeof n||null===n)throw new Error("Parsed Cesium 3D Tiles style is not a valid object");return n}catch(t){throw new Error(`Cesium 3D Tiles style parsing failed: ${t?.message||t}`)}}async parseGeoStyler(t){try{const n=JSON.parse(t);if("object"!=typeof n||null===n)throw new Error("Parsed GeoStyler style is not a valid object");if("string"!=typeof n.name||!Array.isArray(n.rules))throw new Error('GeoStyler style must have "name" (string) and "rules" (array)');return n}catch(t){throw new Error(`GeoStyler style parsing failed: ${t?.message||t}`)}}async getLayerTargetIds(){return this.getLayerTargets()}getLayerTargets(){return this.layerTargets?this.layerTargets.split(",").map((t=>t.trim())):[]}isStyleLoading(){return this.isLoading}getError(){return this.error}render(){return i("div",{key:"a913bf37c39b0dc70522bb813809c38e5e099ebe",class:"style-container"},this.isLoading&&i("div",{key:"b8a28051b8ff2ae1d80b1a0af110f9e8342e2260",class:"loading"},"Loading style..."),this.error&&i("div",{key:"b7db13abadd3f11f5916296d3e0278ce9044fafc",class:"error"},"Style Error: ",this.error.message),this.parsedStyle&&i("div",{key:"56e9327b9794d3eb09c520a17cc1103538f42453",class:"success"},"Style loaded (",this.format.toUpperCase(),")",this.getLayerTargets().length>0&&i("div",{key:"b08e604f7fbec96aede1112538b0d785e9b3d226",class:"targets"},"Targets: ",this.getLayerTargets().join(", "))),i("slot",{key:"609e6131f414425f639cc81104cbb20da61bc1de"}))}static get watchers(){return{src:[{onStyleSourceChanged:0}],content:[{onStyleSourceChanged:0}],format:[{onStyleSourceChanged:0}]}}static get style(){return":host{display:block;position:relative}.style-container{min-height:20px}.loading{padding:8px;background-color:#f0f0f0;border-left:4px solid #2196f3;font-size:14px;color:#666}.error{padding:8px;background-color:#ffebee;border-left:4px solid #f44336;color:#c62828;font-size:14px}.success{padding:8px;background-color:#e8f5e8;border-left:4px solid #4caf50;color:#2e7d32;font-size:14px}.targets{margin-top:4px;font-size:12px;color:#666}"}},[769,"v-map-style",{format:[513],src:[513],content:[513],layerTargets:[513,"layer-targets"],autoApply:[516,"auto-apply"],parsedStyle:[32],isLoading:[32],error:[32],getStyle:[64],getLayerTargetIds:[64]},void 0,{src:[{onStyleSourceChanged:0}],content:[{onStyleSourceChanged:0}],format:[{onStyleSourceChanged:0}]}]);function Rs(){"undefined"!=typeof customElements&&["v-map-style"].forEach((n=>{"v-map-style"===n&&(customElements.get(t(n))||customElements.define(t(n),Ls))}))}Rs();export{Ls as V,Rs as d}
|
|
10
|
+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){!function(t){O(t),""!==t.cdata&&(S(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(S(t,"onscript",t.script),t.script="")}(this)}};try{n=require("stream").Stream}catch(t){n=function(){}}n||(n=function(){});var i=t.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function o(t,e){if(!(this instanceof o))return new o(t,e);n.apply(this),this._parser=new r(t,e),this.writable=!0,this.readable=!0;var s=this;this._parser.onend=function(){s.emit("end")},this._parser.onerror=function(t){s.emit("error",t),s._parser.error=null},this._decoder=null,i.forEach((function(t){Object.defineProperty(s,"on"+t,{get:function(){return s._parser["on"+t]},set:function(n){if(!n)return s.removeAllListeners(t),s._parser["on"+t]=n,n;s.on(t,n)},enumerable:!0,configurable:!1})}))}(o.prototype=Object.create(n.prototype,{constructor:{value:o}})).write=function(t){return"function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)&&(this._decoder||(this._decoder=new(0,Xi.StringDecoder)("utf8")),t=this._decoder.write(t)),this._parser.write(t.toString()),this.emit("data",t),!0},o.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},o.prototype.on=function(t,e){var r=this;return r._parser["on"+t]||-1===i.indexOf(t)||(r._parser["on"+t]=function(){var n=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);n.splice(0,0,t),r.emit.apply(r,n)}),n.prototype.on.call(r,t,e)};var s="[CDATA[",u="DOCTYPE",a="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/2000/xmlns/",l={xml:a,xmlns:c},h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,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 m(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function y(t){return'"'===t||"'"===t}function v(t){return">"===t||m(t)}function b(t,n){return t.test(n)}function g(t,n){return!b(t,n)}var w=0;for(var x in t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},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(n){var e=t.ENTITIES[n],r="number"==typeof e?String.fromCharCode(e):e;t.ENTITIES[n]=r})),t.STATE)t.STATE[t.STATE[x]]=x;function E(t,n,e){t[n]&&t[n](e)}function S(t,n,e){t.textNode&&O(t),E(t,n,e)}function O(t){t.textNode=F(t.opt,t.textNode),t.textNode&&E(t,"ontext",t.textNode),t.textNode=""}function F(t,n){return t.trim&&(n=n.trim()),t.normalize&&(n=n.replace(/\s+/g," ")),n}function T(t,n){return O(t),t.trackPosition&&(n+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),n=new Error(n),t.error=n,E(t,"onerror",n),t}function M(t){return t.sawRoot&&!t.closedRoot&&k(t,"Unclosed root tag"),t.state!==w.BEGIN&&t.state!==w.BEGIN_WHITESPACE&&t.state!==w.TEXT&&T(t,"Unexpected end"),O(t),t.c="",t.closed=!0,E(t,"onend"),r.call(t,t.strict,t.opt),t}function k(t,n){if("object"!=typeof t||!(t instanceof r))throw new Error("bad call to strictFail");t.strict&&T(t,n)}function I(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var n=t.tags[t.tags.length-1]||t,e=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(e.ns=n.ns),t.attribList.length=0,S(t,"onopentagstart",e)}function _(t,n){var e=t.indexOf(":")<0?["",t]:t.split(":"),r=e[0],i=e[1];return n&&"xmlns"===t&&(r="xmlns",i=""),{prefix:r,local:i}}function A(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var n=_(t.attribName,!0),e=n.local;if("xmlns"===n.prefix)if("xml"===e&&t.attribValue!==a)k(t,"xml: prefix must be bound to "+a+"\nActual: "+t.attribValue);else if("xmlns"===e&&t.attribValue!==c)k(t,"xmlns: prefix must be bound to "+c+"\nActual: "+t.attribValue);else{var r=t.tag,i=t.tags[t.tags.length-1]||t;r.ns===i.ns&&(r.ns=Object.create(i.ns)),r.ns[e]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,S(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function C(t,n){if(t.opt.xmlns){var e=t.tag,r=_(t.tagName);e.prefix=r.prefix,e.local=r.local,e.uri=e.ns[r.prefix]||"",e.prefix&&!e.uri&&(k(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),e.uri=r.prefix),e.ns&&(t.tags[t.tags.length-1]||t).ns!==e.ns&&Object.keys(e.ns).forEach((function(n){S(t,"onopennamespace",{prefix:n,uri:e.ns[n]})}));for(var i=0,o=t.attribList.length;i<o;i++){var s=t.attribList[i],u=s[0],a=s[1],c=_(u,!0),l=c.prefix,h=""===l?"":e.ns[l]||"",f={name:u,value:a,prefix:l,local:c.local,uri:h};l&&"xmlns"!==l&&!h&&(k(t,"Unbound namespace prefix: "+JSON.stringify(l)),f.uri=l),t.tag.attributes[u]=f,S(t,"onattribute",f)}t.attribList.length=0}t.tag.isSelfClosing=!!n,t.sawRoot=!0,t.tags.push(t.tag),S(t,"onopentag",t.tag),n||(t.state=t.noscript||"script"!==t.tagName.toLowerCase()?w.TEXT:w.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function N(t){if(!t.tagName)return k(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=w.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=w.SCRIPT);S(t,"onscript",t.script),t.script=""}var n=t.tags.length,e=t.tagName;t.strict||(e=e[t.looseCase]());for(var r=e;n--&&t.tags[n].name!==r;)k(t,"Unexpected close tag");if(n<0)return k(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=w.TEXT);t.tagName=e;for(var i=t.tags.length;i-- >n;){var o=t.tag=t.tags.pop();t.tagName=t.tag.name,S(t,"onclosetag",t.tagName);var s={};for(var u in o.ns)s[u]=o.ns[u];t.opt.xmlns&&o.ns!==(t.tags[t.tags.length-1]||t).ns&&Object.keys(o.ns).forEach((function(n){S(t,"onclosenamespace",{prefix:n,uri:o.ns[n]})}))}0===n&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=w.TEXT}function D(t){var n,e=t.entity,r=e.toLowerCase(),i="";return t.ENTITIES[e]?t.ENTITIES[e]:t.ENTITIES[r]?t.ENTITIES[r]:("#"===(e=r).charAt(0)&&("x"===e.charAt(1)?(e=e.slice(2),i=(n=parseInt(e,16)).toString(16)):(e=e.slice(1),i=(n=parseInt(e,10)).toString(10))),e=e.replace(/^0+/,""),isNaN(n)||i.toLowerCase()!==e?(k(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(n))}function j(t,n){"<"===n?(t.state=w.OPEN_WAKA,t.startTagPosition=t.position):m(n)||(k(t,"Non-whitespace before first tag."),t.textNode=n,t.state=w.TEXT)}function P(t,n){var e="";return n<t.length&&(e=t.charAt(n)),e}w=t.STATE,String.fromCodePoint||function(){var t=String.fromCharCode,n=Math.floor,e=function(){var e=[],r=-1,i=arguments.length;if(!i)return"";for(var o="";++r<i;){var s=Number(arguments[r]);if(!isFinite(s)||s<0||s>1114111||n(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?e.push(s):e.push(55296+((s-=65536)>>10),s%1024+56320),(r+1===i||e.length>16384)&&(o+=t.apply(null,e),e.length=0)}return o};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:e,configurable:!0,writable:!0}):String.fromCodePoint=e}()}(Vi)),Vi}const Zi=Symbol("listenersMap");class Ji{constructor(){this[Zi]=new Map}addListener(t,n){return this.on(t,n)}on(t,n){if("function"!=typeof n)throw new TypeError("listener must be a function");const e=this[Zi],r=e.get(t);return r?r.push(n):e.set(t,[n]),this}once(t,n){if("function"!=typeof n)throw new TypeError("listener must be a function");const e=(...r)=>{this.off(t,e),n.apply(this,r)};return e.listener=n,this.on(t,e)}removeListener(t,n){if(!n)return this;const e=this[Zi],r=e.get(t);if(!r)return this;for(let t=r.length-1;t>=0;t-=1){const e=r[t];e!==n&&e.listener!==n||r.splice(t,1)}return 0===r.length&&e.delete(t),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){const n=this[Zi];return void 0===t?n.clear():n.delete(t),this}emit(t,...n){const e=this[Zi].get(t);return!(!e||0===e.length||(e.slice().forEach((t=>t.apply(this,n))),0))}listeners(t){const n=this[Zi].get(t);return n?n.slice():[]}listenerCount(t){return this.listeners(t).length}}Ji.prototype.addListener=Ji.prototype.on;var to,no=u(Object.freeze({__proto__:null,EventEmitter:Ji,default:{EventEmitter:Ji,defaultMaxListeners:10},defaultMaxListeners:10})),eo={};function ro(){return to||(to=1,function(){eo.stripBOM=function(t){return"\ufeff"===t[0]?t.substring(1):t}}.call(eo)),eo}var io,oo={};function so(){return io||(io=1,function(){var t;t=new RegExp(/(?!xmlns)^.*:/),oo.normalize=function(t){return t.toLowerCase()},oo.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},oo.stripPrefix=function(n){return n.replace(t,"")},oo.parseNumbers=function(t){return isNaN(t)||(t=t%1==0?parseInt(t,10):parseFloat(t)),t},oo.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t="true"===t.toLowerCase()),t}}.call(oo)),oo}var uo,ao,co,lo={};function ho(){return ao||(ao=1,function(t){(function(){var n,e,r,i,o,s,u,a,c,l=function(t,n){return function(){return t.apply(n,arguments)}},h={}.hasOwnProperty;a=Qi(),i=no,n=ro(),u=so(),c=function(){if(uo)return lo;uo=1,lo.every=function(t){return new e(t)};var t={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5};for(var n in t)"millisecond"===n?t.ms=t[n]:t[n.charAt(0)]=t[n],t[n+"s"]=t[n];function e(n){this.count=0;var e=function(n){var e=n.match(r);return e&&t[e[2]]?e.slice(1):null}(n);e&&(this.time=Number(e[0])*t[e[1]],this.type=e[1])}e.prototype.do=function(t){this.time&&(this.interval=setInterval((function(){n.count++,t.call(n)}),this.time));var n=this;return this},e.prototype.stop=function(){return this.interval&&(clearInterval(this.interval),delete this.interval),this};var r=/^\s*(\d+(?:\.\d+)?)\s*([a-z]+)\s*$/;return lo}().setImmediate,e=xe().defaults,o=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},s=function(t,n,e){var r,i;for(r=0,i=t.length;r<i;r++)n=(0,t[r])(n,e);return n},r=function(t,n,e){var r;return(r=Object.create(null)).value=e,r.writable=!0,r.enumerable=!0,r.configurable=!0,Object.defineProperty(t,n,r)},t.Parser=function(i){function f(n){var r,i;if(this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this),!(this instanceof t.Parser))return new t.Parser(n);for(r in this.options={},i=e[.2])h.call(i,r)&&(this.options[r]=i[r]);for(r in n)h.call(n,r)&&(this.options[r]=n[r]);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 function(t,n){for(var e in n)h.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(f,i),f.prototype.processAsync=function(){var t,n;try{return this.remaining.length<=this.options.chunkSize?(t=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(t),this.saxParser.close()):(t=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(t),c(this.processAsync))}catch(t){if(n=t,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(n)}},f.prototype.assignOrPush=function(t,n,e){return n in t?(t[n]instanceof Array||r(t,n,[t[n]]),t[n].push(e)):r(t,n,this.options.explicitArray?[e]:e)},f.prototype.reset=function(){var t,n,e,i,u;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(u=this,function(t){if(u.saxParser.resume(),!u.saxParser.errThrown)return u.saxParser.errThrown=!0,u.emit("error",t)}),this.saxParser.onend=function(t){return function(){if(!t.saxParser.ended)return t.saxParser.ended=!0,t.emit("end",t.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,i=[],t=this.options.attrkey,n=this.options.charkey,this.saxParser.onopentag=function(e){return function(o){var u,a,c,l,f;if((c={})[n]="",!e.options.ignoreAttrs)for(u in f=o.attributes)h.call(f,u)&&(t in c||e.options.mergeAttrs||(c[t]={}),a=e.options.attrValueProcessors?s(e.options.attrValueProcessors,o.attributes[u],u):o.attributes[u],l=e.options.attrNameProcessors?s(e.options.attrNameProcessors,u):u,e.options.mergeAttrs?e.assignOrPush(c,l,a):r(c[t],l,a));return c["#name"]=e.options.tagNameProcessors?s(e.options.tagNameProcessors,o.name):o.name,e.options.xmlns&&(c[e.options.xmlnskey]={uri:o.uri,local:o.local}),i.push(c)}}(this),this.saxParser.onclosetag=function(t){return function(){var e,u,a,c,l,f,p,d,m,y;if(f=i.pop(),l=f["#name"],t.options.explicitChildren&&t.options.preserveChildrenOrder||delete f["#name"],!0===f.cdata&&(e=f.cdata,delete f.cdata),m=i[i.length-1],f[n].match(/^\s*$/)&&!e?(u=f[n],delete f[n]):(t.options.trim&&(f[n]=f[n].trim()),t.options.normalize&&(f[n]=f[n].replace(/\s{2,}/g," ").trim()),f[n]=t.options.valueProcessors?s(t.options.valueProcessors,f[n],l):f[n],1===Object.keys(f).length&&n in f&&!t.EXPLICIT_CHARKEY&&(f=f[n])),o(f)&&(f="function"==typeof t.options.emptyTag?t.options.emptyTag():""!==t.options.emptyTag?t.options.emptyTag:u),null!=t.options.validator&&(y="/"+function(){var t,n,e;for(e=[],t=0,n=i.length;t<n;t++)e.push((c=i[t])["#name"]);return e}().concat(l).join("/"),function(){try{return f=t.options.validator(y,m&&m[l],f)}catch(n){return t.emit("error",n)}}()),t.options.explicitChildren&&!t.options.mergeAttrs&&"object"==typeof f)if(t.options.preserveChildrenOrder){if(m){for(a in m[t.options.childkey]=m[t.options.childkey]||[],p={},f)h.call(f,a)&&r(p,a,f[a]);m[t.options.childkey].push(p),delete f["#name"],1===Object.keys(f).length&&n in f&&!t.EXPLICIT_CHARKEY&&(f=f[n])}}else c={},t.options.attrkey in f&&(c[t.options.attrkey]=f[t.options.attrkey],delete f[t.options.attrkey]),!t.options.charsAsChildren&&t.options.charkey in f&&(c[t.options.charkey]=f[t.options.charkey],delete f[t.options.charkey]),Object.getOwnPropertyNames(f).length>0&&(c[t.options.childkey]=f),f=c;return i.length>0?t.assignOrPush(m,l,f):(t.options.explicitRoot&&(d=f,r(f={},l,d)),t.resultObject=f,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),e=function(t){return function(e){var r,o;if(o=i[i.length-1])return o[n]+=e,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==e.replace(/\\n/g,"").trim())&&(o[t.options.childkey]=o[t.options.childkey]||[],(r={"#name":"__text__"})[n]=e,t.options.normalize&&(r[n]=r[n].replace(/\s{2,}/g," ").trim()),o[t.options.childkey].push(r)),o}}(this),this.saxParser.ontext=e,this.saxParser.oncdata=function(t){var n;if(n=e(t))return n.cdata=!0}},f.prototype.parseString=function(t,e){var r;null!=e&&"function"==typeof e&&(this.on("end",(function(t){return this.reset(),e(null,t)})),this.on("error",(function(t){return this.reset(),e(t)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=n.stripBOM(t),this.options.async?(this.remaining=t,c(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(t){if(r=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",r),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw r}},f.prototype.parseStringPromise=function(t){return new Promise((n=this,function(e,r){return n.parseString(t,(function(t,n){return t?r(t):e(n)}))}));var n},f}(i),t.parseString=function(n,e,r){var i,o;return null!=r?("function"==typeof r&&(i=r),"object"==typeof e&&(o=e)):("function"==typeof e&&(i=e),o={}),new t.Parser(o).parseString(n,i)},t.parseStringPromise=function(n,e){var r;return"object"==typeof e&&(r=e),new t.Parser(r).parseStringPromise(n)}}).call(Yi)}(Yi)),Yi}var fo=(co||(co=1,function(){var t,n,e,r,i={}.hasOwnProperty;n=xe(),t=Wi(),e=ho(),r=so(),ge.defaults=n.defaults,ge.processors=r,ge.ValidationError=function(){function t(t){this.message=t}return function(t,n){for(var e in n)i.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype}(t,Error),t}(),ge.Builder=t.Builder,ge.Parser=e.Parser,ge.parseString=e.parseString,ge.parseStringPromise=e.parseStringPromise}.call(ge)),ge);const po=(t,n,e)=>{const r=e=>String.prototype.split.call(n,e).filter(Boolean).reduce(((t,n)=>null!=t?t[n]:t),t),i=r(/[,[\]]+?/)||r(/[,[\].]+?/);return void 0===i||i===t?e:i},mo=[2,2],yo=[10,2],vo={solid:void 0,dot:mo,dash:yo,"dash dot":[...yo,...mo],"dash dot dot":[...yo,...mo,...mo]},bo={left:"L",right:"R",top:"T",bottom:"B","top-left":"TL","top-right":"TR","bottom-left":"BL","bottom-right":"BR"};class go{cqlParser=new Hn;static title="QGIS Style Parser";title="QGIS Style Parser";qgisVersion;writePropsAsOptions;constructor(t={}){this.qgisVersion=t.qgisVersion??"3.28.0-Firenze",this.writePropsAsOptions=this.compareVersions("3.28.0-Firenze",this.qgisVersion)>=0}compareVersions(t,n){try{const e=t=>t.split("-")[0].split(".").map(Number),[r,i,o]=e(t),[s,u,a]=e(n);return Math.sign(s-r)||Math.sign(u-i)||Math.sign(a-o)}catch(t){return 0}}readStyle=async t=>{const n={};try{let e;return fo.parseString(t,n,((t,n)=>{if(t)return void(e={errors:[t]});const r=this.qmlObjectToGeoStylerStyle(n);e={output:r}})),e||{errors:[]}}catch(t){return{errors:[t]}}};parseLabelTemplates(t){let n="";return t.split("||").forEach((t=>{const e=t.match(/[']([^']+)[']/);n+=e?e[1]:`{{${t.trim()}}}`})),n}qmlSymbolizerLayerPropsToObject(t){const n={};return t.prop&&t.prop.forEach((t=>{n[t.$.k]=t.$.v})),t.Option&&t.Option[0].Option&&t.Option[0].Option.forEach((t=>{n[t.$.name]=t.$.value})),n}qmlObjectToGeoStylerStyle(t){return{name:"QGIS Style",rules:this.getRulesFromQmlObject(t)}}qmlColorFromHexAndOpacity(t,n){n=Number.isNaN(Number(n))?1:n;const e=be(t).alpha(n||1).rgb().array(),r=void 0===e[3]||isNaN(e[3])?255:0===e[3]?0:255*e[3];return`${e[0]},${e[1]},${e[2]},${Math.round(r)}`}qmlColorToOpacity(t){const n=t.split(","),e=parseFloat(n[3])/255;return Math.round(100*e)/100}qmlColorToHex(t){const n=t.split(",");return be(`rgb(${n[0]},${n[1]},${n[2]})`).hex()}getRulesFromQmlObject(t){const n=po(t,"qgis.renderer-v2.[0]"),e=po(n,"rules[0].rule"),r=po(n,"categories[0].category"),i=po(n,"ranges[0].range"),o=po(n,"symbols[0].symbol"),s=po(t,"qgis.labeling.[0]");let u=[],a={},c={};if(Array.isArray(o)&&(a=this.parseQmlSymbolizers(o)),s&&(c=this.parseQmlLabeling(s)),Array.isArray(e)&&e.length>0)e.forEach((t=>{const n=this.getFilterFromQmlRule(t),e=this.getScaleDenominatorFromRule(t);let r={name:t.$.label||t.$.filter};n&&(r.filter=n),e&&(r.scaleDenominator=e),Object.keys(a).length>0&&a[t.$.symbol]&&(r.symbolizers=a[t.$.symbol]),u.push(r)}));else if(Array.isArray(r)&&r.length>0){const n=po(t,"qgis.renderer-v2.[0].$.attr");r.forEach((t=>{const e=t.$.value;let r={name:`${n} = ${e}`,filter:["==",n,e]};a&&a[t.$.symbol]&&(r.symbolizers=a[t.$.symbol]),u.push(r)}))}else if(Array.isArray(i)&&i.length>0){const n=po(t,"qgis.renderer-v2.[0].$.attr");i.forEach((t=>{let e={name:t.$.label,filter:["&&",[">=",n,t.$.lower],["<=",n,t.$.upper]]};a&&a[t.$.symbol]&&(e.symbolizers=a[t.$.symbol]),u.push(e)}))}else{const t={name:"QGIS Simple Symbol",symbolizers:[...a[Object.keys(a)[0]]||[],...c[Object.keys(c)[0]]||[]]};try{const n=this.cqlParser.read(Object.keys(c)[0]);n&&(t.filter=n)}catch(t){}u.push(t)}return u}getFilterFromQmlRule(t){const n=po(t,"$.filter");if(n)return this.cqlParser.read(n)}getScaleDenominatorFromRule(t){const n=po(t,"$.scalemaxdenom"),e=po(t,"$.scalemindenom");let r={};return e&&(r.min=Number(e)),n&&(r.max=Number(n)),r.min||r.max?r:void 0}parseQmlLabeling(t){const n=t.$.type,e={};if("rule-based"===n&&po(t,"rules[0].rule").forEach(((t,n)=>{const r=po(t,"settings[0]"),i=this.getTextSymbolizerFromLabelSettings(r);e[t.$.filter||n]=[i]})),"simple"===n){const n=po(t,"settings[0]"),r=this.getTextSymbolizerFromLabelSettings(n);e.a=[r]}return e}getTextSymbolizerFromLabelSettings(t){let n={kind:"Text"};const e=po(t,"text-style[0].$"),r=po(t,"placement[0].$");return e.textColor&&(n.color=this.qmlColorToHex(e.textColor)),e.fieldName&&(n.label=this.parseLabelTemplates(e.fieldName)),e.fontSize&&(n.size=parseFloat(e.fontSize)),e.fontFamily&&(n.font=[e.fontFamily]),e.fontWeight&&e.fontWeight>=70&&(n.fontWeight="bold"),e.fontItalic&&parseFloat(e.fontItalic)>0&&(n.fontStyle="italic"),e.fontLetterSpacing&&parseFloat(e.fontLetterSpacing)>0&&(n.letterSpacing=parseFloat(e.fontLetterSpacing)),e.multilineHeight&&parseFloat(e.multilineHeight)>0&&(n.lineHeight=parseFloat(e.multilineHeight)),(parseFloat(r.xOffset)>0||parseFloat(r.yOffset)>0)&&(n.offset=[parseFloat(r.xOffset),parseFloat(r.yOffset)]),n}parseQmlSymbolizers(t){const n={};return t.forEach((t=>{const e=po(t,"$.name");let r;switch(po(t,"$.type")){case"marker":r=this.getPointSymbolizersFromQmlSymbolizer(t);break;case"line":r=this.getLineSymbolizersFromQmlSymbolizer(t);break;case"fill":r=this.getFillSymbolizerFromQmlSymbolizer(t);break;default:throw new Error("Failed to parse SymbolizerKind from qmlSymbolizer")}n[e]=r})),n}getPointSymbolizersFromQmlSymbolizer(t){return t.layer.map((t=>{const n=t.$.class;switch(n){case"SimpleMarker":return this.getPointSymbolizerFromMarkLayer(t);case"SvgMarker":return this.getPointSymbolizerFromSvgLayer(t);default:throw new Error(`Failed to parse MarkerClass ${n} from qmlSymbolizer`)}}))}getPointSymbolizerFromMarkLayer(t){let n={kind:"Mark"};const e=this.qmlSymbolizerLayerPropsToObject(t);return n.wellKnownName=e.name,e.color&&(n.opacity=this.qmlColorToOpacity(e.color),n.color=this.qmlColorToHex(e.color)),e.angle&&(n.rotate=parseFloat(e.angle)),e.size&&(n.radius=parseFloat(e.size)/2),e.outline_color&&(n.strokeOpacity=this.qmlColorToOpacity(e.outline_color),n.strokeColor=this.qmlColorToHex(e.outline_color)),e.outline_width&&(n.strokeWidth=parseFloat(e.outline_width)),n}getLineSymbolizersFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:n}=this;return t.layer.map((t=>{let e={kind:"Line"};const r=n(t);if(r.line_color&&(e.opacity=this.qmlColorToOpacity(r.line_color),e.color=this.qmlColorToHex(r.line_color)),r.capstyle&&(e.cap=r.capstyle),r.joinstyle&&(e.join=r.joinstyle),r.use_custom_dash&&"0"!==r.use_custom_dash)r.customdash&&(e.dasharray=r.customdash.split(";").map(parseFloat));else{const t=vo[r?.line_style||"solid"];t&&(e.dasharray=t)}return r.offset&&(e.perpendicularOffset=parseFloat(r.offset)),r.line_width&&(e.width=parseFloat(r.line_width)),e}))}getFillSymbolizerFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:n}=this;return t.layer.flatMap((t=>{let e={kind:"Fill"};const r=n(t);let i=r?.outline_style||"solid";r.outline_color&&"no"!==i&&(e.outlineColor=this.qmlColorToHex(r.outline_color));const o=r?.line_style;!e.outlineColor&&o&&"no"!==o&&(i=o,e.outlineColor=this.qmlColorToHex(r.line_color));let s=r?.style||"solid";r.color&&"solid"===s&&(e.opacity=this.qmlColorToOpacity(r.color),e.color=this.qmlColorToHex(r.color));const u=vo[i];if(u&&(e.outlineDasharray=u),r.outline_width&&"no"!==i&&(e.outlineWidth=parseFloat(r.outline_width)),e.outlineColor&&!e.color&&"no"!==s&&(e.color="transparent"),"PointPatternFill"===t.$.class){const n=t.symbol.flatMap((t=>this.getPointSymbolizersFromQmlSymbolizer(t)));if(n.length>1)return n.map((t=>({...e,graphicFill:t})));1===n.length&&(e.graphicFill=n[0])}return[e]}))}getPointSymbolizerFromSvgLayer(t){let n={kind:"Icon"};const e=this.qmlSymbolizerLayerPropsToObject(t);if(e.color){const t=e.color.split(",");n.opacity=parseFloat(t[3])/255;const r=be(`rgb(${t[0]},${t[1]},${t[2]})`);n.color=r.hex()}if(e.angle&&(n.rotate=parseFloat(e.angle)),e.size&&(n.size=parseFloat(e.size)),e.offset){const t=e.offset.split(",").map(parseFloat);(t[0]>0||t[1]>0)&&(n.offset=e.offset.split(",").map(parseFloat))}return e.name&&(n.image=e.name),n}writeStyle(t){return new Promise((n=>{try{const e=new fo.Builder,r=this.geoStylerStyleToQmlObject(t);this.convertTextSymbolizers(r,t),n({output:e.buildObject(r).replace('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',"<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>")})}catch(t){n({errors:[t]})}}))}getQmlFilterFromFilter(t){return this.cqlParser.write(t)}getQmlRuleFromRule(t,n){const e=t.filter,r={$:{key:`renderer_rule_${n}`,symbol:`${n}`,label:t.name}};return t.scaleDenominator&&(t.scaleDenominator.min&&(r.$.scalemindenom=t.scaleDenominator.min),t.scaleDenominator.max&&(r.$.scalemaxdenom=t.scaleDenominator.max)),e&&this.getQmlFilterFromFilter(e)&&(r.$.filter=this.getQmlFilterFromFilter(e)),r}getQmlSymbolsFromStyle(t,n){return t.rules.map(((t,e)=>{const r=this.getQmlSymbolFromRule(t,e);return r&&n.push(this.getQmlRuleFromRule(t,e)),r})).filter((t=>t))}getQmlSymbolFromRule(t,n){const e=this.getQmlLayersFromRule(t);let r;if(t.symbolizers.length){switch(t.symbolizers[0].kind){case"Line":r="line";break;case"Fill":r="fill";break;default:r="marker"}return e&&e[0]?{$:{type:r,name:n.toString()},layer:e}:void 0}}getQmlLineSymbolFromSymbolizer(t){let n;Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity));const e={line_color:n,offset:t.perpendicularOffset,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",joinstyle:t.join,capstyle:t.cap,line_width:t.width,line_width_unit:"Pixel"};return t.dasharray&&(e.customdash=t.dasharray.join(";"),e.use_custom_dash="1"),{$:{class:"SimpleLine"},...this.propsObjectToQmlSymbolOptions(e)}}getQmlFillSymbolFromSymbolizer(t){const n=void 0!==t.fillOpacity?t.fillOpacity:t.opacity,e=void 0!==t.outlineOpacity?t.outlineOpacity:t.opacity;let r,i;Dn(t.color)||Dn(n)||(r=this.qmlColorFromHexAndOpacity(t.color,n)),Dn(t.outlineColor)||Dn(e)||(i=this.qmlColorFromHexAndOpacity(t.outlineColor,e));const o={color:r,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",outline_style:t.outlineDasharray?"dash":"solid",outline_width:t.outlineWidth||"0",outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",customdash:t.outlineDasharray?t.outlineDasharray.join(";"):void 0,outline_color:i};return{$:{class:"SimpleFill"},...this.propsObjectToQmlSymbolOptions(o)}}getQmlLayersFromRule(t){const n=t.symbolizers.map(this.getQmlLayerFromSymbolizer.bind(this)).filter((t=>t));return n.length?n:void 0}getQmlLayerFromSymbolizer(t){switch(t.kind){case"Fill":return this.getQmlFillSymbolFromSymbolizer(t);case"Icon":return this.getQmlMarkSymbolFromIconSymbolizer(t);case"Line":return this.getQmlLineSymbolFromSymbolizer(t);case"Mark":return this.getQmlMarkSymbolFromSymbolizer(t)}}getQmlMarkSymbolFromIconSymbolizer(t){let n;return Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),{$:{class:"SvgMarker"},...this.propsObjectToQmlSymbolOptions({angle:t.rotate||0,color:n,name:t.image,size:t.size,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"})}}getQmlMarkSymbolFromSymbolizer(t){let n,e,r;Dn(t.color)||Dn(t.opacity)||(n=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),Dn(t.strokeColor)||Dn(t.strokeOpacity)||(e=this.qmlColorFromHexAndOpacity(t.strokeColor,t.strokeOpacity)),Dn(t.radius)||(r=t.radius?2*t.radius:void 0);const i={angle:t.rotate||0,color:n,name:t.wellKnownName.toLowerCase(),outline_color:e,outline_style:"solid",outline_width:t.strokeWidth||0,outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",size:r,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"};return{$:{class:"SimpleMarker"},...this.propsObjectToQmlSymbolOptions(i)}}propsObjectToQmlSymbolOptions(t){return this.writePropsAsOptions?this.propsObjectToQmlSymbol_NewerOptions(t):this.propsObjectToQmlSymbol_OlderProps(t)}propsObjectToQmlSymbol_NewerOptions(t){const n=Object.keys(t).map((n=>({$:{name:n,value:t[n],type:"QString"}}))).filter((t=>void 0!==t.$.value));return{Option:{$:{type:"Map"},Option:n}}}propsObjectToQmlSymbol_OlderProps(t){const n=Object.keys(t).map((n=>({$:{k:n,v:t[n]}}))).filter((t=>void 0!==t.$.v));return{prop:n}}geoStylerStyleToQmlObject(t){const n=[],e=this.getQmlSymbolsFromStyle(t,n);return n.length>0||e.length>0?{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"RuleRenderer"},rules:[{$:{key:"renderer_rules"},rule:n}],symbols:[{symbol:e}]}]}}:{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"nullSymbol"}}]}}}convertTextSymbolizerRule(t,n){let e;n.symbolizers.forEach((r=>{if("Text"===r.kind){let i,o;e=r,e.color&&!Dn(e.color)&&(i=this.qmlColorFromHexAndOpacity(e.color,1));const s={fontSize:e.size||12,fontLetterSpacing:e.letterSpacing||0,multilineHeight:void 0!==e.lineHeight?e.lineHeight:1,textColor:e.color?i:"0,0,0,255"};e.font&&(s.fontFamily=e.font[0]),e.label&&!Dn(e.label)&&(s.fieldName=e.label.replace("{{","").replace("}}","")),o=e.anchor&&!Dn(e.anchor)&&"center"!==e.anchor?bo[e.anchor]:"TR,TL,BR,BL,R,L,TSR,BSR";const u={$:{key:`labeling_rule_${t.length}`},settings:[{"text-style":[{$:s}],placement:[{$:{predefinedPositionOrder:o,xOffset:e.offset?`${e.offset[0]}`:"0",yOffset:e.offset?`${e.offset[1]}`:"0",rotationAngle:e.rotate?e.rotate:"0"}}]}]};if(e.haloColor){let t;Dn(e.haloColor)||Dn(e.haloOpacity)||(t=this.qmlColorFromHexAndOpacity(e.haloColor,e.haloOpacity)),u.settings[0]["text-buffer"]=[{$:{bufferSize:e.haloWidth||"0",bufferColor:t,bufferDraw:1,bufferSizeUnits:"Pixel",bufferSizeMapUnitScale:"3x:0,0,0,0,0,0"}}]}n.filter&&(u.$.filter=this.cqlParser.write(n.filter)),t.push(u)}}))}convertTextSymbolizers(t,n){const e=[];n.rules.forEach((t=>{t.symbolizers.forEach((n=>{"Text"!==n.kind||e.includes(t)||e.push(t)}))})),e.length>0&&(t.qgis.labeling=[{$:{type:"rule-based"},rules:[{$:{key:"labeling_rules"},rule:[]}]}],e.forEach((n=>this.convertTextSymbolizerRule(t.qgis.labeling[0].rules[0].rule,n))))}}let wo=function(t){return t.VBScript="VBScript",t.JScript="JScript",t.Python="Python",t.Arcade="Arcade",t}({}),xo=function(t){return t.Point="Point",t.Line="Line",t.Polygon="Polygon",t}({});const Eo="ESRI Default Marker",So=2/3,Oo=["ttf://ESRI SDS 2.00","ttf://ESRI SDS 1.95"],Fo=t=>t*(4/3),To=t=>null!==t&&t.values?t.values[t.values.length-1]/100:0,Mo=t=>{if(null===t)return"#000000";let n=t.values??[0,0,0];return"CIMRGBColor"===t.type?ko(n):"CIMCMYKColor"===t.type?ko(Io(n)):"CIMHSVColor"===t.type?ko(_o(n)):"CIMGrayColor"===t.type?ko(Ao(n)):"#000000"},ko=t=>`#${((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1).split(".")[0]}`,Io=t=>{let n=t[1],e=t[2],r=t[3];return[Math.floor(255*(1-t[0]/100)*(1-r/100)),Math.floor(255*(1-n/100)*(1-r/100)),Math.floor(255*(1-e/100)*(1-r/100))]},_o=t=>{let n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return r*=255,[r,r,r];let i=Math.floor(6*n),o=6*n-i,s=r*(1-e)*255,u=r*(1-e*o)*255,a=r*(1-e*(1-o))*255;return r*=255,i%=6,0===i?[r,a,s]:1===i?[u,r,s]:2===i?[s,r,a]:3===i?[s,u,r]:4===i?[a,s,r]:5===i?[r,s,u]:[-1,-1,-1]},Ao=t=>{const n=t[0],e=n>1?n:255*n;return[e,e,e]},Co=[],No=t=>`0x${t.toString(16)}`,Do=t=>{const n={33:"circle",34:"square",35:"triangle",40:"circle",41:"square",42:"triangle",94:"star",95:"star",203:"cross",204:"cross"};return n.hasOwnProperty(t)?n[t]:(Co.push(`Unsupported symbol from ESRI font (character index ${t}) replaced by default marker`),"circle")},jo=(t,n,e,r=!0)=>{if(null===t||"object"!=typeof t||!t.hasOwnProperty(n))return e;const i=parseFloat(t[n]);if(isNaN(i))return e;const o=Fo(i);return r?o:Math.round(o)},Po=t=>{for(let n of t)if("CIMSolidStroke"===n.type)return[Mo(n.color??""),jo(n,"width",0),To(n.color??"")];return["#000000",0,0]},Lo=t=>{let n="#ffffff";return t.some((t=>{if(!t.type)return!1;if("CIMSolidFill"===t.type)return n=Mo(t.color??""),!0;if("CIMCharacterMarker"===t.type){if(t.symbol.symbolLayers)return n=Lo(t.symbol.symbolLayers),!0}else if("CIMVectorMarker"===t.type){if(t.markerGraphics?.length>0){const e=t.markerGraphics[0];if(e.symbol?.symbolLayers){const t=e.symbol.symbolLayers.filter((t=>t.enable));return n=Lo(t),!0}}return!1}return!1})),n},Ro=t=>{const n=t.find((t=>"CIMSolidFill"===t.type));return n?To(n.color):1},$o=(t,n)=>({args:[n?t.toLowerCase():t],name:"property"}),zo=t=>["&&",...t],Uo=t=>["||",...t],Go=(t,n,e)=>Bo("==",t,n,e),Bo=(t,n,e,r=!0)=>[t,Qo(n,r),Qo(e,!1)],qo=(t,n,e)=>{let r=t;n===wo.Arcade&&(r=Xo(t)),e&&(r=r.toLowerCase());const i=r.match(/\[\s*if\s*\(([^)]+)\)\s*{([^}]*)}\s*\]/is);if(i){const t=i[1],o=i[2],s=4===i.length?Xo(i[3]):"",u=Vo(t,e);return u?{name:"if_then_else",args:[u,qo(o,n,e),s]}:Ko(r)}return/round\s*\(.*\)/i.test(r)?Yo(r,e,""):r.includes("+")||r.includes("&")?(r.includes("+")?r.split("+"):r.split("&")).map((t=>{if((t=t.trimStart().trimEnd()).includes("["))return Ko(t);{const e=t.replaceAll('"',"");return Ho(e,n)}})).join(""):Ho(Ko(r),n)},Wo=(t,n)=>{if((t=t.replace("(","").replace(")","")).includes(" AND ")){const e=t.split(" AND ").map((t=>t.trim()));return zo(e.map((t=>Wo(t,n))))}if(t.includes("=")){const e=t.split("=").map((t=>t.trim()));return Bo("==",e[0],e[1],n)}if(t.includes("<>")){const e=t.split("<>").map((t=>t.trim()));return Bo("!=",e[0],e[1],n)}if(t.includes(">")){const e=t.split(">").map((t=>t.trim()));return Bo(">",e[0],e[1],n)}if(t.toLowerCase().includes(" in ")){const e=(t=t.replace(" IN "," in ")).split(" in "),r=e[0];let i=[];e[1].startsWith("() ")&&(i=e[1].substring(3).split(","));const o=[];if(i.forEach((t=>{o.push(Bo("==",`${Qo(r,n)}`,`${Qo(t,n)}`))})),1===i.length)return o[0];let s=Uo([o[0],o[1]]);for(let t of o.slice(2))s=Uo([s,t]);return s}return Co.push(`Clause skipped because it is not supported as filter: ${t}}`),["==",0,0]},Yo=(t,n,e)=>{const r=t.match(/round\s*\(\s*(?:\[(\w+)\]|{{(\w+)}})\s*,\s*(\d+)\s*\)/i);if(r){const t=r[1]||r[2],i=Number(r[3]),o=$o(t,n);let s;return s=0===i?"#":"#."+"#".repeat(i),{args:[s,o,e],name:"numberFormat"}}return t},Vo=(t,n)=>{const e=Wo(t,n);if(Array.isArray(e)&&3===e.length){let t=String(e[1]);t=t.replace(/^\[(.+)\]$/,"$1").replace(/^{{(.+)}}$/,"$1");const r=$o(t,n),i=Number(e[2]);if(">"===e[0])return{name:"greaterThan",args:[r,i]};if("=="===e[0])return{name:"equalTo",args:[r,i]};if("<"===e[0])return{name:"lessThan",args:[r,i]};if("!="===e[0])return{name:"notEqualTo",args:[r,i]}}return null},Ho=(t,n)=>{let e=t;return e=e.replace(n===wo.Arcade?/TextFormatting\.NewLine/gi:/vbNewLine/gi,"\n"),e=e.replace(/ /g," "),e},Ko=t=>t.replace("[","{{").replace("]","}}").trim(),Xo=t=>t.replace(/\$feature\.(\w+)/g,"[$1]"),Qo=(t,n)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.substring(1).substring(0,t.length-2):"<Null>"===t?null:(n&&t.match(/^[A-zÀ-ú_-][[A-zÀ-ú0-9-_]*$/)&&(t=t.toLowerCase()),t),Zo=t=>{const n=Math.min(...t.map((t=>t[0]))),e=Math.max(...t.map((t=>t[0]))),r=Math.min(...t.map((t=>t[1]))),i=Math.max(...t.map((t=>t[1]))),o=i-r,s=(n+e)/2,u=(r+i)/2;return t.map((t=>[(t[0]-s)/o,(t[1]-u)/o]))},Jo=(t,n)=>Math.sqrt((n[0]-t[0])**2+(n[1]-t[1])**2),ts=(t,n,e,r)=>{const i=[],o=Math.atan2(t[1]-e[1],t[0]-e[0]),s=Math.atan2(n[1]-e[1],n[0]-e[0]),u=Jo(t,e);let a=s-o;a>Math.PI&&(a-=2*Math.PI),a<-Math.PI&&(a+=2*Math.PI);for(let t=1;t<=r;t++){const n=o+a*(t/r),s=e[0]+u*Math.cos(n),c=e[1]+u*Math.sin(n);i.push([s,c])}return i},ns=(t,n,e,r,i)=>{const o=[];for(let s=1;s<=i;s++){const u=s/i,a=u*u,c=a*u,l=1-u,h=l*l,f=h*l;o.push([f*t[0]+3*h*u*n[0]+3*l*a*e[0]+c*r[0],f*t[1]+3*h*u*n[1]+3*l*a*e[1]+c*r[1]])}return o},es=t=>Math.max((t=>Math.abs(t.xmax-t.xmin))(t),(t=>Math.abs(t.ymax-t.ymin))(t)),rs={},is=async(t,n,e,r,i)=>{switch(t.type){case"CIMSolidStroke":return fs(t,n.type);case"CIMSolidFill":return ps(t);case"CIMCharacterMarker":return ds(t,n,e);case"CIMVectorMarker":return ms(t,n,e,r,i);case"CIMHatchFill":return ys(t);case"CIMPictureFill":case"CIMPictureMarker":return await vs(t,n,e);default:return}},os=(t,n,e,r,i=null,o=null,s=!0)=>{const u=[];if("CIMPolygonSymbol"===t.type){const t=as(e,n.markerPlacement||{},s);return t&&u.push(t),u}if("CIMLineSymbol"===t.type){if("CIMCharacterMarker"===n.type){const t=hs(n.markerPlacement);if(t){const e=t=>{const e=cs(n,t,r);e&&u.push(e)};"start"!==t&&"both"!==t||e("start"),"end"!==t&&"both"!==t||e("end")}else{const t=ss(e,n);u.push(t)}return u}const t=ss(e,n);return u.push(t),u}return u},ss=(t,n)=>{const e={kind:"Line",opacity:1,graphicStroke:t},r=n.markerPlacement;if("CIMMarkerPlacementAlongLineSameSize"===n.markerPlacement.type){const i=jo(n,"size",10),o=us(r,i);return"Mark"===t.kind&&(t.wellKnownName.startsWith("wkt://")||0!==t.strokeWidth||(delete t.strokeWidth,delete t.strokeColor,delete t.strokeOpacity)),e.width=i,e.perpendicularOffset=jo(t,"perpendicularOffset",0),e.dasharray=o,e}return e.perpendicularOffset=0,e.graphicStrokeInterval=2*jo(t,"size",0),e.graphicStrokeOffset=0,e},us=(t,n)=>{const e=t?.placementTemplate;if(!e||!e.length)return[];if(1===e.length){const t=Fo(e[0]);return t>=n+1?[t,1]:[n+1,1]}{const t=e.length*n;let r=t=>Math.ceil(Fo(t));return[t,(e?.map(r)||[]).reduce(((t,n)=>t+n),0)-t]}},as=(t,n,e)=>{const r=n.type;return"CIMMarkerPlacementInsidePolygon"===r?{kind:"Fill",fillOpacity:1,graphicFill:t,graphicFillPadding:ls(t,n,e)}:"CIMMarkerPlacementAlongLineSameSize"===r?{kind:"Line",opacity:1,width:jo(t,"size",10),perpendicularOffset:jo(t,"perpendicularOffset",0),graphicStroke:t}:null},cs=(t,n,e)=>{let r;if("start"===n)r=t?.rotation??180;else if("end"===n)r=t?.rotation??0;else{if("both"!==n)return;r=t?.rotation??90}const i=!!e?.replaceesri,o=t.fontFamilyName,s=t.characterIndex,u=No(s);let a,c,l,h,f,p,d;a=o===Eo&&i?Do(s):`ttf://${o}#${u}`;try{c=t.symbol.symbolLayers??[],l=Lo(c),h=Ro(c),[f,p,d]=Po(c)}catch(t){l="#000000",h=1,d=0,f="#000000",p=0}return{opacity:1,fillOpacity:h,strokeColor:f,strokeOpacity:d,strokeWidth:p,rotate:{args:[$o("shape",!0),r],name:"add"},kind:"Mark",color:l,wellKnownName:a,radius:jo(t,"size",10)/2,geometry:[null,["PropertyName","shape"]],inclusion:"mapOnly"}},ls=(t,n,e=!0)=>{const r=Oo.some((n=>t?.wellKnownName?.startsWith(n)));let i;i=e?r?1:So:r?1.8:1;let o=jo(n,"stepX",0),s=jo(n,"stepY",0);const u=Math.round(2*("number"==typeof t.radius?t.radius:0)*i)||1;t.radius=u/2,o<u&&(o=u),s<u&&(s=u);const a=Math.round(o/2-u/2),c=Math.round(o/2-u/2);return[Math.round(s/2-u/2),a,Math.round(s/2-u/2),c]},hs=t=>{if(t?.angleToLine)if("CIMMarkerPlacementAtRatioPositions"===t.type){if(0===t.positionArray[0]&&t.flipFirst)return"start";if(1===t.positionArray[0])return"end"}else if("CIMMarkerPlacementAtExtremities"===t.type){if("Both"===t.extremityPlacement)return"both";if("JustBegin"===t.extremityPlacement)return"start";if("JustEnd"===t.extremityPlacement)return"end"}},fs=(t,n)=>{const e=bs(t);if("CIMPolygonSymbol"===n){const n={kind:"Fill",outlineColor:Mo(t.color),outlineOpacity:To(t.color),outlineWidth:jo(t,"width",0)};return"dasharray"in e&&(n.outlineDasharray=e.dasharray),[n]}const r=t.capStyle.toLowerCase(),i=t.joinStyle.toLowerCase(),o={kind:"Line",color:Mo(t.color),opacity:To(t.color),width:jo(t,"width",0),perpendicularOffset:0,cap:["butt","round","square"].includes(r)?r:void 0,join:["round","bevel","miter"].includes(i)?i:void 0};return"dasharray"in e&&(o.dasharray=e.dasharray),"offset"in e&&(o.perpendicularOffset=e.offset),[o]},ps=t=>{let n=t.color;if(void 0!==n)return[{kind:"Fill",color:Mo(n),fillOpacity:To(n)}]},ds=(t,n,e)=>{const r=!!e.replaceesri,i=t.fontFamilyName,o=t.characterIndex,s=No(o),u=jo(t,"size",12);let a;a=i===Eo&&r?Do(o):`ttf://${i}#${s}`;let c=void 0===t.rotation?0:t.rotation;void 0!==t.rotateClockwise&&t.rotateClockwise||0===c||(c*=-1);let l="#000000",h=1,f="#000000",p=0,d=0,m=t.respectFrame;const y=t.symbol.symbolLayers;y&&(l=Lo(y),h=Ro(y),[f,p,d]=Po(y));const v={opacity:1,offset:Es(t,u),fillOpacity:h,strokeColor:f,strokeOpacity:d,strokeWidth:p,rotate:c,kind:"Mark",color:l,wellKnownName:a,radius:u/2,respectFrame:m},b=os(n,t,v,e,void 0,void 0,m);return b.length?b:[v]},ms=async(t,n,e,r,i)=>{const o=t.size??10,s=t.frame;let u="#ff0000",a="#000000",c=1,l=Fo(o),h=1,f="circle",p=null,d=null;const m=t.markerGraphics||[];if(0===m.length)return[{opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)}];const y=m[0];if(!y.symbol||!y.symbol.symbolLayers)return[{opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)}];const v=s?es(s):void 0,b=(await Ss(y,{},Fo(o),v))[0],g=y.symbol.symbolLayers.filter((t=>t.enable));if(u=Lo(g),[a,c,h]=Po(g),"CIMPointSymbol"===y.symbol.type)f=b.wellKnownName??f,"number"==typeof b.radius&&f?.startsWith("wkt://")&&(l=2*b.radius);else if(["CIMLineSymbol","CIMPolygonSymbol"].includes(y.symbol.type)){const t=y.geometry;if(t){const n=(t=>{const n={wellKnownName:"circle"};if(t.rings){let[n]=t.rings;n=Zo(n);let e=n.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${e}))`,maxX:Math.max(...n.map((t=>t[0]))),maxY:Math.max(...n.map((t=>t[1])))}}const e=t?.paths?.[0];if(e&&2===e[0][0]&&0===e[0][1]&&e[1][0]-2&&0===e[1][1])return{wellKnownName:"wkt://MULTILINESTRING((0 2, 0 0))"};if(t.curveRings){const[e]=t.curveRings,r=e[0],i=e[1];if(i&&2===e.length&&Array.isArray(r)){const t=i?.a||i?.b||i?.c;if(t){const n=t[1];if(JSON.stringify(t[0])===JSON.stringify(r)){const t=Jo(r,n),e=((t,n,e=32)=>{const r=[];for(let i=0;i<e;i++){const o=2*Math.PI*i/e,s=t[0]+n*Math.cos(o),u=t[1]+n*Math.sin(o);r.push([s,u])}return r.push(r[0]),r})(n,t,32),i=Zo(e).map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${i}))`,maxX:t,maxY:t}}}}const o=(t=>{const n=[];for(let e=0;e<t.length;e++){const r=t[e];if(Array.isArray(r)&&"number"==typeof r[0])n.push(r);else if(!Array.isArray(r)&&"object"==typeof r&&null!==r){const t=n[n.length-1]||[0,0];if(r.a&&Array.isArray(r.a)){const e=r.a,i=ts(t,e[0],e[1],16);n.push(...i)}else if(r.b&&Array.isArray(r.b)){const e=r.b,i=ns(t,e[1],e[2],e[0],16);n.push(...i)}else if(r.c&&Array.isArray(r.c)){const e=r.c,i=ts(t,e[0],e[1],16);n.push(...i)}}}return n})(e);if(o.length>0){const t=Zo(o),n=t.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${n}))`,maxX:Math.max(...t.map((t=>t[0]))),maxY:Math.max(...t.map((t=>t[1])))}}return n}return n})(t);if(f=n.wellKnownName,p=jo(n,"maxX",0),d=jo(n,"maxY",0),2===t.curveRings?.[0]?.length)l=1.5*Fo(o);else if(f?.startsWith("wkt://")&&(t.curveRings||r)){const t=r?r/(4/3):o,n=i??(s?es(s):t);l=Fo(t*(t/n))}}}const w={opacity:1,rotate:0,kind:"Mark",color:u,wellKnownName:f,radius:l/2,strokeColor:a,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:Es(t,l)},x=os(n,t,w,e,p,d);return x.length?x:[w]},ys=t=>{const n=t.rotation||0,e=t.lineSymbol.symbolLayers;let r="#000000",i=0,o=0;e&&([r,i,o]=Po(e));let s=xs(n);n%45&&Co.push("Rotation value different than a multiple of 45° is not possible. The nearest value is taken instead.");let u=t.separation||0,a=ws().includes(s)?Fo(u)/2:u;const c={kind:"Mark",color:r,wellKnownName:s,radius:a,strokeColor:r,strokeWidth:i,strokeOpacity:o,rotate:0},l={kind:"Fill",fillOpacity:1,graphicFill:c};if(!e)return[l];let h=bs(e[0]);if("dasharray"in h&&(c.strokeDasharray=h.dasharray,a>0)){let t=h.dasharrayValues.reduce(((t,n)=>t+n),0);if(ws().includes(s)){t/=2;let n=-1*(t-a);l.graphicFillPadding=s===ws()[0]?[n,0,n,0]:[0,n,0,n]}else t=a,Co.push("Unable to keep the original size of CIMHatchFill for line with rotation");c.radius=t}return[l]},vs=async(t,n,e)=>{const r=jo(t,"height",jo(t,"size",0)),i=await(async(t,n)=>{if(!t)return;const e=(t=>{const n=t.split(";");if(2!==n.length)return;const e=n[0].split("/").pop();return e?{data:n[1].substring(7),extension:e}:void 0})(t);if(!e)return t;const r=`image/${e.extension}`,i=Buffer.from(e.data,"base64");let o;try{const t=await rs.read(i),e=((t,n,e)=>{const r=t/Math.max(n,e)*Math.min(n,e);return[n>e?t:r,e>n?t:r]})(n,t.bitmap.height,t.bitmap.width),s=t.resize({h:e[0],w:e[1]});o=await s.getBase64(r)}catch(t){Co.push(`Could not resize image: ${t}`)}return o||t})(t.url,r)??"",o={opacity:1,rotate:0,kind:"Icon",image:i,size:r},s=os(n,t,o,e);return s.length?s:[o]},bs=t=>{let n={};return"effects"in t&&t.effects.forEach((t=>{n={...n,...gs(t)}})),n},gs=t=>{let n=t=>Math.ceil(Fo(t));if("CIMGeometricEffectDashes"===t.type){let e=t.dashTemplate?.map(n)||[];if(e.length>1)return{dasharrayValues:e,dasharray:e}}else if("CIMGeometricEffectOffset"===t.type)return{offset:-1*n(t.offset||0)};return{}},ws=()=>["shape://horline","shape://vertline"],xs=t=>{const n=(t=>(t%360+360)%360)(t),e=ws(),r=["shape://slash","shape://backslash"],i=Math.floor((n+22.5)%180/45);return[e[0],r[0],e[1],r[1]][i]},Es=(t,n)=>{let e=0,r=0;if(t.anchorPoint&&(0!==t.anchorPoint.x||0!==t.anchorPoint.y)){const{x:i,y:o}=t.anchorPoint;"Relative"===(t.anchorPointUnits||"Relative")&&void 0!==n?(e=i*n,r=o*n):(e=Fo(i),r=Fo(o))}if(0!==e||0!==r||void 0===t.offsetX&&void 0===t.offsetY||(e=(t.offsetX||0)*Fo(1)*1.5,r=(t.offsetY||0)*Fo(1)*1.5*-1),0!==e||0!==r)return[e,r]},Ss=async(t,n,e,r)=>{const i=t.symbol,o=[];if(!i||!i.symbolLayers)return o;const s=i.symbolLayers.slice().reverse();for await(const t of s){if(!t.enable)continue;const s=await is(t,i,n,e,r);s&&o.push(...s)}return o},Os=[],Fs=async(t,n)=>{const e={name:t.name,rules:[]};return n={toLowerCase:!0,replaceesri:!1,...n},"CIMFeatureLayer"===t.type?e.rules=await Ts(t,n):"CIMRasterLayer"===t.type&&(e.rules=ks()),e},Ts=async(t,n={})=>{const e=!!n.toLowerCase,r=t.renderer;if(!r)return Co.push(`No renderer on layer: ${t.name}`),[];const i=await Ms(r,n);if(t.labelVisibility)for(const n of t.labelClasses||[])i.push(_s(n,e));return Ns(r,e),i},Ms=async(t,n)=>{const e=[];if("CIMSimpleRenderer"===t.type)return e.push(await As(t,n)),e;if("CIMUniqueValueRenderer"===t.type){const r=t;if(r.groups)for await(const t of r.groups)e.push(...await Cs(r.fields,t,n));else if(r.defaultSymbol){const t={name:"",symbolizers:await Ss(r.defaultSymbol,n)};e.push(t)}return e}if("CIMClassBreaksRenderer"===t.type){const r=t;if(["GraduatedColor","GraduatedSymbol"].includes(r.classBreakType))return e.push(...await Is(r,n)),e}return Co.push(`Unsupported renderer type: ${t}`),e},ks=()=>(Co.push("CIMRasterLayer are not supported yet."),[]),Is=async(t,n={})=>{const e=[],r=[],i=t.field;let o=null;const s=!!n.toLowerCase;Ns(t,s);const u=t.breaks||[];for await(const t of u){const u=await Ss(t.symbol,n),a=t.upperBound||0;let c;c=null!==o?["&&",[">",s?i.toLowerCase():i,o],["<=",s?i.toLowerCase():i,a]]:["<=",s?i.toLowerCase():i,a],o=a;const l={filter:c,symbolizers:u,name:t.label||"classbreak"};r.push(u),e.push(l)}if(!t.showInAscendingOrder){e.reverse();for(const[t,n]of e.entries())n.symbolizers=r[t]}return e},_s=(t,n)=>{if("CIMTextSymbol"!==t.textSymbol?.symbol?.type)return{name:"",symbolizers:[]};const e=t.textSymbol?.symbol,r=qo(t?.expression??"",t.expressionEngine??wo.Arcade,n),i=e?.fontFamilyName||"Arial",o=jo(e,"height",12,!0),s=Lo(e?.symbol?.symbolLayers??[]),u=(t=>"Bold"===t.fontStyleName?"bold":"normal")(e),a=(t.maplexLabelPlacementProperties?.rotationProperties||{}).rotationField,c={kind:"Text",anchor:"right",rotate:0,color:s,font:[i],label:r,size:o,fontWeight:u},l=t.standardLabelPlacementProperties,h=l?.featureType,f=l?.pointPlacementMethod,p=t.maplexLabelPlacementProperties,d=p?.featureType,m=jo(p??{},"primaryOffset",0),y=p?.pointPlacementMethod;if(h===xo.Line&&d===xo.Line){c.placement="line";const t=m??jo(e,"primaryOffset",0);c.perpendicularOffset=0!==t?t+o/2:0}else if(d===xo.Point&&"AroundPoint"===y){const t=m+o/2;c.offset=[t,-1*t]}else if(h===xo.Point&&"AroundPoint"===f){const t=m+o/2;c.offset=[t,-1*t]}else c.offset=[0,0];if(a){const t=$o(a,n);c.rotate={args:[t,-1],name:"mul"}}else c.rotate=0;const v=jo(e,"haloSize",0);if(v&&e.haloSymbol){const t=Lo(e?.haloSymbol?.symbolLayers??[]);Object.assign(c,{haloColor:t,haloWidth:v,haloOpacity:1})}c.group=t.maplexLabelPlacementProperties?.thinDuplicateLabels||d===xo.Polygon&&"OneLabelPerName"===t.standardLabelPlacementProperties?.numLabelsOption;const b={name:"",symbolizers:[c]},g=Ds(t.minimumScale,t.maximumScale);return g&&(b.scaleDenominator=g),t.whereClause&&(b.filter=Wo(t.whereClause,n)),b},As=async(t,n)=>({name:t.label||"",symbolizers:await Ss(t.symbol,n)}),Cs=async(t,n,e)=>{const r=e.toLowerCase||!1,i=[];n.classes=n.classes||[];for await(const o of n.classes){const n=o.label||"label",s=[];o.values.filter((t=>"fieldValues"in t)).forEach((n=>{const e=n.fieldValues;let i=Go(t[0],e[0],r);for(const[n,o]of e.slice(1).map(((n,e)=>[n,t[e+1]])))i=zo([i,Go(`${o}`,`${n}`,r)]);s.push(i)}));let u=null;if(s.length){u=1===s.length?s[0]:Uo(s);const t={name:n,filter:u,symbolizers:await Ss(o.symbol,e)},r=Ds(o.symbol.minScale,o.symbol.maxScale);r&&(t.scaleDenominator=r),i.push(t)}const a=o.alternateSymbols||[];for await(const t of a){const r={name:n,symbolizers:await Ss(t,e)};u&&(r.filter=u);const o=Ds(t.minScale,t.maxScale);o&&(r.scaleDenominator=o),i.push(r)}}return i},Ns=(t,n)=>((t?.visualVariables??[]).find((t=>{if("CIMRotationVisualVariable"!==t.type)return!1;const e=t.visualVariableInfoZ?.valueExpressionInfo?.expression||t.visualVariableInfoZ?.expression;return e?((t,n,e)=>{const r=t.includes("$feature")?Xo(t):Ko(t),i=$o(r,e);return"Arithmetic"===n?{args:[i,-1],name:"mul"}:"Geographic"===n?{args:[i,90],name:"sub"}:null})(e,t.rotationTypeZ,n):null})),null),Ds=(t,n)=>{if(void 0===t&&void 0===n)return null;const e={};return void 0!==t&&(e.max=t),void 0!==n&&(e.min=n),e};class js{static title="ArcGIS Pro lyrx parser";title="ArcGIS Pro lyrx parser";unsupportedProperties={};constructor(t){this.options=t||{}}async readStyle(t){const n=await(async(t,n={})=>[await Fs(t?.layerDefinitions?.[0],n),Os,Co])(t);return Promise.resolve({output:{name:n[0].name,rules:n[0].rules},warnings:Co,errors:[]})}writeStyle(t){return console.log(t),Promise.resolve({output:{stylingRules:[]},errors:[],warnings:[]})}}const Ps="v-map-style",Ls=n(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.styleReady=r(this,"styleReady",7),this.styleError=r(this,"styleError",7)}get el(){return this}format="sld";src;content;layerTargets;autoApply=!0;styleReady;styleError;parsedStyle;isLoading=!1;error;sldParser=new bn;mapboxParser=new Yn;qgisParser=new go;lyrxParser=new js;async connectedCallback(){a(Ps+" - "+c.COMPONENT_CONNECTED_CALLBACK),this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async onStyleSourceChanged(){this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async loadAndParseStyle(){this.isLoading=!0,this.error=void 0;try{let t;if(this.src){const n=await fetch(this.src);if(!n.ok)throw new Error(`Failed to fetch style from ${this.src}: ${n.statusText}`);t=await n.text()}else{if(!this.content)throw new Error("Either src or content must be provided");t=this.content}const n=await this.parseStyle(t);this.parsedStyle=n;const e={style:n,layerIds:this.getLayerTargets()};return this.styleReady.emit(e),a(Ps+" - Style successfully parsed",n),n}catch(t){this.error=t,this.styleError.emit(this.error);const n=function(t){return t.message.startsWith("Failed to fetch style from")}(this.error)?"network":"parse";return this.el.dispatchEvent(new CustomEvent(l.Error,{detail:{type:n,message:this.error.message,cause:this.error},bubbles:!0,composed:!0})),void console.error(Ps+" - Style parsing failed:",t)}finally{this.isLoading=!1}}async parseStyle(t){switch(this.format){case"sld":return this.parseSLD(t);case"mapbox-gl":return this.parseMapboxGL(t);case"qgis":return this.parseQGIS(t);case"lyrx":return this.parseLyrx(t);case"cesium-3d-tiles":return this.parseCesium3DTiles(t);case"geostyler":return this.parseGeoStyler(t);default:throw new Error(`Unsupported style format: ${this.format}`)}}async parseSLD(t){try{const{output:n}=await this.sldParser.readStyle(t);if(!n)throw new Error("Failed to parse SLD - no style output");return n}catch(t){throw new Error(`SLD parsing failed: ${t?.message||t}`)}}async parseMapboxGL(t){try{const n="string"==typeof t?JSON.parse(t):t;if("object"!=typeof n||null===n)throw new Error("Parsed Mapbox GL style is not a valid object");const{output:e}=await this.mapboxParser.readStyle(n);if(!e)throw new Error("Failed to parse Mapbox GL Style - no style output");return e}catch(t){throw new Error(`Mapbox GL Style parsing failed: ${t?.message||t}`)}}async parseQGIS(t){try{const{output:n}=await this.qgisParser.readStyle(t);if(!n)throw new Error("Failed to parse QGIS Style - no style output");return n}catch(t){throw new Error(`QGIS Style parsing failed: ${t?.message||t}`)}}async parseLyrx(t){try{const n="string"==typeof t?JSON.parse(t):t;if("object"!=typeof n||null===n)throw new Error("Parsed LYRX style is not a valid object");const{output:e}=await this.lyrxParser.readStyle(n);if(!e)throw new Error("Failed to parse LYRX (ArcGIS Pro) Style - no style output");return e}catch(t){throw new Error(`LYRX (ArcGIS Pro) Style parsing failed: ${t?.message||t}`)}}async getStyle(){return this.parsedStyle}async parseCesium3DTiles(t){try{const n=JSON.parse(t);if("object"!=typeof n||null===n)throw new Error("Parsed Cesium 3D Tiles style is not a valid object");return n}catch(t){throw new Error(`Cesium 3D Tiles style parsing failed: ${t?.message||t}`)}}async parseGeoStyler(t){try{const n=JSON.parse(t);if("object"!=typeof n||null===n)throw new Error("Parsed GeoStyler style is not a valid object");if("string"!=typeof n.name||!Array.isArray(n.rules))throw new Error('GeoStyler style must have "name" (string) and "rules" (array)');return n}catch(t){throw new Error(`GeoStyler style parsing failed: ${t?.message||t}`)}}async getLayerTargetIds(){return this.getLayerTargets()}getLayerTargets(){return this.layerTargets?this.layerTargets.split(",").map((t=>t.trim())):[]}isStyleLoading(){return this.isLoading}getError(){return this.error}render(){return i("div",{key:"8e1c5cdf6914778d39e8dd74a35d92cd65f7f32c",class:"style-container"},this.isLoading&&i("div",{key:"3c82160e21fa5f8a4ece8399b0e5cc42204104f2",class:"loading"},"Loading style..."),this.error&&i("div",{key:"2017dd34fb9c95595c72611204ad8b7fcb411098",class:"error"},"Style Error: ",this.error.message),this.parsedStyle&&i("div",{key:"a1d2893f784deca67748dd1a757dd0b2aae39974",class:"success"},"Style loaded (",this.format.toUpperCase(),")",this.getLayerTargets().length>0&&i("div",{key:"4e798d938ed53bbac980b9e98b05960c907b0447",class:"targets"},"Targets: ",this.getLayerTargets().join(", "))),i("slot",{key:"e32cf2619d0347bcf0ded90cc13ddd5a168cc483"}))}static get watchers(){return{src:[{onStyleSourceChanged:0}],content:[{onStyleSourceChanged:0}],format:[{onStyleSourceChanged:0}]}}static get style(){return":host{display:block;position:relative}.style-container{min-height:20px}.loading{padding:8px;background-color:#f0f0f0;border-left:4px solid #2196f3;font-size:14px;color:#666}.error{padding:8px;background-color:#ffebee;border-left:4px solid #f44336;color:#c62828;font-size:14px}.success{padding:8px;background-color:#e8f5e8;border-left:4px solid #4caf50;color:#2e7d32;font-size:14px}.targets{margin-top:4px;font-size:12px;color:#666}"}},[769,"v-map-style",{format:[513],src:[513],content:[513],layerTargets:[513,"layer-targets"],autoApply:[516,"auto-apply"],parsedStyle:[32],isLoading:[32],error:[32],getStyle:[64],getLayerTargetIds:[64]},void 0,{src:[{onStyleSourceChanged:0}],content:[{onStyleSourceChanged:0}],format:[{onStyleSourceChanged:0}]}]);function Rs(){"undefined"!=typeof customElements&&["v-map-style"].forEach((n=>{"v-map-style"===n&&(customElements.get(t(n))||customElements.define(t(n),Ls))}))}Rs();export{Ls as V,Rs as d}
|