@maptiler/sdk 3.5.1-rc4 → 3.5.1-rc6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3609,7 +3609,7 @@ class Nr {
3609
3609
  }
3610
3610
  }
3611
3611
  const Ot = { kind: "null" }, b = { kind: "number" }, I = { kind: "string" }, _ = { kind: "boolean" }, de = { kind: "color" }, jt = { kind: "projectionDefinition" }, Re = { kind: "object" }, T = { kind: "value" }, Ki = { kind: "error" }, Nt = { kind: "collator" }, Dt = { kind: "formatted" }, Ut = { kind: "padding" }, nt = { kind: "colorArray" }, Bt = { kind: "numberArray" }, ft = { kind: "resolvedImage" }, qt = { kind: "variableAnchorOffsetCollection" };
3612
- function Y(r, e) {
3612
+ function W(r, e) {
3613
3613
  return {
3614
3614
  kind: "array",
3615
3615
  itemType: r,
@@ -3632,7 +3632,7 @@ const Xi = [
3632
3632
  jt,
3633
3633
  Dt,
3634
3634
  Re,
3635
- Y(T),
3635
+ W(T),
3636
3636
  Ut,
3637
3637
  Bt,
3638
3638
  nt,
@@ -4387,7 +4387,7 @@ function B(r) {
4387
4387
  break;
4388
4388
  }
4389
4389
  }
4390
- return Y(t || T, e);
4390
+ return W(t || T, e);
4391
4391
  } else
4392
4392
  return Re;
4393
4393
  }
@@ -4448,7 +4448,7 @@ class se {
4448
4448
  return t.error('The length argument to "array" must be a positive integer literal', 2);
4449
4449
  l = e[2], n++;
4450
4450
  }
4451
- a = Y(s, l);
4451
+ a = W(s, l);
4452
4452
  } else {
4453
4453
  if (!wt[o])
4454
4454
  throw new Error(`Types doesn't contain name = ${o}`);
@@ -4765,7 +4765,7 @@ class Br {
4765
4765
  static parse(e, t) {
4766
4766
  if (e.length !== 3)
4767
4767
  return t.error(`Expected 2 arguments, but found ${e.length - 1} instead.`);
4768
- const n = t.parse(e[1], 1, b), a = t.parse(e[2], 2, Y(t.expectedType || T));
4768
+ const n = t.parse(e[1], 1, b), a = t.parse(e[2], 2, W(t.expectedType || T));
4769
4769
  if (!n || !a)
4770
4770
  return null;
4771
4771
  const o = a.type;
@@ -4963,7 +4963,7 @@ class _t {
4963
4963
  const n = t.parse(e[1], 1, T), a = t.parse(e[2], 2, b);
4964
4964
  if (!n || !a)
4965
4965
  return null;
4966
- if (!Dr(n.type, [Y(T), I, T]))
4966
+ if (!Dr(n.type, [W(T), I, T]))
4967
4967
  return t.error(`Expected first argument to be of type array or string, but found ${j(n.type)} instead`);
4968
4968
  if (e.length === 4) {
4969
4969
  const o = t.parse(e[3], 3, b);
@@ -5156,7 +5156,7 @@ class he {
5156
5156
  return null;
5157
5157
  l = l || h.type, s.push([c, h]);
5158
5158
  }
5159
- return !we(l, b) && !we(l, jt) && !we(l, de) && !we(l, Ut) && !we(l, Bt) && !we(l, nt) && !we(l, qt) && !we(l, Y(b)) ? t.error(`Type ${j(l)} is not interpolatable.`) : new he(l, n, a, o, s);
5159
+ return !we(l, b) && !we(l, jt) && !we(l, de) && !we(l, Ut) && !we(l, Bt) && !we(l, nt) && !we(l, qt) && !we(l, W(b)) ? t.error(`Type ${j(l)} is not interpolatable.`) : new he(l, n, a, o, s);
5160
5160
  }
5161
5161
  evaluate(e) {
5162
5162
  const t = this.labels, n = this.outputs;
@@ -5437,7 +5437,7 @@ class Kr {
5437
5437
  if (s["font-scale"] && (l = t.parse(s["font-scale"], 1, b), !l))
5438
5438
  return null;
5439
5439
  let u = null;
5440
- if (s["text-font"] && (u = t.parse(s["text-font"], 1, Y(I)), !u))
5440
+ if (s["text-font"] && (u = t.parse(s["text-font"], 1, W(I)), !u))
5441
5441
  return null;
5442
5442
  let c = null;
5443
5443
  if (s["text-color"] && (c = t.parse(s["text-color"], 1, de), !c))
@@ -6370,7 +6370,7 @@ le.register(tn, {
6370
6370
  (r, [e]) => j(B(e.evaluate(r)))
6371
6371
  ],
6372
6372
  "to-rgba": [
6373
- Y(b, 4),
6373
+ W(b, 4),
6374
6374
  [de],
6375
6375
  (r, [e]) => {
6376
6376
  const [t, n, a, o] = e.evaluate(r).rgb;
@@ -6695,23 +6695,23 @@ le.register(tn, {
6695
6695
  ],
6696
6696
  "filter-type-in": [
6697
6697
  _,
6698
- [Y(I)],
6698
+ [W(I)],
6699
6699
  (r, [e]) => e.value.indexOf(r.geometryType()) >= 0
6700
6700
  ],
6701
6701
  "filter-id-in": [
6702
6702
  _,
6703
- [Y(T)],
6703
+ [W(T)],
6704
6704
  (r, [e]) => e.value.indexOf(r.id()) >= 0
6705
6705
  ],
6706
6706
  "filter-in-small": [
6707
6707
  _,
6708
- [I, Y(T)],
6708
+ [I, W(T)],
6709
6709
  // assumes v is an array literal
6710
6710
  (r, [e, t]) => t.value.indexOf(r.properties()[e.value]) >= 0
6711
6711
  ],
6712
6712
  "filter-in-large": [
6713
6713
  _,
6714
- [I, Y(T)],
6714
+ [I, W(T)],
6715
6715
  // assumes v is a array literal with values sorted in ascending order and of a single type
6716
6716
  (r, [e, t]) => Qs(r.properties()[e.value], t.value, 0, t.value.length - 1)
6717
6717
  ],
@@ -6974,7 +6974,7 @@ function nl(r) {
6974
6974
  resolvedImage: ft,
6975
6975
  variableAnchorOffsetCollection: qt
6976
6976
  };
6977
- return r.type === "array" ? Y(e[r.value] || T, r.length) : e[r.type];
6977
+ return r.type === "array" ? W(e[r.value] || T, r.length) : e[r.type];
6978
6978
  }
6979
6979
  function al(r) {
6980
6980
  if (r.type === "color" && rn(r.default))
@@ -7813,7 +7813,7 @@ function Wa(r) {
7813
7813
  const e = r.value, t = r.key, n = Ne(r);
7814
7814
  return n.length || (e.indexOf("{fontstack}") === -1 && n.push(new g(t, e, '"glyphs" url must include a "{fontstack}" token')), e.indexOf("{range}") === -1 && n.push(new g(t, e, '"glyphs" url must include a "{range}" token'))), n;
7815
7815
  }
7816
- function Z(r, e = Hi) {
7816
+ function Y(r, e = Hi) {
7817
7817
  let t = [];
7818
7818
  return t = t.concat(Ft({
7819
7819
  key: "",
@@ -7833,17 +7833,17 @@ function Z(r, e = Hi) {
7833
7833
  value: r.constants
7834
7834
  }))), Ya(t);
7835
7835
  }
7836
- Z.source = pe(ce(Ga));
7837
- Z.sprite = pe(ce(Xa));
7838
- Z.glyphs = pe(ce(Wa));
7839
- Z.light = pe(ce(Va));
7840
- Z.sky = pe(ce(Ha));
7841
- Z.terrain = pe(ce(Ka));
7842
- Z.state = pe(ce(Za));
7843
- Z.layer = pe(ce(qa));
7844
- Z.filter = pe(ce(on));
7845
- Z.paintProperty = pe(ce(Ua));
7846
- Z.layoutProperty = pe(ce(Ba));
7836
+ Y.source = pe(ce(Ga));
7837
+ Y.sprite = pe(ce(Xa));
7838
+ Y.glyphs = pe(ce(Wa));
7839
+ Y.light = pe(ce(Va));
7840
+ Y.sky = pe(ce(Ha));
7841
+ Y.terrain = pe(ce(Ka));
7842
+ Y.state = pe(ce(Za));
7843
+ Y.layer = pe(ce(qa));
7844
+ Y.filter = pe(ce(on));
7845
+ Y.paintProperty = pe(ce(Ua));
7846
+ Y.layoutProperty = pe(ce(Ba));
7847
7847
  function ce(r) {
7848
7848
  return function(e) {
7849
7849
  return r({
@@ -7897,16 +7897,16 @@ function qn(r) {
7897
7897
  style: r.getDefaultVariant().getExpandedStyleURL(),
7898
7898
  requiresUrlMonitoring: !1,
7899
7899
  isFallback: !1
7900
- } : Z(r).length === 0 ? {
7900
+ } : Y(r).length === 0 ? {
7901
7901
  style: r,
7902
7902
  requiresUrlMonitoring: !1,
7903
7903
  isFallback: !1
7904
- } : (console.log("FUCK OFF", Z(r)), {
7904
+ } : {
7905
7905
  style: Qe[rr[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),
7906
7906
  requiresUrlMonitoring: !1,
7907
7907
  // default styles don't require URL monitoring
7908
7908
  isFallback: !0
7909
- });
7909
+ };
7910
7910
  }
7911
7911
  function bl(r) {
7912
7912
  try {
@@ -7917,7 +7917,7 @@ function bl(r) {
7917
7917
  }
7918
7918
  function wl(r) {
7919
7919
  try {
7920
- const e = JSON.parse(r), t = Z(e);
7920
+ const e = JSON.parse(r), t = Y(e);
7921
7921
  return {
7922
7922
  isValidJSON: !0,
7923
7923
  isValidStyle: t.length === 0,
@@ -8065,7 +8065,7 @@ class Cl extends ri {
8065
8065
  }
8066
8066
  }
8067
8067
  }
8068
- var K, oe, Se, xe, W, pt, q, Ja, J, Qa;
8068
+ var K, oe, Se, xe, Z, pt, q, Ja, J, Qa;
8069
8069
  class fr {
8070
8070
  constructor(e, t) {
8071
8071
  be(this, q);
@@ -8074,9 +8074,9 @@ class fr {
8074
8074
  be(this, oe);
8075
8075
  be(this, Se);
8076
8076
  be(this, xe);
8077
- be(this, W, !1);
8077
+ be(this, Z, !1);
8078
8078
  be(this, pt);
8079
- e.style !== void 0 && _e(this, W, !0), _e(this, K, {
8079
+ e.style !== void 0 && _e(this, Z, !0), _e(this, K, {
8080
8080
  // set defaults
8081
8081
  zoomAdjust: -4,
8082
8082
  position: "top-right",
@@ -8102,31 +8102,31 @@ class fr {
8102
8102
  }), e.lockZoom !== void 0 && (P(this, K).minZoom = e.lockZoom, P(this, K).maxZoom = e.lockZoom);
8103
8103
  }
8104
8104
  setStyle(e, t) {
8105
- P(this, W) || this.map.setStyle(e, t), H(this, q, J).call(this);
8105
+ P(this, Z) || this.map.setStyle(e, t), H(this, q, J).call(this);
8106
8106
  }
8107
8107
  addLayer(e, t) {
8108
- return P(this, W) || this.map.addLayer(e, t), H(this, q, J).call(this), this.map;
8108
+ return P(this, Z) || this.map.addLayer(e, t), H(this, q, J).call(this), this.map;
8109
8109
  }
8110
8110
  moveLayer(e, t) {
8111
- return P(this, W) || this.map.moveLayer(e, t), H(this, q, J).call(this), this.map;
8111
+ return P(this, Z) || this.map.moveLayer(e, t), H(this, q, J).call(this), this.map;
8112
8112
  }
8113
8113
  removeLayer(e) {
8114
- return P(this, W) || this.map.removeLayer(e), H(this, q, J).call(this), this;
8114
+ return P(this, Z) || this.map.removeLayer(e), H(this, q, J).call(this), this;
8115
8115
  }
8116
8116
  setLayerZoomRange(e, t, n) {
8117
- return P(this, W) || this.map.setLayerZoomRange(e, t, n), H(this, q, J).call(this), this;
8117
+ return P(this, Z) || this.map.setLayerZoomRange(e, t, n), H(this, q, J).call(this), this;
8118
8118
  }
8119
8119
  setFilter(e, t, n) {
8120
- return P(this, W) || this.map.setFilter(e, t, n), H(this, q, J).call(this), this;
8120
+ return P(this, Z) || this.map.setFilter(e, t, n), H(this, q, J).call(this), this;
8121
8121
  }
8122
8122
  setPaintProperty(e, t, n, a) {
8123
- return P(this, W) || this.map.setPaintProperty(e, t, n, a), H(this, q, J).call(this), this;
8123
+ return P(this, Z) || this.map.setPaintProperty(e, t, n, a), H(this, q, J).call(this), this;
8124
8124
  }
8125
8125
  setLayoutProperty(e, t, n, a) {
8126
- return P(this, W) || this.map.setLayoutProperty(e, t, n, a), H(this, q, J).call(this), this;
8126
+ return P(this, Z) || this.map.setLayoutProperty(e, t, n, a), H(this, q, J).call(this), this;
8127
8127
  }
8128
8128
  setGlyphs(e, t) {
8129
- return P(this, W) || this.map.setGlyphs(e, t), H(this, q, J).call(this), this;
8129
+ return P(this, Z) || this.map.setGlyphs(e, t), H(this, q, J).call(this), this;
8130
8130
  }
8131
8131
  onAdd(e) {
8132
8132
  _e(this, oe, e), _e(this, Se, ge("div", "maplibregl-ctrl maplibregl-ctrl-group"));
@@ -8143,7 +8143,7 @@ class fr {
8143
8143
  (e = P(this, pt)) == null || e.call(this), sn(P(this, Se));
8144
8144
  }
8145
8145
  }
8146
- K = new WeakMap(), oe = new WeakMap(), Se = new WeakMap(), xe = new WeakMap(), W = new WeakMap(), pt = new WeakMap(), q = new WeakSet(), Ja = function(e) {
8146
+ K = new WeakMap(), oe = new WeakMap(), Se = new WeakMap(), xe = new WeakMap(), Z = new WeakMap(), pt = new WeakMap(), q = new WeakSet(), Ja = function(e) {
8147
8147
  e === void 0 || e.linePaint === void 0 && e.fillPaint === void 0 || (_e(this, xe, {
8148
8148
  type: "Feature",
8149
8149
  properties: {
@@ -8228,7 +8228,7 @@ class Ll {
8228
8228
  this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"), this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"), this.map.isGlobeProjection() ? (this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"), this.projectionButton.title = "Enable Mercator projection") : (this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"), this.projectionButton.title = "Enable Globe projection");
8229
8229
  }
8230
8230
  }
8231
- const Al = "@maptiler/sdk", El = "3.5.1-rc4", Tl = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud", _l = "MapTiler", Il = "dist/maptiler-sdk.mjs", Ml = "dist/maptiler-sdk.d.ts", Pl = "dist/maptiler-sdk.css", Rl = "module", zl = "dist/maptiler-sdk.mjs", Fl = { ".": { import: "./dist/maptiler-sdk.mjs", types: "./dist/maptiler-sdk.d.ts" }, "./dist/maptiler-sdk.css": { import: "./dist/maptiler-sdk.css" }, "./style.css": { import: "./dist/maptiler-sdk.css" } }, $l = ["maptiler", "map", "sdk", "webmap", "cloud", "webGL", "maplibre"], Ol = "https://docs.maptiler.com/sdk-js/", jl = "BSD-3-Clause", Nl = { type: "git", url: "https://github.com/maptiler/maptiler-sdk-js.git" }, Dl = { prepare: "husky", doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/", ncu: "npx npm-check-updates", lint: "tsc --noEmit && eslint src", "lint:fix": "tsc --noEmit && eslint src --fix", "test:watch": "vitest watch -c vite.config-test.ts --dom", test: "vitest run -c vite.config-test.ts --dom", "install:clean": "rm -rf build/ dist/ node_modules/ && npm ci", dev: "npm run build-css && vite -c vite.config-dev.ts", "dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts", "build-css": "mkdir -p dist build && node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css", "build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts", "build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts", build: "npm run build-es; npm run build-umd; npm run build-css", make: "npm run install:clean && npm run build" }, Ul = { "@canvas/image-data": "^1.0.0", "@eslint/js": "^9.21.0", "@types/color-convert": "^2.0.4", "@types/color-name": "^2.0.0", "@types/stats.js": "^0.17.4", "@types/uuid": "^10.0.0", "@types/xmldom": "^0.1.31", "@vitest/web-worker": "^3.0.9", "@xmldom/xmldom": "^0.8.10", concurrently: "^9.1.2", eslint: "^9.21.0", "eslint-config-prettier": "^10.0.2", "eslint-plugin-prettier": "^5.2.3", "happy-dom": "^17.4.4", husky: "^8.0.0", jiti: "^2.4.2", "lint-staged": "^15.4.3", prettier: "3.5.2", "stats.js": "^0.17.0", typedoc: "^0.27.6", typescript: "^5.7.3", "typescript-eslint": "^8.25.0", vite: "^6.0.7", "vite-plugin-dts": "^4.5.0", vitest: "^3.0.9" }, Bl = { "@maplibre/maplibre-gl-style-spec": "~23.3.0", "@maptiler/client": "~2.4.0", events: "^3.3.0", "gl-matrix": "^3.4.3", "js-base64": "^3.7.7", "maplibre-gl": "~5.6.0", uuid: "^11.0.5" }, ql = {
8231
+ const Al = "@maptiler/sdk", El = "3.5.1-rc6", Tl = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud", _l = "MapTiler", Il = "dist/maptiler-sdk.mjs", Ml = "dist/maptiler-sdk.d.ts", Pl = "dist/maptiler-sdk.css", Rl = "module", zl = "dist/maptiler-sdk.mjs", Fl = { ".": { import: "./dist/maptiler-sdk.mjs", types: "./dist/maptiler-sdk.d.ts" }, "./dist/maptiler-sdk.css": { import: "./dist/maptiler-sdk.css" }, "./style.css": { import: "./dist/maptiler-sdk.css" } }, $l = ["maptiler", "map", "sdk", "webmap", "cloud", "webGL", "maplibre"], Ol = "https://docs.maptiler.com/sdk-js/", jl = "BSD-3-Clause", Nl = { type: "git", url: "https://github.com/maptiler/maptiler-sdk-js.git" }, Dl = { prepare: "husky", doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/", ncu: "npx npm-check-updates", lint: "tsc --noEmit && eslint src", "lint:fix": "tsc --noEmit && eslint src --fix", "test:watch": "vitest watch -c vite.config-test.ts --dom", test: "vitest run -c vite.config-test.ts --dom", "install:clean": "rm -rf build/ dist/ node_modules/ && npm ci", dev: "npm run build-css && vite -c vite.config-dev.ts", "dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts", "build-css": "mkdir -p dist build && node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css", "build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts", "build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts", build: "npm run build-es; npm run build-umd; npm run build-css", make: "npm run install:clean && npm run build" }, Ul = { "@canvas/image-data": "^1.0.0", "@eslint/js": "^9.21.0", "@types/color-convert": "^2.0.4", "@types/color-name": "^2.0.0", "@types/stats.js": "^0.17.4", "@types/uuid": "^10.0.0", "@types/xmldom": "^0.1.31", "@vitest/web-worker": "^3.0.9", "@xmldom/xmldom": "^0.8.10", concurrently: "^9.1.2", eslint: "^9.21.0", "eslint-config-prettier": "^10.0.2", "eslint-plugin-prettier": "^5.2.3", "happy-dom": "^17.4.4", husky: "^8.0.0", jiti: "^2.4.2", "lint-staged": "^15.4.3", prettier: "3.5.2", "stats.js": "^0.17.0", typedoc: "^0.27.6", typescript: "^5.7.3", "typescript-eslint": "^8.25.0", vite: "^6.0.7", "vite-plugin-dts": "^4.5.0", vitest: "^3.0.9" }, Bl = { "@maplibre/maplibre-gl-style-spec": "~23.3.0", "@maptiler/client": "~2.4.0", events: "^3.3.0", "gl-matrix": "^3.4.3", "js-base64": "^3.7.7", "maplibre-gl": "~5.6.0", uuid: "^11.0.5" }, ql = {
8232
8232
  name: Al,
8233
8233
  version: El,
8234
8234
  description: Tl,
@@ -9081,7 +9081,7 @@ let vr, ta, ra;
9081
9081
  function gu({ gl: r, faces: e, onReady: t, forceRefresh: n }) {
9082
9082
  vr && !n && ra === JSON.stringify(e) && t(vr, ta), ra = JSON.stringify(e);
9083
9083
  const a = r.createTexture();
9084
- if (r.bindTexture(r.TEXTURE_CUBE_MAP, a), !e) {
9084
+ if (!e) {
9085
9085
  console.warn("[CubemapLayer][loadCubemapTexture]: Faces are null");
9086
9086
  return;
9087
9087
  }
@@ -9091,24 +9091,35 @@ function gu({ gl: r, faces: e, onReady: t, forceRefresh: n }) {
9091
9091
  return;
9092
9092
  }
9093
9093
  const i = Object.entries(e).map(([s, l]) => new Promise((u, c) => {
9094
+ const p = s;
9094
9095
  if (l === void 0) {
9095
- console.warn(`[CubemapLayer][loadCubemapTexture]: Face ${s} is undefined`);
9096
+ c(new Error(`[CubemapLayer][loadCubemapTexture]: Face ${s} is undefined`));
9096
9097
  return;
9097
9098
  }
9098
- const p = vu(r, s);
9099
- if (p) {
9100
- const d = r.RGBA, h = r.RGBA, y = r.UNSIGNED_BYTE, m = new Image();
9101
- m.crossOrigin = "anonymous";
9102
- const w = () => {
9103
- r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MAG_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texImage2D(p, 0, d, h, y, m), u(m);
9104
- };
9105
- m.src = l, m.complete && m.naturalWidth > 0 ? w() : m.onload = w, m.onerror = () => {
9106
- c(new Error(`[CubemapLayer][loadCubemapTexture]: Error loading image ${l}`));
9107
- };
9108
- }
9099
+ const f = new Image();
9100
+ f.crossOrigin = "anonymous";
9101
+ const d = () => {
9102
+ u({ image: f, key: p });
9103
+ };
9104
+ f.src = l, f.complete && f.naturalWidth > 0 ? d() : f.onload = d, f.onerror = () => {
9105
+ c(new Error(`[CubemapLayer][loadCubemapTexture]: Error loading image ${l}`));
9106
+ };
9109
9107
  }));
9110
9108
  Promise.all(i).then((s) => {
9111
- r.bindTexture(r.TEXTURE_CUBE_MAP, a), r.generateMipmap(r.TEXTURE_CUBE_MAP), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MIN_FILTER, r.LINEAR_MIPMAP_LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MAG_FILTER, r.LINEAR), t(a, s), ta = s, vr = a;
9109
+ for (let u = 0; u < s.length; u++) {
9110
+ const p = r.RGBA, f = r.RGBA, d = r.UNSIGNED_BYTE, { image: h, key: y } = s[u] ?? {};
9111
+ if (!h || !y) {
9112
+ console.warn("[CubemapLayer][loadCubemapTexture]: Image or key is null");
9113
+ continue;
9114
+ }
9115
+ const m = vu(r, y);
9116
+ r.bindTexture(r.TEXTURE_CUBE_MAP, a), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MAG_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texImage2D(m, 0, p, f, d, h);
9117
+ }
9118
+ r.bindTexture(r.TEXTURE_CUBE_MAP, a), r.generateMipmap(r.TEXTURE_CUBE_MAP), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MIN_FILTER, r.LINEAR_MIPMAP_LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MAG_FILTER, r.LINEAR);
9119
+ const l = s.map((u) => u.image);
9120
+ t(a, l), ta = l, vr = a;
9121
+ }).catch((s) => {
9122
+ console.error("[CubemapLayer][loadCubemapTexture]: Error loading cubemap texture", s);
9112
9123
  });
9113
9124
  }
9114
9125
  function vu(r, e) {
@@ -9460,7 +9471,7 @@ class br {
9460
9471
  const n = Lt(e.color);
9461
9472
  if (e.color && this.targetBgColor.toString() !== n.toString())
9462
9473
  this.setBgColor(n);
9463
- else if (e.preset && e.preset in Ge) {
9474
+ else if (!e.color && e.preset && e.preset in Ge) {
9464
9475
  const a = Ge[e.preset];
9465
9476
  this.setBgColor(Lt(a.color));
9466
9477
  }
@@ -10058,17 +10069,20 @@ let Mu = class ro extends k.Map {
10058
10069
  }
10059
10070
  setSpaceFromStyle({ style: t }) {
10060
10071
  var o, i, s;
10061
- if (!((i = (o = t.metadata) == null ? void 0 : o.maptiler) != null && i.space))
10062
- return;
10063
- const n = t.metadata.maptiler.space;
10064
- if (JSON.stringify((s = this.space) == null ? void 0 : s.getConfig()) === JSON.stringify(n))
10065
- return;
10072
+ const n = (i = (o = t.metadata) == null ? void 0 : o.maptiler) == null ? void 0 : i.space;
10066
10073
  if (!n) {
10067
10074
  this.setSpace({
10068
10075
  color: "transparent"
10069
10076
  });
10070
10077
  return;
10071
10078
  }
10079
+ if (JSON.stringify((s = this.space) == null ? void 0 : s.getConfig()) === JSON.stringify(n)) {
10080
+ if (this.space && !this.getLayer(this.space.id)) {
10081
+ const l = this.getLayersOrder()[0];
10082
+ this.addLayer(this.space, l);
10083
+ }
10084
+ return;
10085
+ }
10072
10086
  (() => {
10073
10087
  if (this.space && this.isGlobeProjection()) {
10074
10088
  if (!this.getLayer(this.space.id)) {
@@ -10080,10 +10094,15 @@ let Mu = class ro extends k.Map {
10080
10094
  })();
10081
10095
  }
10082
10096
  setHaloFromStyle({ style: t }) {
10083
- var o, i;
10097
+ var o, i, s;
10084
10098
  const n = (o = t.metadata) == null ? void 0 : o.maptiler;
10085
- if (JSON.stringify((i = this.halo) == null ? void 0 : i.getConfig()) === JSON.stringify(n == null ? void 0 : n.halo))
10099
+ if (JSON.stringify((i = this.halo) == null ? void 0 : i.getConfig()) === JSON.stringify(n == null ? void 0 : n.halo)) {
10100
+ if (this.halo && !this.getLayer(this.halo.id)) {
10101
+ const l = this.getLayersOrder().indexOf(((s = this.space) == null ? void 0 : s.id) ?? "") + 1, u = this.getLayersOrder()[l];
10102
+ this.addLayer(this.halo, u);
10103
+ }
10086
10104
  return;
10105
+ }
10087
10106
  if (!(n != null && n.halo)) {
10088
10107
  this.setHalo({
10089
10108
  stops: [
@@ -10095,11 +10114,11 @@ let Mu = class ro extends k.Map {
10095
10114
  return;
10096
10115
  }
10097
10116
  (() => {
10098
- var s;
10117
+ var l;
10099
10118
  if (this.halo) {
10100
10119
  if (!this.getLayer(this.halo.id)) {
10101
- const l = this.getLayersOrder().indexOf(((s = this.space) == null ? void 0 : s.id) ?? "") + 1, u = this.getLayersOrder()[l];
10102
- this.addLayer(this.halo, u);
10120
+ const u = this.getLayersOrder().indexOf(((l = this.space) == null ? void 0 : l.id) ?? "") + 1, c = this.getLayersOrder()[u];
10121
+ this.addLayer(this.halo, c);
10103
10122
  }
10104
10123
  this.halo.setGradient(n.halo);
10105
10124
  }
@@ -10232,8 +10251,8 @@ let Mu = class ro extends k.Map {
10232
10251
  * - a longer form with the prefix `"maptiler://"` (eg. `"maptiler://streets-v2"`)
10233
10252
  */
10234
10253
  setStyle(t, n) {
10235
- var o;
10236
- this.originalLabelStyle.clear(), (o = this.minimap) == null || o.setStyle(t), this.forceLanguageUpdate = !0, this.once("idle", () => {
10254
+ var u, c, p, f, d;
10255
+ this.originalLabelStyle.clear(), (u = this.minimap) == null || u.setStyle(t), this.forceLanguageUpdate = !0, this.once("idle", () => {
10237
10256
  this.forceLanguageUpdate = !1;
10238
10257
  });
10239
10258
  const a = qn(t);
@@ -10247,16 +10266,27 @@ let Mu = class ro extends k.Map {
10247
10266
  );
10248
10267
  }
10249
10268
  this.styleInProcess = !0;
10269
+ const o = this.getStyle(), i = a.style, s = ((c = o == null ? void 0 : o.terrain) == null ? void 0 : c.source) !== ((p = i == null ? void 0 : i.terrain) == null ? void 0 : p.source) || ((f = o == null ? void 0 : o.terrain) == null ? void 0 : f.exaggeration) !== ((d = i == null ? void 0 : i.terrain) == null ? void 0 : d.exaggeration);
10250
10270
  try {
10251
10271
  super.setStyle(a.style, n);
10252
- } catch (i) {
10253
- this.styleInProcess = !1, console.error("[Map.setStyle]: Error while setting style:", i);
10272
+ } catch (h) {
10273
+ this.styleInProcess = !1, console.error("[Map.setStyle]: Error while setting style:", h);
10254
10274
  }
10255
- return typeof a.style == "string" || a.requiresUrlMonitoring ? this : (this.once("style.load", () => {
10256
- var l, u, c, p;
10257
- const i = this.getLayersOrder()[0], s = a.style;
10258
- this.space ? this.setSpaceFromStyle({ style: s }) : this.initSpace({ before: i, spec: (u = (l = s.metadata) == null ? void 0 : l.maptiler) == null ? void 0 : u.space }), this.halo ? this.setHaloFromStyle({ style: s }) : this.initHalo({ before: i, spec: (p = (c = s.metadata) == null ? void 0 : c.maptiler) == null ? void 0 : p.halo });
10259
- }), this);
10275
+ if (typeof a.style == "string" || a.requiresUrlMonitoring)
10276
+ return this;
10277
+ const l = () => {
10278
+ this.setSpaceFromStyle({ style: a.style }), this.setHaloFromStyle({ style: a.style });
10279
+ };
10280
+ if (s)
10281
+ this.once("terrain", l);
10282
+ else
10283
+ return l(), this;
10284
+ return this.styleInProcess && this.once("style.load", () => {
10285
+ var m, w, v, x;
10286
+ console.log("style.load");
10287
+ const h = this.getLayersOrder()[0], y = a.style;
10288
+ this.space ? this.setSpaceFromStyle({ style: y }) : this.initSpace({ before: h, spec: (w = (m = y.metadata) == null ? void 0 : m.maptiler) == null ? void 0 : w.space }), this.halo ? this.setHaloFromStyle({ style: y }) : this.initHalo({ before: h, spec: (x = (v = y.metadata) == null ? void 0 : v.maptiler) == null ? void 0 : x.halo });
10289
+ }), this;
10260
10290
  }
10261
10291
  /**
10262
10292
  * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
@@ -12534,7 +12564,7 @@ const xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12534
12564
  }, Symbol.toStringTag, { value: "Module" }));
12535
12565
  qo();
12536
12566
  function kc() {
12537
- return "3.5.1-rc4";
12567
+ return "3.5.1-rc6";
12538
12568
  }
12539
12569
  const Cc = k.Map, Lc = k.Marker, Ac = k.Popup, Ec = k.Style, Tc = k.CanvasSource, _c = k.GeoJSONSource, Ic = k.ImageSource, Mc = k.RasterTileSource, Pc = k.RasterDEMTileSource, Rc = k.VectorTileSource, zc = k.VideoSource, Fc = k.NavigationControl, $c = k.GeolocateControl, Oc = k.AttributionControl, jc = k.LogoControl, Nc = k.ScaleControl, Dc = k.FullscreenControl, Uc = k.TerrainControl, Bc = k.BoxZoomHandler, qc = k.ScrollZoomHandler, Gc = k.CooperativeGesturesHandler, Vc = k.KeyboardHandler, Hc = k.TwoFingersTouchPitchHandler, Kc = k.MapWheelEvent, Xc = k.MapTouchEvent, Zc = k.MapMouseEvent, Wc = k.config, Yc = k.getVersion, {
12540
12570
  setRTLTextPlugin: Jc,