123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- import {
- M
- } from "./chunk-5JK4DCPE.js";
- import {
- l as l2
- } from "./chunk-7XXXCK2A.js";
- import {
- c,
- p
- } from "./chunk-65BYCSII.js";
- import {
- o
- } from "./chunk-ECW2QABR.js";
- import {
- r as r2
- } from "./chunk-MRJEICT6.js";
- import {
- d,
- e,
- l3 as l,
- n2 as n
- } from "./chunk-Y3WMVFTW.js";
- import {
- v
- } from "./chunk-IHXECKQQ.js";
- import {
- r
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/geometry/support/MeshTexture.js
- var p2;
- var d2 = new WeakMap();
- var h = 0;
- var u = p2 = class extends l {
- constructor(t) {
- super(t), this.wrap = "repeat";
- }
- get url() {
- return this._get("url") || null;
- }
- set url(t) {
- this._set("url", t), t && this._set("data", null);
- }
- get data() {
- return this._get("data") || null;
- }
- set data(t) {
- this._set("data", t), t && this._set("url", null);
- }
- writeData(t, e2, a, r3) {
- if (t instanceof HTMLImageElement) {
- const s = { type: "image-element", src: c(t.src, r3), crossOrigin: t.crossOrigin };
- e2[a] = s;
- } else if (t instanceof HTMLCanvasElement) {
- const r4 = t.getContext("2d").getImageData(0, 0, t.width, t.height), s = { type: "canvas-element", imageData: this._encodeImageData(r4) };
- e2[a] = s;
- } else if (t instanceof HTMLVideoElement) {
- const s = { type: "video-element", src: c(t.src, r3), autoplay: t.autoplay, loop: t.loop, muted: t.muted, crossOrigin: t.crossOrigin, preload: t.preload };
- e2[a] = s;
- } else {
- const r4 = { type: "image-data", imageData: this._encodeImageData(t) };
- e2[a] = r4;
- }
- }
- readData(t) {
- switch (t.type) {
- case "image-element": {
- const e2 = new Image();
- return e2.src = t.src, e2.crossOrigin = t.crossOrigin, e2;
- }
- case "canvas-element": {
- const e2 = this._decodeImageData(t.imageData), a = document.createElement("canvas");
- return a.width = e2.width, a.height = e2.height, a.getContext("2d").putImageData(e2, 0, 0), a;
- }
- case "image-data":
- return this._decodeImageData(t.imageData);
- case "video-element": {
- const e2 = document.createElement("video");
- return e2.src = t.src, e2.crossOrigin = t.crossOrigin, e2.autoplay = t.autoplay, e2.loop = t.loop, e2.muted = t.muted, e2.preload = t.preload, e2;
- }
- default:
- return;
- }
- }
- get transparent() {
- const t = this.data, e2 = this.url;
- if (t instanceof HTMLCanvasElement)
- return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0, 0, t.width, t.height));
- if (t instanceof ImageData)
- return this._imageDataContainsTransparent(t);
- if (e2) {
- const t2 = e2.substr(e2.length - 4, 4).toLowerCase(), a = e2.substr(0, 15).toLocaleLowerCase();
- if (t2 === ".png" || a === "data:image/png;")
- return true;
- }
- return false;
- }
- set transparent(t) {
- t != null ? this._override("transparent", t) : this._clearOverride("transparent");
- }
- get contentHash() {
- const t = typeof this.wrap == "string" ? this.wrap : typeof this.wrap == "object" ? `${this.wrap.horizontal}/${this.wrap.vertical}` : "", e2 = (e3 = "") => `d:${e3},t:${this.transparent},w:${t}`;
- return this.url != null ? e2(this.url) : this.data != null ? this.data instanceof HTMLImageElement || this.data instanceof HTMLVideoElement ? e2(this.data.src) : (d2.has(this.data) || d2.set(this.data, ++h), e2(d2.get(this.data))) : e2();
- }
- clone() {
- const t = { url: this.url, data: this.data, wrap: this._cloneWrap() };
- return new p2(t);
- }
- cloneWithDeduplication(t) {
- const e2 = t.get(this);
- if (e2)
- return e2;
- const a = this.clone();
- return t.set(this, a), a;
- }
- _cloneWrap() {
- return typeof this.wrap == "string" ? this.wrap : { horizontal: this.wrap.horizontal, vertical: this.wrap.vertical };
- }
- _encodeImageData(t) {
- let e2 = "";
- for (let a = 0; a < t.data.length; a++)
- e2 += String.fromCharCode(t.data[a]);
- return { data: btoa(e2), width: t.width, height: t.height };
- }
- _decodeImageData(t) {
- const e2 = atob(t.data), a = new Uint8ClampedArray(e2.length);
- for (let r3 = 0; r3 < e2.length; r3++)
- a[r3] = e2.charCodeAt(r3);
- return M(a, t.width, t.height);
- }
- _imageDataContainsTransparent(t) {
- for (let e2 = 3; e2 < t.data.length; e2 += 4)
- if (t.data[e2] !== 255)
- return true;
- return false;
- }
- static from(t) {
- return typeof t == "string" ? new p2({ url: t }) : t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof ImageData || t instanceof HTMLVideoElement ? new p2({ data: t }) : v(p2, t);
- }
- };
- e([d({ type: String, json: { write: p } })], u.prototype, "url", null), e([d({ json: { write: { overridePolicy() {
- return { enabled: !this.url };
- } } } }), d()], u.prototype, "data", null), e([r2("data")], u.prototype, "writeData", null), e([o("data")], u.prototype, "readData", null), e([d({ type: Boolean, json: { write: { overridePolicy() {
- return { enabled: this._isOverridden("transparent") };
- } } } })], u.prototype, "transparent", null), e([d({ json: { write: true } })], u.prototype, "wrap", void 0), e([d({ readOnly: true })], u.prototype, "contentHash", null), u = p2 = e([n("esri.geometry.support.MeshTexture")], u);
- var m = u;
- // node_modules/@arcgis/core/geometry/support/MeshMaterial.js
- var p3;
- var n2 = p3 = class extends l {
- constructor(o2) {
- super(o2), this.color = null, this.colorTexture = null, this.normalTexture = null, this.alphaMode = "auto", this.alphaCutoff = 0.5, this.doubleSided = true;
- }
- clone() {
- return this.cloneWithDeduplication(null, new Map());
- }
- cloneWithDeduplication(o2, e2) {
- const t = r(o2) ? o2.get(this) : null;
- if (t)
- return t;
- const l3 = new p3(this.clonePropertiesWithDeduplication(e2));
- return r(o2) && o2.set(this, l3), l3;
- }
- clonePropertiesWithDeduplication(o2) {
- return { color: r(this.color) ? this.color.clone() : null, colorTexture: r(this.colorTexture) ? this.colorTexture.cloneWithDeduplication(o2) : null, normalTexture: r(this.normalTexture) ? this.normalTexture.cloneWithDeduplication(o2) : null, alphaMode: this.alphaMode, alphaCutoff: this.alphaCutoff, doubleSided: this.doubleSided };
- }
- };
- e([d({ type: l2, json: { write: true } })], n2.prototype, "color", void 0), e([d({ type: m, json: { write: true } })], n2.prototype, "colorTexture", void 0), e([d({ type: m, json: { write: true } })], n2.prototype, "normalTexture", void 0), e([d({ nonNullable: true, json: { write: true } })], n2.prototype, "alphaMode", void 0), e([d({ nonNullable: true, json: { write: true } })], n2.prototype, "alphaCutoff", void 0), e([d({ nonNullable: true, json: { write: true } })], n2.prototype, "doubleSided", void 0), n2 = p3 = e([n("esri.geometry.support.MeshMaterial")], n2);
- var u2 = n2;
- // node_modules/@arcgis/core/geometry/support/MeshMaterialMetallicRoughness.js
- var n3;
- var u3 = n3 = class extends u2 {
- constructor(e2) {
- super(e2), this.emissiveColor = null, this.emissiveTexture = null, this.occlusionTexture = null, this.metallic = 1, this.roughness = 1, this.metallicRoughnessTexture = null;
- }
- clone() {
- return this.cloneWithDeduplication(null, new Map());
- }
- cloneWithDeduplication(e2, t) {
- const s = r(e2) ? e2.get(this) : null;
- if (s)
- return s;
- const i = new n3(this.clonePropertiesWithDeduplication(t));
- return r(e2) && e2.set(this, i), i;
- }
- clonePropertiesWithDeduplication(e2) {
- return { ...super.clonePropertiesWithDeduplication(e2), emissiveColor: r(this.emissiveColor) ? this.emissiveColor.clone() : null, emissiveTexture: r(this.emissiveTexture) ? this.emissiveTexture.cloneWithDeduplication(e2) : null, occlusionTexture: r(this.occlusionTexture) ? this.occlusionTexture.cloneWithDeduplication(e2) : null, metallic: this.metallic, roughness: this.roughness, metallicRoughnessTexture: r(this.metallicRoughnessTexture) ? this.metallicRoughnessTexture.cloneWithDeduplication(e2) : null };
- }
- };
- e([d({ type: l2, json: { write: true } })], u3.prototype, "emissiveColor", void 0), e([d({ type: m, json: { write: true } })], u3.prototype, "emissiveTexture", void 0), e([d({ type: m, json: { write: true } })], u3.prototype, "occlusionTexture", void 0), e([d({ type: Number, nonNullable: true, json: { write: true }, range: { min: 0, max: 1 } })], u3.prototype, "metallic", void 0), e([d({ type: Number, nonNullable: true, json: { write: true }, range: { min: 0, max: 1 } })], u3.prototype, "roughness", void 0), e([d({ type: m, json: { write: true } })], u3.prototype, "metallicRoughnessTexture", void 0), u3 = n3 = e([n("esri.geometry.support.MeshMaterialMetallicRoughness")], u3);
- var c2 = u3;
- export {
- m,
- u2 as u,
- c2 as c
- };
- //# sourceMappingURL=chunk-7NPG47AN.js.map
|