WMSLayer-TMD46NQL.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. import {
  2. l as l3
  3. } from "./chunk-XBNW6PXM.js";
  4. import {
  5. o as o2
  6. } from "./chunk-ELA7HWPA.js";
  7. import {
  8. i
  9. } from "./chunk-3YTO5A3F.js";
  10. import {
  11. a as a2
  12. } from "./chunk-XEQ4FTFC.js";
  13. import "./chunk-JM5OVQAD.js";
  14. import {
  15. g as g2
  16. } from "./chunk-7C23ILQ4.js";
  17. import {
  18. k as k2
  19. } from "./chunk-P6VVVEX6.js";
  20. import "./chunk-3Z755LKF.js";
  21. import "./chunk-LTZ5XXDV.js";
  22. import "./chunk-DLMAGHHC.js";
  23. import "./chunk-JOYXMSKE.js";
  24. import {
  25. I
  26. } from "./chunk-SZFMKPVM.js";
  27. import "./chunk-YZVAB3DF.js";
  28. import "./chunk-ECY35CJI.js";
  29. import "./chunk-MCWCB5IY.js";
  30. import "./chunk-TV3CFJQR.js";
  31. import {
  32. U,
  33. a,
  34. l
  35. } from "./chunk-TJV6ODRM.js";
  36. import {
  37. v
  38. } from "./chunk-JUWKPBLS.js";
  39. import {
  40. c as c2
  41. } from "./chunk-WLSB4F4I.js";
  42. import {
  43. c,
  44. f
  45. } from "./chunk-GLSWDDR3.js";
  46. import {
  47. O,
  48. S as S2
  49. } from "./chunk-MIQGEDET.js";
  50. import "./chunk-DUEMJ5XS.js";
  51. import "./chunk-VRLXUHP2.js";
  52. import "./chunk-3LVSQLWJ.js";
  53. import "./chunk-4ONPMX2F.js";
  54. import "./chunk-CRGY2SDS.js";
  55. import "./chunk-4T5ZGMEN.js";
  56. import {
  57. p
  58. } from "./chunk-GN35O2ZO.js";
  59. import {
  60. n as n2
  61. } from "./chunk-XTVKPAWY.js";
  62. import "./chunk-3OSQ6GXO.js";
  63. import "./chunk-3WQOA5CB.js";
  64. import {
  65. t as t2
  66. } from "./chunk-PLWDAYK7.js";
  67. import "./chunk-FZQZIM7U.js";
  68. import "./chunk-CZBRZ6SU.js";
  69. import "./chunk-VGWC3IKZ.js";
  70. import "./chunk-2H5MD622.js";
  71. import "./chunk-3RSFVUKZ.js";
  72. import "./chunk-UVVU4UUO.js";
  73. import {
  74. l as l2
  75. } from "./chunk-CDZENOCQ.js";
  76. import "./chunk-X4SA4ELJ.js";
  77. import "./chunk-5N7JLUJJ.js";
  78. import "./chunk-ZAY3CMAZ.js";
  79. import "./chunk-P3XKUGLS.js";
  80. import "./chunk-2ZSOO377.js";
  81. import "./chunk-YUA3AHKR.js";
  82. import "./chunk-LU5IJZB4.js";
  83. import "./chunk-7IBV2TRE.js";
  84. import "./chunk-ZLNEXZAN.js";
  85. import "./chunk-5UVJ64RB.js";
  86. import "./chunk-SFEFRQCL.js";
  87. import {
  88. b as b2
  89. } from "./chunk-DXVOOCG4.js";
  90. import {
  91. s as s5
  92. } from "./chunk-3GZSQU56.js";
  93. import "./chunk-ZYRIJWLX.js";
  94. import "./chunk-RYY6632W.js";
  95. import "./chunk-DW42UVIT.js";
  96. import "./chunk-YAEIHDJH.js";
  97. import "./chunk-TJNOJH33.js";
  98. import "./chunk-OSHI574D.js";
  99. import "./chunk-ETGAZ7LF.js";
  100. import "./chunk-75U5LM2V.js";
  101. import "./chunk-RMDDCMKS.js";
  102. import "./chunk-VCH45Q2I.js";
  103. import {
  104. j
  105. } from "./chunk-LBW34VZ2.js";
  106. import "./chunk-GSSTTHIT.js";
  107. import "./chunk-YFSLJIO4.js";
  108. import "./chunk-IM3LVQXV.js";
  109. import "./chunk-55RWC67C.js";
  110. import {
  111. s as s3
  112. } from "./chunk-HZRKBTHJ.js";
  113. import {
  114. U as U2
  115. } from "./chunk-DVUG3KID.js";
  116. import "./chunk-FWSQEIAR.js";
  117. import {
  118. Bt,
  119. S,
  120. j as j2,
  121. y as y3
  122. } from "./chunk-VEGAOVMY.js";
  123. import {
  124. o,
  125. w2
  126. } from "./chunk-6T6G6LCQ.js";
  127. import {
  128. s as s4
  129. } from "./chunk-YEJL5NEF.js";
  130. import {
  131. E,
  132. k2 as k,
  133. r as r2
  134. } from "./chunk-PQFTYGF5.js";
  135. import {
  136. e,
  137. g,
  138. n5 as n,
  139. y3 as y2
  140. } from "./chunk-2Z2TG5CU.js";
  141. import "./chunk-6KZ2LTDA.js";
  142. import "./chunk-U2XHEJM7.js";
  143. import {
  144. T,
  145. b
  146. } from "./chunk-SQOPWYIT.js";
  147. import {
  148. w
  149. } from "./chunk-V6P2MAQQ.js";
  150. import {
  151. s,
  152. s3 as s2
  153. } from "./chunk-E5O6P5I2.js";
  154. import {
  155. y
  156. } from "./chunk-SPWQ3AWG.js";
  157. import "./chunk-2TIUKVZN.js";
  158. import {
  159. r,
  160. t
  161. } from "./chunk-YXWMMD76.js";
  162. import "./chunk-S5KM4IGW.js";
  163. // node_modules/@arcgis/core/layers/support/WMSSublayer.js
  164. var c3;
  165. var h = 0;
  166. var g3 = c3 = class extends s5(S2) {
  167. constructor(e2) {
  168. super(e2), this.dimensions = null, this.fullExtents = null, this.legendUrl = null, this.legendEnabled = true, this.layer = null, this.maxScale = 0, this.minScale = 0, this.parent = null, this.popupEnabled = false, this.queryable = false, this.sublayers = null, this.spatialReferences = null, this.addHandles([a(() => this.sublayers, "after-add", ({ item: e3 }) => {
  169. e3.parent = this, e3.layer = this.layer;
  170. }, U), a(() => this.sublayers, "after-remove", ({ item: e3 }) => {
  171. e3.layer = e3.parent = null;
  172. }, U), l(() => this.sublayers, (e3, t3) => {
  173. if (t3)
  174. for (const r3 of t3)
  175. r3.layer = r3.parent = null;
  176. if (e3)
  177. for (const r3 of e3)
  178. r3.parent = this, r3.layer = this.layer;
  179. }, U)]);
  180. }
  181. get description() {
  182. return this._get("description");
  183. }
  184. set description(e2) {
  185. this._set("description", e2);
  186. }
  187. get fullExtent() {
  188. return this._get("fullExtent");
  189. }
  190. set fullExtent(e2) {
  191. this._set("fullExtent", e2);
  192. }
  193. readExtent(e2, t3) {
  194. return (e2 = t3.extent) ? w2.fromJSON(e2) : null;
  195. }
  196. get id() {
  197. const e2 = this._get("id");
  198. return e2 != null ? e2 : h++;
  199. }
  200. set id(e2) {
  201. this._set("id", e2);
  202. }
  203. readLegendUrl(e2, t3) {
  204. var _a, _b;
  205. return (_b = (_a = t3 == null ? void 0 : t3.legendUrl) != null ? _a : t3 == null ? void 0 : t3.legendURL) != null ? _b : null;
  206. }
  207. get effectiveScaleRange() {
  208. const { minScale: e2, maxScale: t3 } = this;
  209. return { minScale: e2, maxScale: t3 };
  210. }
  211. get name() {
  212. return this._get("name");
  213. }
  214. set name(e2) {
  215. this._set("name", e2);
  216. }
  217. castSublayers(e2) {
  218. return b(j.ofType(c3), e2);
  219. }
  220. get title() {
  221. return this._get("title");
  222. }
  223. set title(e2) {
  224. this._set("title", e2);
  225. }
  226. get visible() {
  227. return this._get("visible");
  228. }
  229. set visible(e2) {
  230. this._setAndNotifyLayer("visible", e2);
  231. }
  232. clone() {
  233. var _a, _b, _c;
  234. const e2 = new c3();
  235. return this.hasOwnProperty("description") && (e2.description = this.description), this.hasOwnProperty("fullExtent") && (e2.fullExtent = this.fullExtent.clone()), this.hasOwnProperty("fullExtents") && (e2.fullExtents = (_b = (_a = this.fullExtents) == null ? void 0 : _a.map((e3) => e3.clone())) != null ? _b : null), this.hasOwnProperty("legendUrl") && (e2.legendUrl = this.legendUrl), this.hasOwnProperty("legendEnabled") && (e2.legendEnabled = this.legendEnabled), this.hasOwnProperty("layer") && (e2.layer = this.layer), this.hasOwnProperty("name") && (e2.name = this.name), this.hasOwnProperty("parent") && (e2.parent = this.parent), this.hasOwnProperty("queryable") && (e2.queryable = this.queryable), this.hasOwnProperty("sublayers") && (e2.sublayers = this.sublayers && this.sublayers.map((e3) => e3.clone())), this.hasOwnProperty("spatialReferences") && (e2.spatialReferences = (_c = this.spatialReferences) == null ? void 0 : _c.map((e3) => e3)), this.hasOwnProperty("visible") && (e2.visible = this.visible), this.hasOwnProperty("title") && (e2.title = this.title), e2;
  236. }
  237. _setAndNotifyLayer(e2, t3) {
  238. const r3 = this.layer;
  239. this._get(e2) !== t3 && (this._set(e2, t3), r3 && r3.emit("wms-sublayer-update", { propertyName: e2, id: this.id }));
  240. }
  241. };
  242. e([y2()], g3.prototype, "description", null), e([y2({ readOnly: true })], g3.prototype, "dimensions", void 0), e([y2({ value: null })], g3.prototype, "fullExtent", null), e([o("fullExtent", ["extent"])], g3.prototype, "readExtent", null), e([y2()], g3.prototype, "fullExtents", void 0), e([y2({ type: Number, json: { write: { enabled: false, overridePolicy: () => ({ ignoreOrigin: true, enabled: true }) } } })], g3.prototype, "id", null), e([y2({ type: String, json: { origins: { "web-document": { read: { source: ["legendUrl", "legendURL"] }, write: { target: "legendUrl", ignoreOrigin: true } } }, read: { source: "legendURL" }, write: { ignoreOrigin: true } } })], g3.prototype, "legendUrl", void 0), e([o(["web-document"], "legendUrl")], g3.prototype, "readLegendUrl", null), e([y2({ value: true, type: Boolean, json: { read: { source: "showLegend" }, write: { target: "showLegend" }, origins: { "web-map": { read: false, write: false }, "web-scene": { read: false, write: false } } } })], g3.prototype, "legendEnabled", void 0), e([y2()], g3.prototype, "layer", void 0), e([y2()], g3.prototype, "maxScale", void 0), e([y2()], g3.prototype, "minScale", void 0), e([y2({ readOnly: true })], g3.prototype, "effectiveScaleRange", null), e([y2({ type: String, value: null, json: { read: { source: "name" }, write: { ignoreOrigin: true } } })], g3.prototype, "name", null), e([y2()], g3.prototype, "parent", void 0), e([y2({ type: Boolean, json: { read: { source: "showPopup" }, write: { ignoreOrigin: true, target: "showPopup" } } })], g3.prototype, "popupEnabled", void 0), e([y2({ type: Boolean, json: { write: { ignoreOrigin: true } } })], g3.prototype, "queryable", void 0), e([y2()], g3.prototype, "sublayers", void 0), e([s4("sublayers")], g3.prototype, "castSublayers", null), e([y2({ type: [Number], json: { read: { source: "spatialReferences" } } })], g3.prototype, "spatialReferences", void 0), e([y2({ type: String, value: null, json: { write: { ignoreOrigin: true } } })], g3.prototype, "title", null), e([y2({ type: Boolean, value: true, json: { read: { source: "defaultVisibility" } } })], g3.prototype, "visible", null), g3 = c3 = e([n("esri.layers.support.WMSSublayer")], g3);
  243. var m = g3;
  244. // node_modules/@arcgis/core/layers/support/wmsUtils.js
  245. var o3 = { 84: 4326, 83: 4269, 27: 4267 };
  246. function a3(t3) {
  247. if (!t3)
  248. return null;
  249. const n3 = { idCounter: -1 };
  250. if ("string" == typeof t3) {
  251. t3 = new DOMParser().parseFromString(t3, "text/xml");
  252. }
  253. const i2 = t3.documentElement;
  254. if ("ServiceExceptionReport" === i2.nodeName) {
  255. const t4 = Array.prototype.slice.call(i2.childNodes).map((e2) => e2.textContent).join("\r\n");
  256. throw new s2("wmslayer:wms-capabilities-xml-is-not-valid", "The server returned errors when the WMS capabilities were requested.", t4);
  257. }
  258. const s6 = d("Capability", i2), o4 = d("Service", i2), a4 = d("Request", s6);
  259. if (!s6 || !o4 || !a4)
  260. return null;
  261. const l5 = d("Layer", s6);
  262. if (!l5)
  263. return null;
  264. const m3 = "WMS_Capabilities" === i2.nodeName || "WMT_MS_Capabilities" === i2.nodeName ? i2.getAttribute("version") : "1.3.0", f3 = h2("Title", o4, "") || h2("Name", o4, ""), p3 = h2("AccessConstraints", o4, ""), x2 = /^none$/i.test(p3) ? "" : p3, y5 = h2("Abstract", o4, ""), S4 = parseInt(h2("MaxWidth", o4, "5000"), 10), E2 = parseInt(h2("MaxHeight", o4, "5000"), 10), w4 = N(a4, "GetMap"), L = g4(a4, "GetMap"), M2 = b3(l5, m3, n3);
  265. let C2, R2 = 0;
  266. if (Array.prototype.slice.call(s6.childNodes).forEach((e2) => {
  267. "Layer" === e2.nodeName && (0 === R2 ? C2 = e2 : 1 === R2 ? (M2.name && (M2.name = "", M2.sublayers.push(b3(C2, m3, n3))), M2.sublayers.push(b3(e2, m3, n3))) : M2.sublayers.push(b3(e2, m3, n3)), R2++);
  268. }), !M2)
  269. return null;
  270. let I3, T3;
  271. const U4 = M2.fullExtents;
  272. if (I3 = M2.sublayers, I3 || (I3 = []), 0 === I3.length && I3.push(M2), T3 = M2.extent, !T3) {
  273. const e2 = new w2(I3[0].extent);
  274. M2.extent = e2.toJSON(), T3 = M2.extent;
  275. }
  276. const V3 = M2.spatialReferences.length > 0 ? M2.spatialReferences : u(M2), v3 = g4(a4, "GetFeatureInfo"), O3 = v3 ? N(a4, "GetFeatureInfo") : null, _2 = c4(I3), B = M2.minScale || 0, D = M2.maxScale || 0, j3 = M2.dimensions, k3 = _2.reduce((e2, t4) => e2.concat(t4.dimensions), []), q = j3.concat(k3).filter(F);
  277. let X2 = null;
  278. if (q.length) {
  279. const e2 = q.map((e3) => {
  280. const { extent: t4 } = e3;
  281. return A(t4) ? t4.map((e4) => e4.getTime()) : t4.map((e4) => [e4.min.getTime(), e4.max.getTime()]);
  282. }).flat(2);
  283. X2 = { startTimeField: null, endTimeField: null, trackIdField: null, timeExtent: [Math.min(...e2), Math.max(...e2)] };
  284. }
  285. return { copyright: x2, description: y5, dimensions: j3, extent: T3, fullExtents: U4, featureInfoFormats: O3, featureInfoUrl: v3, mapUrl: L, maxWidth: S4, maxHeight: E2, maxScale: D, minScale: B, layers: _2, spatialReferences: V3, supportedImageFormatTypes: w4, timeInfo: X2, title: f3, version: m3 };
  286. }
  287. function l4(e2) {
  288. const t3 = e2.filter((e3) => e3.popupEnabled && e3.name && e3.queryable);
  289. return t3.length ? t3.map(({ name: e3 }) => e3).join() : null;
  290. }
  291. function u(e2) {
  292. if (e2.spatialReferences.length > 0)
  293. return e2.spatialReferences;
  294. if (e2.sublayers)
  295. for (const t3 of e2.sublayers) {
  296. const e3 = u(t3);
  297. if (e3.length > 0)
  298. return e3;
  299. }
  300. return [];
  301. }
  302. function c4(e2) {
  303. var _a;
  304. let t3 = [];
  305. for (const n3 of e2)
  306. t3.push(n3), ((_a = n3.sublayers) == null ? void 0 : _a.length) && (t3 = t3.concat(c4(n3.sublayers)), delete n3.sublayers);
  307. return t3;
  308. }
  309. function m2(e2, t3, n3) {
  310. var _a;
  311. return (_a = t3.getAttribute(e2)) != null ? _a : n3;
  312. }
  313. function f2(e2, t3, n3, r3) {
  314. const i2 = d(e2, n3);
  315. return i2 ? m2(t3, i2, r3) : r3;
  316. }
  317. function d(e2, t3) {
  318. for (let n3 = 0; n3 < t3.childNodes.length; n3++) {
  319. const r3 = t3.childNodes[n3];
  320. if (S3(r3) && r3.nodeName === e2)
  321. return r3;
  322. }
  323. return null;
  324. }
  325. function p2(e2, t3) {
  326. const n3 = [];
  327. for (let r3 = 0; r3 < t3.childNodes.length; r3++) {
  328. const i2 = t3.childNodes[r3];
  329. S3(i2) && i2.nodeName === e2 && n3.push(i2);
  330. }
  331. return n3;
  332. }
  333. function h2(e2, t3, n3) {
  334. const r3 = d(e2, t3);
  335. return r3 ? r3.textContent : n3;
  336. }
  337. function x(e2, t3, n3) {
  338. if (!e2)
  339. return null;
  340. const s6 = parseFloat(e2.getAttribute("minx")), o4 = parseFloat(e2.getAttribute("miny")), a4 = parseFloat(e2.getAttribute("maxx")), l5 = parseFloat(e2.getAttribute("maxy"));
  341. let u2, c5, m3, f3;
  342. n3 ? (u2 = isNaN(o4) ? -Number.MAX_VALUE : o4, c5 = isNaN(s6) ? -Number.MAX_VALUE : s6, m3 = isNaN(l5) ? Number.MAX_VALUE : l5, f3 = isNaN(a4) ? Number.MAX_VALUE : a4) : (u2 = isNaN(s6) ? -Number.MAX_VALUE : s6, c5 = isNaN(o4) ? -Number.MAX_VALUE : o4, m3 = isNaN(a4) ? Number.MAX_VALUE : a4, f3 = isNaN(l5) ? Number.MAX_VALUE : l5);
  343. const d2 = new k({ wkid: t3 });
  344. return new w2({ xmin: u2, ymin: c5, xmax: m3, ymax: f3, spatialReference: d2 });
  345. }
  346. function g4(e2, t3) {
  347. const n3 = d(t3, e2);
  348. if (n3) {
  349. const e3 = d("DCPType", n3);
  350. if (e3) {
  351. const t4 = d("HTTP", e3);
  352. if (t4) {
  353. const e4 = d("Get", t4);
  354. if (e4) {
  355. let t5 = f2("OnlineResource", "xlink:href", e4, null);
  356. if (t5)
  357. return t5.indexOf("&") === t5.length - 1 && (t5 = t5.substring(0, t5.length - 1)), M(t5, ["service", "request"]);
  358. }
  359. }
  360. }
  361. }
  362. return null;
  363. }
  364. function N(e2, t3) {
  365. const n3 = p2("Operation", e2);
  366. if (!n3.length) {
  367. return p2("Format", d(t3, e2)).map(({ textContent: e3 }) => e3);
  368. }
  369. const r3 = [];
  370. for (const i2 of n3)
  371. if (i2.getAttribute("name") === t3) {
  372. const e3 = p2("Format", i2);
  373. for (const { textContent: t4 } of e3)
  374. r3.push(t4);
  375. }
  376. return r3;
  377. }
  378. function y4(e2, t3, n3) {
  379. const r3 = d(t3, e2);
  380. if (!r3)
  381. return n3;
  382. const { textContent: i2 } = r3;
  383. if (null == i2 || "" === i2)
  384. return n3;
  385. const s6 = Number(i2);
  386. return isNaN(s6) ? n3 : s6;
  387. }
  388. function b3(e2, t3, n3) {
  389. if (!e2)
  390. return null;
  391. const a4 = { id: n3.idCounter++, fullExtents: [], parentLayerId: null, queryable: "1" === e2.getAttribute("queryable"), spatialReferences: [], sublayers: null }, l5 = d("LatLonBoundingBox", e2), u2 = d("EX_GeographicBoundingBox", e2);
  392. let c5 = null;
  393. l5 && (c5 = x(l5, 4326)), u2 && (c5 = new w2(0, 0, 0, 0, new k({ wkid: 4326 })), c5.xmin = parseFloat(h2("westBoundLongitude", u2, "0")), c5.ymin = parseFloat(h2("southBoundLatitude", u2, "0")), c5.xmax = parseFloat(h2("eastBoundLongitude", u2, "0")), c5.ymax = parseFloat(h2("northBoundLatitude", u2, "0"))), l5 || u2 || (c5 = new w2(-180, -90, 180, 90, new k({ wkid: 4326 }))), a4.minScale = y4(e2, "MaxScaleDenominator", 0), a4.maxScale = y4(e2, "MinScaleDenominator", 0);
  394. const f3 = ["1.0.0", "1.1.0", "1.1.1"].includes(t3) ? "SRS" : "CRS";
  395. return Array.prototype.slice.call(e2.childNodes).forEach((e3) => {
  396. if ("Name" === e3.nodeName)
  397. a4.name = e3.textContent || "";
  398. else if ("Title" === e3.nodeName)
  399. a4.title = e3.textContent || "";
  400. else if ("Abstract" === e3.nodeName)
  401. a4.description = e3.textContent || "";
  402. else if ("BoundingBox" === e3.nodeName) {
  403. const n4 = e3.getAttribute(f3);
  404. if (n4 && 0 === n4.indexOf("EPSG:")) {
  405. const r4 = parseInt(n4.substring(5), 10);
  406. 0 === r4 || isNaN(r4) || c5 || (c5 = "1.3.0" === t3 ? x(e3, r4, o2(r4)) : x(e3, r4));
  407. }
  408. const r3 = n4 && n4.indexOf(":");
  409. if (r3 && r3 > -1) {
  410. let i2 = parseInt(n4.substring(r3 + 1, n4.length), 10);
  411. 0 === i2 || isNaN(i2) || (i2 = o3[i2] ? o3[i2] : i2);
  412. const l6 = "1.3.0" === t3 ? x(e3, i2, o2(i2)) : x(e3, i2);
  413. a4.fullExtents.push(l6);
  414. }
  415. } else if (e3.nodeName === f3) {
  416. e3.textContent.split(" ").forEach((e4) => {
  417. const t4 = e4.includes(":") ? parseInt(e4.split(":")[1], 10) : parseInt(e4, 10);
  418. if (0 !== t4 && !isNaN(t4)) {
  419. const e5 = o3[t4] ? o3[t4] : t4;
  420. a4.spatialReferences.includes(e5) || a4.spatialReferences.push(e5);
  421. }
  422. });
  423. } else if ("Style" !== e3.nodeName || a4.legendURL) {
  424. if ("Layer" === e3.nodeName) {
  425. const r3 = b3(e3, t3, n3);
  426. r3 && (r3.parentLayerId = a4.id, a4.sublayers || (a4.sublayers = []), a4.sublayers.push(r3));
  427. }
  428. } else {
  429. const t4 = d("LegendURL", e3);
  430. if (t4) {
  431. const e4 = d("OnlineResource", t4);
  432. e4 && (a4.legendURL = e4.getAttribute("xlink:href"));
  433. }
  434. }
  435. }), a4.extent = c5 == null ? void 0 : c5.toJSON(), a4.dimensions = p2("Dimension", e2).filter((e3) => e3.getAttribute("name") && e3.getAttribute("units") && e3.textContent).map((e3) => {
  436. const t4 = e3.getAttribute("name"), n4 = e3.getAttribute("units"), r3 = e3.textContent, i2 = e3.getAttribute("unitSymbol"), s6 = e3.getAttribute("default"), o4 = "0" !== m2("default", e3, "0"), a5 = "0" !== m2("nearestValue", e3, "0"), l6 = "0" !== m2("current", e3, "0");
  437. if (F({ name: t4, units: n4 })) {
  438. return { name: "time", units: "ISO8601", extent: I2(r3), default: I2(s6), multipleValues: o4, nearestValue: a5, current: l6 };
  439. }
  440. if (w3({ name: t4, units: n4 })) {
  441. return { name: "elevation", units: n4, extent: C(r3), unitSymbol: i2, default: C(s6), multipleValues: o4, nearestValue: a5 };
  442. }
  443. return { name: t4, units: n4, extent: R(r3), unitSymbol: i2, default: R(s6), multipleValues: o4, nearestValue: a5 };
  444. }), a4;
  445. }
  446. function A(e2) {
  447. return Array.isArray(e2) && e2.length > 0 && e2[0] instanceof Date;
  448. }
  449. function S3(e2) {
  450. return e2.nodeType === Node.ELEMENT_NODE;
  451. }
  452. function w3(e2) {
  453. return /^elevation$/i.test(e2.name) && /^(epsg|crs):\d+$/i.test(e2.units);
  454. }
  455. function F(e2) {
  456. return /^time$/i.test(e2.name) && /^iso8601$/i.test(e2.units);
  457. }
  458. function M(e2, t3) {
  459. const r3 = [], i2 = j2(e2);
  460. for (const n3 in i2.query)
  461. i2.query.hasOwnProperty(n3) && (t3.includes(n3.toLowerCase()) || r3.push(n3 + "=" + i2.query[n3]));
  462. return i2.path + (r3.length ? "?" + r3.join("&") : "");
  463. }
  464. function C(e2) {
  465. if (!e2)
  466. return null;
  467. const t3 = e2.includes("/"), n3 = e2.split(",");
  468. return t3 ? n3.map((e3) => {
  469. const t4 = e3.split("/");
  470. if (t4.length < 2)
  471. return null;
  472. return { min: parseFloat(t4[0]), max: parseFloat(t4[1]), resolution: t4.length >= 3 && "0" !== t4[2] ? parseFloat(t4[2]) : void 0 };
  473. }).filter((e3) => e3) : n3.map((e3) => parseFloat(e3));
  474. }
  475. function R(e2) {
  476. if (!e2)
  477. return null;
  478. const t3 = e2.includes("/"), n3 = e2.split(",");
  479. return t3 ? n3.map((e3) => {
  480. const t4 = e3.split("/");
  481. if (t4.length < 2)
  482. return null;
  483. return { min: t4[0], max: t4[1], resolution: t4.length >= 3 && "0" !== t4[2] ? t4[2] : void 0 };
  484. }).filter((e3) => e3) : n3;
  485. }
  486. function I2(e2) {
  487. if (!e2)
  488. return null;
  489. const t3 = e2.includes("/"), n3 = e2.split(",");
  490. return t3 ? n3.map((e3) => {
  491. const t4 = e3.split("/");
  492. if (t4.length < 2)
  493. return null;
  494. return { min: new Date(t4[0]), max: new Date(t4[1]), resolution: t4.length >= 3 && "0" !== t4[2] ? T2(t4[2]) : void 0 };
  495. }).filter((e3) => e3) : n3.map((e3) => new Date(e3));
  496. }
  497. function T2(e2) {
  498. const t3 = /(?:p(\d+y|\d+(?:.|,)\d+y)?(\d+m|\d+(?:.|,)\d+m)?(\d+d|\d+(?:.|,)\d+d)?)?(?:t(\d+h|\d+(?:.|,)\d+h)?(\d+m|\d+(?:.|,)\d+m)?(\d+s|\d+(?:.|,)\d+s)?)?/i, n3 = e2.match(t3);
  499. if (!n3)
  500. return null;
  501. return { years: U3(n3[1]), months: U3(n3[2]), days: U3(n3[3]), hours: U3(n3[4]), minutes: U3(n3[5]), seconds: U3(n3[6]) };
  502. }
  503. function U3(e2) {
  504. if (!e2)
  505. return 0;
  506. const t3 = /(?:\d+(?:.|,)\d+|\d+)/, n3 = e2.match(t3);
  507. if (!n3)
  508. return 0;
  509. const r3 = n3[0].replace(",", ".");
  510. return Number(r3);
  511. }
  512. function V(e2) {
  513. return e2.toISOString().replace(/\.[0-9]{3}/, "");
  514. }
  515. var v2 = /* @__PURE__ */ new Set([102100, 3857, 102113, 900913]);
  516. var O2 = /* @__PURE__ */ new Set([3395, 54004]);
  517. function _(e2, n3) {
  518. let r3 = e2.wkid;
  519. return t(n3) ? r3 : (!n3.includes(r3) && e2.latestWkid && (r3 = e2.latestWkid), v2.has(r3) ? n3.find((e3) => v2.has(e3)) || n3.find((e3) => O2.has(e3)) || 102100 : r3);
  520. }
  521. // node_modules/@arcgis/core/layers/WMSLayer.js
  522. var J = new s3({ bmp: "image/bmp", gif: "image/gif", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml" }, { ignoreUnknown: false });
  523. function V2(e2) {
  524. return "text/html" === e2;
  525. }
  526. function Q(e2) {
  527. return "text/plain" === e2;
  528. }
  529. var z = class extends n2(a2(p(t2(c2(v(O(b2))))))) {
  530. constructor(...e2) {
  531. super(...e2), this.allSublayers = new l2({ getCollections: () => [this.sublayers], getChildrenFunction: (e3) => e3.sublayers }), this.customParameters = null, this.customLayerParameters = null, this.copyright = null, this.description = null, this.dimensions = null, this.fullExtent = null, this.fullExtents = null, this.featureInfoFormats = null, this.featureInfoUrl = null, this.fetchFeatureInfoFunction = null, this.imageFormat = null, this.imageMaxHeight = 2048, this.imageMaxWidth = 2048, this.imageTransparency = true, this.legendEnabled = true, this.mapUrl = null, this.isReference = null, this.operationalLayerType = "WMS", this.spatialReference = null, this.spatialReferences = null, this.sublayers = null, this.type = "wms", this.url = null, this.version = null, this.addHandles([a(() => this.sublayers, "after-add", ({ item: e3 }) => {
  532. e3.parent = e3.layer = this;
  533. }, U), a(() => this.sublayers, "after-remove", ({ item: e3 }) => {
  534. e3.layer = e3.parent = null;
  535. }, U), l(() => this.sublayers, (e3, t3) => {
  536. if (t3)
  537. for (const r3 of t3)
  538. r3.layer = r3.parent = null;
  539. if (e3)
  540. for (const r3 of e3)
  541. r3.parent = r3.layer = this;
  542. }, U)]);
  543. }
  544. normalizeCtorArgs(e2, t3) {
  545. return "string" == typeof e2 ? { url: e2, ...t3 } : e2;
  546. }
  547. load(e2) {
  548. const t3 = r(e2) ? e2.signal : null;
  549. return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["WMS"] }, e2).catch(w).then(() => this._fetchService(t3))), Promise.resolve(this);
  550. }
  551. readFullExtentFromItemOrMap(e2, t3) {
  552. const r3 = t3.extent;
  553. return r3 ? new w2({ xmin: r3[0][0], ymin: r3[0][1], xmax: r3[1][0], ymax: r3[1][1] }) : null;
  554. }
  555. writeFullExtent(e2, t3) {
  556. t3.extent = [[e2.xmin, e2.ymin], [e2.xmax, e2.ymax]];
  557. }
  558. get featureInfoFormat() {
  559. var _a, _b;
  560. return t(this.featureInfoFormats) ? null : (_b = (_a = this.featureInfoFormats.find(V2)) != null ? _a : this.featureInfoFormats.find(Q)) != null ? _b : null;
  561. }
  562. set featureInfoFormat(e2) {
  563. r(e2) ? (V2(e2) || Q(e2)) && this._override("featureInfoFormat", e2) : (this.revert("featureInfoFormat", "service"), this._clearOverride("featureInfoFormat"));
  564. }
  565. readImageFormat(e2, t3) {
  566. const r3 = t3.supportedImageFormatTypes;
  567. return r3 && r3.includes("image/png") ? "image/png" : r3 && r3[0];
  568. }
  569. readSpatialReferenceFromItemOrDocument(e2, t3) {
  570. return new k(t3.spatialReferences[0]);
  571. }
  572. writeSpatialReferences(e2, t3) {
  573. var _a;
  574. const r3 = (_a = this.spatialReference) == null ? void 0 : _a.wkid;
  575. e2 && r3 ? (t3.spatialReferences = e2.filter((e3) => e3 !== r3), t3.spatialReferences.unshift(r3)) : t3.spatialReferences = e2;
  576. }
  577. readSublayersFromItemOrMap(e2, t3, r3) {
  578. return X(t3.layers, r3, t3.visibleLayers);
  579. }
  580. readSublayers(e2, t3, r3) {
  581. return X(t3.layers, r3);
  582. }
  583. writeSublayers(e2, t3, r3, o4) {
  584. var _a, _b;
  585. t3.layers = [];
  586. const s6 = /* @__PURE__ */ new Map(), i2 = e2.flatten(({ sublayers: e3 }) => e3);
  587. for (const a4 of i2)
  588. if ("number" == typeof ((_a = a4.parent) == null ? void 0 : _a.id)) {
  589. const e3 = s6.get(a4.parent.id);
  590. null != e3 ? e3.push(a4.id) : s6.set(a4.parent.id, [a4.id]);
  591. }
  592. for (const a4 of i2) {
  593. const e3 = { sublayer: a4, ...o4 }, r4 = a4.write({ parentLayerId: "number" == typeof ((_b = a4.parent) == null ? void 0 : _b.id) ? a4.parent.id : -1 }, e3);
  594. if (s6.has(a4.id) && (r4.sublayerIds = s6.get(a4.id)), !a4.sublayers && a4.name) {
  595. const r5 = a4.write({}, e3);
  596. delete r5.id, t3.layers.push(r5);
  597. }
  598. }
  599. t3.visibleLayers = i2.filter(({ visible: e3, sublayers: t4 }) => e3 && !t4).map(({ name: e3 }) => e3).toArray();
  600. }
  601. createExportImageParameters(e2, t3, r3, o4) {
  602. var _a;
  603. const s6 = (_a = o4 == null ? void 0 : o4.pixelRatio) != null ? _a : 1, i2 = i({ extent: e2, width: t3 }) * s6, a4 = new l3({ layer: this, scale: i2 }), { xmin: n3, ymin: l5, xmax: p3, ymax: m3, spatialReference: u2 } = e2, c5 = _(u2, this.spatialReferences), f3 = "1.3.0" === this.version && o2(c5) ? `${l5},${n3},${m3},${p3}` : `${n3},${l5},${p3},${m3}`, y5 = a4.toJSON();
  604. return { bbox: f3, ["1.3.0" === this.version ? "crs" : "srs"]: isNaN(c5) ? void 0 : "EPSG:" + c5, ...y5 };
  605. }
  606. async fetchImage(e2, t3, r3, o4) {
  607. var _a, _b;
  608. const i2 = this.mapUrl, a4 = this.createExportImageParameters(e2, t3, r3, o4);
  609. if (!a4.layers) {
  610. const e3 = document.createElement("canvas");
  611. return e3.width = t3, e3.height = r3, e3;
  612. }
  613. const n3 = (_a = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _a.start, l5 = (_b = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _b.end, m3 = r(n3) && r(l5) ? n3.getTime() === l5.getTime() ? V(n3) : `${V(n3)}/${V(l5)}` : void 0, u2 = { responseType: "image", query: this._mixCustomParameters({ width: t3, height: r3, ...a4, time: m3, ...this.refreshParameters }), signal: o4 == null ? void 0 : o4.signal };
  614. return U2(i2 != null ? i2 : "", u2).then((e3) => e3.data);
  615. }
  616. async fetchImageBitmap(e2, t3, r3, o4) {
  617. var _a, _b;
  618. const i2 = this.mapUrl, a4 = this.createExportImageParameters(e2, t3, r3, o4);
  619. if (!a4.layers) {
  620. const e3 = document.createElement("canvas");
  621. return e3.width = t3, e3.height = r3, e3;
  622. }
  623. const n3 = (_a = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _a.start, l5 = (_b = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _b.end, m3 = r(n3) && r(l5) ? n3.getTime() === l5.getTime() ? V(n3) : `${V(n3)}/${V(l5)}` : void 0, u2 = { responseType: "blob", query: this._mixCustomParameters({ width: t3, height: r3, ...a4, time: m3, ...this.refreshParameters }), signal: o4 == null ? void 0 : o4.signal }, c5 = await U2(i2 != null ? i2 : "", u2).then((e3) => e3.data);
  624. return createImageBitmap(c5);
  625. }
  626. fetchFeatureInfo(e2, t3, r3, o4, s6) {
  627. const i2 = i({ extent: e2, width: t3 }), a4 = new l3({ layer: this, scale: i2 }), n3 = l4(a4.visibleSublayers);
  628. if (t(this.featureInfoUrl) || t(n3))
  629. return Promise.resolve([]);
  630. if (t(this.fetchFeatureInfoFunction) && t(this.featureInfoFormat))
  631. return Promise.resolve([]);
  632. const l5 = "1.3.0" === this.version ? { I: o4, J: s6 } : { x: o4, y: s6 }, u2 = { query_layers: n3, request: "GetFeatureInfo", info_format: this.featureInfoFormat, feature_count: 25, width: t3, height: r3, ...l5 }, c5 = { ...this.createExportImageParameters(e2, t3, r3), ...u2 }, f3 = this._mixCustomParameters(c5);
  633. return r(this.fetchFeatureInfoFunction) ? this.fetchFeatureInfoFunction(f3) : this._defaultFetchFeatureInfoFunction(Bt(this.featureInfoUrl, f3));
  634. }
  635. findSublayerById(e2) {
  636. return this.allSublayers.find((t3) => t3.id === e2);
  637. }
  638. findSublayerByName(e2) {
  639. return this.allSublayers.find((t3) => t3.name === e2);
  640. }
  641. serviceSupportsSpatialReference(e2) {
  642. return I(this.url) || null != this.spatialReferences && this.spatialReferences.some((t3) => {
  643. const r3 = 900913 === t3 ? k.WebMercator : new k({ wkid: t3 });
  644. return E(r3, e2);
  645. });
  646. }
  647. _defaultFetchFeatureInfoFunction(e2) {
  648. const t3 = document.createElement("iframe");
  649. t3.src = S(e2), t3.style.border = "none", t3.style.margin = "0", t3.style.width = "100%", t3.setAttribute("sandbox", "");
  650. const s6 = new k2({ title: this.title, content: t3 }), i2 = new g2({ sourceLayer: this, popupTemplate: s6 });
  651. return Promise.resolve([i2]);
  652. }
  653. async _fetchService(e2) {
  654. var _a;
  655. if (!this.resourceInfo) {
  656. const { path: t3, query: r3 } = (_a = this.parsedUrl) != null ? _a : {};
  657. (r3 == null ? void 0 : r3.service) && (r3.SERVICE = r3.service, delete r3.service), (r3 == null ? void 0 : r3.request) && (r3.REQUEST = r3.request, delete r3.request);
  658. const { data: o4 } = await U2(t3 != null ? t3 : "", { query: { SERVICE: "WMS", REQUEST: "GetCapabilities", ...r3, ...this.customParameters }, responseType: "xml", signal: e2 });
  659. this.resourceInfo = a3(o4);
  660. }
  661. if (this.parsedUrl) {
  662. const e3 = new y3(this.parsedUrl.path), { httpsDomains: r3 } = s.request;
  663. "https" !== e3.scheme || e3.port && "443" !== e3.port || !e3.host || r3.includes(e3.host) || r3.push(e3.host);
  664. }
  665. this.read(this.resourceInfo, { origin: "service" });
  666. }
  667. _mixCustomParameters(e2) {
  668. if (!this.customLayerParameters && !this.customParameters)
  669. return e2;
  670. const t3 = { ...this.customParameters, ...this.customLayerParameters };
  671. for (const r3 in t3)
  672. e2[r3.toLowerCase()] = t3[r3];
  673. return e2;
  674. }
  675. };
  676. function K(e2, t3) {
  677. return e2.some((e3) => {
  678. for (const r3 in e3)
  679. if (g(e3, r3, null, t3))
  680. return true;
  681. return false;
  682. });
  683. }
  684. function X(e2, t3, r3) {
  685. e2 = e2 != null ? e2 : [];
  686. const o4 = /* @__PURE__ */ new Map();
  687. e2.every((e3) => null == e3.id) && (e2 = y(e2)).forEach((e3, t4) => e3.id = t4);
  688. for (const i2 of e2) {
  689. const e3 = new m();
  690. e3.read(i2, t3), r3 && !r3.includes(e3.name) && (e3.visible = false), o4.set(e3.id, e3);
  691. }
  692. const s6 = [];
  693. for (const a4 of e2) {
  694. const e3 = null != a4.id ? o4.get(a4.id) : null;
  695. if (e3)
  696. if (null != a4.parentLayerId && a4.parentLayerId >= 0) {
  697. const t4 = o4.get(a4.parentLayerId);
  698. if (!t4)
  699. continue;
  700. t4.sublayers || (t4.sublayers = new j()), t4.sublayers.push(e3);
  701. } else
  702. s6.push(e3);
  703. }
  704. return s6;
  705. }
  706. e([y2({ readOnly: true })], z.prototype, "allSublayers", void 0), e([y2({ json: { type: Object, write: true } })], z.prototype, "customParameters", void 0), e([y2({ json: { type: Object, write: true } })], z.prototype, "customLayerParameters", void 0), e([y2({ type: String, json: { write: true } })], z.prototype, "copyright", void 0), e([y2()], z.prototype, "description", void 0), e([y2({ readOnly: true })], z.prototype, "dimensions", void 0), e([y2({ json: { type: [[Number]], read: { source: "extent" }, write: { target: "extent" }, origins: { "web-document": { write: { ignoreOrigin: true } }, "portal-item": { write: { ignoreOrigin: true } } } } })], z.prototype, "fullExtent", void 0), e([o(["web-document", "portal-item"], "fullExtent", ["extent"])], z.prototype, "readFullExtentFromItemOrMap", null), e([r2(["web-document", "portal-item"], "fullExtent", { extent: { type: [[Number]] } })], z.prototype, "writeFullExtent", null), e([y2()], z.prototype, "fullExtents", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "featureInfoFormat", null), e([y2({ type: [String], readOnly: true })], z.prototype, "featureInfoFormats", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "featureInfoUrl", void 0), e([y2()], z.prototype, "fetchFeatureInfoFunction", void 0), e([y2({ type: String, json: { origins: { "web-document": { default: "image/png", type: J.jsonValues, read: { reader: J.read, source: "format" }, write: { writer: J.write, target: "format" } } } } })], z.prototype, "imageFormat", void 0), e([o("imageFormat", ["supportedImageFormatTypes"])], z.prototype, "readImageFormat", null), e([y2({ type: Number, json: { read: { source: "maxHeight" }, write: { target: "maxHeight" } } })], z.prototype, "imageMaxHeight", void 0), e([y2({ type: Number, json: { read: { source: "maxWidth" }, write: { target: "maxWidth" } } })], z.prototype, "imageMaxWidth", void 0), e([y2()], z.prototype, "imageTransparency", void 0), e([y2(c)], z.prototype, "legendEnabled", void 0), e([y2({ type: ["show", "hide", "hide-children"] })], z.prototype, "listMode", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "mapUrl", void 0), e([y2({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], z.prototype, "isReference", void 0), e([y2({ type: ["WMS"] })], z.prototype, "operationalLayerType", void 0), e([y2()], z.prototype, "resourceInfo", void 0), e([y2({ type: k, json: { origins: { service: { read: { source: "extent.spatialReference" } } }, write: false } })], z.prototype, "spatialReference", void 0), e([o(["web-document", "portal-item"], "spatialReference", ["spatialReferences"])], z.prototype, "readSpatialReferenceFromItemOrDocument", null), e([y2({ type: [T], json: { read: false, origins: { service: { read: true }, "web-document": { read: false, write: { ignoreOrigin: true } }, "portal-item": { read: false, write: { ignoreOrigin: true } } } } })], z.prototype, "spatialReferences", void 0), e([r2(["web-document", "portal-item"], "spatialReferences")], z.prototype, "writeSpatialReferences", null), e([y2({ type: j.ofType(m), json: { write: { target: "layers", overridePolicy(e2, t3, r3) {
  707. if (K(this.allSublayers, r3))
  708. return { ignoreOrigin: true };
  709. } } } })], z.prototype, "sublayers", void 0), e([o(["web-document", "portal-item"], "sublayers", ["layers", "visibleLayers"])], z.prototype, "readSublayersFromItemOrMap", null), e([o("service", "sublayers", ["layers"])], z.prototype, "readSublayers", null), e([r2("sublayers", { layers: { type: [m] }, visibleLayers: { type: [String] } })], z.prototype, "writeSublayers", null), e([y2({ json: { read: false }, readOnly: true, value: "wms" })], z.prototype, "type", void 0), e([y2(f)], z.prototype, "url", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "version", void 0), z = e([n("esri.layers.WMSLayer")], z);
  710. var Y = z;
  711. export {
  712. Y as default
  713. };
  714. //# sourceMappingURL=WMSLayer-TMD46NQL.js.map