import { u } from "./chunk-N2663GRX.js"; import { z } from "./chunk-O4FY3ITT.js"; import { s } from "./chunk-PDKDCAAD.js"; import { M, j2 as j, o } from "./chunk-ECW2QABR.js"; import { E, I, R, k2 as k, o as o2, r } from "./chunk-MRJEICT6.js"; import { d, e, l3 as l, n2 as n } from "./chunk-Y3WMVFTW.js"; import { S } from "./chunk-IHXECKQQ.js"; import { t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/layers/support/LOD.js var i; var l2 = i = class extends l { constructor(e2) { super(e2), this.cols = null, this.level = 0, this.levelValue = null, this.origin = null, this.resolution = 0, this.rows = null, this.scale = 0; } clone() { return new i({ cols: this.cols, level: this.level, levelValue: this.levelValue, resolution: this.resolution, rows: this.rows, scale: this.scale }); } }; e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "cols", void 0), e([d({ type: S, json: { write: true } })], l2.prototype, "level", void 0), e([d({ type: String, json: { write: true } })], l2.prototype, "levelValue", void 0), e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "origin", void 0), e([d({ type: Number, json: { write: true } })], l2.prototype, "resolution", void 0), e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "rows", void 0), e([d({ type: Number, json: { write: true } })], l2.prototype, "scale", void 0), l2 = i = e([n("esri.layers.support.LOD")], l2); var p = l2; // node_modules/@arcgis/core/layers/support/TileInfo.js var w; var x = new s({ PNG: "png", PNG8: "png8", PNG24: "png24", PNG32: "png32", JPEG: "jpg", JPG: "jpg", DIB: "dib", TIFF: "tiff", EMF: "emf", PS: "ps", PDF: "pdf", GIF: "gif", SVG: "svg", SVGZ: "svgz", Mixed: "mixed", MIXED: "mixed", LERC: "lerc", LERC2D: "lerc2d", RAW: "raw", pbf: "pbf" }); var O = w = class extends l { constructor(e2) { super(e2), this.dpi = 96, this.format = null, this.origin = null, this.minScale = 0, this.maxScale = 0, this.size = null, this.spatialReference = null; } static create(e2 = {}) { const { resolutionFactor: t2 = 1, scales: o3, size: r2 = 256, spatialReference: i2 = k.WebMercator, numLODs: l3 = 24 } = e2; if (!I(i2)) { const e3 = []; if (o3) for (let t3 = 0; t3 < o3.length; t3++) { const r3 = o3[t3]; e3.push({ level: t3, scale: r3, resolution: r3 }); } else { let t3 = 5e-4; for (let o4 = l3 - 1; o4 >= 0; o4--) e3.unshift({ level: o4, scale: t3, resolution: t3 }), t3 *= 2; } return new w({ dpi: 96, lods: e3, origin: new j(0, 0, i2), size: [r2, r2], spatialReference: i2 }); } const n2 = R(i2), a = e2.origin ? new j({ x: e2.origin.x, y: e2.origin.y, spatialReference: i2 }) : new j(n2 ? { x: n2.origin[0], y: n2.origin[1], spatialReference: i2 } : { x: 0, y: 0, spatialReference: i2 }), p2 = 96, f = 1 / (z(i2) * 39.37 * p2), g = []; if (o3) for (let s2 = 0; s2 < o3.length; s2++) { const e3 = o3[s2], t3 = e3 * f; g.push({ level: s2, scale: e3, resolution: t3 }); } else { let e3 = o2(i2) ? 512 / r2 * 5916575275917094e-7 : 256 / r2 * 591657527591555e-6; const o4 = Math.ceil(l3 / t2); g.push({ level: 0, scale: e3, resolution: e3 * f }); for (let r3 = 1; r3 < o4; r3++) { const o5 = e3 / 2 ** t2, s2 = o5 * f; g.push({ level: r3, scale: o5, resolution: s2 }), e3 = o5; } } return new w({ dpi: p2, lods: g, origin: a, size: [r2, r2], spatialReference: i2 }); } get isWrappable() { const { spatialReference: e2, origin: t2 } = this; if (e2 && t2) { const o3 = R(e2); return e2.isWrappable && Math.abs(o3.origin[0] - t2.x) <= o3.dx; } return false; } readOrigin(e2, t2) { return j.fromJSON({ spatialReference: t2.spatialReference, ...e2 }); } set lods(e2) { let t2 = 0, o3 = 0; const r2 = []; this._levelToLOD = {}, e2 && (t2 = -1 / 0, o3 = 1 / 0, e2.forEach((e3) => { r2.push(e3.scale), t2 = e3.scale > t2 ? e3.scale : t2, o3 = e3.scale < o3 ? e3.scale : o3, this._levelToLOD[e3.level] = e3; })), this._set("scales", r2), this._set("minScale", t2), this._set("maxScale", o3), this._set("lods", e2), this._initializeUpsampleLevels(); } readSize(e2, t2) { return [t2.cols, t2.rows]; } writeSize(e2, t2) { t2.cols = e2[0], t2.rows = e2[1]; } zoomToScale(e2) { const t2 = this.scales; if (e2 <= 0) return t2[0]; if (e2 >= t2.length - 1) return t2[t2.length - 1]; { const o3 = Math.floor(e2), r2 = o3 + 1; return t2[o3] / (t2[o3] / t2[r2]) ** (e2 - o3); } } scaleToZoom(e2) { const t2 = this.scales, o3 = t2.length - 1; let r2 = 0; for (; r2 < o3; r2++) { const o4 = t2[r2], s2 = t2[r2 + 1]; if (o4 <= e2) return r2; if (s2 === e2) return r2 + 1; if (o4 > e2 && s2 < e2) return r2 + Math.log(o4 / e2) / Math.log(o4 / s2); } return r2; } snapScale(e2, t2 = 0.95) { const o3 = this.scaleToZoom(e2); return o3 % Math.floor(o3) >= t2 ? this.zoomToScale(Math.ceil(o3)) : this.zoomToScale(Math.floor(o3)); } tileAt(e2, t2, o3, s2) { const i2 = this.lodAt(e2); if (!i2) return null; let l3, n2; if (typeof t2 == "number") l3 = t2, n2 = o3; else if (E(t2.spatialReference, this.spatialReference)) l3 = t2.x, n2 = t2.y, s2 = o3; else { const e3 = M(t2, this.spatialReference); if (t(e3)) return null; l3 = e3.x, n2 = e3.y, s2 = o3; } const a = i2.resolution * this.size[0], p2 = i2.resolution * this.size[1]; return s2 || (s2 = { id: null, level: 0, row: 0, col: 0, extent: u() }), s2.level = e2, s2.row = Math.floor((this.origin.y - n2) / p2 + 1e-3), s2.col = Math.floor((l3 - this.origin.x) / a + 1e-3), this.updateTileInfo(s2), s2; } updateTileInfo(e2, t2 = w.ExtrapolateOptions.NONE) { let o3 = this.lodAt(e2.level); if (!o3 && t2 === w.ExtrapolateOptions.POWER_OF_TWO) { const t3 = this.lods[this.lods.length - 1]; t3.level < e2.level && (o3 = t3); } if (!o3) return; const r2 = e2.level - o3.level, s2 = o3.resolution * this.size[0] / 2 ** r2, i2 = o3.resolution * this.size[1] / 2 ** r2; e2.id = `${e2.level}/${e2.row}/${e2.col}`, e2.extent || (e2.extent = u()), e2.extent[0] = this.origin.x + e2.col * s2, e2.extent[1] = this.origin.y - (e2.row + 1) * i2, e2.extent[2] = e2.extent[0] + s2, e2.extent[3] = e2.extent[1] + i2; } upsampleTile(e2) { const t2 = this._upsampleLevels[e2.level]; return !(!t2 || t2.parentLevel === -1) && (e2.level = t2.parentLevel, e2.row = Math.floor(e2.row / t2.factor + 1e-3), e2.col = Math.floor(e2.col / t2.factor + 1e-3), this.updateTileInfo(e2), true); } getTileBounds(e2, t2) { const { resolution: o3 } = this.lodAt(t2.level), r2 = o3 * this.size[0], s2 = o3 * this.size[1]; return e2[0] = this.origin.x + t2.col * r2, e2[1] = this.origin.y - (t2.row + 1) * s2, e2[2] = e2[0] + r2, e2[3] = e2[1] + s2, e2; } lodAt(e2) { return this._levelToLOD && this._levelToLOD[e2] || null; } clone() { return w.fromJSON(this.write({})); } getOrCreateCompatible(e2, t2) { if (this.size[0] === 256 && this.size[1] === 256) return e2 === 256 ? this : null; const o3 = [], r2 = this.lods.length; for (let s2 = 0; s2 < r2; s2++) { const e3 = this.lods[s2], r3 = e3.resolution * t2; o3.push(new p({ level: e3.level, scale: e3.scale, resolution: r3 })); } return new w({ size: [e2, e2], dpi: this.dpi, format: this.format, compressionQuality: this.compressionQuality, origin: this.origin, spatialReference: this.spatialReference, lods: o3 }); } _initializeUpsampleLevels() { const e2 = this.lods; this._upsampleLevels = []; let t2 = null; for (let o3 = 0; o3 < e2.length; o3++) { const r2 = e2[o3]; this._upsampleLevels[r2.level] = { parentLevel: t2 ? t2.level : -1, factor: t2 ? t2.resolution / r2.resolution : 0 }, t2 = r2; } } }; e([d({ type: Number, json: { write: true } })], O.prototype, "compressionQuality", void 0), e([d({ type: Number, json: { write: true } })], O.prototype, "dpi", void 0), e([d({ type: String, json: { read: x.read, write: x.write, origins: { "web-scene": { read: false, write: false } } } })], O.prototype, "format", void 0), e([d({ readOnly: true })], O.prototype, "isWrappable", null), e([d({ type: j, json: { write: true } })], O.prototype, "origin", void 0), e([o("origin")], O.prototype, "readOrigin", null), e([d({ type: [p], value: null, json: { write: true } })], O.prototype, "lods", null), e([d({ readOnly: true })], O.prototype, "minScale", void 0), e([d({ readOnly: true })], O.prototype, "maxScale", void 0), e([d({ readOnly: true })], O.prototype, "scales", void 0), e([d({ cast: (e2) => Array.isArray(e2) ? e2 : typeof e2 == "number" ? [e2, e2] : [256, 256] })], O.prototype, "size", void 0), e([o("size", ["rows", "cols"])], O.prototype, "readSize", null), e([r("size", { cols: { type: S }, rows: { type: S } })], O.prototype, "writeSize", null), e([d({ type: k, json: { write: true } })], O.prototype, "spatialReference", void 0), O = w = e([n("esri.layers.support.TileInfo")], O), function(e2) { var t2; (t2 = e2.ExtrapolateOptions || (e2.ExtrapolateOptions = {}))[t2.NONE = 0] = "NONE", t2[t2.POWER_OF_TWO = 1] = "POWER_OF_TWO"; }(O || (O = {})); var S2 = O; export { p, S2 as S }; //# sourceMappingURL=chunk-RBZL6SRZ.js.map