WMSLayer-JW7EUXIE.js 32 KB

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