(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6490f072","chunk-06ad9dad"],{3981:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var i,a=r("a4ee"),l=r("6a0ed"),s=r("7ffa"),o=r("59b2"),n=(r("cea0"),r("d386"));let c=i=class extends l["a"]{constructor(e){super(e)}clone(){return new i({customLayerParameters:Object(s["a"])(this.customLayerParameters),customParameters:Object(s["a"])(this.customParameters),layerIdentifier:this.layerIdentifier,tileMatrixSet:this.tileMatrixSet,url:this.url})}};Object(a["a"])([Object(o["b"])({json:{type:Object,write:!0}})],c.prototype,"customLayerParameters",void 0),Object(a["a"])([Object(o["b"])({json:{type:Object,write:!0}})],c.prototype,"customParameters",void 0),Object(a["a"])([Object(o["b"])({type:String,json:{write:!0}})],c.prototype,"layerIdentifier",void 0),Object(a["a"])([Object(o["b"])({type:String,json:{write:!0}})],c.prototype,"tileMatrixSet",void 0),Object(a["a"])([Object(o["b"])({type:String,json:{write:!0}})],c.prototype,"url",void 0),c=i=Object(a["a"])([Object(n["a"])("esri.layer.support.WMTSLayerInfo")],c);const u=c},"68dc":function(e,t,r){"use strict";function i(e,t){for(const r of e.children)if(r.localName in t){const e=t[r.localName];if("function"==typeof e){const t=e(r);t&&i(r,t)}else i(r,e)}}function*a(e,t){for(const r of e.children)if(r.localName in t){const e=t[r.localName];"function"==typeof e?yield e(r):yield*a(r,e)}}r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return i}))},7749:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));const i=[[3819,3819],[3821,3824],[3889,3889],[3906,3906],[4001,4025],[4027,4036],[4039,4047],[4052,4055],[4074,4075],[4080,4081],[4120,4176],[4178,4185],[4188,4216],[4218,4289],[4291,4304],[4306,4319],[4322,4326],[4463,4463],[4470,4470],[4475,4475],[4483,4483],[4490,4490],[4555,4558],[4600,4646],[4657,4765],[4801,4811],[4813,4821],[4823,4824],[4901,4904],[5013,5013],[5132,5132],[5228,5229],[5233,5233],[5246,5246],[5252,5252],[5264,5264],[5324,5340],[5354,5354],[5360,5360],[5365,5365],[5370,5373],[5381,5381],[5393,5393],[5451,5451],[5464,5464],[5467,5467],[5489,5489],[5524,5524],[5527,5527],[5546,5546],[2044,2045],[2081,2083],[2085,2086],[2093,2093],[2096,2098],[2105,2132],[2169,2170],[2176,2180],[2193,2193],[2200,2200],[2206,2212],[2319,2319],[2320,2462],[2523,2549],[2551,2735],[2738,2758],[2935,2941],[2953,2953],[3006,3030],[3034,3035],[3038,3051],[3058,3059],[3068,3068],[3114,3118],[3126,3138],[3150,3151],[3300,3301],[3328,3335],[3346,3346],[3350,3352],[3366,3366],[3389,3390],[3416,3417],[3833,3841],[3844,3850],[3854,3854],[3873,3885],[3907,3910],[4026,4026],[4037,4038],[4417,4417],[4434,4434],[4491,4554],[4839,4839],[5048,5048],[5105,5130],[5253,5259],[5269,5275],[5343,5349],[5479,5482],[5518,5519],[5520,5520],[20004,20032],[20064,20092],[21413,21423],[21473,21483],[21896,21899],[22171,22177],[22181,22187],[22191,22197],[25884,25884],[27205,27232],[27391,27398],[27492,27492],[28402,28432],[28462,28492],[30161,30179],[30800,30800],[31251,31259],[31275,31279],[31281,31290],[31466,31700]];function a(e){return i.some(([t,r])=>e>=t&&e<=r)}},"9dc3":function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return I}));var i=r("a4ee"),a=(r("e06a"),r("2eab")),l=r("ce50"),s=r("e694"),o=r("b3b6"),n=r("e041"),c=r("59b2"),u=(r("b50f"),r("c120"),r("cea0"),r("afcf")),p=r("d386"),d=r("09db"),h=r("a6a3"),b=r("997b"),y=r("b911"),m=r("0db5"),f=r("8e17"),O=r("5a62"),g=r("50e6"),j=r("dff3"),v=r("3981"),w=r("3af1"),x=r("5996"),S=r("4ae5");let M=class extends(Object(b["a"])(Object(f["a"])(Object(O["a"])(Object(y["a"])(Object(m["a"])(Object(s["a"])(h["a"]))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new w["a"](-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,x["a"].WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=x["a"].WebMercator,this.subDomains=null,this.tileInfo=new j["a"]({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new S["a"]({x:-20037508.342787,y:20037508.342787,spatialReference:x["a"].WebMercator}),spatialReference:x["a"].WebMercator,lods:[new g["a"]({level:0,scale:591657527.591555,resolution:156543.033928}),new g["a"]({level:1,scale:295828763.795777,resolution:78271.5169639999}),new g["a"]({level:2,scale:147914381.897889,resolution:39135.7584820001}),new g["a"]({level:3,scale:73957190.948944,resolution:19567.8792409999}),new g["a"]({level:4,scale:36978595.474472,resolution:9783.93962049996}),new g["a"]({level:5,scale:18489297.737236,resolution:4891.96981024998}),new g["a"]({level:6,scale:9244648.868618,resolution:2445.98490512499}),new g["a"]({level:7,scale:4622324.434309,resolution:1222.99245256249}),new g["a"]({level:8,scale:2311162.217155,resolution:611.49622628138}),new g["a"]({level:9,scale:1155581.108577,resolution:305.748113140558}),new g["a"]({level:10,scale:577790.554289,resolution:152.874056570411}),new g["a"]({level:11,scale:288895.277144,resolution:76.4370282850732}),new g["a"]({level:12,scale:144447.638572,resolution:38.2185141425366}),new g["a"]({level:13,scale:72223.819286,resolution:19.1092570712683}),new g["a"]({level:14,scale:36111.909643,resolution:9.55462853563415}),new g["a"]({level:15,scale:18055.954822,resolution:4.77731426794937}),new g["a"]({level:16,scale:9027.977411,resolution:2.38865713397468}),new g["a"]({level:17,scale:4513.988705,resolution:1.19432856685505}),new g["a"]({level:18,scale:2256.994353,resolution:.597164283559817}),new g["a"]({level:19,scale:1128.497176,resolution:.298582141647617}),new g["a"]({level:20,scale:564.248588,resolution:.14929107082380833}),new g["a"]({level:21,scale:282.124294,resolution:.07464553541190416}),new g["a"]({level:22,scale:141.062147,resolution:.03732276770595208}),new g["a"]({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new n["a"](this.urlTemplate);this.subDomains&&this.subDomains.length>0||-1===t.authority.indexOf("{subDomain}")||(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new l["a"]("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}readSpatialReference(e,t){return e||t.fullExtent&&t.fullExtent.spatialReference&&x["a"].fromJSON(t.fullExtent.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,i=new n["a"](t),a=i.scheme?i.scheme+"://":"//",l=a+i.authority+"/";if(-1===i.authority.indexOf("{subDomain}"))e.push(l);else if(r&&r.length>0&&i.authority.split(".").length>1)for(const s of r)e.push(a+i.authority.replace(/\{subDomain\}/gi,s)+"/");return e.map(e=>("/"!==e.charAt(e.length-1)&&(e+="/"),e))}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new n["a"](e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.substring(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){e&&Object(n["y"])(e)&&(e="https:"+e),e&&(e=e.replace(/\{z\}/gi,"{level}").replace(/\{x\}/gi,"{col}").replace(/\{y\}/gi,"{row}"),e=Object(n["F"])(e)),t.templateUrl=e}fetchTile(e,t,r,i={}){const{signal:l}=i,s=this.getTileUrl(e,t,r),o={responseType:"image",signal:l,query:{...this.refreshParameters}};return Object(a["default"])(s,o).then(e=>e.data)}getTileUrl(e,t,r){const i=this.levelValues[e];return this.tileServers[t%this.tileServers.length]+Object(o["c"])(this.urlPath,{level:i,z:i,col:r,x:r,row:t,y:t})}};Object(i["a"])([Object(c["b"])({type:String,value:"",json:{write:!0}})],M.prototype,"copyright",void 0),Object(i["a"])([Object(c["b"])({type:w["a"],json:{write:!0},nonNullable:!0})],M.prototype,"fullExtent",void 0),Object(i["a"])([Object(c["b"])({readOnly:!0,json:{read:!1,write:!1}})],M.prototype,"legendEnabled",void 0),Object(i["a"])([Object(c["b"])({type:["show","hide"]})],M.prototype,"listMode",void 0),Object(i["a"])([Object(c["b"])()],M.prototype,"levelValues",null),Object(i["a"])([Object(c["b"])({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],M.prototype,"isReference",void 0),Object(i["a"])([Object(c["b"])({type:["WebTiledLayer"],value:"WebTiledLayer"})],M.prototype,"operationalLayerType",void 0),Object(i["a"])([Object(c["b"])({readOnly:!0,json:{read:!1,write:!1}})],M.prototype,"popupEnabled",void 0),Object(i["a"])([Object(c["b"])({type:x["a"]})],M.prototype,"spatialReference",void 0),Object(i["a"])([Object(u["a"])("spatialReference",["spatialReference","fullExtent.spatialReference"])],M.prototype,"readSpatialReference",null),Object(i["a"])([Object(c["b"])({type:[String],json:{write:!0}})],M.prototype,"subDomains",void 0),Object(i["a"])([Object(c["b"])({type:j["a"],json:{write:!0}})],M.prototype,"tileInfo",void 0),Object(i["a"])([Object(c["b"])({readOnly:!0})],M.prototype,"tileServers",null),Object(i["a"])([Object(c["b"])({json:{read:!1}})],M.prototype,"type",void 0),Object(i["a"])([Object(c["b"])()],M.prototype,"urlPath",null),Object(i["a"])([Object(c["b"])({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],M.prototype,"urlTemplate",void 0),Object(i["a"])([Object(u["a"])("urlTemplate",["urlTemplate","templateUrl"])],M.prototype,"readUrlTemplate",null),Object(i["a"])([Object(d["a"])("urlTemplate",{templateUrl:{type:String}})],M.prototype,"writeUrlTemplate",null),Object(i["a"])([Object(c["b"])({type:v["a"],json:{write:!0}})],M.prototype,"wmtsInfo",void 0),M=Object(i["a"])([Object(p["a"])("esri.layers.WebTileLayer")],M);const I=M},b039:function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return we}));var i=r("a4ee"),a=r("2eab"),l=r("2c4f"),s=r("ce50"),o=r("af40"),n=r("7ffa"),c=r("e694"),u=r("9d1d"),p=r("f4cc"),d=r("e041"),h=r("59b2"),b=(r("cea0"),r("afcf")),y=r("d386"),m=r("09db"),f=r("3af1"),O=r("a6a3"),g=r("9dc3"),j=r("997b"),v=r("b911"),w=r("0db5"),x=r("8e17"),S=r("5a62"),M=r("dff3");class I{constructor(e,t=0,r=e.lods.length-1){this.tileInfo=e,this.minLOD=t,this.maxLOD=r}getAvailability(e,t,r){const i=this.tileInfo.lodAt(e);return!i||ethis.maxLOD?"unavailable":i.cols&&i.rows?r>=i.cols[0]&&r<=i.cols[1]&&t>=i.rows[0]&&t<=i.rows[1]?"available":"unavailable":"available"}async fetchAvailability(e,t,r,i){return await Object(p["x"])(i),this.getAvailability(e,t,r)}async fetchAvailabilityUpsample(e,t,r,i,a){await Object(p["x"])(a),i.level=e,i.row=t,i.col=r;const l=this.tileInfo;for(l.updateTileInfo(i);;){const e=this.getAvailability(i.level,i.row,i.col);if("unavailable"!==e)return e;if(!l.upsampleTile(i))return"unavailable"}}}var T,L=r("3981"),P=r("6a0ed");r("b50f"),r("c120");let E=T=class extends P["a"]{constructor(e){super(e),this.fullExtent=null,this.id=null,this.tileInfo=null}clone(){const e=new T;return this.hasOwnProperty("fullExtent")&&(e.fullExtent=this.fullExtent&&this.fullExtent.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("tileInfo")&&(e.tileInfo=this.tileInfo&&this.tileInfo.clone()),e}};Object(i["a"])([Object(h["b"])({type:f["a"],json:{read:{source:"fullExtent"}}})],E.prototype,"fullExtent",void 0),Object(i["a"])([Object(h["b"])({type:String,json:{read:{source:"id"}}})],E.prototype,"id",void 0),Object(i["a"])([Object(h["b"])({type:M["a"],json:{read:{source:"tileInfo"}}})],E.prototype,"tileInfo",void 0),E=T=Object(i["a"])([Object(y["a"])("esri.layer.support.TileMatrixSet")],E);const R=E;var C;let F=C=class extends P["a"]{constructor(e){super(e),this.id=null,this.title=null,this.description=null,this.legendUrl=null}clone(){const e=new C;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("isDefault")&&(e.isDefault=this.isDefault),this.hasOwnProperty("keywords")&&(e.keywords=this.keywords&&this.keywords.slice()),this.hasOwnProperty("legendUrl")&&(e.legendUrl=this.legendUrl),this.hasOwnProperty("title")&&(e.title=this.title),e}};Object(i["a"])([Object(h["b"])({json:{read:{source:"id"}}})],F.prototype,"id",void 0),Object(i["a"])([Object(h["b"])({json:{read:{source:"title"}}})],F.prototype,"title",void 0),Object(i["a"])([Object(h["b"])({json:{read:{source:"abstract"}}})],F.prototype,"description",void 0),Object(i["a"])([Object(h["b"])({json:{read:{source:"legendUrl"}}})],F.prototype,"legendUrl",void 0),Object(i["a"])([Object(h["b"])({json:{read:{source:"isDefault"}}})],F.prototype,"isDefault",void 0),Object(i["a"])([Object(h["b"])({json:{read:{source:"keywords"}}})],F.prototype,"keywords",void 0),F=C=Object(i["a"])([Object(y["a"])("esri.layer.support.WMTSStyle")],F);const _=F;var U;let V=U=class extends P["a"]{constructor(e){super(e),this.fullExtent=null,this.fullExtents=null,this.imageFormats=null,this.id=null,this.layer=null,this.styles=null,this.tileMatrixSetId=null,this.tileMatrixSets=null}get description(){return this._get("description")}set description(e){this._set("description",e)}readFullExtent(e,t){return(e=t.fullExtent)?f["a"].fromJSON(e):null}readFullExtents(e,t){var r;return null!=(r=t.fullExtents)&&r.length?t.fullExtents.map(e=>f["a"].fromJSON(e)):t.tileMatrixSets.map(e=>f["a"].fromJSON(e.fullExtent)).filter(e=>e)}get imageFormat(){let e=this._get("imageFormat");return e||(e=this.imageFormats&&this.imageFormats.length?this.imageFormats[0]:""),e}set imageFormat(e){const t=this.imageFormats;e&&(e.indexOf("image/")>-1||t&&-1===t.indexOf(e))&&(-1===e.indexOf("image/")&&(e="image/"+e),t&&-1===t.indexOf(e))?console.error("The layer doesn't support the format of "+e):this._set("imageFormat",e)}get styleId(){let e=this._get("styleId");return e||(e=this.styles&&this.styles.length?this.styles.getItemAt(0).id:""),e}set styleId(e){this._set("styleId",e)}get title(){return this._get("title")}set title(e){this._set("title",e)}get tileMatrixSet(){return this.tileMatrixSets?this.tileMatrixSets.find(e=>e.id===this.tileMatrixSetId):null}clone(){const e=new U;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("imageFormats")&&(e.imageFormats=this.imageFormats&&this.imageFormats.slice()),this.hasOwnProperty("imageFormat")&&(e.imageFormat=this.imageFormat),this.hasOwnProperty("fullExtent")&&(e.fullExtent=this.fullExtent&&this.fullExtent.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("layer")&&(e.layer=this.layer),this.hasOwnProperty("styleId")&&(e.styleId=this.styleId),this.hasOwnProperty("styles")&&(e.styles=this.styles&&this.styles.clone()),this.hasOwnProperty("tileMatrixSetId")&&(e.tileMatrixSetId=this.tileMatrixSetId),this.hasOwnProperty("tileMatrixSets")&&(e.tileMatrixSets=this.tileMatrixSets.clone()),this.hasOwnProperty("title")&&(e.title=this.title),e}};Object(i["a"])([Object(h["b"])()],V.prototype,"description",null),Object(i["a"])([Object(h["b"])()],V.prototype,"fullExtent",void 0),Object(i["a"])([Object(b["a"])("fullExtent",["fullExtent"])],V.prototype,"readFullExtent",null),Object(i["a"])([Object(h["b"])({readOnly:!0})],V.prototype,"fullExtents",void 0),Object(i["a"])([Object(b["a"])("fullExtents",["fullExtents","tileMatrixSets"])],V.prototype,"readFullExtents",null),Object(i["a"])([Object(h["b"])()],V.prototype,"imageFormat",null),Object(i["a"])([Object(h["b"])({json:{read:{source:"formats"}}})],V.prototype,"imageFormats",void 0),Object(i["a"])([Object(h["b"])()],V.prototype,"id",void 0),Object(i["a"])([Object(h["b"])()],V.prototype,"layer",void 0),Object(i["a"])([Object(h["b"])()],V.prototype,"styleId",null),Object(i["a"])([Object(h["b"])({type:l["a"].ofType(_),json:{read:{source:"styles"}}})],V.prototype,"styles",void 0),Object(i["a"])([Object(h["b"])({value:null,json:{write:{ignoreOrigin:!0}}})],V.prototype,"title",null),Object(i["a"])([Object(h["b"])()],V.prototype,"tileMatrixSetId",void 0),Object(i["a"])([Object(h["b"])({readOnly:!0})],V.prototype,"tileMatrixSet",null),Object(i["a"])([Object(h["b"])({type:l["a"].ofType(R),json:{read:{source:"tileMatrixSets"}}})],V.prototype,"tileMatrixSets",void 0),V=U=Object(i["a"])([Object(y["a"])("esri.layers.support.WMTSSublayer")],V);const A=V;var N=r("b2b2"),D=r("4ae5"),W=r("f694"),k=r("2c81"),K=r("7749"),B=r("68dc");const H=90.71428571428571;function J(e,t){var r,i;e=e.replace(/ows:/gi,"");const a=(new DOMParser).parseFromString(e,"text/xml").documentElement,l=new Map,o=new Map,n=G("Contents",a);if(!n)throw new s["a"]("wmtslayer:wmts-capabilities-xml-is-not-valid");const c=G("OperationsMetadata",a),u=null==c?void 0:c.querySelector("[name='GetTile']"),p=null==u?void 0:u.getElementsByTagName("Get"),d=p&&Array.prototype.slice.call(p),h=null!=(r=(null==t||null==(i=t.url)?void 0:i.indexOf("https"))>-1)&&r;let b,y,m=t.serviceMode,f=t&&t.url;if(d&&d.length&&d.some(e=>{const t=G("Constraint",e);return!t||Y("AllowedValues","Value",m,t)?(f=e.attributes[0].nodeValue,!0):(!t||Y("AllowedValues","Value","RESTful",t)||Y("AllowedValues","Value","REST",t)?y=e.attributes[0].nodeValue:t&&!Y("AllowedValues","Value","KVP",t)||(b=e.attributes[0].nodeValue),!1)}),!f)if(y)f=y,m="RESTful";else if(b)f=b,m="KVP";else{const e=G("ServiceMetadataURL",a);f=e&&e.getAttribute("xlink:href")}const O=f.indexOf("1.0.0/");-1===O&&"RESTful"===m?f+="/":O>-1&&(f=f.substring(0,O)),"KVP"===m&&(f+=O>-1?"":"?"),h&&(f=f.replace(/^http:/i,"https:"));const g=X("ServiceIdentification>ServiceTypeVersion",a),j=X("ServiceIdentification>AccessConstraints",a),v=$("Layer",n),w=$("TileMatrixSet",n),x=v.map(e=>{const t=X("Identifier",e);return l.set(t,e),Z(t,e,w,h,g)});return{copyright:j,dimensionMap:o,layerMap:l,layers:x,serviceMode:m,tileUrl:f}}function q(e){return e.layers.forEach(e=>{e.tileMatrixSets.forEach(e=>{const t=e.tileInfo;96!==t.dpi&&(t.lods.forEach(r=>{r.scale=96*r.scale/t.dpi,r.resolution=fe(t.spatialReference.wkid,r.scale*H/96,e.id)}),t.dpi=96)})}),e}function z(e){return e.nodeType===Node.ELEMENT_NODE}function G(e,t){for(let r=0;re.textContent)}function X(e,t){return e.split(">").forEach(e=>{t&&(t=G(e,t))}),t&&t.textContent}function Y(e,t,r,i){let a;return Array.prototype.slice.call(i.childNodes).some(i=>{if(i.nodeName.indexOf(e)>-1){const e=G(t,i),l=e&&e.textContent;if(l===r||r.split(":")&&r.split(":")[1]===l)return a=i,!0}return!1}),a}function Z(e,t,r,i,a){const l=X("Abstract",t),s=Q("Format",t);return{id:e,fullExtent:ae(t),fullExtents:le(t),description:l,formats:s,styles:se(t,i),title:X("Title",t),tileMatrixSets:oe(a,t,r)}}function ee(e,t){var r;const i=[],a=null==(r=e.layerMap)?void 0:r.get(t);if(!a)return;const l=$("ResourceURL",a),s=$("Dimension",a);let o,n,c,u;return s.length&&(o=X("Identifier",s[0]),n=Q("Default",s[0])||Q("Value",s[0])),s.length>1&&(c=X("Identifier",s[1]),u=Q("Default",s[1])||Q("Value",s[1])),e.dimensionMap.set(t,{dimensions:n,dimensions2:u}),l.forEach(e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(o&&n.length)if(t.indexOf("{"+o+"}")>-1)t=t.replace("{"+o+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+o.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue}"+t.substring(e+o.length+2))}if(c&&u.length)if(t.indexOf("{"+c+"}")>-1)t=t.replace("{"+c+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+c.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue2}"+t.substring(e+c.length+2))}i.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}}),i}function te(e,t,r,i,a,l,s,o){var n,c;const u=re(e,t,i);if(!((null==u?void 0:u.length)>0))return"";const{dimensionMap:p}=e,d=null==(n=p.get(t).dimensions)?void 0:n[0],h=null==(c=p.get(t).dimensions2)?void 0:c[0];return u[s%u.length].template.replace(/\{Style\}/gi,a).replace(/\{TileMatrixSet\}/gi,r).replace(/\{TileMatrix\}/gi,l).replace(/\{TileRow\}/gi,""+s).replace(/\{TileCol\}/gi,""+o).replace(/\{dimensionValue\}/gi,d).replace(/\{dimensionValue2\}/gi,h)}function re(e,t,r){const i=ee(e,t),a=i.filter(e=>e.format===r);return a.length?a:i}function ie(e,t,r,i){const{dimensionMap:a}=e,l=ee(e,t);let s="";if(l&&l.length>0){const e=a.get(t).dimensions&&a.get(t).dimensions[0],o=a.get(t).dimensions2&&a.get(t).dimensions2[0];s=l[0].template,s.indexOf(".xxx")===s.length-4&&(s=s.slice(0,s.length-4)),s=s.replace(/\{Style\}/gi,i),s=s.replace(/\{TileMatrixSet\}/gi,r),s=s.replace(/\{TileMatrix\}/gi,"{level}"),s=s.replace(/\{TileRow\}/gi,"{row}"),s=s.replace(/\{TileCol\}/gi,"{col}"),s=s.replace(/\{dimensionValue\}/gi,e),s=s.replace(/\{dimensionValue2\}/gi,o)}return s}function ae(e){const t=G("WGS84BoundingBox",e),r=t?X("LowerCorner",t).split(" "):["-180","-90"],i=t?X("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(r[0]),ymin:parseFloat(r[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function le(e){const t=[];return Object(B["b"])(e,{BoundingBox:e=>{if(!e.getAttribute("crs"))return;const r=e.getAttribute("crs").toLowerCase(),i=ce(r),a=r.includes("epsg")&&Object(K["a"])(i.wkid);let l,s,o,n;Object(B["b"])(e,{LowerCorner:e=>{[l,s]=e.textContent.split(" ").map(e=>Number.parseFloat(e)),a&&([l,s]=[s,l])},UpperCorner:e=>{[o,n]=e.textContent.split(" ").map(e=>Number.parseFloat(e)),a&&([o,n]=[n,o])}}),t.push({xmin:l,ymin:s,xmax:o,ymax:n,spatialReference:i})}}),t}function se(e,t){return $("Style",e).map(e=>{const r=G("LegendURL",e),i=G("Keywords",e),a=i&&Q("Keyword",i);let l=r&&r.getAttribute("xlink:href");return t&&(l=l&&l.replace(/^http:/i,"https:")),{abstract:X("Abstract",e),id:X("Identifier",e),isDefault:"true"===e.getAttribute("isDefault"),keywords:a,legendUrl:l,title:X("Title",e)}})}function oe(e,t,r){return $("TileMatrixSetLink",t).map(t=>ne(e,t,r))}function ne(e,t,r){const i=G("TileMatrixSet",t).textContent,a=Q("TileMatrix",t),l=r.find(e=>{const t=G("Identifier",e),r=t&&t.textContent;return!!(r===i||i.split(":")&&i.split(":")[1]===r)}),s=G("TileMatrixSetLimits",t),o=s&&$("TileMatrixLimits",s),n=new Map;if(null!=o&&o.length)for(const f of o){const e=G("TileMatrix",f).textContent,t=+G("MinTileRow",f).textContent,r=+G("MaxTileRow",f).textContent,i=+G("MinTileCol",f).textContent,a=+G("MaxTileCol",f).textContent;n.set(e,{minCol:i,maxCol:a,minRow:t,maxRow:r})}const c=X("SupportedCRS",l).toLowerCase(),u=ue(l,c),p=u.spatialReference,d=G("TileMatrix",l),h=[parseInt(X("TileWidth",d),10),parseInt(X("TileHeight",d),10)],b=[];a.length?a.forEach((e,t)=>{const r=Y("TileMatrix","Identifier",e,l);b.push(me(r,c,t,i,n))}):$("TileMatrix",l).forEach((e,t)=>{b.push(me(e,c,t,i,n))});const y=de(e,l,u,h,b[0]).toJSON(),m=new M["a"]({dpi:96,spatialReference:p,size:h,origin:u,lods:b}).toJSON();return{id:i,fullExtent:y,tileInfo:m}}function ce(e){e=e.toLowerCase();let t=parseInt(e.split(":").pop(),10);900913!==t&&3857!==t||(t=102100);const r=ye(e);return Object(N["k"])(r)&&(t=r),{wkid:t}}function ue(e,t){return pe(G("TileMatrix",e),t)}function pe(e,t){const r=ce(t),[i,a]=X("TopLeftCorner",e).split(" ").map(e=>parseFloat(e)),l=t.includes("epsg")&&Object(K["a"])(r.wkid);return new D["a"](l?{x:a,y:i,spatialReference:r}:{x:i,y:a,spatialReference:r})}function de(e,t,r,i,a){const l=G("BoundingBox",t);let s,o,n,c,u,p;if(l&&(s=X("LowerCorner",l).split(" "),o=X("UpperCorner",l).split(" ")),s&&s.length>1&&o&&o.length>1)n=parseFloat(s[0]),u=parseFloat(s[1]),c=parseFloat(o[0]),p=parseFloat(o[1]);else{const e=G("TileMatrix",t),l=parseInt(X("MatrixWidth",e),10),s=parseInt(X("MatrixHeight",e),10);n=r.x,p=r.y,c=n+l*i[0]*a.resolution,u=p-s*i[1]*a.resolution}return he(e,r.spatialReference)?new f["a"](u,n,p,c,r.spatialReference):new f["a"](n,u,c,p,r.spatialReference)}function he(e,t){return"1.0.0"===e&&Object(K["a"])(t.wkid)}var be;function ye(e){return e.includes("crs84")||e.includes("crs:84")?be.CRS84:e.includes("crs83")||e.includes("crs:83")?be.CRS83:e.includes("crs27")||e.includes("crs:27")?be.CRS27:null}function me(e,t,r,i,a){var l;const s=ce(t),o=X("Identifier",e);let n=parseFloat(X("ScaleDenominator",e));const c=fe(s.wkid,n,i);n*=96/H;const u=+X("MatrixWidth",e),p=+X("MatrixHeight",e),{maxCol:d=u-1,maxRow:h=p-1,minCol:b=0,minRow:y=0}=null!=(l=a.get(o))?l:{},{x:m,y:f}=pe(e,t);return{cols:[b,d],level:r,levelValue:o,origin:[m,f],scale:n,resolution:c,rows:[y,h]}}function fe(e,t,r){let i;return i=k["a"].hasOwnProperty(""+e)?k["a"].values[k["a"][e]]:"default028mm"===r?6370997*Math.PI/180:Object(W["f"])(e).metersPerDegree,7*t/25e3/i}!function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"}(be||(be={}));const Oe={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},ge=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let je=class extends(Object(j["a"])(Object(x["a"])(Object(S["a"])(Object(v["a"])(Object(w["a"])(Object(c["a"])(O["a"]))))))){constructor(...e){super(...e),this._sublayersHandles=new o["a"],this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.watch("activeLayer",(e,t)=>{t&&(t.layer=null),e&&(e.layer=this)},!0),this.watch("sublayers",(e,t)=>{t&&(t.forEach(e=>{e.layer=null}),this._sublayersHandles.removeAll(),this._sublayersHandles=null),e&&(e.forEach(e=>{e.layer=this}),this._sublayersHandles||(this._sublayersHandles=new o["a"]),this._sublayersHandles.add([e.on("after-add",({item:e})=>{e.layer=this}),e.on("after-remove",({item:e})=>{e.layer=null})]))},!0)}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){if("KVP"===this.serviceMode||"RESTful"===this.serviceMode)return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(p["u"]).then(()=>this._fetchService(e)).catch(e=>{throw Object(p["u"])(e),new s["a"]("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:e})})),Promise.resolve(this);console.error("WMTS mode could only be 'KVP' or 'RESTful'")}get activeLayer(){return this._get("activeLayer")}set activeLayer(e){this._set("activeLayer",e)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new A);let i=t.layers.find(e=>e.id===this.activeLayer.id);return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,a=r?this._getLowerCasedUrlParams(r):null,l=null==i?void 0:i.layerIdentifier;let s=null;const o=null==i?void 0:i.tileMatrixSet;o&&(Array.isArray(o)?o.length&&(s=o[0]):s=o);const n=null==a?void 0:a.format,c=null==a?void 0:a.style;return new A({id:l,imageFormat:n,styleId:c,tileMatrixSetId:s})}writeActiveLayer(e,t,r,i){const a=this.activeLayer;t.templateUrl=this.getUrlTemplate(a.id,a.tileMatrixSetId,a.imageFormat,a.styleId);const l=Object(u["b"])("tileMatrixSet.tileInfo",a);t.tileInfo=l?l.toJSON(i):null,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:a.id,tileMatrixSet:a.tileMatrixSetId}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.indexOf("?")>-1?"KVP":"RESTful"}readSublayersFromService(e,t,r){return ve(t.layers,r)}get supportedSpatialReferences(){return this.activeLayer.tileMatrixSets.map(e=>e.tileInfo.spatialReference).toArray()}get tilemapCache(){var e,t;const r=null==(e=this.activeLayer)||null==(t=e.tileMatrixSet)?void 0:t.tileInfo;return new I(r)}get title(){var e,t;return null!=(e=null==(t=this.activeLayer)?void 0:t.title)?e:"Layer"}set title(e){e?this._override("title",e):this._clearOverride("title")}get url(){return this._get("url")}set url(e){e&&"/"===e.substr(-1)?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId).tileInfo,i=e.fullExtent,a=new L["a"]({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new g["default"]({fullExtent:i,urlTemplate:t,tileInfo:r,wmtsInfo:a})}fetchTile(e,t,r){const i=this.getTileUrl(e,t,r);return Object(a["default"])(i,{responseType:"image"}).then(e=>e.data)}findSublayerById(e){return this.sublayers.find(t=>t.id===e)}getTileUrl(e,t,r){const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId).tileInfo.lods[e],a=i?i.levelValue?i.levelValue:""+i.level:""+e;let l=this.resourceInfo?"":te({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);return l||(l=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replace(/\{level\}/gi,a).replace(/\{row\}/gi,""+t).replace(/\{col\}/gi,""+r)),l=this._appendCustomLayerParameters(l),l}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const r=ie({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(r)return r}if("KVP"===this.serviceMode)return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if("RESTful"===this.serviceMode){let a="";return Oe[r.toLowerCase()]&&(a=Oe[r.toLowerCase()]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+a}return""}async _fetchService(e){let t;if(this.resourceInfo)"KVP"===this.resourceInfo.serviceMode&&(this.url+=this.url.indexOf("?")>-1?"":"?"),t={ssl:!1,data:this.resourceInfo};else try{t=await this._getCapabilities(this.serviceMode,e)}catch{const i="KVP"===this.serviceMode?"RESTful":"KVP";try{t=await this._getCapabilities(i,e),this.serviceMode=i}catch(r){throw new s["a"]("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:r})}}this.resourceInfo?t.data=q(t.data):t.data=J(t.data,{serviceMode:this.serviceMode,url:this.url}),t.data&&this.read(t.data,{origin:"service"})}async _getCapabilities(e,t){const r=this._getCapabilitiesUrl(e);return await Object(a["default"])(r,{...t,responseType:"text"})}_getTileMatrixSetById(e){return this.findSublayerById(this.activeLayer.id).tileMatrixSets.find(t=>t.id===e)}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...Object(n["a"])(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=Object(d["M"])(e),i={...r.query,...t},a=Object(d["G"])(i);return""===a?r.path:`${r.path}?${a}`}_getCapabilitiesUrl(e){let t;return this.url=this.url.split("?")[0],"KVP"===e?t=this.url+"?request=GetCapabilities&service=WMTS&version="+this.version:"RESTful"===e&&(t=this.url+"/"+this.version+"/WMTSCapabilities.xml"),t=this._appendCustomParameters(t),t}_getLowerCasedUrlParams(e){if(!e)return null;const t=Object(d["M"])(e).query;if(!t)return null;const r={};return Object.keys(t).forEach(e=>{r[e.toLowerCase()]=t[e]}),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const t=Object.keys(r);t.length&&(e=e?Object(n["a"])(e):{},t.forEach(t=>{e.hasOwnProperty(t)||ge.has(t)||(e[t]=r[t])}))}return e}};function ve(e,t){return e.map(e=>{const r=new A;return r.read(e,t),r})}Object(i["a"])([Object(h["b"])()],je.prototype,"dimensionMap",void 0),Object(i["a"])([Object(h["b"])()],je.prototype,"layerMap",void 0),Object(i["a"])([Object(h["b"])({type:A,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],je.prototype,"activeLayer",null),Object(i["a"])([Object(b["a"])("service","activeLayer",["layers"])],je.prototype,"readActiveLayerFromService",null),Object(i["a"])([Object(b["a"])(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],je.prototype,"readActiveLayerFromItemOrWebDoc",null),Object(i["a"])([Object(m["a"])(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:M["a"]},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],je.prototype,"writeActiveLayer",null),Object(i["a"])([Object(h["b"])({type:String,value:"",json:{write:!0}})],je.prototype,"copyright",void 0),Object(i["a"])([Object(h["b"])({type:["show","hide"]})],je.prototype,"listMode",void 0),Object(i["a"])([Object(h["b"])({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],je.prototype,"customParameters",void 0),Object(i["a"])([Object(b["a"])(["portal-item","web-document"],"customParameters")],je.prototype,"readCustomParameters",null),Object(i["a"])([Object(h["b"])({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],je.prototype,"customLayerParameters",void 0),Object(i["a"])([Object(h["b"])({type:f["a"],json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],je.prototype,"fullExtent",void 0),Object(i["a"])([Object(h["b"])({readOnly:!0})],je.prototype,"fullExtents",null),Object(i["a"])([Object(h["b"])({type:["WebTiledLayer"]})],je.prototype,"operationalLayerType",void 0),Object(i["a"])([Object(h["b"])()],je.prototype,"resourceInfo",void 0),Object(i["a"])([Object(h["b"])()],je.prototype,"serviceMode",void 0),Object(i["a"])([Object(b["a"])(["portal-item","web-document"],"serviceMode",["templateUrl"])],je.prototype,"readServiceMode",null),Object(i["a"])([Object(h["b"])({type:l["a"].ofType(A)})],je.prototype,"sublayers",void 0),Object(i["a"])([Object(b["a"])("service","sublayers",["layers"])],je.prototype,"readSublayersFromService",null),Object(i["a"])([Object(h["b"])({readOnly:!0})],je.prototype,"supportedSpatialReferences",null),Object(i["a"])([Object(h["b"])({readOnly:!0})],je.prototype,"tilemapCache",null),Object(i["a"])([Object(h["b"])({json:{read:{source:"title"}}})],je.prototype,"title",null),Object(i["a"])([Object(h["b"])({json:{read:!1},readOnly:!0,value:"wmts"})],je.prototype,"type",void 0),Object(i["a"])([Object(h["b"])({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],je.prototype,"url",null),Object(i["a"])([Object(h["b"])()],je.prototype,"version",void 0),je=Object(i["a"])([Object(y["a"])("esri.layers.WMTSLayer")],je);const we=je}}]); //# sourceMappingURL=chunk-6490f072.f1a43a4f.js.map