chunk-7NPG47AN.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. import {
  2. M
  3. } from "./chunk-5JK4DCPE.js";
  4. import {
  5. l as l2
  6. } from "./chunk-7XXXCK2A.js";
  7. import {
  8. c,
  9. p
  10. } from "./chunk-65BYCSII.js";
  11. import {
  12. o
  13. } from "./chunk-ECW2QABR.js";
  14. import {
  15. r as r2
  16. } from "./chunk-MRJEICT6.js";
  17. import {
  18. d,
  19. e,
  20. l3 as l,
  21. n2 as n
  22. } from "./chunk-Y3WMVFTW.js";
  23. import {
  24. v
  25. } from "./chunk-IHXECKQQ.js";
  26. import {
  27. r
  28. } from "./chunk-GZT4BVFP.js";
  29. // node_modules/@arcgis/core/geometry/support/MeshTexture.js
  30. var p2;
  31. var d2 = new WeakMap();
  32. var h = 0;
  33. var u = p2 = class extends l {
  34. constructor(t) {
  35. super(t), this.wrap = "repeat";
  36. }
  37. get url() {
  38. return this._get("url") || null;
  39. }
  40. set url(t) {
  41. this._set("url", t), t && this._set("data", null);
  42. }
  43. get data() {
  44. return this._get("data") || null;
  45. }
  46. set data(t) {
  47. this._set("data", t), t && this._set("url", null);
  48. }
  49. writeData(t, e2, a, r3) {
  50. if (t instanceof HTMLImageElement) {
  51. const s = { type: "image-element", src: c(t.src, r3), crossOrigin: t.crossOrigin };
  52. e2[a] = s;
  53. } else if (t instanceof HTMLCanvasElement) {
  54. const r4 = t.getContext("2d").getImageData(0, 0, t.width, t.height), s = { type: "canvas-element", imageData: this._encodeImageData(r4) };
  55. e2[a] = s;
  56. } else if (t instanceof HTMLVideoElement) {
  57. 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 };
  58. e2[a] = s;
  59. } else {
  60. const r4 = { type: "image-data", imageData: this._encodeImageData(t) };
  61. e2[a] = r4;
  62. }
  63. }
  64. readData(t) {
  65. switch (t.type) {
  66. case "image-element": {
  67. const e2 = new Image();
  68. return e2.src = t.src, e2.crossOrigin = t.crossOrigin, e2;
  69. }
  70. case "canvas-element": {
  71. const e2 = this._decodeImageData(t.imageData), a = document.createElement("canvas");
  72. return a.width = e2.width, a.height = e2.height, a.getContext("2d").putImageData(e2, 0, 0), a;
  73. }
  74. case "image-data":
  75. return this._decodeImageData(t.imageData);
  76. case "video-element": {
  77. const e2 = document.createElement("video");
  78. 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;
  79. }
  80. default:
  81. return;
  82. }
  83. }
  84. get transparent() {
  85. const t = this.data, e2 = this.url;
  86. if (t instanceof HTMLCanvasElement)
  87. return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0, 0, t.width, t.height));
  88. if (t instanceof ImageData)
  89. return this._imageDataContainsTransparent(t);
  90. if (e2) {
  91. const t2 = e2.substr(e2.length - 4, 4).toLowerCase(), a = e2.substr(0, 15).toLocaleLowerCase();
  92. if (t2 === ".png" || a === "data:image/png;")
  93. return true;
  94. }
  95. return false;
  96. }
  97. set transparent(t) {
  98. t != null ? this._override("transparent", t) : this._clearOverride("transparent");
  99. }
  100. get contentHash() {
  101. 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}`;
  102. 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();
  103. }
  104. clone() {
  105. const t = { url: this.url, data: this.data, wrap: this._cloneWrap() };
  106. return new p2(t);
  107. }
  108. cloneWithDeduplication(t) {
  109. const e2 = t.get(this);
  110. if (e2)
  111. return e2;
  112. const a = this.clone();
  113. return t.set(this, a), a;
  114. }
  115. _cloneWrap() {
  116. return typeof this.wrap == "string" ? this.wrap : { horizontal: this.wrap.horizontal, vertical: this.wrap.vertical };
  117. }
  118. _encodeImageData(t) {
  119. let e2 = "";
  120. for (let a = 0; a < t.data.length; a++)
  121. e2 += String.fromCharCode(t.data[a]);
  122. return { data: btoa(e2), width: t.width, height: t.height };
  123. }
  124. _decodeImageData(t) {
  125. const e2 = atob(t.data), a = new Uint8ClampedArray(e2.length);
  126. for (let r3 = 0; r3 < e2.length; r3++)
  127. a[r3] = e2.charCodeAt(r3);
  128. return M(a, t.width, t.height);
  129. }
  130. _imageDataContainsTransparent(t) {
  131. for (let e2 = 3; e2 < t.data.length; e2 += 4)
  132. if (t.data[e2] !== 255)
  133. return true;
  134. return false;
  135. }
  136. static from(t) {
  137. 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);
  138. }
  139. };
  140. e([d({ type: String, json: { write: p } })], u.prototype, "url", null), e([d({ json: { write: { overridePolicy() {
  141. return { enabled: !this.url };
  142. } } } }), 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() {
  143. return { enabled: this._isOverridden("transparent") };
  144. } } } })], 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);
  145. var m = u;
  146. // node_modules/@arcgis/core/geometry/support/MeshMaterial.js
  147. var p3;
  148. var n2 = p3 = class extends l {
  149. constructor(o2) {
  150. super(o2), this.color = null, this.colorTexture = null, this.normalTexture = null, this.alphaMode = "auto", this.alphaCutoff = 0.5, this.doubleSided = true;
  151. }
  152. clone() {
  153. return this.cloneWithDeduplication(null, new Map());
  154. }
  155. cloneWithDeduplication(o2, e2) {
  156. const t = r(o2) ? o2.get(this) : null;
  157. if (t)
  158. return t;
  159. const l3 = new p3(this.clonePropertiesWithDeduplication(e2));
  160. return r(o2) && o2.set(this, l3), l3;
  161. }
  162. clonePropertiesWithDeduplication(o2) {
  163. 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 };
  164. }
  165. };
  166. 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);
  167. var u2 = n2;
  168. // node_modules/@arcgis/core/geometry/support/MeshMaterialMetallicRoughness.js
  169. var n3;
  170. var u3 = n3 = class extends u2 {
  171. constructor(e2) {
  172. super(e2), this.emissiveColor = null, this.emissiveTexture = null, this.occlusionTexture = null, this.metallic = 1, this.roughness = 1, this.metallicRoughnessTexture = null;
  173. }
  174. clone() {
  175. return this.cloneWithDeduplication(null, new Map());
  176. }
  177. cloneWithDeduplication(e2, t) {
  178. const s = r(e2) ? e2.get(this) : null;
  179. if (s)
  180. return s;
  181. const i = new n3(this.clonePropertiesWithDeduplication(t));
  182. return r(e2) && e2.set(this, i), i;
  183. }
  184. clonePropertiesWithDeduplication(e2) {
  185. 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 };
  186. }
  187. };
  188. 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);
  189. var c2 = u3;
  190. export {
  191. m,
  192. u2 as u,
  193. c2 as c
  194. };
  195. //# sourceMappingURL=chunk-7NPG47AN.js.map