123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import {
- p
- } from "./chunk-65BYCSII.js";
- import {
- At,
- Ct,
- G,
- j
- } from "./chunk-VBRY5KJM.js";
- import {
- r,
- t
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/layers/support/arcgisLayerUrl.js
- var c = { mapserver: "MapServer", imageserver: "ImageServer", featureserver: "FeatureServer", sceneserver: "SceneServer", streamserver: "StreamServer", vectortileserver: "VectorTileServer" };
- var a = Object.values(c);
- var f = new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`, "i");
- var v = new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`, "i");
- var p2 = /(.*?)\/(?:layers\/)?(\d+)\/?$/i;
- function d(e) {
- return !!f.test(e);
- }
- function m(r2) {
- if (t(r2))
- return null;
- const n = j(r2), s = n.path.match(f) || n.path.match(v);
- if (!s)
- return null;
- const [, u, i, l, o] = s, a2 = i.indexOf("/");
- return { title: h(a2 !== -1 ? i.slice(a2 + 1) : i), serverType: c[l.toLowerCase()], sublayer: o != null && o !== "" ? parseInt(o, 10) : null, url: { path: u } };
- }
- function w(e) {
- const r2 = j(e).path.match(p2);
- return r2 ? { serviceUrl: r2[1], sublayerId: Number(r2[2]) } : null;
- }
- function h(e) {
- return (e = e.replace(/\s*[/_]+\s*/g, " "))[0].toUpperCase() + e.slice(1);
- }
- function y2(e, t2) {
- const n = [];
- if (e) {
- const t3 = m(e);
- r(t3) && t3.title && n.push(t3.title);
- }
- if (t2) {
- const e2 = h(t2);
- n.push(e2);
- }
- if (n.length === 2) {
- if (n[0].toLowerCase().includes(n[1].toLowerCase()))
- return n[0];
- if (n[1].toLowerCase().includes(n[0].toLowerCase()))
- return n[1];
- }
- return n.join(" - ");
- }
- function g(e) {
- if (!e)
- return false;
- const r2 = ".arcgis.com/", t2 = "//services", n = "//tiles", s = "//features", u = (e = e.toLowerCase()).includes(r2), i = e.includes(t2) || e.includes(n) || e.includes(s);
- return u && i;
- }
- function S(e, r2) {
- return e ? Ct(At(e, r2)) : e;
- }
- function L(e) {
- let { url: u } = e;
- if (!u)
- return { url: u };
- u = At(u, e.logger);
- const i = j(u), l = m(i.path);
- let o;
- if (r(l))
- l.sublayer != null && e.layer.layerId == null && (o = l.sublayer), u = l.url.path;
- else if (e.nonStandardUrlAllowed) {
- const e2 = w(i.path);
- r(e2) && (u = e2.serviceUrl, o = e2.sublayerId);
- }
- return { url: Ct(u), layerId: o };
- }
- function b(e, r2, t2, n, s) {
- p(r2, n, "url", s), n.url && e.layerId != null && (n.url = G(n.url, t2, e.layerId.toString()));
- }
- function I(e) {
- if (!e)
- return false;
- const r2 = e.toLowerCase(), t2 = r2.includes("/services/"), n = r2.includes("/mapserver/wmsserver"), s = r2.includes("/imageserver/wmsserver"), u = r2.includes("/wmsserver");
- return t2 && (n || s || u);
- }
- export {
- d,
- m,
- w,
- h,
- y2 as y,
- g,
- S,
- L,
- b,
- I
- };
- //# sourceMappingURL=chunk-X7DBH4KK.js.map
|