import { g } from "./chunk-Z2FNPC7X.js"; import { j } from "./chunk-YLEVJ6UV.js"; import "./chunk-U2WD23Z5.js"; import { c } from "./chunk-WLSB4F4I.js"; import "./chunk-GLSWDDR3.js"; import { O } from "./chunk-MIQGEDET.js"; import "./chunk-DUEMJ5XS.js"; import "./chunk-VRLXUHP2.js"; import "./chunk-3LVSQLWJ.js"; import "./chunk-4ONPMX2F.js"; import "./chunk-CRGY2SDS.js"; import "./chunk-4T5ZGMEN.js"; import "./chunk-GN35O2ZO.js"; import { n as n2 } from "./chunk-XTVKPAWY.js"; import "./chunk-3OSQ6GXO.js"; import "./chunk-3WQOA5CB.js"; import "./chunk-PLWDAYK7.js"; import "./chunk-FZQZIM7U.js"; import "./chunk-CZBRZ6SU.js"; import "./chunk-VGWC3IKZ.js"; import "./chunk-2H5MD622.js"; import "./chunk-3RSFVUKZ.js"; import "./chunk-UVVU4UUO.js"; import "./chunk-P3XKUGLS.js"; import "./chunk-DXVOOCG4.js"; import "./chunk-3GZSQU56.js"; import "./chunk-ZYRIJWLX.js"; import "./chunk-RYY6632W.js"; import "./chunk-DW42UVIT.js"; import "./chunk-YAEIHDJH.js"; import "./chunk-TJNOJH33.js"; import "./chunk-OSHI574D.js"; import "./chunk-ETGAZ7LF.js"; import "./chunk-75U5LM2V.js"; import "./chunk-RMDDCMKS.js"; import "./chunk-VCH45Q2I.js"; import "./chunk-LBW34VZ2.js"; import "./chunk-GSSTTHIT.js"; import "./chunk-YFSLJIO4.js"; import "./chunk-IM3LVQXV.js"; import "./chunk-55RWC67C.js"; import { s as s2 } from "./chunk-HZRKBTHJ.js"; import { U } from "./chunk-DVUG3KID.js"; import "./chunk-FWSQEIAR.js"; import "./chunk-VEGAOVMY.js"; import "./chunk-6T6G6LCQ.js"; import "./chunk-YEJL5NEF.js"; import { k2 as k } from "./chunk-PQFTYGF5.js"; import { e, n5 as n, y3 as y } from "./chunk-2Z2TG5CU.js"; import "./chunk-6KZ2LTDA.js"; import "./chunk-U2XHEJM7.js"; import "./chunk-SQOPWYIT.js"; import "./chunk-V6P2MAQQ.js"; import { s3 as s } from "./chunk-E5O6P5I2.js"; import "./chunk-SPWQ3AWG.js"; import "./chunk-2TIUKVZN.js"; import { r, t } from "./chunk-YXWMMD76.js"; import "./chunk-S5KM4IGW.js"; // node_modules/@arcgis/core/layers/BingMapsLayer.js var c2 = new s2({ BingMapsAerial: "aerial", BingMapsRoad: "road", BingMapsHybrid: "hybrid" }); var h = "https://dev.virtualearth.net"; var m = class extends n2(c(O(g))) { constructor(e2) { super(e2), this.type = "bing-maps", this.tileInfo = new j({ size: [256, 256], dpi: 96, origin: { x: -20037508342787e-6, y: 20037508342787e-6, spatialReference: k.WebMercator }, spatialReference: k.WebMercator, lods: [{ level: 1, resolution: 78271.5169639999, scale: 295828763795777e-6 }, { level: 2, resolution: 39135.7584820001, scale: 147914381897889e-6 }, { level: 3, resolution: 19567.8792409999, scale: 73957190948944e-6 }, { level: 4, resolution: 9783.93962049996, scale: 36978595474472e-6 }, { level: 5, resolution: 4891.96981024998, scale: 18489297737236e-6 }, { level: 6, resolution: 2445.98490512499, scale: 9244648868618e-6 }, { level: 7, resolution: 1222.99245256249, scale: 4622324434309e-6 }, { level: 8, resolution: 611.49622628138, scale: 2311162217155e-6 }, { level: 9, resolution: 305.748113140558, scale: 1155581108577e-6 }, { level: 10, resolution: 152.874056570411, scale: 577790.554289 }, { level: 11, resolution: 76.4370282850732, scale: 288895.277144 }, { level: 12, resolution: 38.2185141425366, scale: 144447.638572 }, { level: 13, resolution: 19.1092570712683, scale: 72223.819286 }, { level: 14, resolution: 9.55462853563415, scale: 36111.909643 }, { level: 15, resolution: 4.77731426794937, scale: 18055.954822 }, { level: 16, resolution: 2.38865713397468, scale: 9027.977411 }, { level: 17, resolution: 1.19432856685505, scale: 4513.988705 }, { level: 18, resolution: 0.597164283559817, scale: 2256.994353 }, { level: 19, resolution: 0.298582141647617, scale: 1128.497176 }, { level: 20, resolution: 0.1492910708238085, scale: 564.248588 }] }), this.key = null, this.style = "road", this.culture = "en-US", this.region = null, this.portalUrl = null, this.hasAttributionData = true; } get bingMetadata() { return this._get("bingMetadata"); } set bingMetadata(e2) { this._set("bingMetadata", e2); } get copyright() { return r(this.bingMetadata) ? this.bingMetadata.copyright : null; } get operationalLayerType() { return c2.toJSON(this.style); } get bingLogo() { return r(this.bingMetadata) ? this.bingMetadata.brandLogoUri : null; } load(e2) { return this.key ? this.addResolvingPromise(this._getMetadata()) : this.portalUrl ? this.addResolvingPromise(this._getPortalBingKey().then(() => this._getMetadata())) : this.addResolvingPromise(Promise.reject(new s("bingmapslayer:load", "Bing layer must have bing key."))), Promise.resolve(this); } getTileUrl(e2, t2, r2) { if (!this.loaded || t(this.bingMetadata)) return null; const a = this.bingMetadata.resourceSets[0].resources[0], o = a.imageUrlSubdomains[t2 % a.imageUrlSubdomains.length], i = this._getQuadKey(e2, t2, r2); return a.imageUrl.replace("{subdomain}", o).replace("{quadkey}", i); } async fetchAttributionData() { return this.load().then(() => { if (t(this.bingMetadata)) return null; return { contributors: this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map((e2) => ({ attribution: e2.attribution, coverageAreas: e2.coverageAreas.map((e3) => ({ zoomMin: e3.zoomMin, zoomMax: e3.zoomMax, score: 1, bbox: [e3.bbox[0], e3.bbox[1], e3.bbox[2], e3.bbox[3]] })) })) }; }); } _getMetadata() { const e2 = { road: "roadOnDemand", aerial: "aerial", hybrid: "aerialWithLabelsOnDemand" }[this.style]; return U(`${h}/REST/v1/Imagery/Metadata/${e2}`, { responseType: "json", query: { include: "ImageryProviders", uriScheme: "https", key: this.key, suppressStatus: true, output: "json", culture: this.culture, userRegion: this.region } }).then((e3) => { const t2 = e3.data; if (200 !== t2.statusCode) throw new s("bingmapslayer:getmetadata", t2.statusDescription); if (this.bingMetadata = t2, 0 === this.bingMetadata.resourceSets.length) throw new s("bingmapslayer:getmetadata", "no bing resourcesets"); if (0 === this.bingMetadata.resourceSets[0].resources.length) throw new s("bingmapslayer:getmetadata", "no bing resources"); }).catch((e3) => { throw new s("bingmapslayer:getmetadata", e3.message); }); } _getPortalBingKey() { var _a; return U((_a = this.portalUrl) != null ? _a : "", { responseType: "json", authMode: "no-prompt", query: { f: "json" } }).then((e2) => { if (!e2.data.bingKey) throw new s("bingmapslayer:getportalbingkey", "The referenced Portal does not contain a valid bing key"); this.key = e2.data.bingKey; }).catch((e2) => { throw new s("bingmapslayer:getportalbingkey", e2.message); }); } _getQuadKey(e2, t2, r2) { let a = ""; for (let o = e2; o > 0; o--) { let e3 = 0; const s3 = 1 << o - 1; 0 != (r2 & s3) && (e3 += 1), 0 != (t2 & s3) && (e3 += 2), a += e3.toString(); } return a; } }; e([y({ json: { read: false, write: false }, value: null })], m.prototype, "bingMetadata", null), e([y({ json: { read: false, write: false }, value: "bing-maps", readOnly: true })], m.prototype, "type", void 0), e([y({ type: j })], m.prototype, "tileInfo", void 0), e([y({ type: String, readOnly: true, json: { read: false, write: false } })], m.prototype, "copyright", null), e([y({ type: String, json: { write: false, read: false } })], m.prototype, "key", void 0), e([y({ type: c2.apiValues, nonNullable: true, json: { read: { source: "layerType", reader: c2.read } } })], m.prototype, "style", void 0), e([y({ type: ["BingMapsAerial", "BingMapsHybrid", "BingMapsRoad"] })], m.prototype, "operationalLayerType", null), e([y({ type: String, json: { write: false, read: false } })], m.prototype, "culture", void 0), e([y({ type: String, json: { write: false, read: false } })], m.prototype, "region", void 0), e([y({ type: String, json: { write: true, read: true } })], m.prototype, "portalUrl", void 0), e([y({ type: Boolean, json: { write: false, read: false } })], m.prototype, "hasAttributionData", void 0), e([y({ type: String, readOnly: true })], m.prototype, "bingLogo", null), m = e([n("esri.layers.BingMapsLayer")], m); var b = m; export { b as default }; //# sourceMappingURL=BingMapsLayer-G5OIKC22.js.map