@nika-js/onlymap 0.11.1 → 0.11.3

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +3 -3
  3. package/dist/attribution.d.ts +27 -0
  4. package/dist/{basemap-CHFwxaRT.js → basemap-C6Ehu6fw.js} +923 -878
  5. package/dist/basemap.d.ts +11 -0
  6. package/dist/cartograph/elements/om-cartograph.d.ts +22 -0
  7. package/dist/cartograph/elements/om-frame.d.ts +8 -0
  8. package/dist/cartograph.js +1139 -1058
  9. package/dist/cartograph.standalone.js +1595 -1514
  10. package/dist/cluster-options.d.ts +11 -0
  11. package/dist/elements/om-map.d.ts +6 -0
  12. package/dist/{geoparquet-DBzSJJz_.js → geoparquet-3V4KrvQN.js} +1 -1
  13. package/dist/{globe-view-D0eDmIGO.js → globe-view-D4Tlyff-.js} +1 -1
  14. package/dist/{hillshade-DodGS9DL.js → hillshade-BC8QiJRP.js} +1 -1
  15. package/dist/{index-CrnprTab.js → index-BPCIxI1b.js} +1 -1
  16. package/dist/{index-Ca5y3OLs.js → index-BUE-VzWx.js} +1 -1
  17. package/dist/{index-BGvTOkkE.js → index-BqFwoWp9.js} +1 -1
  18. package/dist/{index-em-_HmNV.js → index-C1f14saD.js} +3 -3
  19. package/dist/{index-DH1_IQmW.js → index-DgutJ5y2.js} +3 -3
  20. package/dist/{index-C7Tpf_BA.js → index-DpUl6z5-.js} +1 -1
  21. package/dist/{index-5iFHs_bW.js → index-iwTA46AA.js} +1 -1
  22. package/dist/{index-wRR0a71N.js → index-p5XXAoNa.js} +2 -2
  23. package/dist/{index-D04CeeYu.js → index-pu3BNjzA.js} +11202 -11134
  24. package/dist/layers/cluster-layer.d.ts +7 -0
  25. package/dist/{lerc-KZgSVKKQ.js → lerc-DWtJKNQk.js} +1 -1
  26. package/dist/onlymap.standalone.js +19242 -19130
  27. package/dist/onlymapjs.js +1 -1
  28. package/dist/{post-process-effect-eJXo3MSl.js → post-process-effect-mQdMaWQE.js} +1 -1
  29. package/dist/{raster-CHuauCiR.js → raster-DtUDOXfy.js} +3 -3
  30. package/dist/{raster-pipeline-Coou2lF-.js → raster-pipeline-hQh5cG3e.js} +1 -1
  31. package/dist/runtime-core.d.ts +22 -0
  32. package/dist/{text-on-path-DUfdTGzX.js → text-on-path-CcfoZqXD.js} +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/dist/{zarr-BYLzFMeQ.js → zarr-Qo4A_t7d.js} +2 -2
  35. package/docs/cartograph.md +27 -3
  36. package/llms.txt +3 -3
  37. package/onlymapjs.attributes.json +12 -0
  38. package/onlymapjs.html-data.json +20 -0
  39. package/package.json +1 -1
  40. package/skills/onlymapjs/SKILL.md +1 -1
  41. package/skills/onlymapjs/references/syntax.md +9 -6
@@ -1,16 +1,16 @@
1
- let xt = null, Z = null;
2
- function Pe(r) {
3
- xt = r;
1
+ let Pt = null, Z = null;
2
+ function Re(r) {
3
+ Pt = r;
4
4
  }
5
- function dr() {
5
+ function br() {
6
6
  return V !== null;
7
7
  }
8
8
  let V = null;
9
9
  function J() {
10
10
  return V;
11
11
  }
12
- function Te() {
13
- return V ? Promise.resolve(V) : Z || (xt ? (Z = Promise.resolve(xt()).then((r) => (V = r, V)).catch((r) => {
12
+ function Ie() {
13
+ return V ? Promise.resolve(V) : Z || (Pt ? (Z = Promise.resolve(Pt()).then((r) => (V = r, V)).catch((r) => {
14
14
  throw Z = null, r;
15
15
  }), Z) : Promise.reject(
16
16
  new Error(
@@ -18,17 +18,17 @@ function Te() {
18
18
  )
19
19
  ));
20
20
  }
21
- const fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21
+ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22
22
  __proto__: null,
23
- isCoreLoaded: dr,
24
- loadCore: Te,
23
+ isCoreLoaded: br,
24
+ loadCore: Ie,
25
25
  peekCore: J,
26
- setCoreLoader: Pe
26
+ setCoreLoader: Re
27
27
  }, Symbol.toStringTag, { value: "Module" }));
28
- function Bt(r) {
28
+ function Xt(r) {
29
29
  return { scale: r / 96, pxPerMm: r / 25.4 };
30
30
  }
31
- function ft(r) {
31
+ function gt(r) {
32
32
  return typeof r?.paintCartograph == "function";
33
33
  }
34
34
  const K = (r, t) => {
@@ -47,17 +47,17 @@ function S(r) {
47
47
  z: K(r, "z")
48
48
  };
49
49
  }
50
- function $t(r, t = 0) {
50
+ function Tt(r, t = 0) {
51
51
  if (!r) return t;
52
52
  const e = Number.parseFloat(r);
53
53
  return Number.isFinite(e) ? e : t;
54
54
  }
55
- function F(r) {
55
+ function I(r) {
56
56
  if (!r) return null;
57
57
  const t = r.trim().toLowerCase();
58
58
  return t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "none" ? null : r;
59
59
  }
60
- const D = 96 / 25.4, Kt = {
60
+ const D = 96 / 25.4, Jt = {
61
61
  A0: { widthMm: 841, heightMm: 1189 },
62
62
  A1: { widthMm: 594, heightMm: 841 },
63
63
  A2: { widthMm: 420, heightMm: 594 },
@@ -66,15 +66,15 @@ const D = 96 / 25.4, Kt = {
66
66
  A5: { widthMm: 148, heightMm: 210 },
67
67
  Letter: { widthMm: 215.9, heightMm: 279.4 },
68
68
  Legal: { widthMm: 215.9, heightMm: 355.6 }
69
- }, Vt = "A4";
70
- function ht(r, t, e, n) {
71
- const i = t != null ? Number(t) : NaN, o = e != null ? Number(e) : NaN;
72
- if (Number.isFinite(i) && i > 0 && Number.isFinite(o) && o > 0) return { widthMm: i, heightMm: o };
73
- const s = Kt[r ?? Vt] ?? Kt[Vt];
74
- return n === "landscape" ? { widthMm: s.heightMm, heightMm: s.widthMm } : { ...s };
69
+ }, Zt = "A4";
70
+ function dt(r, t, e, n) {
71
+ const i = t != null ? Number(t) : NaN, s = e != null ? Number(e) : NaN;
72
+ if (Number.isFinite(i) && i > 0 && Number.isFinite(s) && s > 0) return { widthMm: i, heightMm: s };
73
+ const o = Jt[r ?? Zt] ?? Jt[Zt];
74
+ return n === "landscape" ? { widthMm: o.heightMm, heightMm: o.widthMm } : { ...o };
75
75
  }
76
76
  let rt = null;
77
- function pr(r) {
77
+ function wr(r) {
78
78
  if (!rt) {
79
79
  rt = new Uint32Array(256);
80
80
  for (let e = 0; e < 256; e++) {
@@ -87,39 +87,39 @@ function pr(r) {
87
87
  for (let e = 0; e < r.length; e++) t = rt[(t ^ r[e]) & 255] ^ t >>> 8;
88
88
  return (t ^ 4294967295) >>> 0;
89
89
  }
90
- function gr(r) {
90
+ function vr(r) {
91
91
  const t = Math.max(1980, r.getFullYear());
92
92
  return {
93
93
  time: r.getHours() << 11 | r.getMinutes() << 5 | Math.floor(r.getSeconds() / 2),
94
94
  date: t - 1980 << 9 | r.getMonth() + 1 << 5 | r.getDate()
95
95
  };
96
96
  }
97
- async function br(r, t = /* @__PURE__ */ new Date()) {
98
- const e = new TextEncoder(), { time: n, date: i } = gr(t), o = [], s = [];
97
+ async function Ar(r, t = /* @__PURE__ */ new Date()) {
98
+ const e = new TextEncoder(), { time: n, date: i } = vr(t), s = [], o = [];
99
99
  let a = 0;
100
100
  for (const u of r) {
101
- const m = u.data instanceof Blob ? new Uint8Array(await u.data.arrayBuffer()) : u.data, d = e.encode(u.name), h = pr(m), f = new DataView(new ArrayBuffer(30));
102
- f.setUint32(0, 67324752, !0), f.setUint16(4, 20, !0), f.setUint16(6, 2048, !0), f.setUint16(8, 0, !0), f.setUint16(10, n, !0), f.setUint16(12, i, !0), f.setUint32(14, h, !0), f.setUint32(18, m.length, !0), f.setUint32(22, m.length, !0), f.setUint16(26, d.length, !0), f.setUint16(28, 0, !0), o.push(new Uint8Array(f.buffer), d, m), s.push({ name: u.name, bytes: m, crc: h, offset: a }), a += 30 + d.length + m.length;
101
+ const h = u.data instanceof Blob ? new Uint8Array(await u.data.arrayBuffer()) : u.data, d = e.encode(u.name), m = wr(h), f = new DataView(new ArrayBuffer(30));
102
+ f.setUint32(0, 67324752, !0), f.setUint16(4, 20, !0), f.setUint16(6, 2048, !0), f.setUint16(8, 0, !0), f.setUint16(10, n, !0), f.setUint16(12, i, !0), f.setUint32(14, m, !0), f.setUint32(18, h.length, !0), f.setUint32(22, h.length, !0), f.setUint16(26, d.length, !0), f.setUint16(28, 0, !0), s.push(new Uint8Array(f.buffer), d, h), o.push({ name: u.name, bytes: h, crc: m, offset: a }), a += 30 + d.length + h.length;
103
103
  }
104
104
  const l = a;
105
- for (const u of s) {
106
- const m = e.encode(u.name), d = new DataView(new ArrayBuffer(46));
107
- d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, 2048, !0), d.setUint16(10, 0, !0), d.setUint16(12, n, !0), d.setUint16(14, i, !0), d.setUint32(16, u.crc, !0), d.setUint32(20, u.bytes.length, !0), d.setUint32(24, u.bytes.length, !0), d.setUint16(28, m.length, !0), d.setUint16(30, 0, !0), d.setUint16(32, 0, !0), d.setUint16(34, 0, !0), d.setUint16(36, 0, !0), d.setUint32(38, 0, !0), d.setUint32(42, u.offset, !0), o.push(new Uint8Array(d.buffer), m), a += 46 + m.length;
105
+ for (const u of o) {
106
+ const h = e.encode(u.name), d = new DataView(new ArrayBuffer(46));
107
+ d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, 2048, !0), d.setUint16(10, 0, !0), d.setUint16(12, n, !0), d.setUint16(14, i, !0), d.setUint32(16, u.crc, !0), d.setUint32(20, u.bytes.length, !0), d.setUint32(24, u.bytes.length, !0), d.setUint16(28, h.length, !0), d.setUint16(30, 0, !0), d.setUint16(32, 0, !0), d.setUint16(34, 0, !0), d.setUint16(36, 0, !0), d.setUint32(38, 0, !0), d.setUint32(42, u.offset, !0), s.push(new Uint8Array(d.buffer), h), a += 46 + h.length;
108
108
  }
109
109
  const c = new DataView(new ArrayBuffer(22));
110
- return c.setUint32(0, 101010256, !0), c.setUint16(4, 0, !0), c.setUint16(6, 0, !0), c.setUint16(8, s.length, !0), c.setUint16(10, s.length, !0), c.setUint32(12, a - l, !0), c.setUint32(16, l, !0), c.setUint16(20, 0, !0), o.push(new Uint8Array(c.buffer)), new Blob(o, { type: "application/zip" });
110
+ return c.setUint32(0, 101010256, !0), c.setUint16(4, 0, !0), c.setUint16(6, 0, !0), c.setUint16(8, o.length, !0), c.setUint16(10, o.length, !0), c.setUint32(12, a - l, !0), c.setUint32(16, l, !0), c.setUint16(20, 0, !0), s.push(new Uint8Array(c.buffer)), new Blob(s, { type: "application/zip" });
111
111
  }
112
- const mt = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"], Le = {
112
+ const ft = ["protanopia", "deuteranopia", "tritanopia", "achromatopsia"], Fe = {
113
113
  protan: "protanopia",
114
114
  deutan: "deuteranopia",
115
115
  tritan: "tritanopia",
116
116
  achroma: "achromatopsia"
117
117
  };
118
- function Dt(r) {
118
+ function qt(r) {
119
119
  const t = r?.trim().toLowerCase();
120
- return !t || t === "none" ? null : mt.includes(t) ? t : Le[t] ?? null;
120
+ return !t || t === "none" ? null : ft.includes(t) ? t : Fe[t] ?? null;
121
121
  }
122
- const yr = ["none", ...mt, ...Object.keys(Le)], zt = {
122
+ const Mr = ["none", ...ft, ...Object.keys(Fe)], Wt = {
123
123
  protanopia: [0.11238, 0.88762, 0, 0.11238, 0.88762, 0, 401e-5, -401e-5, 1],
124
124
  deuteranopia: [0.29275, 0.70725, 0, 0.29275, 0.70725, 0, -0.02234, 0.02234, 1],
125
125
  tritanopia: [1, 0.14461, -0.14461, 0, 0.85659, 0.14341, 0, 0.85659, 0.14341],
@@ -127,69 +127,69 @@ const yr = ["none", ...mt, ...Object.keys(Le)], zt = {
127
127
  }, q = (r) => {
128
128
  const t = r / 255;
129
129
  return t <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
130
- }, ct = (r) => {
130
+ }, ht = (r) => {
131
131
  const t = Math.min(1, Math.max(0, r));
132
132
  return 255 * (t <= 31308e-7 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - 0.055);
133
133
  };
134
- function wr(r) {
134
+ function Sr(r) {
135
135
  const t = r.trim().toLowerCase(), e = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);
136
136
  if (e) {
137
- const i = e[1], o = (s) => parseInt(s.length === 1 ? s + s : s, 16);
138
- return i.length === 3 ? { r: o(i[0]), g: o(i[1]), b: o(i[2]) } : { r: o(i.slice(0, 2)), g: o(i.slice(2, 4)), b: o(i.slice(4, 6)) };
137
+ const i = e[1], s = (o) => parseInt(o.length === 1 ? o + o : o, 16);
138
+ return i.length === 3 ? { r: s(i[0]), g: s(i[1]), b: s(i[2]) } : { r: s(i.slice(0, 2)), g: s(i.slice(2, 4)), b: s(i.slice(4, 6)) };
139
139
  }
140
140
  const n = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(t);
141
141
  return n ? { r: Number(n[1]), g: Number(n[2]), b: Number(n[3]) } : null;
142
142
  }
143
- function Ht(r, t) {
144
- const e = zt[t], [n, i, o] = [q(r.r), q(r.g), q(r.b)];
143
+ function Qt(r, t) {
144
+ const e = Wt[t], [n, i, s] = [q(r.r), q(r.g), q(r.b)];
145
145
  return {
146
- r: ct(e[0] * n + e[1] * i + e[2] * o),
147
- g: ct(e[3] * n + e[4] * i + e[5] * o),
148
- b: ct(e[6] * n + e[7] * i + e[8] * o)
146
+ r: ht(e[0] * n + e[1] * i + e[2] * s),
147
+ g: ht(e[3] * n + e[4] * i + e[5] * s),
148
+ b: ht(e[6] * n + e[7] * i + e[8] * s)
149
149
  };
150
150
  }
151
- function Yt({ r, g: t, b: e }) {
152
- const [n, i, o] = [q(r), q(t), q(e)], s = (n * 0.4124564 + i * 0.3575761 + o * 0.1804375) / 0.95047, a = n * 0.2126729 + i * 0.7151522 + o * 0.072175, l = (n * 0.0193339 + i * 0.119192 + o * 0.9503041) / 1.08883, c = (h) => h > 216 / 24389 ? Math.cbrt(h) : 841 / 108 * h + 4 / 29, [u, m, d] = [c(s), c(a), c(l)];
153
- return [116 * m - 16, 500 * (u - m), 200 * (m - d)];
151
+ function te({ r, g: t, b: e }) {
152
+ const [n, i, s] = [q(r), q(t), q(e)], o = (n * 0.4124564 + i * 0.3575761 + s * 0.1804375) / 0.95047, a = n * 0.2126729 + i * 0.7151522 + s * 0.072175, l = (n * 0.0193339 + i * 0.119192 + s * 0.9503041) / 1.08883, c = (m) => m > 216 / 24389 ? Math.cbrt(m) : 841 / 108 * m + 4 / 29, [u, h, d] = [c(o), c(a), c(l)];
153
+ return [116 * h - 16, 500 * (u - h), 200 * (h - d)];
154
154
  }
155
- function Xt(r, t) {
156
- const [e, n, i] = Yt(r), [o, s, a] = Yt(t), l = Math.PI / 180, c = 180 / Math.PI, u = (Math.hypot(n, i) + Math.hypot(s, a)) / 2, m = 0.5 * (1 - Math.sqrt(u ** 7 / (u ** 7 + 25 ** 7))), [d, h] = [n * (1 + m), s * (1 + m)], [f, g] = [Math.hypot(d, i), Math.hypot(h, a)], p = (L, R) => {
155
+ function ee(r, t) {
156
+ const [e, n, i] = te(r), [s, o, a] = te(t), l = Math.PI / 180, c = 180 / Math.PI, u = (Math.hypot(n, i) + Math.hypot(o, a)) / 2, h = 0.5 * (1 - Math.sqrt(u ** 7 / (u ** 7 + 25 ** 7))), [d, m] = [n * (1 + h), o * (1 + h)], [f, g] = [Math.hypot(d, i), Math.hypot(m, a)], p = (L, R) => {
157
157
  if (L === 0 && R === 0) return 0;
158
158
  const B = Math.atan2(R, L) * c;
159
159
  return B >= 0 ? B : B + 360;
160
- }, [b, w] = [p(d, i), p(h, a)], y = o - e, A = g - f;
160
+ }, [b, w] = [p(d, i), p(m, a)], y = s - e, A = g - f;
161
161
  let v = 0;
162
162
  f * g !== 0 && (v = w - b, v > 180 ? v -= 360 : v < -180 && (v += 360));
163
- const $ = 2 * Math.sqrt(f * g) * Math.sin(v * l / 2), G = (e + o) / 2, _ = (f + g) / 2;
163
+ const $ = 2 * Math.sqrt(f * g) * Math.sin(v * l / 2), G = (e + s) / 2, _ = (f + g) / 2;
164
164
  let E = b + w;
165
165
  f * g !== 0 && (Math.abs(b - w) > 180 && (E += b + w < 360 ? 360 : -360), E /= 2);
166
- const N = 1 - 0.17 * Math.cos((E - 30) * l) + 0.24 * Math.cos(2 * E * l) + 0.32 * Math.cos((3 * E + 6) * l) - 0.2 * Math.cos((4 * E - 63) * l), M = 1 + 0.015 * (G - 50) ** 2 / Math.sqrt(20 + (G - 50) ** 2), C = 1 + 0.045 * _, P = 1 + 0.015 * _ * N, x = -2 * Math.sqrt(_ ** 7 / (_ ** 7 + 25 ** 7)) * Math.sin(60 * Math.exp(-(((E - 275) / 25) ** 2)) * l);
167
- return Math.sqrt((y / M) ** 2 + (A / C) ** 2 + ($ / P) ** 2 + x * (A / C) * ($ / P));
166
+ const N = 1 - 0.17 * Math.cos((E - 30) * l) + 0.24 * Math.cos(2 * E * l) + 0.32 * Math.cos((3 * E + 6) * l) - 0.2 * Math.cos((4 * E - 63) * l), M = 1 + 0.015 * (G - 50) ** 2 / Math.sqrt(20 + (G - 50) ** 2), C = 1 + 0.045 * _, P = 1 + 0.015 * _ * N, k = -2 * Math.sqrt(_ ** 7 / (_ ** 7 + 25 ** 7)) * Math.sin(60 * Math.exp(-(((E - 275) / 25) ** 2)) * l);
167
+ return Math.sqrt((y / M) ** 2 + (A / C) ** 2 + ($ / P) ** 2 + k * (A / C) * ($ / P));
168
168
  }
169
- const vr = 10;
170
- function Ar(r, t = vr) {
169
+ const Cr = 10;
170
+ function xr(r, t = Cr) {
171
171
  const e = /* @__PURE__ */ new Map();
172
172
  for (const a of r) {
173
- const l = wr(a.color);
173
+ const l = Sr(a.color);
174
174
  if (!l) continue;
175
175
  const c = a.layer ?? "", u = e.get(c);
176
176
  u ? u.push({ entry: a, rgb: l }) : e.set(c, [{ entry: a, rgb: l }]);
177
177
  }
178
178
  const n = [], i = /* @__PURE__ */ new Map();
179
- for (const a of mt)
179
+ for (const a of ft)
180
180
  for (const l of e.values())
181
181
  for (let c = 0; c < l.length; c++)
182
182
  for (let u = c + 1; u < l.length; u++) {
183
- if (Xt(l[c].rgb, l[u].rgb) < t) continue;
184
- const d = Xt(Ht(l[c].rgb, a), Ht(l[u].rgb, a));
183
+ if (ee(l[c].rgb, l[u].rgb) < t) continue;
184
+ const d = ee(Qt(l[c].rgb, a), Qt(l[u].rgb, a));
185
185
  d < t && (n.push({ type: a, a: l[c].entry, b: l[u].entry, distance: d }), i.set(a, (i.get(a) ?? 0) + 1));
186
186
  }
187
- let o = null, s = 0;
187
+ let s = null, o = 0;
188
188
  for (const [a, l] of i)
189
- l > s && (s = l, o = a);
190
- return { collapses: n, worstType: o };
189
+ l > o && (o = l, s = a);
190
+ return { collapses: n, worstType: s };
191
191
  }
192
- function Mr(r, t, e, n) {
192
+ function kr(r, t, e, n) {
193
193
  if (t <= 0 || e <= 0) return !0;
194
194
  let i;
195
195
  try {
@@ -197,37 +197,37 @@ function Mr(r, t, e, n) {
197
197
  } catch {
198
198
  return !1;
199
199
  }
200
- const o = new Float64Array(256);
201
- for (let m = 0; m < 256; m++) o[m] = q(m);
202
- const s = 1024, a = new Float64Array(s + 1);
203
- for (let m = 0; m <= s; m++) a[m] = ct(m / s);
204
- const l = (m) => {
205
- const d = Math.min(1, Math.max(0, m)) * s, h = Math.floor(d);
206
- return h >= s ? a[s] : a[h] + (a[h + 1] - a[h]) * (d - h);
207
- }, c = zt[n], u = i.data;
208
- for (let m = 0; m < u.length; m += 4) {
209
- const d = o[u[m]], h = o[u[m + 1]], f = o[u[m + 2]];
210
- u[m] = l(c[0] * d + c[1] * h + c[2] * f), u[m + 1] = l(c[3] * d + c[4] * h + c[5] * f), u[m + 2] = l(c[6] * d + c[7] * h + c[8] * f);
200
+ const s = new Float64Array(256);
201
+ for (let h = 0; h < 256; h++) s[h] = q(h);
202
+ const o = 1024, a = new Float64Array(o + 1);
203
+ for (let h = 0; h <= o; h++) a[h] = ht(h / o);
204
+ const l = (h) => {
205
+ const d = Math.min(1, Math.max(0, h)) * o, m = Math.floor(d);
206
+ return m >= o ? a[o] : a[m] + (a[m + 1] - a[m]) * (d - m);
207
+ }, c = Wt[n], u = i.data;
208
+ for (let h = 0; h < u.length; h += 4) {
209
+ const d = s[u[h]], m = s[u[h + 1]], f = s[u[h + 2]];
210
+ u[h] = l(c[0] * d + c[1] * m + c[2] * f), u[h + 1] = l(c[3] * d + c[4] * m + c[5] * f), u[h + 2] = l(c[6] * d + c[7] * m + c[8] * f);
211
211
  }
212
212
  return r.putImageData(i, 0, 0), !0;
213
213
  }
214
- const Re = (r) => `om-carto-cvd-${r}`;
215
- function Sr(r) {
214
+ const Oe = (r) => `om-carto-cvd-${r}`;
215
+ function $r(r) {
216
216
  if (r.getElementById("om-carto-cvd-filters")) return;
217
217
  const t = r.createElementNS("http://www.w3.org/2000/svg", "svg");
218
218
  t.id = "om-carto-cvd-filters", t.setAttribute("aria-hidden", "true"), t.setAttribute("width", "0"), t.setAttribute("height", "0"), t.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;";
219
- for (const e of mt) {
219
+ for (const e of ft) {
220
220
  const n = r.createElementNS("http://www.w3.org/2000/svg", "filter");
221
- n.id = Re(e), n.setAttribute("color-interpolation-filters", "linearRGB");
221
+ n.id = Oe(e), n.setAttribute("color-interpolation-filters", "linearRGB");
222
222
  const i = r.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix");
223
223
  i.setAttribute("type", "matrix");
224
- const o = zt[e];
225
- i.setAttribute("values", [o[0], o[1], o[2], 0, 0, o[3], o[4], o[5], 0, 0, o[6], o[7], o[8], 0, 0, 0, 0, 0, 1, 0].join(" ")), n.appendChild(i), t.appendChild(n);
224
+ const s = Wt[e];
225
+ i.setAttribute("values", [s[0], s[1], s[2], 0, 0, s[3], s[4], s[5], 0, 0, s[6], s[7], s[8], 0, 0, 0, 0, 0, 1, 0].join(" ")), n.appendChild(i), t.appendChild(n);
226
226
  }
227
227
  r.body.appendChild(t);
228
228
  }
229
- const Fe = 16384, Ie = 134217728;
230
- async function Cr(r) {
229
+ const _e = 16384, Ue = 134217728;
230
+ async function Er(r) {
231
231
  const t = [], e = [...r.querySelectorAll("img")];
232
232
  return await Promise.all(
233
233
  e.map(async (n) => {
@@ -240,31 +240,31 @@ async function Cr(r) {
240
240
  })
241
241
  ), t;
242
242
  }
243
- function Oe(r) {
243
+ function De(r) {
244
244
  return !r.hasAttribute("hidden") && !r.hasAttribute("data-om-carto-screen-only") && !r.hasAttribute("data-om-carto-marks") && !r.hasAttribute("data-om-carto-flattened") && r.tagName.toLowerCase() !== "style" && r.tagName.toLowerCase() !== "script";
245
245
  }
246
- function kr(r) {
247
- return [...r.children].filter(Oe).map((t, e) => ({ el: t, index: e, z: S(t).z ?? 0 })).sort((t, e) => t.z - e.z || t.index - e.index).map((t) => t.el);
246
+ function Nr(r) {
247
+ return [...r.children].filter(De).map((t, e) => ({ el: t, index: e, z: S(t).z ?? 0 })).sort((t, e) => t.z - e.z || t.index - e.index).map((t) => t.el);
248
248
  }
249
- async function jt(r, t = {}) {
249
+ async function Bt(r, t = {}) {
250
250
  const e = r ?? document.querySelector("om-cartograph");
251
251
  if (!e) throw new Error("[onlymapjs/cartograph] renderCartograph: no <om-cartograph> to render.");
252
252
  const n = [], i = t.dpi ?? (Number(e.getAttribute("dpi")) || 300);
253
253
  if (!Number.isFinite(i) || i <= 0) throw new Error(`[onlymapjs/cartograph] renderCartograph: invalid dpi ${t.dpi}.`);
254
- const { widthMm: o, heightMm: s } = ht(
254
+ const { widthMm: s, heightMm: o } = dt(
255
255
  e.getAttribute("size"),
256
256
  e.getAttribute("width"),
257
257
  e.getAttribute("height"),
258
258
  e.getAttribute("orientation")
259
- ), a = Math.max(0, Number(e.getAttribute("bleed")) || 0), l = o + a * 2, c = s + a * 2, u = t.maxDimension ?? Fe, m = t.maxArea ?? Ie;
259
+ ), a = Math.max(0, Number(e.getAttribute("bleed")) || 0), l = s + a * 2, c = o + a * 2, u = t.maxDimension ?? _e, h = t.maxArea ?? Ue;
260
260
  let d = i;
261
- const h = Math.min(u / (l / 25.4), u / (c / 25.4)), f = Math.sqrt(m / (l / 25.4 * (c / 25.4))), g = Math.min(h, f);
262
- d > g && (d = Math.floor(g), n.push(`Requested ${i} dpi exceeds this browser's canvas budget for a ${l.toFixed(0)}×${c.toFixed(0)}mm page; rendered at ${d} dpi instead.`)), n.push(...await Cr(e)), typeof document < "u" && document.fonts?.ready && await document.fonts.ready;
263
- const p = Bt(d), b = Math.max(1, Math.round(l * p.pxPerMm)), w = Math.max(1, Math.round(c * p.pxPerMm)), y = kr(e);
261
+ const m = Math.min(u / (l / 25.4), u / (c / 25.4)), f = Math.sqrt(h / (l / 25.4 * (c / 25.4))), g = Math.min(m, f);
262
+ d > g && (d = Math.floor(g), n.push(`Requested ${i} dpi exceeds this browser's canvas budget for a ${l.toFixed(0)}×${c.toFixed(0)}mm page; rendered at ${d} dpi instead.`)), n.push(...await Er(e)), typeof document < "u" && document.fonts?.ready && await document.fonts.ready;
263
+ const p = Xt(d), b = Math.max(1, Math.round(l * p.pxPerMm)), w = Math.max(1, Math.round(c * p.pxPerMm)), y = Nr(e);
264
264
  for (const M of y)
265
- if (!(!ft(M) || !M.prepareCartograph))
265
+ if (!(!gt(M) || !M.prepareCartograph))
266
266
  try {
267
- await M.prepareCartograph(Bt(d));
267
+ await M.prepareCartograph(Xt(d));
268
268
  } catch (C) {
269
269
  M.discardCartograph?.(), n.push(`${M.tagName.toLowerCase()}${M.id ? `#${M.id}` : ""} could not be captured: ${C.message}`);
270
270
  }
@@ -273,13 +273,13 @@ async function jt(r, t = {}) {
273
273
  const v = A.getContext("2d");
274
274
  if (!v) throw new Error("[onlymapjs/cartograph] renderCartograph: could not get a 2D canvas context.");
275
275
  const $ = typeof getComputedStyle == "function" ? getComputedStyle(e) : null;
276
- v.fillStyle = F($?.backgroundColor) ?? "#ffffff", v.fillRect(0, 0, b, w);
276
+ v.fillStyle = I($?.backgroundColor) ?? "#ffffff", v.fillRect(0, 0, b, w);
277
277
  for (const M of y) {
278
- if (!ft(M)) continue;
278
+ if (!gt(M)) continue;
279
279
  const C = S(M);
280
280
  if (v.save(), v.translate((C.x + a) * p.pxPerMm, (C.y + a) * p.pxPerMm), C.rotation) {
281
- const P = C.w / 2 * p.pxPerMm, x = C.h / 2 * p.pxPerMm;
282
- v.translate(P, x), v.rotate(C.rotation * Math.PI / 180), v.translate(-P, -x);
281
+ const P = C.w / 2 * p.pxPerMm, k = C.h / 2 * p.pxPerMm;
282
+ v.translate(P, k), v.rotate(C.rotation * Math.PI / 180), v.translate(-P, -k);
283
283
  }
284
284
  try {
285
285
  M.paintCartograph(v, p);
@@ -290,19 +290,19 @@ async function jt(r, t = {}) {
290
290
  }
291
291
  const G = e.querySelector(":scope > [data-om-carto-marks]");
292
292
  for (const M of G?.querySelectorAll("line") ?? []) {
293
- const C = Number(M.getAttribute("x1")), P = Number(M.getAttribute("y1")), x = Number(M.getAttribute("x2")), L = Number(M.getAttribute("y2"));
294
- [C, P, x, L].every(Number.isFinite) && (v.save(), v.strokeStyle = M.getAttribute("stroke") || "#000000", v.lineWidth = (Number(M.getAttribute("stroke-width")) || 0.2) * p.pxPerMm, v.beginPath(), v.moveTo((C + a) * p.pxPerMm, (P + a) * p.pxPerMm), v.lineTo((x + a) * p.pxPerMm, (L + a) * p.pxPerMm), v.stroke(), v.restore());
293
+ const C = Number(M.getAttribute("x1")), P = Number(M.getAttribute("y1")), k = Number(M.getAttribute("x2")), L = Number(M.getAttribute("y2"));
294
+ [C, P, k, L].every(Number.isFinite) && (v.save(), v.strokeStyle = M.getAttribute("stroke") || "#000000", v.lineWidth = (Number(M.getAttribute("stroke-width")) || 0.2) * p.pxPerMm, v.beginPath(), v.moveTo((C + a) * p.pxPerMm, (P + a) * p.pxPerMm), v.lineTo((k + a) * p.pxPerMm, (L + a) * p.pxPerMm), v.stroke(), v.restore());
295
295
  }
296
- const _ = Dt(t.cvd === "page" ? e.getAttribute("cvd") : t.cvd);
297
- _ && !Mr(v, b, w, _) && n.push("Colour-vision simulation was skipped: a cross-origin image on the page makes the export canvas unreadable.");
298
- for (const M of y) ft(M) && M.discardCartograph?.();
296
+ const _ = qt(t.cvd === "page" ? e.getAttribute("cvd") : t.cvd);
297
+ _ && !kr(v, b, w, _) && n.push("Colour-vision simulation was skipped: a cross-origin image on the page makes the export canvas unreadable.");
298
+ for (const M of y) gt(M) && M.discardCartograph?.();
299
299
  const E = t.format === "jpeg" ? "image/jpeg" : "image/png";
300
300
  E === "image/jpeg" && e.querySelector("om-text") && n.push("JPEG compresses text edges — prefer PNG for a page carrying labels.");
301
301
  const N = await new Promise((M) => A.toBlob(M, E, t.quality));
302
302
  if (!N) throw new Error("[onlymapjs/cartograph] renderCartograph: the canvas produced no image (it may have exceeded a browser limit).");
303
303
  return { blob: N, widthPx: b, heightPx: w, dpi: d, warnings: n };
304
304
  }
305
- async function _e(r, t = {}) {
305
+ async function ze(r, t = {}) {
306
306
  const e = r ?? document.querySelector("om-cartograph");
307
307
  if (!e) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: no <om-cartograph> to render.");
308
308
  const n = e.querySelector("om-atlas") ?? null;
@@ -311,61 +311,61 @@ async function _e(r, t = {}) {
311
311
  throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: the atlas layer cannot drive pages (${n.problem}).`);
312
312
  const i = n.count;
313
313
  if (i === 0) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: the atlas layer produced no features.");
314
- const o = t.format === "jpeg" ? "jpg" : "png", s = n.filenames(o), a = [], l = n.index;
314
+ const s = t.format === "jpeg" ? "jpg" : "png", o = n.filenames(s), a = [], l = n.index;
315
315
  try {
316
316
  if (t.page != null) {
317
- const m = Math.trunc(t.page);
318
- if (!Number.isInteger(m) || m < 0 || m >= i)
317
+ const h = Math.trunc(t.page);
318
+ if (!Number.isInteger(h) || h < 0 || h >= i)
319
319
  throw new Error(`[onlymapjs/cartograph] renderCartographAtlas: page ${t.page} is out of range (this atlas has ${i}).`);
320
- n.seek(m);
321
- const d = await Jt(e, t, a);
322
- return { blob: d.blob, filenames: [s[m]], pages: 1, dpi: d.dpi, warnings: a };
320
+ n.seek(h);
321
+ const d = await re(e, t, a);
322
+ return { blob: d.blob, filenames: [o[h]], pages: 1, dpi: d.dpi, warnings: a };
323
323
  }
324
324
  const c = [];
325
325
  let u = t.dpi ?? 300;
326
- for (let m = 0; m < i; m++) {
327
- n.seek(m);
328
- const d = await Jt(e, t, a);
329
- u = d.dpi, c.push({ name: s[m], data: d.blob }), t.onPage?.(m + 1, i);
326
+ for (let h = 0; h < i; h++) {
327
+ n.seek(h);
328
+ const d = await re(e, t, a);
329
+ u = d.dpi, c.push({ name: o[h], data: d.blob }), t.onPage?.(h + 1, i);
330
330
  }
331
- return { blob: await br(c), filenames: s, pages: i, dpi: u, warnings: a };
331
+ return { blob: await Ar(c), filenames: o, pages: i, dpi: u, warnings: a };
332
332
  } finally {
333
333
  n.seek(l);
334
334
  }
335
335
  }
336
- async function Jt(r, t, e) {
336
+ async function re(r, t, e) {
337
337
  for (const i of r.querySelectorAll("om-frame"))
338
338
  await i.mapElement?.whenSettled?.({ timeout: 2e4 });
339
- const n = await jt(r, t);
339
+ const n = await Bt(r, t);
340
340
  return e.push(...n.warnings), n;
341
341
  }
342
- const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
342
+ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
343
343
  __proto__: null,
344
- MAX_CANVAS_AREA: Ie,
345
- MAX_CANVAS_DIMENSION: Fe,
346
- paintsInExport: Oe,
347
- renderCartograph: jt,
348
- renderCartographAtlas: _e
344
+ MAX_CANVAS_AREA: Ue,
345
+ MAX_CANVAS_DIMENSION: _e,
346
+ paintsInExport: De,
347
+ renderCartograph: Bt,
348
+ renderCartographAtlas: ze
349
349
  }, Symbol.toStringTag, { value: "Module" }));
350
- function Zt(r, t, e = {}) {
350
+ function ne(r, t, e = {}) {
351
351
  const n = URL.createObjectURL(r), i = document.createElement("a");
352
352
  i.href = n, i.download = t, document.body.appendChild(i), i.click(), i.remove();
353
- const o = e.revokeAfterMs ?? 0;
354
- o > 0 ? setTimeout(() => URL.revokeObjectURL(n), o) : URL.revokeObjectURL(n);
353
+ const s = e.revokeAfterMs ?? 0;
354
+ s > 0 ? setTimeout(() => URL.revokeObjectURL(n), s) : URL.revokeObjectURL(n);
355
355
  }
356
- const $r = 3e4;
357
- async function Qt(r, t = $r) {
356
+ const Tr = 3e4;
357
+ async function ie(r, t = Tr) {
358
358
  let e = !1;
359
359
  const n = new Promise(
360
- (o) => setTimeout(() => {
361
- e = !0, o();
360
+ (s) => setTimeout(() => {
361
+ e = !0, s();
362
362
  }, t)
363
363
  ), i = (async () => {
364
- const o = [...r.querySelectorAll("om-frame")];
365
- await Promise.all(o.map((a) => a.ready ?? Promise.resolve()));
366
- const s = [...r.querySelectorAll("img")];
364
+ const s = [...r.querySelectorAll("om-frame")];
365
+ await Promise.all(s.map((a) => a.ready ?? Promise.resolve()));
366
+ const o = [...r.querySelectorAll("img")];
367
367
  await Promise.all(
368
- s.map(async (a) => {
368
+ o.map(async (a) => {
369
369
  a.complete || await new Promise((l) => {
370
370
  a.addEventListener("load", () => l(), { once: !0 }), a.addEventListener("error", () => l(), { once: !0 });
371
371
  });
@@ -374,53 +374,81 @@ async function Qt(r, t = $r) {
374
374
  })();
375
375
  return await Promise.race([i, n]), { timedOut: e };
376
376
  }
377
- async function Er(r, t = {}) {
377
+ async function Lr(r, t = {}) {
378
378
  if (!r.hasAttribute("allow-url-actions") || typeof document < "u" && document.documentElement?.dataset?.omHost === "editor") return null;
379
379
  const e = t.search ?? (typeof location < "u" ? location.search : "");
380
380
  if (!e) return null;
381
381
  const n = new URLSearchParams(e), i = n.get("cvd");
382
382
  i && r.setAttribute("cvd", i);
383
- const o = n.get("export");
384
- if (o) {
385
- await Qt(r, t.timeoutMs);
386
- const s = o === "jpeg" ? "jpeg" : "png", a = Number(n.get("dpi")) || void 0, l = r.getAttribute("cartograph-id") || "cartograph", c = n.get("page");
383
+ const s = n.get("export");
384
+ if (s) {
385
+ await ie(r, t.timeoutMs);
386
+ const o = s === "jpeg" ? "jpeg" : "png", a = Number(n.get("dpi")) || void 0, l = r.getAttribute("cartograph-id") || "cartograph", c = n.get("page");
387
387
  if (c != null) {
388
- const m = r.querySelector("om-atlas");
389
- if (!m) throw new Error(`?page=${c} needs an <om-atlas>; this cartograph is a single sheet.`);
388
+ const h = r.querySelector("om-atlas");
389
+ if (!h) throw new Error(`?page=${c} needs an <om-atlas>; this cartograph is a single sheet.`);
390
390
  const d = Number(c);
391
391
  if (!Number.isInteger(d) || d < 1) throw new Error(`?page=${c} is not a page number (they start at 1).`);
392
- m.refresh?.();
393
- const h = await _e(r, { dpi: a, format: s, page: d - 1 });
394
- for (const f of h.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
395
- return Zt(h.blob, h.filenames[0] ?? `${l}.${s === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
392
+ h.refresh?.();
393
+ const m = await ze(r, { dpi: a, format: o, page: d - 1 });
394
+ for (const f of m.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
395
+ return ne(m.blob, m.filenames[0] ?? `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
396
396
  }
397
- const u = await jt(r, { dpi: a, format: s });
398
- for (const m of u.warnings) console.warn(`[onlymapjs/cartograph] ${m}`);
399
- return Zt(u.blob, `${l}.${s === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
397
+ const u = await Bt(r, { dpi: a, format: o });
398
+ for (const h of u.warnings) console.warn(`[onlymapjs/cartograph] ${h}`);
399
+ return ne(u.blob, `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
400
400
  }
401
- return n.get("print") === "1" ? (await Qt(r, t.timeoutMs), typeof r.print == "function" ? await r.print({ dpi: Number(n.get("dpi")) || void 0 }) : typeof window < "u" && window.print(), "print") : i ? "cvd" : null;
401
+ return n.get("print") === "1" ? (await ie(r, t.timeoutMs), typeof r.print == "function" ? await r.print({ dpi: Number(n.get("dpi")) || void 0 }) : typeof window < "u" && window.print(), "print") : i ? "cvd" : null;
402
402
  }
403
- function Nr() {
403
+ function Rr() {
404
404
  if (typeof document > "u") return;
405
405
  const r = () => {
406
406
  for (const t of document.querySelectorAll("om-cartograph[allow-url-actions]"))
407
- Er(t).catch((e) => console.warn(`[onlymapjs/cartograph] URL action failed: ${e.message}`));
407
+ Lr(t).catch((e) => console.warn(`[onlymapjs/cartograph] URL action failed: ${e.message}`));
408
408
  };
409
409
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", r, { once: !0 }) : r();
410
410
  }
411
- const Ue = typeof window < "u" && typeof document < "u" && typeof customElements < "u", De = Ue ? HTMLElement : class {
411
+ const je = typeof window < "u" && typeof document < "u" && typeof customElements < "u", Ge = je ? HTMLElement : class {
412
412
  };
413
- function k(r, t) {
414
- Ue && (customElements.get(r) || customElements.define(r, t));
413
+ function x(r, t) {
414
+ je && (customElements.get(r) || customElements.define(r, t));
415
415
  }
416
- function Pr(r) {
416
+ function Ir(r) {
417
417
  if (typeof DOMParser > "u")
418
418
  throw new Error(
419
419
  "[onlymapjs] Parsing a manifest string needs a DOM implementation (DOMParser). In node, run under a DOM test environment — e.g. vitest with `environment: 'happy-dom'` (or jsdom) — or pass an already-parsed Element instead of a string."
420
420
  );
421
421
  return new DOMParser().parseFromString(r, "text/html");
422
422
  }
423
- class O extends De {
423
+ const Kt = " · ", Fr = {
424
+ copy: "©",
425
+ reg: "®",
426
+ amp: "&",
427
+ lt: "<",
428
+ gt: ">",
429
+ quot: '"',
430
+ apos: "'",
431
+ nbsp: " "
432
+ };
433
+ function Or(r) {
434
+ return r.replace(/<[^>]*>/g, " ").replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (t, e) => {
435
+ if (e.startsWith("#")) {
436
+ const n = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
437
+ return Number.isInteger(n) && n > 0 && n <= 1114111 ? String.fromCodePoint(n) : t;
438
+ }
439
+ return Fr[e.toLowerCase()] ?? t;
440
+ }).replace(/\s+/g, " ").trim();
441
+ }
442
+ function qe(r) {
443
+ const t = [...new Set(r.filter((e) => typeof e == "string").map(Or))].filter(
444
+ (e) => e.length > 0
445
+ );
446
+ return t.filter((e) => !t.some((n) => n !== e && n.includes(e)));
447
+ }
448
+ function _r(r) {
449
+ return qe((r ?? "").split(Kt.trim()));
450
+ }
451
+ class O extends Ge {
424
452
  renderQueued = !1;
425
453
  connectedCallback() {
426
454
  this.scheduleRender();
@@ -456,19 +484,19 @@ class O extends De {
456
484
  if (c == null || c === "") return null;
457
485
  const u = Number(c);
458
486
  return Number.isFinite(u) ? u : null;
459
- }, e = t("x"), n = t("y"), i = t("w"), o = t("h");
460
- this.style.position = "absolute", e != null && (this.style.left = `${e}mm`), n != null && (this.style.top = `${n}mm`), i != null && (this.style.width = `${i}mm`), o != null && (this.style.height = `${o}mm`);
461
- const s = t("rotation");
462
- s != null && s !== 0 ? (this.style.transform = `rotate(${s}deg)`, this.style.transformOrigin = "center") : this.style.removeProperty("transform");
487
+ }, e = t("x"), n = t("y"), i = t("w"), s = t("h");
488
+ this.style.position = "absolute", e != null && (this.style.left = `${e}mm`), n != null && (this.style.top = `${n}mm`), i != null && (this.style.width = `${i}mm`), s != null && (this.style.height = `${s}mm`);
489
+ const o = t("rotation");
490
+ o != null && o !== 0 ? (this.style.transform = `rotate(${o}deg)`, this.style.transformOrigin = "center") : this.style.removeProperty("transform");
463
491
  const a = t("z");
464
492
  a != null && Number.isInteger(a) ? this.style.zIndex = String(a) : this.style.removeProperty("z-index");
465
493
  }
466
494
  }
467
- const pt = "cartograph/2", Ai = ["default", "dark", "sepia", "blueprint", "minimal"], te = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], Tr = /* @__PURE__ */ new Map([
495
+ const bt = "cartograph/2", Ei = ["default", "dark", "sepia", "blueprint", "minimal"], se = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], Ur = /* @__PURE__ */ new Map([
468
496
  ["projection", "live frames render Web Mercator (EPSG:3857) only — Globe support is design-only; use a static frame for other projections"]
469
497
  ]), z = ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"], T = {
470
498
  "om-cartograph": ["cartograph-id", "format", "size", "width", "height", "orientation", "theme", "bg", "color", "font", "title", "attribution", "notes", "cvd", "bleed", "crop-marks", "safe-zone", "dpi", "flatten", "color-profile", "allow-url-actions", "keep-badge"],
471
- "om-frame": [...z, "src", "mode", "center", "zoom", "bearing", "pitch", "dpi", "crs", "corners", "crs-def", "overview-of", "overview-stroke", "atlas-fit", "atlas-margin", "frame-stroke", "frame-bg"],
499
+ "om-frame": [...z, "src", "mode", "center", "zoom", "bearing", "pitch", "dpi", "crs", "corners", "crs-def", "overview-of", "overview-stroke", "atlas-fit", "atlas-margin", "frame-stroke", "frame-bg", "attribution"],
472
500
  "om-legend": [...z, "for", "title", "columns", "derived", "bg", "color", "stroke", "font-size", "padding"],
473
501
  "om-legend-row": ["layer", "match", "label", "hide", "order", "color", "shape"],
474
502
  // NOTE: the discriminator on furniture is `kind`, never `style` — `style` is
@@ -488,58 +516,58 @@ const pt = "cartograph/2", Ai = ["default", "dark", "sepia", "blueprint", "minim
488
516
  // CRS is therefore unknowable.
489
517
  "om-source": ["src", "corners", "crs", "crs-def"],
490
518
  "om-atlas": ["id", "for", "layer", "filter", "sort", "filename", "page-name", "pager"]
491
- }, gt = Object.keys(T), Et = "data-om-carto-vector", Lr = ["metric", "imperial", "nautical"], Rr = 0.3048, Fr = 1609.344, Ir = 1852;
492
- function Or(r) {
493
- return r != null && Lr.includes(r) ? r : null;
519
+ }, yt = Object.keys(T), Lt = "data-om-carto-vector", Dr = ["metric", "imperial", "nautical"], zr = 0.3048, jr = 1609.344, Gr = 1852;
520
+ function qr(r) {
521
+ return r != null && Dr.includes(r) ? r : null;
494
522
  }
495
- function ze(r) {
523
+ function We(r) {
496
524
  if (!isFinite(r) || r <= 0) return 0;
497
525
  const t = Math.pow(10, Math.floor(Math.log10(r))), e = r / t;
498
526
  return (e >= 5 ? 5 : e >= 2 ? 2 : 1) * t;
499
527
  }
500
- const ee = {
528
+ const oe = {
501
529
  // Finest first; the largest tier whose snapped length is ≥ 1 unit wins.
502
530
  metric: [
503
531
  { metersPerUnit: 1, label: "m" },
504
532
  { metersPerUnit: 1e3, label: "km" }
505
533
  ],
506
534
  imperial: [
507
- { metersPerUnit: Rr, label: "ft" },
508
- { metersPerUnit: Fr, label: "mi" }
535
+ { metersPerUnit: zr, label: "ft" },
536
+ { metersPerUnit: jr, label: "mi" }
509
537
  ],
510
- nautical: [{ metersPerUnit: Ir, label: "nmi" }]
538
+ nautical: [{ metersPerUnit: Gr, label: "nmi" }]
511
539
  };
512
- function je({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "metric", segmentLengthMeters: i }) {
540
+ function Be({ groundMetersPerMm: r, maxWidthMm: t, segments: e = 4, units: n = "metric", segmentLengthMeters: i }) {
513
541
  if (!Number.isFinite(r) || r <= 0 || !Number.isFinite(t) || t <= 0) return null;
514
- const o = Number.isInteger(e) && e > 0 ? e : 4, s = ee[n] ?? ee.metric, a = t / o * r;
542
+ const s = Number.isInteger(e) && e > 0 ? e : 4, o = oe[n] ?? oe.metric, a = t / s * r;
515
543
  let l, c;
516
544
  if (i != null && Number.isFinite(i) && i > 0)
517
- l = i, c = re(s, l);
545
+ l = i, c = ae(o, l);
518
546
  else {
519
- c = re(s, a);
520
- const f = ze(a / c.metersPerUnit);
547
+ c = ae(o, a);
548
+ const f = We(a / c.metersPerUnit);
521
549
  if (f <= 0) return null;
522
550
  l = f * c.metersPerUnit;
523
551
  }
524
552
  const u = l / r;
525
553
  if (!Number.isFinite(u) || u <= 0) return null;
526
- const m = l / c.metersPerUnit, d = m < 1 ? 2 : m < 10 && !Number.isInteger(m) ? 1 : 0, h = Array.from({ length: o + 1 }, (f, g) => (g * m).toFixed(d));
554
+ const h = l / c.metersPerUnit, d = h < 1 ? 2 : h < 10 && !Number.isInteger(h) ? 1 : 0, m = Array.from({ length: s + 1 }, (f, g) => (g * h).toFixed(d));
527
555
  return {
528
556
  segmentMeters: l,
529
557
  segmentMm: u,
530
- segments: o,
531
- totalMm: u * o,
532
- labels: h,
558
+ segments: s,
559
+ totalMm: u * s,
560
+ labels: m,
533
561
  unitLabel: c.label,
534
562
  // 1 mm on the page is groundMetersPerMm metres on the ground; the RF is
535
563
  // that ratio in consistent units (mm : mm).
536
564
  scaleDenominator: r * 1e3
537
565
  };
538
566
  }
539
- function _r(r, t, e) {
540
- const n = Math.min(2.6, Math.max(1.6, e * 0.34)), i = 0.2, o = n * 1.25, s = Math.max(0.6, Math.min(2.2, e - o - 0.4)), a = 0, l = r.segmentMm, c = [], u = [];
567
+ function Wr(r, t, e) {
568
+ const n = Math.min(2.6, Math.max(1.6, e * 0.34)), i = 0.2, s = n * 1.25, o = Math.max(0.6, Math.min(2.2, e - s - 0.4)), a = 0, l = r.segmentMm, c = [], u = [];
541
569
  if (t === "single" || t === "double") {
542
- const p = t === "double" ? 2 : 1, b = s / p;
570
+ const p = t === "double" ? 2 : 1, b = o / p;
543
571
  for (let w = 0; w < p; w++)
544
572
  for (let y = 0; y < r.segments; y++)
545
573
  c.push({
@@ -551,45 +579,45 @@ function _r(r, t, e) {
551
579
  filled: (y + w) % 2 === 0
552
580
  });
553
581
  } else {
554
- u.push({ x1: 0, y1: a + s, x2: r.totalMm, y2: a + s });
582
+ u.push({ x1: 0, y1: a + o, x2: r.totalMm, y2: a + o });
555
583
  const p = t === "ticks" ? r.segments : 1;
556
584
  for (let b = 0; b <= p; b++) {
557
585
  const w = b / p * r.totalMm;
558
- u.push({ x1: w, y1: a, x2: w, y2: a + s });
586
+ u.push({ x1: w, y1: a, x2: w, y2: a + o });
559
587
  }
560
588
  }
561
- const m = r.labels.length - 1, d = r.labels.map((p, b) => ({
589
+ const h = r.labels.length - 1, d = r.labels.map((p, b) => ({
562
590
  // The end label carries the unit so the bar reads "0 2 4 6 8 km".
563
- text: b === m ? `${p} ${r.unitLabel}` : p,
591
+ text: b === h ? `${p} ${r.unitLabel}` : p,
564
592
  // Keep the end label inside the drawn width rather than hanging off it.
565
- x: b === m ? r.totalMm : b * l,
566
- y: a + s + n,
567
- anchor: b === 0 ? "start" : b === m ? "end" : "middle",
593
+ x: b === h ? r.totalMm : b * l,
594
+ y: a + o + n,
595
+ anchor: b === 0 ? "start" : b === h ? "end" : "middle",
568
596
  index: b
569
- })), h = (p) => p.length * n * 0.62, f = [];
597
+ })), m = (p) => p.length * n * 0.62, f = [];
570
598
  let g = -1 / 0;
571
599
  for (const p of d) {
572
- const b = h(p.text) / 2, w = p.anchor === "start" ? p.x : p.anchor === "end" ? p.x - b * 2 : p.x - b, y = w + h(p.text);
573
- if (!(!(p.index === 0 || p.index === m) && w < g + n * 0.4)) {
574
- if (p.index === m && w < g + n * 0.4)
575
- for (; f.length > 1 && f[f.length - 1].x + h(f[f.length - 1].text) / 2 > w - n * 0.4; ) f.pop();
600
+ const b = m(p.text) / 2, w = p.anchor === "start" ? p.x : p.anchor === "end" ? p.x - b * 2 : p.x - b, y = w + m(p.text);
601
+ if (!(!(p.index === 0 || p.index === h) && w < g + n * 0.4)) {
602
+ if (p.index === h && w < g + n * 0.4)
603
+ for (; f.length > 1 && f[f.length - 1].x + m(f[f.length - 1].text) / 2 > w - n * 0.4; ) f.pop();
576
604
  f.push({ text: p.text, x: p.x, y: p.y, anchor: p.anchor }), g = y;
577
605
  }
578
606
  }
579
607
  return { bars: c, strokes: u, labels: f, fontMm: n, strokeMm: i, segmentMeters: r.segmentMeters, unitLabel: r.unitLabel, scaleDenominator: r.scaleDenominator };
580
608
  }
581
- function re(r, t) {
609
+ function ae(r, t) {
582
610
  let e = r[0];
583
611
  for (const n of r)
584
612
  t / n.metersPerUnit >= 1 && (e = n);
585
613
  return e;
586
614
  }
587
- const Ur = " ";
588
- function Dr(r) {
589
- return !Number.isFinite(r) || r <= 0 ? "" : Math.round(r).toString().replace(/\B(?=(\d{3})+(?!\d))/g, Ur);
615
+ const Br = " ";
616
+ function Kr(r) {
617
+ return !Number.isFinite(r) || r <= 0 ? "" : Math.round(r).toString().replace(/\B(?=(\d{3})+(?!\d))/g, Br);
590
618
  }
591
- const Ge = /\{\{\s*([\w.]+)\s*\}\}/g;
592
- function zr(r, t) {
619
+ const Ke = /\{\{\s*([\w.]+)\s*\}\}/g;
620
+ function Vr(r, t) {
593
621
  if (r.startsWith("atlas.")) return t.atlas?.[r.slice(6)];
594
622
  if (r.startsWith("frame.")) {
595
623
  const e = r.slice(6), n = e.lastIndexOf(".");
@@ -601,78 +629,81 @@ function zr(r, t) {
601
629
  }
602
630
  return t.page[r];
603
631
  }
604
- function qe(r, t) {
632
+ function Ve(r, t) {
605
633
  const e = [];
606
- return { text: r.replace(Ge, (i, o) => {
607
- const s = zr(o, t);
608
- return s === void 0 ? (e.push(o), i) : s;
634
+ return { text: r.replace(Ke, (i, s) => {
635
+ const o = Vr(s, t);
636
+ return o === void 0 ? (e.push(s), i) : o;
609
637
  }), unresolved: e };
610
638
  }
611
- function jr(r) {
612
- return [...r.matchAll(Ge)].map((t) => t[1]);
639
+ function Hr(r) {
640
+ return [...r.matchAll(Ke)].map((t) => t[1]);
613
641
  }
614
- const ne = /* @__PURE__ */ new WeakMap();
615
- function Gr(r, t) {
642
+ const le = /* @__PURE__ */ new WeakMap();
643
+ function Yr(r, t) {
616
644
  const e = [], n = r.ownerDocument ?? (typeof document < "u" ? document : null);
617
645
  if (!n) return e;
618
646
  const i = n.createTreeWalker(
619
647
  r,
620
648
  4
621
649
  /* NodeFilter.SHOW_TEXT */
622
- ), o = [];
623
- for (let s = i.nextNode(); s; s = i.nextNode()) o.push(s);
624
- for (const s of o) {
625
- let a = ne.get(s);
650
+ ), s = [];
651
+ for (let o = i.nextNode(); o; o = i.nextNode()) s.push(o);
652
+ for (const o of s) {
653
+ let a = le.get(o);
626
654
  if (a === void 0) {
627
- if (a = s.data, !a.includes("{{")) continue;
628
- ne.set(s, a);
655
+ if (a = o.data, !a.includes("{{")) continue;
656
+ le.set(o, a);
629
657
  }
630
- const l = qe(a, t);
631
- s.data !== l.text && (s.data = l.text), e.push(...l.unresolved);
658
+ const l = Ve(a, t);
659
+ o.data !== l.text && (o.data = l.text), e.push(...l.unresolved);
632
660
  }
633
661
  return e;
634
662
  }
635
- function qr(r = /* @__PURE__ */ new Date()) {
663
+ function Xr(r = /* @__PURE__ */ new Date()) {
636
664
  return `${r.getFullYear()}-${String(r.getMonth() + 1).padStart(2, "0")}-${String(r.getDate()).padStart(2, "0")}`;
637
665
  }
638
- const Nt = "data-om-carto-unlinked";
639
- function We(r) {
666
+ const Rt = "data-om-carto-unlinked";
667
+ function He(r) {
640
668
  return r.closest("om-cartograph");
641
669
  }
642
- function Be(r, t) {
643
- const e = We(r);
670
+ function Ye(r, t) {
671
+ const e = He(r);
644
672
  if (!e || !t) return null;
645
673
  for (const n of e.querySelectorAll("om-frame"))
646
674
  if (n.id === t) return n;
647
675
  return null;
648
676
  }
649
- function Ke(r) {
677
+ function Xe(r) {
650
678
  return [...r.querySelectorAll("om-frame")];
651
679
  }
652
- function Wr(r) {
653
- const t = We(r);
680
+ function Jr(r) {
681
+ const t = He(r);
654
682
  if (!t) return null;
655
- const e = Ke(t);
683
+ const e = Xe(t);
656
684
  return e.length === 1 ? e[0] : null;
657
685
  }
658
686
  function U(r) {
659
687
  const t = r.getAttribute("for");
660
- return t ? Be(r, t) : Wr(r);
688
+ return t ? Ye(r, t) : Jr(r);
661
689
  }
662
690
  function W(r, t) {
663
- let e = r.querySelector(`:scope > [${Nt}]`);
691
+ let e = r.querySelector(`:scope > [${Rt}]`);
664
692
  if (!e) {
665
693
  for (const n of [...r.children])
666
694
  n.tagName.toLowerCase() !== "om-legend-row" && n.remove();
667
- e = r.ownerDocument.createElement("div"), e.setAttribute(Nt, ""), e.style.cssText = "font:italic 2.6mm/1.3 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.7;", r.appendChild(e);
695
+ e = r.ownerDocument.createElement("div"), e.setAttribute(Rt, ""), e.style.cssText = "font:italic 2.6mm/1.3 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.7;", r.appendChild(e);
668
696
  }
669
697
  e.textContent !== t && (e.textContent = t);
670
698
  }
671
- function Br(r) {
672
- r.querySelector(`:scope > [${Nt}]`)?.remove();
699
+ function Zr(r) {
700
+ r.querySelector(`:scope > [${Rt}]`)?.remove();
701
+ }
702
+ const ce = "data-om-carto-page", ue = "data-om-carto-marks", wt = "data-om-carto-credit", he = "data-om-carto-attribution", Je = "Built with OnlyMap by NIKA", Qr = `${Je} · free for non-commercial use`, nt = 2, vt = 1.2, it = 2.4, At = 1.5, st = 1.2, Mt = 0.3, St = 0.8, Ct = "http://www.w3.org/2000/svg", tn = 6e4;
703
+ function me(r) {
704
+ return r.replace(/©|\(c\)/gi, " ").replace(/\s+/g, " ").trim().toLowerCase();
673
705
  }
674
- const ie = "data-om-carto-page", se = "data-om-carto-marks", bt = "data-om-carto-credit", Ve = "Built with OnlyMap by NIKA", Kr = `${Ve} · free for non-commercial use`, nt = 2, oe = 1.2, yt = 2.4, ae = 1.5, wt = 1.2, le = 0.3, ce = 0.8, vt = "http://www.w3.org/2000/svg", Vr = 6e4;
675
- class He extends O {
706
+ class Ze extends O {
676
707
  static observedAttributes = [...T["om-cartograph"]];
677
708
  frameListenerBound = !1;
678
709
  /** Fields of the atlas page currently displayed, for {{atlas.<field>}}. */
@@ -681,7 +712,7 @@ class He extends O {
681
712
  unsubscribeLicense = null;
682
713
  /** The resolved page box, mm — furniture and export read this, never the attributes. */
683
714
  get pageSize() {
684
- return ht(this.getAttribute("size"), this.getAttribute("width"), this.getAttribute("height"), this.getAttribute("orientation"));
715
+ return dt(this.getAttribute("size"), this.getAttribute("width"), this.getAttribute("height"), this.getAttribute("orientation"));
685
716
  }
686
717
  /** Bleed in mm (0 when unset) — extends the printed sheet past the trim. */
687
718
  get bleedMm() {
@@ -690,11 +721,11 @@ class He extends O {
690
721
  }
691
722
  connectedCallback() {
692
723
  super.connectedCallback(), this.frameListenerBound || (this.frameListenerBound = !0, this.addEventListener("om-frame-ready", () => {
693
- this.atlas?.refresh(), this.refreshTokens(), this.refreshFurniture(), this.renderCredit();
694
- }), this.addEventListener("om-frame-view", () => {
724
+ this.atlas?.refresh(), this.refreshTokens(), this.refreshFurniture(), this.renderCredit(), this.renderAttribution();
725
+ }), this.addEventListener("om-attributions-changed", () => this.renderAttribution()), this.addEventListener("om-frame-view", () => {
695
726
  this.refreshTokens(), this.refreshFurniture();
696
727
  })), !this.creditObserver && typeof MutationObserver < "u" && (this.creditObserver = new MutationObserver(() => {
697
- this.querySelector(`:scope > [${bt}]`) || this.renderCredit();
728
+ this.querySelector(`:scope > [${wt}]`) || this.renderCredit(), this.renderAttribution();
698
729
  }), this.creditObserver.observe(this, { childList: !0 }));
699
730
  }
700
731
  disconnectedCallback() {
@@ -713,18 +744,47 @@ class He extends O {
713
744
  renderCredit() {
714
745
  const t = J();
715
746
  t && !this.unsubscribeLicense && typeof t.subscribeLicense == "function" && (this.unsubscribeLicense = t.subscribeLicense(() => this.renderCredit()));
716
- const e = this.creditMode(t, this.hasAttribute("keep-badge")), n = [...this.querySelectorAll("om-text")].some((a) => /onlymap/i.test(a.textContent ?? "")), i = this.querySelector(`:scope > [${bt}]`);
747
+ const e = this.creditMode(t, this.hasAttribute("keep-badge")), n = [...this.querySelectorAll("om-text")].some((a) => /onlymap/i.test(a.textContent ?? "")), i = this.querySelector(`:scope > [${wt}]`);
717
748
  if (e === "hidden" || n) {
718
749
  i?.remove();
719
750
  return;
720
751
  }
721
- const o = e === "voluntary" ? Ve : Kr;
752
+ const s = e === "voluntary" ? Je : Qr;
722
753
  if (i) {
723
- i.textContent !== o && (i.textContent = o), this.armCreditPainter(i);
754
+ i.textContent !== s && (i.textContent = s), this.armCreditPainter(i);
724
755
  return;
725
756
  }
726
- const s = this.ownerDocument.createElement("div");
727
- s.setAttribute(bt, ""), s.setAttribute("z", "2147483644"), s.textContent = o, s.style.cssText = `position:absolute;left:${nt}mm;bottom:${oe}mm;z-index:2147483644;font:${yt}mm/${ae} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${le}mm ${wt}mm;border-radius:${ce}mm;pointer-events:none;`, this.armCreditPainter(s), this.appendChild(s);
757
+ const o = this.ownerDocument.createElement("div");
758
+ o.setAttribute(wt, ""), o.setAttribute("z", "2147483644"), o.textContent = s, o.style.cssText = `position:absolute;left:${nt}mm;bottom:${vt}mm;z-index:2147483644;font:${it}mm/${At} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${Mt}mm ${st}mm;border-radius:${St}mm;pointer-events:none;`, this.armCreditPainter(o), this.appendChild(o);
759
+ }
760
+ /**
761
+ * Basemap attribution, moved off the maps and onto the sheet.
762
+ *
763
+ * A frame's map draws no attribution of its own — the same rule as the
764
+ * badge, and for the same reasons: the sheet is the published artefact, a
765
+ * line per frame credits one provider several times, and on a small inset
766
+ * the control covers the map it credits. So the page prints every frame's
767
+ * providers once, bottom-right (the credit has bottom-left).
768
+ *
769
+ * A provider the author already credits in their own text is left out:
770
+ * the obligation is the credit, not this element. Static frames contribute
771
+ * through their `attribution` attribute, so a page that never loads the
772
+ * runtime still credits the tiles in its pictures.
773
+ */
774
+ renderAttribution() {
775
+ const t = [...this.querySelectorAll("om-frame")], e = qe(t.flatMap((l) => l.attributions?.() ?? [])), n = [...this.querySelectorAll("om-text")].map((l) => me(l.textContent ?? "")).join(`
776
+ `), i = e.filter((l) => !n.includes(me(l))), s = this.querySelector(`:scope > [${he}]`);
777
+ if (i.length === 0) {
778
+ s?.remove();
779
+ return;
780
+ }
781
+ const o = i.join(Kt);
782
+ if (s) {
783
+ s.textContent !== o && (s.textContent = o);
784
+ return;
785
+ }
786
+ const a = this.ownerDocument.createElement("div");
787
+ a.setAttribute(he, ""), a.setAttribute("z", "2147483644"), a.textContent = o, a.style.cssText = `position:absolute;right:${nt}mm;bottom:${vt}mm;z-index:2147483644;max-width:60%;text-align:right;font:${it}mm/${At} system-ui,sans-serif;color:#374151;background:rgba(255,255,255,.72);padding:${Mt}mm ${st}mm;border-radius:${St}mm;pointer-events:none;`, this.armFootPainter(a, "right"), this.appendChild(a);
728
788
  }
729
789
  /**
730
790
  * Which credit this sheet carries, from the core's own predicate so the
@@ -740,11 +800,20 @@ class He extends O {
740
800
  }
741
801
  /** Give the runtime-owned DOM credit the same canvas paint contract as authored furniture. */
742
802
  armCreditPainter(t) {
743
- t.paintCartograph = (e, n) => {
744
- const i = (u) => u * n.pxPerMm, o = t.textContent ?? "", a = yt * ae + le * 2, l = this.pageSize.heightMm - oe - a;
745
- e.save(), e.font = `${i(yt)}px system-ui, sans-serif`;
746
- const c = e.measureText(o).width / n.pxPerMm + wt * 2;
747
- e.fillStyle = "rgba(255,255,255,.72)", e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(i(nt), i(l), i(c), i(a), i(ce)) : e.rect(i(nt), i(l), i(c), i(a)), e.fill(), e.fillStyle = "#374151", e.textAlign = "left", e.textBaseline = "middle", e.fillText(o, i(nt + wt), i(l + a / 2)), e.restore();
803
+ this.armFootPainter(t, "left");
804
+ }
805
+ /**
806
+ * The canvas twin of a runtime-owned foot line — the credit (left) or the
807
+ * basemap attribution (right) — so the exported raster carries what the
808
+ * screen and the printed page carry. One painter for both, so the two lines
809
+ * cannot drift apart in size, ground or inset.
810
+ */
811
+ armFootPainter(t, e) {
812
+ t.paintCartograph = (n, i) => {
813
+ const s = (d) => d * i.pxPerMm, o = t.textContent ?? "", l = it * At + Mt * 2, c = this.pageSize.heightMm - vt - l;
814
+ n.save(), n.font = `${s(it)}px system-ui, sans-serif`;
815
+ const u = n.measureText(o).width / i.pxPerMm + st * 2, h = e === "left" ? nt : this.pageSize.widthMm - nt - u;
816
+ n.fillStyle = "rgba(255,255,255,.72)", n.beginPath(), typeof n.roundRect == "function" ? n.roundRect(s(h), s(c), s(u), s(l), s(St)) : n.rect(s(h), s(c), s(u), s(l)), n.fill(), n.fillStyle = "#374151", n.textAlign = "left", n.textBaseline = "middle", n.fillText(o, s(h + st), s(c + l / 2)), n.restore();
748
817
  };
749
818
  }
750
819
  /**
@@ -761,27 +830,27 @@ class He extends O {
761
830
  const e = t.dpi ?? (Number(this.getAttribute("dpi")) || 300), n = [...this.querySelectorAll("om-frame")];
762
831
  let i = null;
763
832
  if (this.hasAttribute("flatten") && (i = await this.buildFlattenedImage(e).catch(() => null), i && this.appendChild(i)), !i) for (const a of n) await a.enterPrintMode?.(e);
764
- let o = !1;
765
- const s = () => {
766
- if (!o) {
767
- o = !0, i && URL.revokeObjectURL(i.src), i?.remove(), i = null;
833
+ let s = !1;
834
+ const o = () => {
835
+ if (!s) {
836
+ s = !0, i && URL.revokeObjectURL(i.src), i?.remove(), i = null;
768
837
  for (const a of n) a.exitPrintMode?.();
769
- window.removeEventListener("afterprint", s);
838
+ window.removeEventListener("afterprint", o);
770
839
  }
771
840
  };
772
- window.addEventListener("afterprint", s);
841
+ window.addEventListener("afterprint", o);
773
842
  try {
774
843
  window.print();
775
844
  } finally {
776
- o || setTimeout(s, Vr);
845
+ s || setTimeout(o, tn);
777
846
  }
778
847
  }
779
848
  /** Render the whole page to one image, for `flatten`. */
780
849
  async buildFlattenedImage(t) {
781
- const { renderCartograph: e } = await Promise.resolve().then(() => xr), { blob: n } = await e(this, { dpi: t }), i = this.ownerDocument.createElement("img");
850
+ const { renderCartograph: e } = await Promise.resolve().then(() => Pr), { blob: n } = await e(this, { dpi: t }), i = this.ownerDocument.createElement("img");
782
851
  i.src = URL.createObjectURL(n), i.setAttribute("data-om-carto-flattened", "");
783
- const o = this.bleedMm;
784
- return i.style.cssText = `position:absolute;left:${-o}mm;top:${-o}mm;width:calc(100% + ${o * 2}mm);height:calc(100% + ${o * 2}mm);z-index:2147483645;`, await i.decode().catch(() => {
852
+ const s = this.bleedMm;
853
+ return i.style.cssText = `position:absolute;left:${-s}mm;top:${-s}mm;width:calc(100% + ${s * 2}mm);height:calc(100% + ${s * 2}mm);z-index:2147483645;`, await i.decode().catch(() => {
785
854
  }), i;
786
855
  }
787
856
  /** The page's atlas controller, if it has one. */
@@ -799,20 +868,20 @@ class He extends O {
799
868
  }
800
869
  /** Values every `{{token}}` on this page resolves against. */
801
870
  tokenContext() {
802
- const t = /* @__PURE__ */ new Map(), e = Ke(this);
803
- for (const o of e) {
804
- const s = o.georef, a = s?.groundMetersPerMm() ?? 0;
805
- t.set(o.id, {
806
- scale: a > 0 ? Dr(a * 1e3) : void 0,
807
- crs: s?.crs
871
+ const t = /* @__PURE__ */ new Map(), e = Xe(this);
872
+ for (const s of e) {
873
+ const o = s.georef, a = o?.groundMetersPerMm() ?? 0;
874
+ t.set(s.id, {
875
+ scale: a > 0 ? Kr(a * 1e3) : void 0,
876
+ crs: o?.crs
808
877
  });
809
878
  }
810
- const n = { page: {}, frames: t, soleFrameId: e.length === 1 ? e[0].id : null, atlas: this.atlasFields }, i = (o) => qe(this.getAttribute(o) ?? "", n).text;
879
+ const n = { page: {}, frames: t, soleFrameId: e.length === 1 ? e[0].id : null, atlas: this.atlasFields }, i = (s) => Ve(this.getAttribute(s) ?? "", n).text;
811
880
  return {
812
881
  page: {
813
882
  title: i("title"),
814
883
  attribution: i("attribution"),
815
- date: qr(),
884
+ date: Xr(),
816
885
  notes: i("notes")
817
886
  },
818
887
  frames: t,
@@ -830,11 +899,11 @@ class He extends O {
830
899
  renderNow() {
831
900
  const { widthMm: t, heightMm: e } = this.pageSize, n = this.bleedMm;
832
901
  this.style.display = "block", this.style.position = "relative", this.style.width = `${t}mm`, this.style.height = `${e}mm`, this.style.margin = n > 0 ? `${n}mm` : "", this.style.overflow = n > 0 ? "visible" : "hidden", this.applyThemeOverride("bg", "--om-carto-bg"), this.applyThemeOverride("color", "--om-carto-ink"), this.applyThemeOverride("font", "--om-carto-font");
833
- let i = this.querySelector(`style[${ie}]`);
834
- i || (i = document.createElement("style"), i.setAttribute(ie, ""), this.prepend(i));
835
- const o = t + n * 2, s = e + n * 2;
836
- i.textContent = `@page { size: ${o}mm ${s}mm; margin: 0; }
837
- @media print { html, body { margin: 0; padding: 0; } om-cartograph { break-after: page; } }`, this.renderPrintMarks(t, e, n), this.applyCvd(), this.refreshTokens(), this.renderCredit();
902
+ let i = this.querySelector(`style[${ce}]`);
903
+ i || (i = document.createElement("style"), i.setAttribute(ce, ""), this.prepend(i));
904
+ const s = t + n * 2, o = e + n * 2;
905
+ i.textContent = `@page { size: ${s}mm ${o}mm; margin: 0; }
906
+ @media print { html, body { margin: 0; padding: 0; } om-cartograph { break-after: page; } }`, this.renderPrintMarks(t, e, n), this.applyCvd(), this.refreshTokens(), this.renderCredit(), this.renderAttribution();
838
907
  }
839
908
  /**
840
909
  * Crop marks and the safe-zone guide.
@@ -846,27 +915,27 @@ class He extends O {
846
915
  * worse than no guide.
847
916
  */
848
917
  renderPrintMarks(t, e, n) {
849
- const i = this.hasAttribute("crop-marks") && n > 0, o = Number(this.getAttribute("safe-zone")), s = Number.isFinite(o) && o > 0, a = this.querySelector(`:scope > [${se}]`);
850
- if (!i && !s) {
918
+ const i = this.hasAttribute("crop-marks") && n > 0, s = Number(this.getAttribute("safe-zone")), o = Number.isFinite(s) && s > 0, a = this.querySelector(`:scope > [${ue}]`);
919
+ if (!i && !o) {
851
920
  a?.remove();
852
921
  return;
853
922
  }
854
- const l = this.ownerDocument, c = a ?? l.createElementNS(vt, "svg");
855
- if (c.setAttribute(se, ""), c.setAttribute("viewBox", `${-n} ${-n} ${t + n * 2} ${e + n * 2}`), c.setAttribute("width", `${t + n * 2}mm`), c.setAttribute("height", `${e + n * 2}mm`), c.style.cssText = `position:absolute;left:${-n}mm;top:${-n}mm;pointer-events:none;z-index:2147483646;`, c.replaceChildren(), i) {
856
- const u = Math.min(n, 4), m = Math.min(n * 0.35, 1.5), d = [];
857
- for (const h of [0, t])
923
+ const l = this.ownerDocument, c = a ?? l.createElementNS(Ct, "svg");
924
+ if (c.setAttribute(ue, ""), c.setAttribute("viewBox", `${-n} ${-n} ${t + n * 2} ${e + n * 2}`), c.setAttribute("width", `${t + n * 2}mm`), c.setAttribute("height", `${e + n * 2}mm`), c.style.cssText = `position:absolute;left:${-n}mm;top:${-n}mm;pointer-events:none;z-index:2147483646;`, c.replaceChildren(), i) {
925
+ const u = Math.min(n, 4), h = Math.min(n * 0.35, 1.5), d = [];
926
+ for (const m of [0, t])
858
927
  for (const f of [0, e]) {
859
- const g = h === 0 ? -1 : 1, p = f === 0 ? -1 : 1;
860
- d.push([h + g * m, f, h + g * (m + u), f]), d.push([h, f + p * m, h, f + p * (m + u)]);
928
+ const g = m === 0 ? -1 : 1, p = f === 0 ? -1 : 1;
929
+ d.push([m + g * h, f, m + g * (h + u), f]), d.push([m, f + p * h, m, f + p * (h + u)]);
861
930
  }
862
- for (const [h, f, g, p] of d) {
863
- const b = l.createElementNS(vt, "line");
864
- b.setAttribute("x1", String(h)), b.setAttribute("y1", String(f)), b.setAttribute("x2", String(g)), b.setAttribute("y2", String(p)), b.setAttribute("stroke", "#000"), b.setAttribute("stroke-width", "0.15"), c.appendChild(b);
931
+ for (const [m, f, g, p] of d) {
932
+ const b = l.createElementNS(Ct, "line");
933
+ b.setAttribute("x1", String(m)), b.setAttribute("y1", String(f)), b.setAttribute("x2", String(g)), b.setAttribute("y2", String(p)), b.setAttribute("stroke", "#000"), b.setAttribute("stroke-width", "0.15"), c.appendChild(b);
865
934
  }
866
935
  }
867
- if (s) {
868
- const u = l.createElementNS(vt, "rect");
869
- u.setAttribute("x", String(o)), u.setAttribute("y", String(o)), u.setAttribute("width", String(Math.max(0, t - o * 2))), u.setAttribute("height", String(Math.max(0, e - o * 2))), u.setAttribute("fill", "none"), u.setAttribute("stroke", "#22aaff"), u.setAttribute("stroke-width", "0.2"), u.setAttribute("stroke-dasharray", "2 1.5"), u.setAttribute("data-om-carto-screen-only", ""), c.appendChild(u);
936
+ if (o) {
937
+ const u = l.createElementNS(Ct, "rect");
938
+ u.setAttribute("x", String(s)), u.setAttribute("y", String(s)), u.setAttribute("width", String(Math.max(0, t - s * 2))), u.setAttribute("height", String(Math.max(0, e - s * 2))), u.setAttribute("fill", "none"), u.setAttribute("stroke", "#22aaff"), u.setAttribute("stroke-width", "0.2"), u.setAttribute("stroke-dasharray", "2 1.5"), u.setAttribute("data-om-carto-screen-only", ""), c.appendChild(u);
870
939
  }
871
940
  a || this.appendChild(c);
872
941
  }
@@ -879,54 +948,54 @@ class He extends O {
879
948
  * injected only when a page actually asks for one.
880
949
  */
881
950
  applyCvd() {
882
- const t = Dt(this.getAttribute("cvd"));
951
+ const t = qt(this.getAttribute("cvd"));
883
952
  if (!t) {
884
953
  this.style.removeProperty("filter");
885
954
  return;
886
955
  }
887
- Sr(this.ownerDocument), this.style.filter = `url(#${Re(t)})`;
956
+ $r(this.ownerDocument), this.style.filter = `url(#${Oe(t)})`;
888
957
  }
889
958
  }
890
- k("om-cartograph", He);
891
- function Hr({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }) {
892
- const o = n > 0 ? n : e * 1.2, s = [];
959
+ x("om-cartograph", Ze);
960
+ function en({ text: r, maxWidth: t, fontSizePx: e, lineHeightPx: n, measure: i }) {
961
+ const s = n > 0 ? n : e * 1.2, o = [];
893
962
  for (const c of r.split(/\r?\n/)) {
894
- const u = c.split(/\s+/).filter((h) => h !== "");
963
+ const u = c.split(/\s+/).filter((m) => m !== "");
895
964
  if (u.length === 0) {
896
- s.push({ text: "", baselineY: 0, width: 0 });
965
+ o.push({ text: "", baselineY: 0, width: 0 });
897
966
  continue;
898
967
  }
899
- const m = (h) => {
900
- let f = h;
968
+ const h = (m) => {
969
+ let f = m;
901
970
  for (; i(f) > t && f.length > 1; ) {
902
971
  let g = f.length - 1;
903
972
  for (; g > 1 && i(f.slice(0, g)) > t; ) g--;
904
- s.push({ text: f.slice(0, g), baselineY: 0, width: i(f.slice(0, g)) }), f = f.slice(g);
973
+ o.push({ text: f.slice(0, g), baselineY: 0, width: i(f.slice(0, g)) }), f = f.slice(g);
905
974
  }
906
975
  return f;
907
976
  };
908
977
  let d = "";
909
- for (const h of u) {
910
- const f = d === "" ? h : `${d} ${h}`;
911
- d === "" ? d = m(h) : i(f) > t ? (s.push({ text: d, baselineY: 0, width: i(d) }), d = m(h)) : d = f;
978
+ for (const m of u) {
979
+ const f = d === "" ? m : `${d} ${m}`;
980
+ d === "" ? d = h(m) : i(f) > t ? (o.push({ text: d, baselineY: 0, width: i(d) }), d = h(m)) : d = f;
912
981
  }
913
- s.push({ text: d, baselineY: 0, width: i(d) });
982
+ o.push({ text: d, baselineY: 0, width: i(d) });
914
983
  }
915
984
  const a = e * 0.8;
916
985
  let l = 0;
917
- return s.forEach((c, u) => {
918
- c.baselineY = a + u * o, c.width > l && (l = c.width);
919
- }), { lines: s, lineHeight: o, maxWidth: l };
986
+ return o.forEach((c, u) => {
987
+ c.baselineY = a + u * s, c.width > l && (l = c.width);
988
+ }), { lines: o, lineHeight: s, maxWidth: l };
920
989
  }
921
- function Mi(r) {
990
+ function Ni(r) {
922
991
  if (typeof document > "u") return null;
923
992
  const e = document.createElement("canvas").getContext("2d");
924
993
  return e ? (e.font = r, (n) => e.measureText(n).width) : null;
925
994
  }
926
- function Yr(r, t, e) {
995
+ function rn(r, t, e) {
927
996
  return r === "center" ? (t - e) / 2 : r === "end" || r === "right" ? t - e : 0;
928
997
  }
929
- class Ye extends O {
998
+ class Qe extends O {
930
999
  static observedAttributes = [...T["om-text"]];
931
1000
  renderNow() {
932
1001
  this.applyPlacement(), this.style.display = "block", this.style.boxSizing = "border-box", this.style.overflow = "hidden";
@@ -938,109 +1007,109 @@ class Ye extends O {
938
1007
  n === "start" || n === "center" || n === "end" ? this.style.textAlign = n : this.style.removeProperty("text-align");
939
1008
  const i = this.getAttribute("font");
940
1009
  i ? this.style.fontFamily = i : this.style.removeProperty("font-family");
941
- const o = this.getAttribute("color");
942
- o ? this.style.color = o : this.style.removeProperty("color");
943
- const s = this.getAttribute("bg");
944
- s ? this.style.background = s : this.style.removeProperty("background"), this.resolveTokens();
1010
+ const s = this.getAttribute("color");
1011
+ s ? this.style.color = s : this.style.removeProperty("color");
1012
+ const o = this.getAttribute("bg");
1013
+ o ? this.style.background = o : this.style.removeProperty("background"), this.resolveTokens();
945
1014
  }
946
1015
  /** Re-run token substitution from the authored templates. */
947
1016
  resolveTokens() {
948
1017
  const t = this.closest("om-cartograph");
949
- t && typeof t.tokenContext == "function" && Gr(this, t.tokenContext());
1018
+ t && typeof t.tokenContext == "function" && Yr(this, t.tokenContext());
950
1019
  }
951
1020
  paintCartograph(t, e) {
952
- const { w: n, h: i } = S(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
953
- if (o <= 0 || s <= 0) return;
954
- const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
955
- l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
1021
+ const { w: n, h: i } = S(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
1022
+ if (s <= 0 || o <= 0) return;
1023
+ const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = I(a?.backgroundColor);
1024
+ l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
956
1025
  const c = (this.textContent ?? "").trim();
957
1026
  if (c === "") return;
958
- const u = $t(a?.fontSize, 12), m = a?.lineHeight === "normal" ? u * 1.4 : $t(a?.lineHeight, u * 1.4), d = a?.fontFamily || "system-ui, sans-serif", h = a?.fontWeight || "400", f = u * e.scale, g = m * e.scale, p = `${h} ${f}px ${d}`;
959
- t.save(), t.font = p, t.fillStyle = F(a?.color) ?? "#000", t.textBaseline = "alphabetic", t.textAlign = "left";
960
- const b = Hr({
1027
+ const u = Tt(a?.fontSize, 12), h = a?.lineHeight === "normal" ? u * 1.4 : Tt(a?.lineHeight, u * 1.4), d = a?.fontFamily || "system-ui, sans-serif", m = a?.fontWeight || "400", f = u * e.scale, g = h * e.scale, p = `${m} ${f}px ${d}`;
1028
+ t.save(), t.font = p, t.fillStyle = I(a?.color) ?? "#000", t.textBaseline = "alphabetic", t.textAlign = "left";
1029
+ const b = en({
961
1030
  text: c,
962
- maxWidth: o,
1031
+ maxWidth: s,
963
1032
  fontSizePx: f,
964
1033
  lineHeightPx: g,
965
1034
  measure: (y) => t.measureText(y).width
966
1035
  }), w = a?.textAlign || "start";
967
1036
  for (const y of b.lines) {
968
- if (y.baselineY > s + g) break;
969
- t.fillText(y.text, Yr(w, o, y.width), y.baselineY);
1037
+ if (y.baselineY > o + g) break;
1038
+ t.fillText(y.text, rn(w, s, y.width), y.baselineY);
970
1039
  }
971
1040
  t.restore();
972
1041
  }
973
1042
  }
974
- k("om-text", Ye);
975
- const Xr = 63710087714e-4;
976
- let Jr = Xr;
977
- const it = Math.PI / 180;
978
- function Zr(r, t, e = Jr) {
979
- const n = (t[1] - r[1]) * it, i = (t[0] - r[0]) * it, o = r[1] * it, s = t[1] * it, a = Math.sin(n / 2) ** 2 + Math.cos(o) * Math.cos(s) * Math.sin(i / 2) ** 2;
1043
+ x("om-text", Qe);
1044
+ const nn = 63710087714e-4;
1045
+ let sn = nn;
1046
+ const ot = Math.PI / 180;
1047
+ function on(r, t, e = sn) {
1048
+ const n = (t[1] - r[1]) * ot, i = (t[0] - r[0]) * ot, s = r[1] * ot, o = t[1] * ot, a = Math.sin(n / 2) ** 2 + Math.cos(s) * Math.cos(o) * Math.sin(i / 2) ** 2;
980
1049
  return 2 * e * Math.asin(Math.min(1, Math.sqrt(a)));
981
1050
  }
982
- const et = 6378137, ue = Math.PI / 180, he = 180 / Math.PI, me = 85.0511287798066, Pt = 2 * Math.PI * et / 360;
983
- function Gt([r, t]) {
984
- const e = Math.max(-me, Math.min(me, t));
985
- return [et * r * ue, et * Math.log(Math.tan(Math.PI / 4 + e * ue / 2))];
1051
+ const et = 6378137, de = Math.PI / 180, fe = 180 / Math.PI, pe = 85.0511287798066, It = 2 * Math.PI * et / 360;
1052
+ function Vt([r, t]) {
1053
+ const e = Math.max(-pe, Math.min(pe, t));
1054
+ return [et * r * de, et * Math.log(Math.tan(Math.PI / 4 + e * de / 2))];
986
1055
  }
987
- function dt([r, t]) {
988
- return [r / et * he, (2 * Math.atan(Math.exp(t / et)) - Math.PI / 2) * he];
1056
+ function pt([r, t]) {
1057
+ return [r / et * fe, (2 * Math.atan(Math.exp(t / et)) - Math.PI / 2) * fe];
989
1058
  }
990
- const Qr = {
1059
+ const an = {
991
1060
  code: "EPSG:3857",
992
1061
  units: "linear",
993
1062
  metresPerUnit: 1,
994
- forward: Gt,
995
- inverse: dt
996
- }, tn = {
1063
+ forward: Vt,
1064
+ inverse: pt
1065
+ }, ln = {
997
1066
  code: "EPSG:4326",
998
1067
  units: "degree",
999
- metresPerUnit: Pt,
1068
+ metresPerUnit: It,
1000
1069
  forward: ([r, t]) => [r, t],
1001
1070
  inverse: ([r, t]) => [r, t]
1002
1071
  };
1003
- function qt(r) {
1072
+ function Ht(r) {
1004
1073
  if (r == null) return null;
1005
1074
  const t = r.trim();
1006
1075
  if (t === "") return null;
1007
1076
  const e = /^(?:epsg:{1,2})?(\d{4,6})$/i.exec(t);
1008
1077
  return e ? `EPSG:${e[1]}` : t.toUpperCase();
1009
1078
  }
1010
- function Xe(r) {
1011
- const t = qt(r) ?? "EPSG:3857";
1012
- return t === "EPSG:3857" || t === "EPSG:900913" ? Qr : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ? tn : null;
1079
+ function tr(r) {
1080
+ const t = Ht(r) ?? "EPSG:3857";
1081
+ return t === "EPSG:3857" || t === "EPSG:900913" ? an : t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84" ? ln : null;
1013
1082
  }
1014
- const Je = /* @__PURE__ */ new Map();
1015
- function Tt(r, t) {
1083
+ const er = /* @__PURE__ */ new Map();
1084
+ function Ft(r, t) {
1016
1085
  return !Number.isInteger(r) || r < 1 || r > 60 ? null : `+proj=utm +zone=${r}${t === "S" ? " +south" : ""} +datum=WGS84 +units=m +no_defs`;
1017
1086
  }
1018
- async function en(r) {
1019
- const t = Je.get(r);
1087
+ async function cn(r) {
1088
+ const t = er.get(r);
1020
1089
  if (typeof t == "string") return t;
1021
1090
  const e = Number(/^EPSG:(\d+)$/.exec(r)?.[1]);
1022
1091
  if (!Number.isFinite(e)) return null;
1023
- if (e >= 32601 && e <= 32660) return Tt(e - 32600, "N");
1024
- if (e >= 32701 && e <= 32760) return Tt(e - 32700, "S");
1092
+ if (e >= 32601 && e <= 32660) return Ft(e - 32600, "N");
1093
+ if (e >= 32701 && e <= 32760) return Ft(e - 32700, "S");
1025
1094
  const { CRS_DEFS: n } = await import("./crs-BzE_KP4M.js");
1026
1095
  return n[e]?.def ?? null;
1027
1096
  }
1028
- function rn(r) {
1029
- if (r.projName === "longlat") return { units: "degree", metresPerUnit: Pt };
1097
+ function un(r) {
1098
+ if (r.projName === "longlat") return { units: "degree", metresPerUnit: It };
1030
1099
  if (typeof r.to_meter == "number" && r.to_meter > 0) return { units: "linear", metresPerUnit: r.to_meter };
1031
1100
  const t = (r.units ?? "m").toLowerCase();
1032
- return t.startsWith("deg") ? { units: "degree", metresPerUnit: Pt } : t.includes("ft") || t.includes("foot") ? { units: "linear", metresPerUnit: 0.3048 } : { units: "linear", metresPerUnit: 1 };
1101
+ return t.startsWith("deg") ? { units: "degree", metresPerUnit: It } : t.includes("ft") || t.includes("foot") ? { units: "linear", metresPerUnit: 0.3048 } : { units: "linear", metresPerUnit: 1 };
1033
1102
  }
1034
- async function nn(r, t) {
1035
- const e = qt(r) ?? "EPSG:3857", n = Je.get(e);
1103
+ async function hn(r, t) {
1104
+ const e = Ht(r) ?? "EPSG:3857", n = er.get(e);
1036
1105
  if (n && typeof n != "string") return n;
1037
1106
  if (!t) {
1038
- const u = Xe(e);
1107
+ const u = tr(e);
1039
1108
  if (u) return u;
1040
1109
  }
1041
- const i = t?.trim() || await en(e);
1110
+ const i = t?.trim() || await cn(e);
1042
1111
  if (!i) return null;
1043
- const o = (await import("./index-CcLC9jE5.js")).default, a = o(i, "+proj=longlat +datum=WGS84 +no_defs"), { units: l, metresPerUnit: c } = rn(new o.Proj(i));
1112
+ const s = (await import("./index-CcLC9jE5.js")).default, a = s(i, "+proj=longlat +datum=WGS84 +no_defs"), { units: l, metresPerUnit: c } = un(new s.Proj(i));
1044
1113
  return {
1045
1114
  code: e,
1046
1115
  units: l,
@@ -1049,92 +1118,92 @@ async function nn(r, t) {
1049
1118
  inverse: (u) => a.forward(u)
1050
1119
  };
1051
1120
  }
1052
- const de = Math.PI / 180, sn = 180 / Math.PI, on = { code: "EPSG:3857", forward: Gt, inverse: dt }, Si = Gt, Ci = dt, fe = 6378137, pe = 89.9;
1053
- function an([r, t]) {
1054
- const e = Math.max(-pe, Math.min(pe, t));
1055
- return [fe * r * de, fe * Math.log(Math.tan(Math.PI / 4 + e * de / 2))];
1121
+ const ge = Math.PI / 180, mn = 180 / Math.PI, dn = { code: "EPSG:3857", forward: Vt, inverse: pt }, Pi = Vt, Ti = pt, be = 6378137, ye = 89.9;
1122
+ function fn([r, t]) {
1123
+ const e = Math.max(-ye, Math.min(ye, t));
1124
+ return [be * r * ge, be * Math.log(Math.tan(Math.PI / 4 + e * ge / 2))];
1056
1125
  }
1057
- const ln = { code: "EPSG:3857", forward: an, inverse: dt }, Lt = qt;
1126
+ const pn = { code: "EPSG:3857", forward: fn, inverse: pt }, Ot = Ht;
1058
1127
  function Y(r) {
1059
- return Xe(r);
1128
+ return tr(r);
1060
1129
  }
1061
- async function Rt(r, t) {
1062
- return nn(r, t);
1130
+ async function _t(r, t) {
1131
+ return hn(r, t);
1063
1132
  }
1064
- const ki = Tt;
1065
- function cn(r, t) {
1066
- const e = t.length, n = r.map((i, o) => [...i, t[o]]);
1133
+ const Li = Ft;
1134
+ function gn(r, t) {
1135
+ const e = t.length, n = r.map((i, s) => [...i, t[s]]);
1067
1136
  for (let i = 0; i < e; i++) {
1068
- let o = i;
1069
- for (let s = i + 1; s < e; s++) Math.abs(n[s][i]) > Math.abs(n[o][i]) && (o = s);
1070
- if (Math.abs(n[o][i]) < 1e-12) return null;
1071
- [n[i], n[o]] = [n[o], n[i]];
1072
- for (let s = 0; s < e; s++) {
1073
- if (s === i) continue;
1074
- const a = n[s][i] / n[i][i];
1137
+ let s = i;
1138
+ for (let o = i + 1; o < e; o++) Math.abs(n[o][i]) > Math.abs(n[s][i]) && (s = o);
1139
+ if (Math.abs(n[s][i]) < 1e-12) return null;
1140
+ [n[i], n[s]] = [n[s], n[i]];
1141
+ for (let o = 0; o < e; o++) {
1142
+ if (o === i) continue;
1143
+ const a = n[o][i] / n[i][i];
1075
1144
  if (a !== 0)
1076
- for (let l = i; l <= e; l++) n[s][l] -= a * n[i][l];
1145
+ for (let l = i; l <= e; l++) n[o][l] -= a * n[i][l];
1077
1146
  }
1078
1147
  }
1079
- return n.map((i, o) => i[e] / i[o]);
1148
+ return n.map((i, s) => i[e] / i[s]);
1080
1149
  }
1081
- function un(r, t) {
1150
+ function bn(r, t) {
1082
1151
  if (r.length !== 4 || t.length !== 4) return null;
1083
- const e = r.reduce((m, d) => m + d[0], 0) / 4, n = r.reduce((m, d) => m + d[1], 0) / 4, i = r.reduce((m, d) => m + Math.hypot(d[0] - e, d[1] - n), 0) / 4, o = i > 1e-12 ? Math.SQRT2 / i : 1, s = (m) => [(m[0] - e) * o, (m[1] - n) * o], a = [], l = [];
1084
- for (let m = 0; m < 4; m++) {
1085
- const [d, h] = s(r[m]), [f, g] = t[m];
1086
- a.push([d, h, 1, 0, 0, 0, -d * f, -h * f]), l.push(f), a.push([0, 0, 0, d, h, 1, -d * g, -h * g]), l.push(g);
1152
+ const e = r.reduce((h, d) => h + d[0], 0) / 4, n = r.reduce((h, d) => h + d[1], 0) / 4, i = r.reduce((h, d) => h + Math.hypot(d[0] - e, d[1] - n), 0) / 4, s = i > 1e-12 ? Math.SQRT2 / i : 1, o = (h) => [(h[0] - e) * s, (h[1] - n) * s], a = [], l = [];
1153
+ for (let h = 0; h < 4; h++) {
1154
+ const [d, m] = o(r[h]), [f, g] = t[h];
1155
+ a.push([d, m, 1, 0, 0, 0, -d * f, -m * f]), l.push(f), a.push([0, 0, 0, d, m, 1, -d * g, -m * g]), l.push(g);
1087
1156
  }
1088
- const c = cn(a, l);
1089
- if (!c || c.some((m) => !Number.isFinite(m))) return null;
1090
- const u = (m) => [m[0] / o + e, m[1] / o + n];
1091
- return { matrix: [c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 1], normalize: s, denormalize: u };
1157
+ const c = gn(a, l);
1158
+ if (!c || c.some((h) => !Number.isFinite(h))) return null;
1159
+ const u = (h) => [h[0] / s + e, h[1] / s + n];
1160
+ return { matrix: [c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 1], normalize: o, denormalize: u };
1092
1161
  }
1093
- function ge(r, [t, e]) {
1162
+ function we(r, [t, e]) {
1094
1163
  const n = r[6] * t + r[7] * e + r[8];
1095
1164
  return Math.abs(n) < 1e-12 ? null : [(r[0] * t + r[1] * e + r[2]) / n, (r[3] * t + r[4] * e + r[5]) / n];
1096
1165
  }
1097
- function hn(r) {
1098
- const [t, e, n, i, o, s, a, l, c] = r, u = t * (o * c - s * l) - e * (i * c - s * a) + n * (i * l - o * a);
1166
+ function yn(r) {
1167
+ const [t, e, n, i, s, o, a, l, c] = r, u = t * (s * c - o * l) - e * (i * c - o * a) + n * (i * l - s * a);
1099
1168
  return !Number.isFinite(u) || Math.abs(u) < 1e-15 ? null : [
1100
- (o * c - s * l) / u,
1169
+ (s * c - o * l) / u,
1101
1170
  (n * l - e * c) / u,
1102
- (e * s - n * o) / u,
1103
- (s * a - i * c) / u,
1171
+ (e * o - n * s) / u,
1172
+ (o * a - i * c) / u,
1104
1173
  (t * c - n * a) / u,
1105
- (n * i - t * s) / u,
1106
- (i * l - o * a) / u,
1174
+ (n * i - t * o) / u,
1175
+ (i * l - s * a) / u,
1107
1176
  (e * a - t * l) / u,
1108
- (t * o - e * i) / u
1177
+ (t * s - e * i) / u
1109
1178
  ];
1110
1179
  }
1111
- function mn(r, t) {
1180
+ function wn(r, t) {
1112
1181
  let e = r;
1113
1182
  for (; e - t > 180; ) e -= 360;
1114
1183
  for (; t - e > 180; ) e += 360;
1115
1184
  return e;
1116
1185
  }
1117
- const Ze = (r) => {
1186
+ const rr = (r) => {
1118
1187
  let t = ((r + 180) % 360 + 360) % 360 - 180;
1119
1188
  return t === -180 && (t = 180), t;
1120
1189
  };
1121
1190
  function tt({ corners: r, widthMm: t, heightMm: e, crsForward: n, continuous: i = !1 }) {
1122
- const o = n ?? (i ? ln : on), s = r[0][0], a = (b) => i ? b : mn(b, s), l = (b) => i ? b : Ze(b), c = r.map(([b, w]) => [a(b), w]), u = c.map((b) => o.forward(b)), m = [
1191
+ const s = n ?? (i ? pn : dn), o = r[0][0], a = (b) => i ? b : wn(b, o), l = (b) => i ? b : rr(b), c = r.map(([b, w]) => [a(b), w]), u = c.map((b) => s.forward(b)), h = [
1123
1192
  [0, 0],
1124
1193
  [t, 0],
1125
1194
  [t, e],
1126
1195
  [0, e]
1127
- ], d = t > 0 && e > 0 ? un(u, m) : null, h = d ? hn(d.matrix) : null, f = !d || !h, g = (b, w = i ? 16 : 1) => {
1196
+ ], d = t > 0 && e > 0 ? bn(u, h) : null, m = d ? yn(d.matrix) : null, f = !d || !m, g = (b, w = i ? 16 : 1) => {
1128
1197
  let y = 0, A = p.unproject(0, b);
1129
1198
  if (!A) return null;
1130
1199
  for (let v = 1; v <= w; v++) {
1131
1200
  const $ = p.unproject(t * v / w, b);
1132
1201
  if (!$) return null;
1133
- y += Zr(A, $), A = $;
1202
+ y += on(A, $), A = $;
1134
1203
  }
1135
1204
  return y;
1136
1205
  }, p = {
1137
- crs: o.code,
1206
+ crs: s.code,
1138
1207
  corners: c,
1139
1208
  widthMm: t,
1140
1209
  heightMm: e,
@@ -1142,14 +1211,14 @@ function tt({ corners: r, widthMm: t, heightMm: e, crsForward: n, continuous: i
1142
1211
  continuous: i,
1143
1212
  project(b) {
1144
1213
  if (!d) return null;
1145
- const w = o.forward([a(b[0]), b[1]]), y = ge(d.matrix, d.normalize(w));
1214
+ const w = s.forward([a(b[0]), b[1]]), y = we(d.matrix, d.normalize(w));
1146
1215
  return y && Number.isFinite(y[0]) && Number.isFinite(y[1]) ? { xMm: y[0], yMm: y[1] } : null;
1147
1216
  },
1148
1217
  unproject(b, w) {
1149
- if (!d || !h) return null;
1150
- const y = ge(h, [b, w]);
1218
+ if (!d || !m) return null;
1219
+ const y = we(m, [b, w]);
1151
1220
  if (!y) return null;
1152
- const A = o.inverse(d.denormalize(y));
1221
+ const A = s.inverse(d.denormalize(y));
1153
1222
  return Number.isFinite(A[0]) && Number.isFinite(A[1]) ? [l(A[0]), A[1]] : null;
1154
1223
  },
1155
1224
  groundMetersPerMm() {
@@ -1190,33 +1259,33 @@ function X(r) {
1190
1259
  const e = [];
1191
1260
  for (const n of t) {
1192
1261
  if (!Array.isArray(n) || n.length < 2) return null;
1193
- const [i, o] = n;
1194
- if (typeof i != "number" || typeof o != "number" || !Number.isFinite(i) || !Number.isFinite(o) || o < -90 || o > 90) return null;
1195
- e.push([i, o]);
1262
+ const [i, s] = n;
1263
+ if (typeof i != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(s) || s < -90 || s > 90) return null;
1264
+ e.push([i, s]);
1196
1265
  }
1197
1266
  return e;
1198
1267
  }
1199
- function dn(r) {
1268
+ function vn(r) {
1200
1269
  if (r.degenerate) return null;
1201
1270
  const t = r.unproject(r.widthMm / 2, r.heightMm / 2);
1202
1271
  if (!t) return null;
1203
- const n = [t[0], Math.min(89.9, Math.max(-89.9, t[1] + 0.01))], i = r.project(t), o = r.project(n);
1204
- if (!i || !o) return null;
1205
- const s = o.xMm - i.xMm, a = o.yMm - i.yMm;
1206
- return Math.abs(s) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(s, -a) * sn % 360 + 360) % 360;
1272
+ const n = [t[0], Math.min(89.9, Math.max(-89.9, t[1] + 0.01))], i = r.project(t), s = r.project(n);
1273
+ if (!i || !s) return null;
1274
+ const o = s.xMm - i.xMm, a = s.yMm - i.yMm;
1275
+ return Math.abs(o) < 1e-12 && Math.abs(a) < 1e-12 ? null : (Math.atan2(o, -a) * mn % 360 + 360) % 360;
1207
1276
  }
1208
- function fn(r) {
1277
+ function An(r) {
1209
1278
  if (r.degenerate) return null;
1210
1279
  const { widthMm: t, heightMm: e } = r, n = [];
1211
- for (const s of [0.02, 0.5, 0.98]) {
1212
- const a = r.rowGroundMeters(e * s);
1280
+ for (const o of [0.02, 0.5, 0.98]) {
1281
+ const a = r.rowGroundMeters(e * o);
1213
1282
  if (a == null || !(a > 0)) return null;
1214
1283
  n.push(a / t);
1215
1284
  }
1216
- const i = Math.min(...n), o = Math.max(...n);
1217
- return i > 0 ? (o - i) / i : null;
1285
+ const i = Math.min(...n), s = Math.max(...n);
1286
+ return i > 0 ? (s - i) / i : null;
1218
1287
  }
1219
- function xi(r, t, e, n) {
1288
+ function Ri(r, t, e, n) {
1220
1289
  return [
1221
1290
  [r, n],
1222
1291
  [e, n],
@@ -1224,8 +1293,8 @@ function xi(r, t, e, n) {
1224
1293
  [r, t]
1225
1294
  ];
1226
1295
  }
1227
- const pn = (r) => r.toLowerCase().startsWith("on");
1228
- function gn(r, t) {
1296
+ const Mn = (r) => r.toLowerCase().startsWith("on");
1297
+ function Sn(r, t) {
1229
1298
  const e = (n) => {
1230
1299
  const i = n.tagName.toLowerCase();
1231
1300
  if (i === "script") {
@@ -1234,29 +1303,29 @@ function gn(r, t) {
1234
1303
  return a.setAttribute("type", "application/json"), a.textContent = n.textContent, a;
1235
1304
  }
1236
1305
  if (i === "style" || i === "link" || i === "iframe" || i === "object" || i === "embed") return null;
1237
- const o = t.createElement(i);
1238
- for (const s of n.attributes)
1239
- pn(s.name) || /^\s*javascript:/i.test(s.value) || o.setAttribute(s.name, s.value);
1240
- for (const s of n.childNodes)
1241
- if (s.nodeType === 3) o.appendChild(t.createTextNode(s.textContent ?? ""));
1242
- else if (s.nodeType === 1) {
1243
- const a = e(s);
1244
- a && o.appendChild(a);
1306
+ const s = t.createElement(i);
1307
+ for (const o of n.attributes)
1308
+ Mn(o.name) || /^\s*javascript:/i.test(o.value) || s.setAttribute(o.name, o.value);
1309
+ for (const o of n.childNodes)
1310
+ if (o.nodeType === 3) s.appendChild(t.createTextNode(o.textContent ?? ""));
1311
+ else if (o.nodeType === 1) {
1312
+ const a = e(o);
1313
+ a && s.appendChild(a);
1245
1314
  }
1246
- return o;
1315
+ return s;
1247
1316
  };
1248
1317
  return e(r);
1249
1318
  }
1250
- async function bn(r, t = document) {
1319
+ async function Cn(r, t = document) {
1251
1320
  const e = await fetch(r, { credentials: "same-origin", cache: "no-store" });
1252
1321
  if (!e.ok) throw new Error(`fetching ${r} failed with HTTP ${e.status}`);
1253
- const n = await e.text(), o = new DOMParser().parseFromString(n, "text/html").querySelector("om-map");
1254
- if (!o) throw new Error(`${r} contains no <om-map>`);
1255
- const s = gn(o, t);
1256
- if (!s) throw new Error(`${r} could not be adopted`);
1257
- return s;
1322
+ const n = await e.text(), s = new DOMParser().parseFromString(n, "text/html").querySelector("om-map");
1323
+ if (!s) throw new Error(`${r} contains no <om-map>`);
1324
+ const o = Sn(s, t);
1325
+ if (!o) throw new Error(`${r} could not be adopted`);
1326
+ return o;
1258
1327
  }
1259
- function ut(r) {
1328
+ function mt(r) {
1260
1329
  const t = r.getAttribute("center"), e = r.getAttribute("zoom");
1261
1330
  if (!t || e == null || e.trim() === "") return null;
1262
1331
  const n = Number(e);
@@ -1269,26 +1338,26 @@ function ut(r) {
1269
1338
  i = a.length === 2 ? a : null;
1270
1339
  }
1271
1340
  if (!Array.isArray(i) || i.length < 2) return null;
1272
- const [o, s] = i;
1273
- return !Number.isFinite(o) || !Number.isFinite(s) ? null : {
1274
- center: [o, s],
1341
+ const [s, o] = i;
1342
+ return !Number.isFinite(s) || !Number.isFinite(o) ? null : {
1343
+ center: [s, o],
1275
1344
  zoom: n,
1276
1345
  bearing: Number(r.getAttribute("bearing")) || 0,
1277
1346
  pitch: Number(r.getAttribute("pitch")) || 0
1278
1347
  };
1279
1348
  }
1280
- function $i(r, t, e, n, i = 60) {
1281
- const o = (l) => Ft(r, { ...t, pitch: l }, e, n) !== null;
1282
- if (o(i)) return i;
1283
- if (!o(0)) return 0;
1284
- let s = 0, a = i;
1285
- for (; a - s > 1; ) {
1286
- const l = Math.floor((s + a) / 2);
1287
- o(l) ? s = l : a = l;
1349
+ function Ii(r, t, e, n, i = 60) {
1350
+ const s = (l) => Ut(r, { ...t, pitch: l }, e, n) !== null;
1351
+ if (s(i)) return i;
1352
+ if (!s(0)) return 0;
1353
+ let o = 0, a = i;
1354
+ for (; a - o > 1; ) {
1355
+ const l = Math.floor((o + a) / 2);
1356
+ s(l) ? o = l : a = l;
1288
1357
  }
1289
- return s;
1358
+ return o;
1290
1359
  }
1291
- function Ft(r, t, e, n) {
1360
+ function Ut(r, t, e, n) {
1292
1361
  if (!(e > 0) || !(n > 0)) return null;
1293
1362
  const i = new r.WebMercatorViewport({
1294
1363
  width: e,
@@ -1298,61 +1367,61 @@ function Ft(r, t, e, n) {
1298
1367
  zoom: t.zoom,
1299
1368
  bearing: t.bearing,
1300
1369
  pitch: t.pitch
1301
- }), o = [
1370
+ }), s = [
1302
1371
  [0, 0],
1303
1372
  [e, 0],
1304
1373
  [e, n],
1305
1374
  [0, n]
1306
- ], s = [];
1307
- for (const a of o) {
1375
+ ], o = [];
1376
+ for (const a of s) {
1308
1377
  const l = i.unproject(a);
1309
1378
  if (!l || !Number.isFinite(l[0]) || !Number.isFinite(l[1])) return null;
1310
- s.push([l[0], l[1]]);
1379
+ o.push([l[0], l[1]]);
1311
1380
  }
1312
- return s;
1381
+ return o;
1313
1382
  }
1314
- async function yn(r, t) {
1315
- const e = await Te();
1383
+ async function xn(r, t) {
1384
+ const e = await Ie();
1316
1385
  if (t && typeof t != "string") return { core: e, map: t };
1317
1386
  if (!t) throw new Error("a live frame needs src= or an inline <om-map> child");
1318
- const n = await bn(t, r.ownerDocument);
1387
+ const n = await Cn(t, r.ownerDocument);
1319
1388
  return { core: e, map: n };
1320
1389
  }
1321
- function At(r, t) {
1322
- r.setAttribute("center", JSON.stringify(t.center)), r.setAttribute("zoom", String(t.zoom)), r.setAttribute("bearing", String(t.bearing)), r.setAttribute("pitch", String(t.pitch)), wn(r, t);
1390
+ function xt(r, t) {
1391
+ r.setAttribute("center", JSON.stringify(t.center)), r.setAttribute("zoom", String(t.zoom)), r.setAttribute("bearing", String(t.bearing)), r.setAttribute("pitch", String(t.pitch)), kn(r, t);
1323
1392
  }
1324
- function wn(r, t) {
1393
+ function kn(r, t) {
1325
1394
  const e = r;
1326
1395
  typeof e.setViewInternal == "function" ? e.setViewInternal({ longitude: t.center[0], latitude: t.center[1], zoom: t.zoom, pitch: t.pitch, bearing: t.bearing }) : typeof e.flyTo == "function" && e.flyTo(t.center, t.zoom, { duration: 0 });
1327
1396
  }
1328
- const vn = [".png", ".jpg", ".jpeg", ".webp", ".avif", ".gif", ".svg"], An = [".html", ".htm"];
1329
- function It(r) {
1397
+ const $n = [".png", ".jpg", ".jpeg", ".webp", ".avif", ".gif", ".svg"], En = [".html", ".htm"];
1398
+ function Dt(r) {
1330
1399
  const t = r.trim().split(/[?#]/, 1)[0]?.toLowerCase() ?? "";
1331
- return An.some((e) => t.endsWith(e)) ? "map" : vn.some((e) => t.endsWith(e)) ? "raster" : null;
1400
+ return En.some((e) => t.endsWith(e)) ? "map" : $n.some((e) => t.endsWith(e)) ? "raster" : null;
1332
1401
  }
1333
- function Mn(r, t) {
1402
+ function Nn(r, t) {
1334
1403
  const e = [], n = [...r.children].find(
1335
- (s) => s.tagName.toLowerCase() === "om-map" && s !== t
1404
+ (o) => o.tagName.toLowerCase() === "om-map" && o !== t
1336
1405
  );
1337
1406
  n && e.push({ kind: "inline", key: "inline", el: r, map: n });
1338
1407
  const i = r.getAttribute("src")?.trim();
1339
- i && e.push({ kind: It(i) ?? "map", key: `src:${i}`, el: r, src: i });
1340
- let o = 0;
1341
- for (const s of r.children) {
1342
- if (s.tagName.toLowerCase() !== "om-source") continue;
1343
- const a = s.getAttribute("src")?.trim();
1344
- a && e.push({ kind: It(a) ?? "map", key: `source:${o++}:${a}`, el: s, src: a });
1408
+ i && e.push({ kind: Dt(i) ?? "map", key: `src:${i}`, el: r, src: i });
1409
+ let s = 0;
1410
+ for (const o of r.children) {
1411
+ if (o.tagName.toLowerCase() !== "om-source") continue;
1412
+ const a = o.getAttribute("src")?.trim();
1413
+ a && e.push({ kind: Dt(a) ?? "map", key: `source:${s++}:${a}`, el: o, src: a });
1345
1414
  }
1346
1415
  return e;
1347
1416
  }
1348
- function Sn(r) {
1417
+ function Pn(r) {
1349
1418
  return r.map((t) => t.key).join("|");
1350
1419
  }
1351
- async function Cn(r, t, e) {
1352
- const n = Math.max(1, Math.round(t.w * e)), i = Math.max(1, Math.round(t.h * e)), o = r.cloneNode(!0);
1353
- o.removeAttribute("style"), o.setAttribute("width", String(n)), o.setAttribute("height", String(i)), o.setAttribute("preserveAspectRatio", "none");
1354
- const s = new XMLSerializer().serializeToString(o), a = new Image();
1355
- a.decoding = "sync", a.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;
1420
+ async function Tn(r, t, e) {
1421
+ const n = Math.max(1, Math.round(t.w * e)), i = Math.max(1, Math.round(t.h * e)), s = r.cloneNode(!0);
1422
+ s.removeAttribute("style"), s.setAttribute("width", String(n)), s.setAttribute("height", String(i)), s.setAttribute("preserveAspectRatio", "none");
1423
+ const o = new XMLSerializer().serializeToString(s), a = new Image();
1424
+ a.decoding = "sync", a.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`;
1356
1425
  try {
1357
1426
  await a.decode();
1358
1427
  } catch {
@@ -1360,8 +1429,8 @@ async function Cn(r, t, e) {
1360
1429
  }
1361
1430
  return a;
1362
1431
  }
1363
- const Mt = "data-om-carto-placeholder", be = "data-om-carto-source", St = "data-om-carto-capture", Ct = "data-om-carto-overview", ye = "http://www.w3.org/2000/svg", we = 24, ve = 0.25;
1364
- class Qe extends O {
1432
+ const kt = "data-om-carto-placeholder", ve = "data-om-carto-source", $t = "data-om-carto-capture", Et = "data-om-carto-overview", Ae = "http://www.w3.org/2000/svg", Me = 24, Se = 0.25;
1433
+ class nr extends O {
1365
1434
  static observedAttributes = [...T["om-frame"]];
1366
1435
  /** Resolved non-builtin CRS planes, so a re-render does not re-await proj4. */
1367
1436
  resolvedForward = null;
@@ -1451,9 +1520,9 @@ class Qe extends O {
1451
1520
  }
1452
1521
  const n = this.georefHost, i = X(n.getAttribute("corners"));
1453
1522
  if (!i) return null;
1454
- const o = Lt(n.getAttribute("crs")) ?? "EPSG:3857", s = n.getAttribute("crs-def");
1455
- let a = s ? null : Y(o);
1456
- return !a && this.resolvedForwardKey === `${o}|${s ?? ""}` && (a = this.resolvedForward), a ? tt({ corners: i, widthMm: t, heightMm: e, crsForward: a }) : null;
1523
+ const s = Ot(n.getAttribute("crs")) ?? "EPSG:3857", o = n.getAttribute("crs-def");
1524
+ let a = o ? null : Y(s);
1525
+ return !a && this.resolvedForwardKey === `${s}|${o ?? ""}` && (a = this.resolvedForward), a ? tt({ corners: i, widthMm: t, heightMm: e, crsForward: a }) : null;
1457
1526
  }
1458
1527
  /**
1459
1528
  * Resolve a live map's CRS through the core's lazy proj4, into the same
@@ -1466,7 +1535,7 @@ class Qe extends O {
1466
1535
  if (this.resolvedForwardKey === e || this.pendingLiveCrs === e) return;
1467
1536
  this.pendingLiveCrs = e;
1468
1537
  const n = ++this.resolveToken;
1469
- Rt(t, null).then((i) => {
1538
+ _t(t, null).then((i) => {
1470
1539
  if (n === this.resolveToken) {
1471
1540
  if (this.pendingLiveCrs = null, !i) {
1472
1541
  this.showPlaceholder("unknown-crs", `The map in this frame is projected to "${t}", which could not be resolved.`);
@@ -1492,7 +1561,7 @@ class Qe extends O {
1492
1561
  * showing its own overview polygon instead of the map.
1493
1562
  */
1494
1563
  get vector() {
1495
- return this.querySelector(`:scope > svg[${Et}]`);
1564
+ return this.querySelector(`:scope > svg[${Lt}]`);
1496
1565
  }
1497
1566
  /** What a static frame actually shows — vector first, because a frozen sheet that has both was frozen twice and the newer one is the vector. */
1498
1567
  get staticSource() {
@@ -1513,7 +1582,7 @@ class Qe extends O {
1513
1582
  renderNow() {
1514
1583
  this.applyPlacement(), this.style.display = "block", this.style.overflow = "hidden", this.style.boxSizing = "border-box";
1515
1584
  const t = this.getAttribute("frame-stroke");
1516
- this.style.border = "0", this.style.boxShadow = `inset 0 0 0 ${ve}mm ${t || "var(--om-carto-frame-stroke)"}`;
1585
+ this.style.border = "0", this.style.boxShadow = `inset 0 0 0 ${Se}mm ${t || "var(--om-carto-frame-stroke)"}`;
1517
1586
  const e = this.getAttribute("frame-bg");
1518
1587
  this.style.background = e || "var(--om-carto-frame-bg)", this.mode === "static" ? (this.suspendLiveMode(), this.renderStatic()) : this.renderLive(), this.renderOverview();
1519
1588
  }
@@ -1528,16 +1597,16 @@ class Qe extends O {
1528
1597
  }
1529
1598
  const e = t.style;
1530
1599
  e.position = "absolute", e.inset = "0", e.width = "100%", e.height = "100%", e.display = "block", t instanceof SVGSVGElement ? t.setAttribute("preserveAspectRatio", "none") : e.objectFit = "fill";
1531
- const n = Lt(this.getAttribute("crs")) ?? "EPSG:3857", i = this.getAttribute("crs-def"), o = `${n}|${i ?? ""}`;
1532
- if ((i != null || Y(n) == null) && this.resolvedForwardKey !== o) {
1600
+ const n = Ot(this.getAttribute("crs")) ?? "EPSG:3857", i = this.getAttribute("crs-def"), s = `${n}|${i ?? ""}`;
1601
+ if ((i != null || Y(n) == null) && this.resolvedForwardKey !== s) {
1533
1602
  const a = ++this.resolveToken;
1534
- this.resolvedForward = null, this.resolvedForwardKey = null, Rt(n, i).then((l) => {
1603
+ this.resolvedForward = null, this.resolvedForwardKey = null, _t(n, i).then((l) => {
1535
1604
  if (a === this.resolveToken) {
1536
1605
  if (!l) {
1537
1606
  this.showPlaceholder("unknown-crs", `Unknown CRS "${n}" — supply crs-def="+proj=…".`);
1538
1607
  return;
1539
1608
  }
1540
- this.resolvedForward = l, this.resolvedForwardKey = o, this.scheduleRender();
1609
+ this.resolvedForward = l, this.resolvedForwardKey = s, this.scheduleRender();
1541
1610
  }
1542
1611
  }).catch(() => {
1543
1612
  a === this.resolveToken && this.showPlaceholder("unknown-crs", `Could not resolve CRS "${n}".`);
@@ -1558,21 +1627,21 @@ class Qe extends O {
1558
1627
  c.tagName.toLowerCase() === "om-map" && c.setAttribute("data-om-carto-frame", "");
1559
1628
  const t = this.staticSource;
1560
1629
  t && (t.style.display = "none");
1561
- const e = ut(this);
1630
+ const e = mt(this);
1562
1631
  if (!e) {
1563
1632
  this.showPlaceholder("no-camera", 'Live frame needs its own camera — center="[lng, lat]" and zoom=.');
1564
1633
  return;
1565
1634
  }
1566
1635
  const n = JSON.stringify(e), i = n !== this.appliedCameraKey;
1567
1636
  this.appliedCameraKey = n, this.updateLiveCorners(i ? e : this.liveCamera() ?? e);
1568
- const o = this.sources();
1569
- if (o.length === 0) {
1637
+ const s = this.sources();
1638
+ if (s.length === 0) {
1570
1639
  this.showPlaceholder("no-source", "Live frame needs src=, an <om-source> child, or an inline <om-map>.");
1571
1640
  return;
1572
1641
  }
1573
- const s = Sn(o);
1574
- s !== this.knownSourceList && (this.knownSourceList = s, this.sourceCursor = 0, this.settledSource = null, this.removeAttribute(be));
1575
- const a = Math.min(this.sourceCursor, o.length - 1), l = o[a];
1642
+ const o = Pn(s);
1643
+ o !== this.knownSourceList && (this.knownSourceList = o, this.sourceCursor = 0, this.settledSource = null, this.removeAttribute(ve));
1644
+ const a = Math.min(this.sourceCursor, s.length - 1), l = s[a];
1576
1645
  if (l.kind === "raster") {
1577
1646
  this.suspendLiveMode(), this.renderCaptureSource(l, a);
1578
1647
  return;
@@ -1581,14 +1650,14 @@ class Qe extends O {
1581
1650
  if (this.mountedSource !== l.key)
1582
1651
  this.releaseLiveMap();
1583
1652
  else {
1584
- At(this.liveMap, e), this.sizeLiveMap();
1653
+ xt(this.liveMap, e), this.sizeLiveMap();
1585
1654
  return;
1586
1655
  }
1587
1656
  if (this.mounting) {
1588
1657
  if (this.mountingSource === l.key) return;
1589
1658
  this.abandonMount();
1590
1659
  }
1591
- this.mountLive(l, a, o);
1660
+ this.mountLive(l, a, s);
1592
1661
  }
1593
1662
  /**
1594
1663
  * Draw a CAPTURE source — a georeferenced picture, placed exactly like a
@@ -1598,8 +1667,8 @@ class Qe extends O {
1598
1667
  */
1599
1668
  renderCaptureSource(t, e) {
1600
1669
  const n = t.src ?? "";
1601
- let i = this.querySelector(`:scope > img[${St}]`);
1602
- if (i || (i = document.createElement("img"), i.setAttribute(St, ""), i.alt = "", this.appendChild(i)), i.getAttribute("src") !== n && i.setAttribute("src", n), i.style.cssText = "position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:fill;", this.captureImage = i, !X(this.georefHostFor(t).getAttribute("corners"))) {
1670
+ let i = this.querySelector(`:scope > img[${$t}]`);
1671
+ if (i || (i = document.createElement("img"), i.setAttribute($t, ""), i.alt = "", this.appendChild(i)), i.getAttribute("src") !== n && i.setAttribute("src", n), i.style.cssText = "position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:fill;", this.captureImage = i, !X(this.georefHostFor(t).getAttribute("corners"))) {
1603
1672
  this.showPlaceholder("bad-corners", 'A capture <om-source> needs corners="[[lng,lat] × 4]" (tl, tr, br, bl).');
1604
1673
  return;
1605
1674
  }
@@ -1611,7 +1680,7 @@ class Qe extends O {
1611
1680
  }
1612
1681
  /** A capture left over from an earlier source must not sit under a live map. */
1613
1682
  hideCaptureImage() {
1614
- const t = this.querySelector(`:scope > img[${St}]`);
1683
+ const t = this.querySelector(`:scope > img[${$t}]`);
1615
1684
  t && (t.style.display = "none");
1616
1685
  }
1617
1686
  /**
@@ -1620,7 +1689,7 @@ class Qe extends O {
1620
1689
  * inline source on the next render.
1621
1690
  */
1622
1691
  sources() {
1623
- return Mn(this, this.liveMapOwned ? this.liveMap : null);
1692
+ return Nn(this, this.liveMapOwned ? this.liveMap : null);
1624
1693
  }
1625
1694
  /**
1626
1695
  * Move to the next source, or report that there is none.
@@ -1645,7 +1714,7 @@ class Qe extends O {
1645
1714
  */
1646
1715
  settleSource(t, e) {
1647
1716
  if (this.settledSource?.key === t.key) return;
1648
- this.settledSource = t, this.sourceCursor = e, this.setAttribute(be, String(e));
1717
+ this.settledSource = t, this.sourceCursor = e, this.setAttribute(ve, String(e));
1649
1718
  const n = { id: this.id, index: e, kind: t.kind, src: t.src ?? null };
1650
1719
  this.dispatchEvent(new CustomEvent("om-frame-source", { bubbles: !0, detail: n })), this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } }));
1651
1720
  }
@@ -1687,38 +1756,38 @@ class Qe extends O {
1687
1756
  const e = `${Number(t.toFixed(6))}m`;
1688
1757
  this.liveMap.getAttribute("reference-scale") !== e && this.liveMap.setAttribute("reference-scale", e);
1689
1758
  }
1690
- updateLiveCorners(t = ut(this)) {
1759
+ updateLiveCorners(t = mt(this)) {
1691
1760
  if (!t) return;
1692
1761
  const e = J();
1693
1762
  if (!e) return;
1694
- const { w: n, h: i } = S(this), s = this.liveMap?.groundCorners?.(n * D, i * D) ?? Ft(e, t, n * D, i * D), a = JSON.stringify(s) !== JSON.stringify(this.liveCorners);
1695
- this.liveCorners = s, a && this.liveMap && this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } })), this.applyReferenceScale(), s ? this.lastError === "degenerate-view" && this.clearPlaceholder() : this.showPlaceholder("degenerate-view", "This frame's box cannot be georeferenced — give it a positive width and height.");
1763
+ const { w: n, h: i } = S(this), o = this.liveMap?.groundCorners?.(n * D, i * D) ?? Ut(e, t, n * D, i * D), a = JSON.stringify(o) !== JSON.stringify(this.liveCorners);
1764
+ this.liveCorners = o, a && this.liveMap && this.dispatchEvent(new CustomEvent("om-frame-view", { bubbles: !0, detail: { id: this.id } })), this.applyReferenceScale(), o ? this.lastError === "degenerate-view" && this.clearPlaceholder() : this.showPlaceholder("degenerate-view", "This frame's box cannot be georeferenced — give it a positive width and height.");
1696
1765
  }
1697
1766
  async mountLive(t, e, n) {
1698
1767
  const i = ++this.mountToken;
1699
1768
  this.mounting = !0, this.mountingSource = t.key;
1700
- let o = !1;
1769
+ let s = !1;
1701
1770
  try {
1702
- const { core: s, map: a } = await yn(this, t.map ?? t.src);
1771
+ const { core: o, map: a } = await xn(this, t.map ?? t.src);
1703
1772
  if (i !== this.mountToken || !this.isConnected || this.mode !== "live") return;
1704
- const l = ut(this);
1773
+ const l = mt(this);
1705
1774
  if (!l) return;
1706
- this.appliedCameraKey = JSON.stringify(l), At(a, l);
1775
+ this.appliedCameraKey = JSON.stringify(l), xt(a, l);
1707
1776
  const c = a;
1708
1777
  c.style.position = "absolute", c.style.inset = "0", c.style.display = "block", a.setAttribute("data-om-carto-frame", ""), this.liveMapOwned = a.parentElement !== this, this.liveMapOwned && this.appendChild(a), this.liveMap = c, c.addEventListener("om-view-changed", this.onLiveViewSettled), this.mountedSource = t.key, this.sizeLiveMap(), this.clearPlaceholder();
1709
- const { w: u, h: m } = S(this);
1710
- if (this.liveCorners = Ft(s, l, u * D, m * D), this.applyReferenceScale(), await c.ready, i !== this.mountToken || (At(a, l), await c.whenSettled?.({ timeout: 2e4 }), i !== this.mountToken)) return;
1778
+ const { w: u, h } = S(this);
1779
+ if (this.liveCorners = Ut(o, l, u * D, h * D), this.applyReferenceScale(), await c.ready, i !== this.mountToken || (xt(a, l), await c.whenSettled?.({ timeout: 2e4 }), i !== this.mountToken)) return;
1711
1780
  if (c.hasDrawableContent?.() === !1) {
1712
1781
  if (this.advanceSource(n)) return;
1713
1782
  console.warn(
1714
1783
  `[onlymapjs] <om-frame id="${this.id}"> source ${e} (${t.src ?? "inline"}) drew nothing, and it is the last source.`
1715
1784
  );
1716
1785
  }
1717
- o = !0, this.settleSource(t, e), this.signalReady();
1718
- } catch (s) {
1786
+ s = !0, this.settleSource(t, e), this.signalReady();
1787
+ } catch (o) {
1719
1788
  if (i !== this.mountToken) return;
1720
- const a = s.message ?? String(s);
1721
- if (o) {
1789
+ const a = o.message ?? String(o);
1790
+ if (s) {
1722
1791
  console.error(`[onlymapjs] <om-frame id="${this.id}"> rendered, then failed while reporting it: ${a}`);
1723
1792
  return;
1724
1793
  }
@@ -1750,34 +1819,34 @@ class Qe extends O {
1750
1819
  * segments would visibly cut the corners on a wide-extent inset.
1751
1820
  */
1752
1821
  renderOverview() {
1753
- const t = this.getAttribute("overview-of"), e = this.querySelector(`:scope > [${Ct}]`);
1822
+ const t = this.getAttribute("overview-of"), e = this.querySelector(`:scope > [${Et}]`);
1754
1823
  if (!t) {
1755
1824
  e?.remove();
1756
1825
  return;
1757
1826
  }
1758
- const n = Be(this, t), i = this.georef, o = n?.georef;
1759
- if (!n || !i || !o) {
1827
+ const n = Ye(this, t), i = this.georef, s = n?.georef;
1828
+ if (!n || !i || !s) {
1760
1829
  e?.remove();
1761
1830
  return;
1762
1831
  }
1763
- const { w: s, h: a } = S(this), l = [], [c, u, m, d] = o.corners, h = [
1832
+ const { w: o, h: a } = S(this), l = [], [c, u, h, d] = s.corners, m = [
1764
1833
  [c, u],
1765
- [u, m],
1766
- [m, d],
1834
+ [u, h],
1835
+ [h, d],
1767
1836
  [d, c]
1768
1837
  ];
1769
- for (const [b, w] of h)
1770
- for (let y = 0; y < we; y++) {
1771
- const A = y / we, v = [b[0] + (w[0] - b[0]) * A, b[1] + (w[1] - b[1]) * A], $ = i.project(v);
1838
+ for (const [b, w] of m)
1839
+ for (let y = 0; y < Me; y++) {
1840
+ const A = y / Me, v = [b[0] + (w[0] - b[0]) * A, b[1] + (w[1] - b[1]) * A], $ = i.project(v);
1772
1841
  $ && l.push(`${$.xMm.toFixed(3)},${$.yMm.toFixed(3)}`);
1773
1842
  }
1774
1843
  if (l.length < 3) {
1775
1844
  e?.remove();
1776
1845
  return;
1777
1846
  }
1778
- const f = this.ownerDocument, g = e ?? f.createElementNS(ye, "svg");
1779
- g.setAttribute(Ct, ""), g.setAttribute("width", `${s}mm`), g.setAttribute("height", `${a}mm`), g.setAttribute("viewBox", `0 0 ${s} ${a}`), g.style.cssText = "position:absolute;inset:0;pointer-events:none;", g.replaceChildren();
1780
- const p = f.createElementNS(ye, "polygon");
1847
+ const f = this.ownerDocument, g = e ?? f.createElementNS(Ae, "svg");
1848
+ g.setAttribute(Et, ""), g.setAttribute("width", `${o}mm`), g.setAttribute("height", `${a}mm`), g.setAttribute("viewBox", `0 0 ${o} ${a}`), g.style.cssText = "position:absolute;inset:0;pointer-events:none;", g.replaceChildren();
1849
+ const p = f.createElementNS(Ae, "polygon");
1781
1850
  p.setAttribute("points", l.join(" ")), p.setAttribute("fill", "none"), p.setAttribute("stroke", this.getAttribute("overview-stroke") || "#e63946"), p.setAttribute("stroke-width", "0.4"), g.appendChild(p), e || this.appendChild(g);
1782
1851
  }
1783
1852
  // -------------------------------------------------------------------------
@@ -1801,11 +1870,11 @@ class Qe extends O {
1801
1870
  * the worst outcome — it looks like a design choice.
1802
1871
  */
1803
1872
  showPlaceholder(t, e) {
1804
- let n = this.querySelector(`:scope > [${Mt}]`);
1805
- n || (n = document.createElement("div"), n.setAttribute(Mt, ""), n.style.cssText = "position:absolute;inset:0;display:grid;place-content:center;padding:4mm;text-align:center;font:italic 3mm/1.4 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.75;", this.appendChild(n)), n.textContent !== e && (n.textContent = e), this.lastError !== t && (this.lastError = t, this.settleReady(), this.dispatchEvent(new CustomEvent("om-frame-error", { bubbles: !0, detail: { id: this.id, reason: t, message: e } })));
1873
+ let n = this.querySelector(`:scope > [${kt}]`);
1874
+ n || (n = document.createElement("div"), n.setAttribute(kt, ""), n.style.cssText = "position:absolute;inset:0;display:grid;place-content:center;padding:4mm;text-align:center;font:italic 3mm/1.4 system-ui,sans-serif;color:var(--om-carto-ink);opacity:.75;", this.appendChild(n)), n.textContent !== e && (n.textContent = e), this.lastError !== t && (this.lastError = t, this.settleReady(), this.dispatchEvent(new CustomEvent("om-frame-error", { bubbles: !0, detail: { id: this.id, reason: t, message: e } })));
1806
1875
  }
1807
1876
  clearPlaceholder() {
1808
- this.querySelector(`:scope > [${Mt}]`)?.remove(), this.lastError = null;
1877
+ this.querySelector(`:scope > [${kt}]`)?.remove(), this.lastError = null;
1809
1878
  }
1810
1879
  // -------------------------------------------------------------------------
1811
1880
  // Capture, export and print
@@ -1846,18 +1915,30 @@ class Qe extends O {
1846
1915
  if (this.mode !== "live" || !this.liveMap) return !1;
1847
1916
  const n = this.georef?.corners;
1848
1917
  if (!n) return !1;
1849
- const i = t.format ?? "svg", o = this.liveMap.projectedCrs?.() ?? null;
1918
+ const i = t.format ?? "svg", s = this.liveMap.projectedCrs?.() ?? null;
1850
1919
  if (i === "svg") {
1851
- const s = await this.liveMap.snapshot({ format: "svg", effectDpi: t.effectDpi }), l = new DOMParser().parseFromString(s, "image/svg+xml").documentElement;
1852
- if (l.nodeName !== "svg") return !1;
1853
- const c = document.importNode(l, !0);
1854
- c.setAttribute(Et, ""), this.vector?.remove(), this.raster?.remove(), this.appendChild(c);
1920
+ const a = await this.liveMap.snapshot({ format: "svg", effectDpi: t.effectDpi }), c = new DOMParser().parseFromString(a, "image/svg+xml").documentElement;
1921
+ if (c.nodeName !== "svg") return !1;
1922
+ const u = document.importNode(c, !0);
1923
+ u.setAttribute(Lt, ""), this.vector?.remove(), this.raster?.remove(), this.appendChild(u);
1855
1924
  } else {
1856
- const s = await this.captureAt(t.scale ?? 3.125);
1857
- if (!s) return !1;
1858
- this.vector?.remove(), this.raster?.remove(), this.appendChild(s);
1925
+ const a = await this.captureAt(t.scale ?? 3.125);
1926
+ if (!a) return !1;
1927
+ this.vector?.remove(), this.raster?.remove(), this.appendChild(a);
1859
1928
  }
1860
- return this.setAttribute("corners", JSON.stringify(n.map(([s, a]) => [Number(s.toFixed(8)), Number(a.toFixed(8))]))), o && o !== "EPSG:3857" ? this.setAttribute("crs", o) : this.removeAttribute("crs"), this.setAttribute("mode", "static"), this.scheduleRender(), !0;
1929
+ this.setAttribute("corners", JSON.stringify(n.map(([a, l]) => [Number(a.toFixed(8)), Number(l.toFixed(8))]))), s && s !== "EPSG:3857" ? this.setAttribute("crs", s) : this.removeAttribute("crs");
1930
+ const o = this.liveMap?.attributions?.() ?? [];
1931
+ return o.length > 0 ? this.setAttribute("attribution", o.join(Kt)) : this.removeAttribute("attribution"), this.setAttribute("mode", "static"), this.scheduleRender(), this.dispatchEvent(new CustomEvent("om-attributions-changed", { bubbles: !0 })), !0;
1932
+ }
1933
+ /**
1934
+ * The basemap attribution this frame owes the sheet, as text.
1935
+ *
1936
+ * A live frame asks its map. A static one reads `attribution`, which
1937
+ * `freeze()` writes and an author may write by hand for a placed raster —
1938
+ * the only source a page without the runtime has.
1939
+ */
1940
+ attributions() {
1941
+ return this.mode === "live" ? this.liveMap?.attributions?.() ?? [] : _r(this.getAttribute("attribution"));
1861
1942
  }
1862
1943
  /**
1863
1944
  * Point this frame's camera at a lon/lat box — the atlas's per-page refit.
@@ -1867,13 +1948,13 @@ class Qe extends O {
1867
1948
  * follows from the same source as any authored camera.
1868
1949
  */
1869
1950
  fitBounds(t) {
1870
- const [e, n, i, o] = t, { w: s, h: a } = S(this);
1871
- if (s <= 0 || a <= 0) return;
1951
+ const [e, n, i, s] = t, { w: o, h: a } = S(this);
1952
+ if (o <= 0 || a <= 0) return;
1872
1953
  const l = J();
1873
1954
  if (!l) return;
1874
- const c = new l.WebMercatorViewport({ width: s * D, height: a * D, longitude: 0, latitude: 0, zoom: 0 }).fitBounds([
1955
+ const c = new l.WebMercatorViewport({ width: o * D, height: a * D, longitude: 0, latitude: 0, zoom: 0 }).fitBounds([
1875
1956
  [e, n],
1876
- [i, o]
1957
+ [i, s]
1877
1958
  ]);
1878
1959
  [c.longitude, c.latitude, c.zoom].every(Number.isFinite) && (this.setAttribute("center", JSON.stringify([Number(c.longitude.toFixed(8)), Number(c.latitude.toFixed(8))])), this.setAttribute("zoom", String(Number(c.zoom.toFixed(4)))), this.updateLiveCorners());
1879
1960
  }
@@ -1894,7 +1975,7 @@ class Qe extends O {
1894
1975
  return;
1895
1976
  }
1896
1977
  const e = this.vector;
1897
- e && (this.captureImage = await Cn(e, S(this), t.pxPerMm));
1978
+ e && (this.captureImage = await Tn(e, S(this), t.pxPerMm));
1898
1979
  }
1899
1980
  /** Export hook: forget the capture, so a failed pre-pass never reuses it. */
1900
1981
  discardCartograph() {
@@ -1915,46 +1996,46 @@ class Qe extends O {
1915
1996
  this.printing = !1, this.querySelector(":scope > img[data-om-carto-print]")?.remove(), this.liveMap && (this.liveMap.hidden = !1);
1916
1997
  }
1917
1998
  paintCartograph(t, e) {
1918
- const { w: n, h: i } = S(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
1919
- if (o <= 0 || s <= 0) return;
1920
- const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
1921
- l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
1999
+ const { w: n, h: i } = S(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
2000
+ if (s <= 0 || o <= 0) return;
2001
+ const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = I(a?.backgroundColor);
2002
+ l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
1922
2003
  const c = this.mode === "static" ? this.vector ? this.captureImage : this.raster : this.captureImage;
1923
- c && c.complete && c.naturalWidth > 0 && t.drawImage(c, 0, 0, o, s), this.paintOverview(t, e);
1924
- const u = this.getAttribute("frame-stroke") || F(a?.getPropertyValue("--om-carto-frame-stroke")?.trim()) || "#333333", m = ve * e.pxPerMm;
1925
- m > 0 && (t.strokeStyle = u, t.lineWidth = m, t.strokeRect(m / 2, m / 2, o - m, s - m));
2004
+ c && c.complete && c.naturalWidth > 0 && t.drawImage(c, 0, 0, s, o), this.paintOverview(t, e);
2005
+ const u = this.getAttribute("frame-stroke") || I(a?.getPropertyValue("--om-carto-frame-stroke")?.trim()) || "#333333", h = Se * e.pxPerMm;
2006
+ h > 0 && (t.strokeStyle = u, t.lineWidth = h, t.strokeRect(h / 2, h / 2, s - h, o - h));
1926
2007
  }
1927
2008
  paintOverview(t, e) {
1928
- const n = this.querySelector(`:scope > [${Ct}] polygon`), i = n?.getAttribute("points");
1929
- i && (t.save(), t.strokeStyle = n.getAttribute("stroke") || "#e63946", t.lineWidth = Number(n.getAttribute("stroke-width") || 0.4) * e.pxPerMm, t.beginPath(), i.split(/\s+/).forEach((o, s) => {
1930
- const [a, l] = o.split(",").map(Number);
1931
- !Number.isFinite(a) || !Number.isFinite(l) || (s === 0 ? t.moveTo(a * e.pxPerMm, l * e.pxPerMm) : t.lineTo(a * e.pxPerMm, l * e.pxPerMm));
2009
+ const n = this.querySelector(`:scope > [${Et}] polygon`), i = n?.getAttribute("points");
2010
+ i && (t.save(), t.strokeStyle = n.getAttribute("stroke") || "#e63946", t.lineWidth = Number(n.getAttribute("stroke-width") || 0.4) * e.pxPerMm, t.beginPath(), i.split(/\s+/).forEach((s, o) => {
2011
+ const [a, l] = s.split(",").map(Number);
2012
+ !Number.isFinite(a) || !Number.isFinite(l) || (o === 0 ? t.moveTo(a * e.pxPerMm, l * e.pxPerMm) : t.lineTo(a * e.pxPerMm, l * e.pxPerMm));
1932
2013
  }), t.closePath(), t.stroke(), t.restore());
1933
2014
  }
1934
2015
  }
1935
- k("om-frame", Qe);
1936
- const st = "http://www.w3.org/2000/svg", kn = ["single", "double", "line", "ticks"];
1937
- class tr extends O {
2016
+ x("om-frame", nr);
2017
+ const at = "http://www.w3.org/2000/svg", Ln = ["single", "double", "line", "ticks"];
2018
+ class ir extends O {
1938
2019
  static observedAttributes = [...T["om-scalebar"]];
1939
2020
  /** The geometry currently drawn — reused by the canvas exporter. */
1940
2021
  get drawing() {
1941
2022
  const e = U(this)?.georef;
1942
2023
  if (!e) return null;
1943
- const { w: n, h: i } = S(this), o = je({
2024
+ const { w: n, h: i } = S(this), s = Be({
1944
2025
  groundMetersPerMm: e.groundMetersPerMm(),
1945
2026
  maxWidthMm: n,
1946
2027
  segments: Number(this.getAttribute("segments")) || void 0,
1947
2028
  units: this.unitSystem,
1948
2029
  segmentLengthMeters: this.getAttribute("segment-length") ? Number(this.getAttribute("segment-length")) : null
1949
2030
  });
1950
- return o ? _r(o, this.barStyle, i) : null;
2031
+ return s ? Wr(s, this.barStyle, i) : null;
1951
2032
  }
1952
2033
  get barStyle() {
1953
2034
  const t = this.getAttribute("kind");
1954
- return kn.includes(t) ? t : "single";
2035
+ return Ln.includes(t) ? t : "single";
1955
2036
  }
1956
2037
  get unitSystem() {
1957
- return Or(this.getAttribute("units")) ?? "metric";
2038
+ return qr(this.getAttribute("units")) ?? "metric";
1958
2039
  }
1959
2040
  renderNow() {
1960
2041
  if (this.applyPlacement(), this.applyThemeOverride("color", "--om-carto-scalebar-ink", !0), this.style.display = "block", !U(this)) {
@@ -1970,48 +2051,48 @@ class tr extends O {
1970
2051
  this.renderSvg(e);
1971
2052
  }
1972
2053
  renderSvg(t) {
1973
- const { w: e, h: n } = S(this), i = this.ownerDocument, o = i.createElementNS(st, "svg");
1974
- o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${n}mm`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), o.setAttribute("part", "scalebar"), o.style.display = "block", o.style.overflow = "visible";
1975
- const s = "var(--om-carto-scalebar-ink)";
2054
+ const { w: e, h: n } = S(this), i = this.ownerDocument, s = i.createElementNS(at, "svg");
2055
+ s.setAttribute("width", `${e}mm`), s.setAttribute("height", `${n}mm`), s.setAttribute("viewBox", `0 0 ${e} ${n}`), s.setAttribute("part", "scalebar"), s.style.display = "block", s.style.overflow = "visible";
2056
+ const o = "var(--om-carto-scalebar-ink)";
1976
2057
  for (const a of t.bars) {
1977
- const l = i.createElementNS(st, "rect");
1978
- l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("width", String(a.w)), l.setAttribute("height", String(a.h)), l.setAttribute("fill", a.filled ? s : "none"), l.setAttribute("stroke", s), l.setAttribute("stroke-width", String(t.strokeMm)), o.appendChild(l);
2058
+ const l = i.createElementNS(at, "rect");
2059
+ l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("width", String(a.w)), l.setAttribute("height", String(a.h)), l.setAttribute("fill", a.filled ? o : "none"), l.setAttribute("stroke", o), l.setAttribute("stroke-width", String(t.strokeMm)), s.appendChild(l);
1979
2060
  }
1980
2061
  for (const a of t.strokes) {
1981
- const l = i.createElementNS(st, "line");
1982
- l.setAttribute("x1", String(a.x1)), l.setAttribute("y1", String(a.y1)), l.setAttribute("x2", String(a.x2)), l.setAttribute("y2", String(a.y2)), l.setAttribute("stroke", s), l.setAttribute("stroke-width", String(t.strokeMm)), o.appendChild(l);
2062
+ const l = i.createElementNS(at, "line");
2063
+ l.setAttribute("x1", String(a.x1)), l.setAttribute("y1", String(a.y1)), l.setAttribute("x2", String(a.x2)), l.setAttribute("y2", String(a.y2)), l.setAttribute("stroke", o), l.setAttribute("stroke-width", String(t.strokeMm)), s.appendChild(l);
1983
2064
  }
1984
2065
  for (const a of t.labels) {
1985
- const l = i.createElementNS(st, "text");
1986
- l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("font-size", String(t.fontMm)), l.setAttribute("fill", s), l.setAttribute("text-anchor", a.anchor), l.setAttribute("font-family", "var(--om-carto-font)"), l.textContent = a.text, o.appendChild(l);
2066
+ const l = i.createElementNS(at, "text");
2067
+ l.setAttribute("x", String(a.x)), l.setAttribute("y", String(a.y)), l.setAttribute("font-size", String(t.fontMm)), l.setAttribute("fill", o), l.setAttribute("text-anchor", a.anchor), l.setAttribute("font-family", "var(--om-carto-font)"), l.textContent = a.text, s.appendChild(l);
1987
2068
  }
1988
- this.replaceChildren(o);
2069
+ this.replaceChildren(s);
1989
2070
  }
1990
2071
  paintCartograph(t, e) {
1991
2072
  const n = this.drawing;
1992
2073
  if (!n) return;
1993
- const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = F(i?.color) ?? "#000", s = (l) => l * e.pxPerMm;
1994
- t.strokeStyle = o, t.fillStyle = o, t.lineWidth = s(n.strokeMm);
2074
+ const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = I(i?.color) ?? "#000", o = (l) => l * e.pxPerMm;
2075
+ t.strokeStyle = s, t.fillStyle = s, t.lineWidth = o(n.strokeMm);
1995
2076
  for (const l of n.bars)
1996
- l.filled && t.fillRect(s(l.x), s(l.y), s(l.w), s(l.h)), t.strokeRect(s(l.x), s(l.y), s(l.w), s(l.h));
2077
+ l.filled && t.fillRect(o(l.x), o(l.y), o(l.w), o(l.h)), t.strokeRect(o(l.x), o(l.y), o(l.w), o(l.h));
1997
2078
  t.beginPath();
1998
2079
  for (const l of n.strokes)
1999
- t.moveTo(s(l.x1), s(l.y1)), t.lineTo(s(l.x2), s(l.y2));
2080
+ t.moveTo(o(l.x1), o(l.y1)), t.lineTo(o(l.x2), o(l.y2));
2000
2081
  t.stroke();
2001
2082
  const a = i?.fontFamily || "system-ui, sans-serif";
2002
- t.font = `${s(n.fontMm)}px ${a}`, t.textBaseline = "alphabetic";
2083
+ t.font = `${o(n.fontMm)}px ${a}`, t.textBaseline = "alphabetic";
2003
2084
  for (const l of n.labels)
2004
- t.textAlign = l.anchor === "middle" ? "center" : l.anchor === "end" ? "right" : "left", t.fillText(l.text, s(l.x), s(l.y));
2085
+ t.textAlign = l.anchor === "middle" ? "center" : l.anchor === "end" ? "right" : "left", t.fillText(l.text, o(l.x), o(l.y));
2005
2086
  }
2006
2087
  }
2007
- k("om-scalebar", tr);
2088
+ x("om-scalebar", ir);
2008
2089
  const Q = "http://www.w3.org/2000/svg";
2009
- class er extends O {
2090
+ class sr extends O {
2010
2091
  static observedAttributes = [...T["om-north"]];
2011
2092
  /** Degrees clockwise from the page's "up", or null when unknowable. */
2012
2093
  get bearing() {
2013
2094
  const t = U(this)?.georef;
2014
- return t ? dn(t) : null;
2095
+ return t ? vn(t) : null;
2015
2096
  }
2016
2097
  get indicatorKind() {
2017
2098
  return this.getAttribute("kind") === "rose" ? "rose" : "arrow";
@@ -2027,38 +2108,38 @@ class er extends O {
2027
2108
  W(this, "North indicator cannot derive a direction from this frame yet.");
2028
2109
  return;
2029
2110
  }
2030
- const { w: n, h: i } = S(this), o = this.ownerDocument, s = o.createElementNS(Q, "svg");
2031
- s.setAttribute("width", `${n}mm`), s.setAttribute("height", `${i}mm`), s.setAttribute("viewBox", `0 0 ${n} ${i}`), s.style.display = "block";
2032
- const a = o.createElementNS(Q, "g");
2111
+ const { w: n, h: i } = S(this), s = this.ownerDocument, o = s.createElementNS(Q, "svg");
2112
+ o.setAttribute("width", `${n}mm`), o.setAttribute("height", `${i}mm`), o.setAttribute("viewBox", `0 0 ${n} ${i}`), o.style.display = "block";
2113
+ const a = s.createElementNS(Q, "g");
2033
2114
  a.setAttribute("transform", `rotate(${e.toFixed(3)} ${n / 2} ${i / 2})`);
2034
- for (const l of this.buildGeometry(o, n, i)) a.appendChild(l);
2035
- s.appendChild(a), this.replaceChildren(s);
2115
+ for (const l of this.buildGeometry(s, n, i)) a.appendChild(l);
2116
+ o.appendChild(a), this.replaceChildren(o);
2036
2117
  }
2037
2118
  buildGeometry(t, e, n) {
2038
- const i = "var(--om-carto-compass-ink)", o = [], s = e / 2, a = Math.min(3, n * 0.24), l = n - a * 1.2;
2119
+ const i = "var(--om-carto-compass-ink)", s = [], o = e / 2, a = Math.min(3, n * 0.24), l = n - a * 1.2;
2039
2120
  if (this.indicatorKind === "rose") {
2040
2121
  const f = Math.min(e, l) / 2, g = t.createElementNS(Q, "circle");
2041
- g.setAttribute("cx", String(s)), g.setAttribute("cy", String(l / 2)), g.setAttribute("r", String(f)), g.setAttribute("fill", "none"), g.setAttribute("stroke", i), g.setAttribute("stroke-width", "0.2"), o.push(g);
2122
+ g.setAttribute("cx", String(o)), g.setAttribute("cy", String(l / 2)), g.setAttribute("r", String(f)), g.setAttribute("fill", "none"), g.setAttribute("stroke", i), g.setAttribute("stroke-width", "0.2"), s.push(g);
2042
2123
  }
2043
- const c = 0, u = l, m = Math.min(e * 0.3, 4), d = t.createElementNS(Q, "path");
2044
- d.setAttribute("d", `M ${s} ${c} L ${s + m} ${u} L ${s} ${u - m * 0.55} L ${s - m} ${u} Z`), d.setAttribute("fill", i), o.push(d);
2045
- const h = t.createElementNS(Q, "text");
2046
- return h.setAttribute("x", String(s)), h.setAttribute("y", String(n)), h.setAttribute("font-size", String(a)), h.setAttribute("text-anchor", "middle"), h.setAttribute("fill", i), h.setAttribute("font-family", "var(--om-carto-font)"), h.textContent = "N", o.push(h), o;
2124
+ const c = 0, u = l, h = Math.min(e * 0.3, 4), d = t.createElementNS(Q, "path");
2125
+ d.setAttribute("d", `M ${o} ${c} L ${o + h} ${u} L ${o} ${u - h * 0.55} L ${o - h} ${u} Z`), d.setAttribute("fill", i), s.push(d);
2126
+ const m = t.createElementNS(Q, "text");
2127
+ return m.setAttribute("x", String(o)), m.setAttribute("y", String(n)), m.setAttribute("font-size", String(a)), m.setAttribute("text-anchor", "middle"), m.setAttribute("fill", i), m.setAttribute("font-family", "var(--om-carto-font)"), m.textContent = "N", s.push(m), s;
2047
2128
  }
2048
2129
  paintCartograph(t, e) {
2049
2130
  const n = this.bearing;
2050
2131
  if (n == null) return;
2051
- const { w: i, h: o } = S(this), s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, a = F(s?.color) ?? "#000", l = (h) => h * e.pxPerMm, c = Math.min(3, o * 0.24), u = o - c * 1.2, m = i / 2, d = Math.min(i * 0.3, 4);
2052
- t.save(), t.translate(l(m), l(o / 2)), t.rotate(n * Math.PI / 180), t.translate(-l(m), -l(o / 2)), t.fillStyle = a, t.strokeStyle = a, this.indicatorKind === "rose" && (t.lineWidth = l(0.2), t.beginPath(), t.arc(l(m), l(u / 2), l(Math.min(i, u) / 2), 0, Math.PI * 2), t.stroke()), t.beginPath(), t.moveTo(l(m), 0), t.lineTo(l(m + d), l(u)), t.lineTo(l(m), l(u - d * 0.55)), t.lineTo(l(m - d), l(u)), t.closePath(), t.fill(), t.font = `${l(c)}px ${s?.fontFamily || "system-ui, sans-serif"}`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillText("N", l(m), l(o)), t.restore();
2132
+ const { w: i, h: s } = S(this), o = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, a = I(o?.color) ?? "#000", l = (m) => m * e.pxPerMm, c = Math.min(3, s * 0.24), u = s - c * 1.2, h = i / 2, d = Math.min(i * 0.3, 4);
2133
+ t.save(), t.translate(l(h), l(s / 2)), t.rotate(n * Math.PI / 180), t.translate(-l(h), -l(s / 2)), t.fillStyle = a, t.strokeStyle = a, this.indicatorKind === "rose" && (t.lineWidth = l(0.2), t.beginPath(), t.arc(l(h), l(u / 2), l(Math.min(i, u) / 2), 0, Math.PI * 2), t.stroke()), t.beginPath(), t.moveTo(l(h), 0), t.lineTo(l(h + d), l(u)), t.lineTo(l(h), l(u - d * 0.55)), t.lineTo(l(h - d), l(u)), t.closePath(), t.fill(), t.font = `${l(c)}px ${o?.fontFamily || "system-ui, sans-serif"}`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillText("N", l(h), l(s)), t.restore();
2053
2134
  }
2054
2135
  }
2055
- k("om-north", er);
2056
- const ot = "http://www.w3.org/2000/svg", xn = ["rect", "ellipse", "line", "arrow"];
2057
- class rr extends O {
2136
+ x("om-north", sr);
2137
+ const lt = "http://www.w3.org/2000/svg", Rn = ["rect", "ellipse", "line", "arrow"];
2138
+ class or extends O {
2058
2139
  static observedAttributes = [...T["om-shape"]];
2059
2140
  get kind() {
2060
2141
  const t = this.getAttribute("kind");
2061
- return xn.includes(t) ? t : "rect";
2142
+ return Rn.includes(t) ? t : "rect";
2062
2143
  }
2063
2144
  get fill() {
2064
2145
  return this.getAttribute("fill") || "var(--om-carto-shape-fill)";
@@ -2084,44 +2165,44 @@ class rr extends O {
2084
2165
  }
2085
2166
  renderNow() {
2086
2167
  this.applyPlacement(), this.style.display = "block";
2087
- const { w: t, h: e } = S(this), n = this.ownerDocument, i = n.createElementNS(ot, "svg");
2168
+ const { w: t, h: e } = S(this), n = this.ownerDocument, i = n.createElementNS(lt, "svg");
2088
2169
  i.setAttribute("width", `${t}mm`), i.setAttribute("height", `${e}mm`), i.setAttribute("viewBox", `0 0 ${t} ${e}`), i.style.display = "block", i.style.overflow = "visible";
2089
- const o = this.strokeWidthMm / 2, s = this.kind;
2170
+ const s = this.strokeWidthMm / 2, o = this.kind;
2090
2171
  let a;
2091
- s === "ellipse" ? (a = n.createElementNS(ot, "ellipse"), a.setAttribute("cx", String(t / 2)), a.setAttribute("cy", String(e / 2)), a.setAttribute("rx", String(Math.max(0, t / 2 - o))), a.setAttribute("ry", String(Math.max(0, e / 2 - o)))) : s === "line" || s === "arrow" ? (a = n.createElementNS(ot, "path"), a.setAttribute("d", s === "arrow" ? this.arrowPath(t, e) : `M 0 0 L ${t} ${e}`)) : (a = n.createElementNS(ot, "rect"), a.setAttribute("x", String(o)), a.setAttribute("y", String(o)), a.setAttribute("width", String(Math.max(0, t - this.strokeWidthMm))), a.setAttribute("height", String(Math.max(0, e - this.strokeWidthMm))), this.radiusMm > 0 && a.setAttribute("rx", String(this.radiusMm)));
2092
- const l = s === "rect" || s === "ellipse" || s === "arrow";
2172
+ o === "ellipse" ? (a = n.createElementNS(lt, "ellipse"), a.setAttribute("cx", String(t / 2)), a.setAttribute("cy", String(e / 2)), a.setAttribute("rx", String(Math.max(0, t / 2 - s))), a.setAttribute("ry", String(Math.max(0, e / 2 - s)))) : o === "line" || o === "arrow" ? (a = n.createElementNS(lt, "path"), a.setAttribute("d", o === "arrow" ? this.arrowPath(t, e) : `M 0 0 L ${t} ${e}`)) : (a = n.createElementNS(lt, "rect"), a.setAttribute("x", String(s)), a.setAttribute("y", String(s)), a.setAttribute("width", String(Math.max(0, t - this.strokeWidthMm))), a.setAttribute("height", String(Math.max(0, e - this.strokeWidthMm))), this.radiusMm > 0 && a.setAttribute("rx", String(this.radiusMm)));
2173
+ const l = o === "rect" || o === "ellipse" || o === "arrow";
2093
2174
  a.setAttribute("fill", l ? this.fill : "none"), l && a.setAttribute("fill-opacity", String(this.fillOpacity)), a.setAttribute("stroke", this.stroke), a.setAttribute("stroke-width", String(this.strokeWidthMm)), i.appendChild(a), this.replaceChildren(i);
2094
2175
  }
2095
2176
  /** A line from the box's top-left to its bottom-right, with a solid head. */
2096
2177
  arrowPath(t, e) {
2097
- const n = Math.min(t, e) * 0.28, i = Math.atan2(e, t), o = t, s = e, a = { x: o - n * Math.cos(i - 0.4), y: s - n * Math.sin(i - 0.4) }, l = { x: o - n * Math.cos(i + 0.4), y: s - n * Math.sin(i + 0.4) };
2098
- return `M 0 0 L ${o} ${s} M ${o} ${s} L ${a.x} ${a.y} L ${l.x} ${l.y} Z`;
2178
+ const n = Math.min(t, e) * 0.28, i = Math.atan2(e, t), s = t, o = e, a = { x: s - n * Math.cos(i - 0.4), y: o - n * Math.sin(i - 0.4) }, l = { x: s - n * Math.cos(i + 0.4), y: o - n * Math.sin(i + 0.4) };
2179
+ return `M 0 0 L ${s} ${o} M ${s} ${o} L ${a.x} ${a.y} L ${l.x} ${l.y} Z`;
2099
2180
  }
2100
2181
  paintCartograph(t, e) {
2101
2182
  const { w: n, h: i } = S(this);
2102
2183
  if (n <= 0 || i <= 0) return;
2103
- const o = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = (d) => d * e.pxPerMm, a = this.getAttribute("fill") || o?.getPropertyValue("--om-carto-shape-fill")?.trim() || "#cccccc", l = this.getAttribute("stroke") || o?.getPropertyValue("--om-carto-shape-stroke")?.trim() || "#333333", c = s(this.strokeWidthMm), u = c / 2, m = this.kind;
2104
- if (t.save(), t.globalAlpha = this.fillOpacity, t.fillStyle = a, t.strokeStyle = l, t.lineWidth = c, m === "ellipse")
2105
- t.beginPath(), t.ellipse(s(n / 2), s(i / 2), Math.max(0, s(n / 2) - u), Math.max(0, s(i / 2) - u), 0, 0, Math.PI * 2), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
2106
- else if (m === "line" || m === "arrow") {
2107
- if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(s(n), s(i)), c > 0 && t.stroke(), m === "arrow") {
2108
- const d = Math.min(s(n), s(i)) * 0.28, h = Math.atan2(s(i), s(n));
2109
- t.beginPath(), t.moveTo(s(n), s(i)), t.lineTo(s(n) - d * Math.cos(h - 0.4), s(i) - d * Math.sin(h - 0.4)), t.lineTo(s(n) - d * Math.cos(h + 0.4), s(i) - d * Math.sin(h + 0.4)), t.closePath(), t.fillStyle = l, t.fill();
2184
+ const s = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = (d) => d * e.pxPerMm, a = this.getAttribute("fill") || s?.getPropertyValue("--om-carto-shape-fill")?.trim() || "#cccccc", l = this.getAttribute("stroke") || s?.getPropertyValue("--om-carto-shape-stroke")?.trim() || "#333333", c = o(this.strokeWidthMm), u = c / 2, h = this.kind;
2185
+ if (t.save(), t.globalAlpha = this.fillOpacity, t.fillStyle = a, t.strokeStyle = l, t.lineWidth = c, h === "ellipse")
2186
+ t.beginPath(), t.ellipse(o(n / 2), o(i / 2), Math.max(0, o(n / 2) - u), Math.max(0, o(i / 2) - u), 0, 0, Math.PI * 2), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
2187
+ else if (h === "line" || h === "arrow") {
2188
+ if (t.globalAlpha = 1, t.beginPath(), t.moveTo(0, 0), t.lineTo(o(n), o(i)), c > 0 && t.stroke(), h === "arrow") {
2189
+ const d = Math.min(o(n), o(i)) * 0.28, m = Math.atan2(o(i), o(n));
2190
+ t.beginPath(), t.moveTo(o(n), o(i)), t.lineTo(o(n) - d * Math.cos(m - 0.4), o(i) - d * Math.sin(m - 0.4)), t.lineTo(o(n) - d * Math.cos(m + 0.4), o(i) - d * Math.sin(m + 0.4)), t.closePath(), t.fillStyle = l, t.fill();
2110
2191
  }
2111
2192
  } else {
2112
- const d = s(this.radiusMm);
2113
- t.beginPath(), d > 0 && typeof t.roundRect == "function" ? t.roundRect(u, u, s(n) - c, s(i) - c, d) : t.rect(u, u, s(n) - c, s(i) - c), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
2193
+ const d = o(this.radiusMm);
2194
+ t.beginPath(), d > 0 && typeof t.roundRect == "function" ? t.roundRect(u, u, o(n) - c, o(i) - c, d) : t.rect(u, u, o(n) - c, o(i) - c), t.fill(), t.globalAlpha = 1, c > 0 && t.stroke();
2114
2195
  }
2115
2196
  t.restore();
2116
2197
  }
2117
2198
  }
2118
- k("om-shape", rr);
2119
- const Ae = "data-om-carto-owned", $n = ["contain", "cover", "fill"];
2120
- class nr extends O {
2199
+ x("om-shape", or);
2200
+ const Ce = "data-om-carto-owned", In = ["contain", "cover", "fill"];
2201
+ class ar extends O {
2121
2202
  static observedAttributes = [...T["om-image"]];
2122
2203
  get fit() {
2123
2204
  const t = this.getAttribute("fit");
2124
- return $n.includes(t ?? "") ? t : "contain";
2205
+ return In.includes(t ?? "") ? t : "contain";
2125
2206
  }
2126
2207
  get image() {
2127
2208
  return this.querySelector(":scope > img");
@@ -2130,29 +2211,29 @@ class nr extends O {
2130
2211
  this.applyPlacement(), this.style.display = "block", this.style.overflow = "hidden";
2131
2212
  const t = this.getAttribute("src");
2132
2213
  let e = this.image;
2133
- !e && t && (e = this.ownerDocument.createElement("img"), e.setAttribute(Ae, ""), e.alt = "", e.crossOrigin = "anonymous", this.appendChild(e)), e && (t && e.hasAttribute(Ae) && e.getAttribute("src") !== t && e.setAttribute("src", t), e.style.width = "100%", e.style.height = "100%", e.style.objectFit = this.fit, e.style.display = "block");
2214
+ !e && t && (e = this.ownerDocument.createElement("img"), e.setAttribute(Ce, ""), e.alt = "", e.crossOrigin = "anonymous", this.appendChild(e)), e && (t && e.hasAttribute(Ce) && e.getAttribute("src") !== t && e.setAttribute("src", t), e.style.width = "100%", e.style.height = "100%", e.style.objectFit = this.fit, e.style.display = "block");
2134
2215
  }
2135
2216
  paintCartograph(t, e) {
2136
2217
  const n = this.image;
2137
2218
  if (!n || !n.complete || n.naturalWidth === 0) return;
2138
- const { w: i, h: o } = S(this), s = i * e.pxPerMm, a = o * e.pxPerMm;
2139
- if (s <= 0 || a <= 0) return;
2219
+ const { w: i, h: s } = S(this), o = i * e.pxPerMm, a = s * e.pxPerMm;
2220
+ if (o <= 0 || a <= 0) return;
2140
2221
  const l = this.fit;
2141
2222
  if (l === "fill") {
2142
- t.drawImage(n, 0, 0, s, a);
2223
+ t.drawImage(n, 0, 0, o, a);
2143
2224
  return;
2144
2225
  }
2145
- const c = n.naturalWidth / n.naturalHeight, u = s / a, m = l === "contain" ? c > u : c < u, d = m ? s : a * c, h = m ? s / c : a;
2146
- l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, s, a), t.clip()), t.drawImage(n, (s - d) / 2, (a - h) / 2, d, h), l === "cover" && t.restore();
2226
+ const c = n.naturalWidth / n.naturalHeight, u = o / a, h = l === "contain" ? c > u : c < u, d = h ? o : a * c, m = h ? o / c : a;
2227
+ l === "cover" && (t.save(), t.beginPath(), t.rect(0, 0, o, a), t.clip()), t.drawImage(n, (o - d) / 2, (a - m) / 2, d, m), l === "cover" && t.restore();
2147
2228
  }
2148
2229
  }
2149
- k("om-image", nr);
2150
- const En = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), Nn = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), Pn = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
2151
- function Tn(r) {
2230
+ x("om-image", ar);
2231
+ const Fn = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), On = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), _n = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
2232
+ function Un(r) {
2152
2233
  const t = r.type ?? "";
2153
- if (Pn.has(t)) return "ramp";
2154
- if (En.has(t)) return "line";
2155
- if (Nn.has(t)) return "point";
2234
+ if (_n.has(t)) return "ramp";
2235
+ if (Fn.has(t)) return "line";
2236
+ if (On.has(t)) return "point";
2156
2237
  if (t === "GeoJsonLayer") {
2157
2238
  const e = r.props ?? {}, n = e.getFillColor !== void 0, i = e.getLineColor !== void 0;
2158
2239
  if (n && !i) return "polygon";
@@ -2160,69 +2241,69 @@ function Tn(r) {
2160
2241
  }
2161
2242
  return "polygon";
2162
2243
  }
2163
- function Ln(r) {
2244
+ function Dn(r) {
2164
2245
  const t = r.meta?.legend;
2165
2246
  return r.meta?.color ?? (t?.kind === "ramp" ? t.colors[0] : t?.entries[0]?.color) ?? "#999";
2166
2247
  }
2167
- const kt = 12;
2168
- function Rn(r, t = []) {
2248
+ const Nt = 12;
2249
+ function zn(r, t = []) {
2169
2250
  const e = [];
2170
2251
  for (const n of r) {
2171
2252
  if (n.props?.visible === !1) continue;
2172
- const i = t.filter((a) => a.layer === n.id), o = i.find((a) => a.match == null);
2173
- if (o?.hide) continue;
2174
- const s = Fn(n.meta?.legend);
2253
+ const i = t.filter((a) => a.layer === n.id), s = i.find((a) => a.match == null);
2254
+ if (s?.hide) continue;
2255
+ const o = jn(n.meta?.legend);
2175
2256
  e.push({
2176
2257
  layerId: n.id,
2177
- label: o?.label ?? n.meta?.label ?? n.id,
2178
- color: o?.color ?? Ln(n),
2179
- shape: o?.shape ?? Tn(n),
2180
- legend: In(s, i),
2181
- order: o?.order
2258
+ label: s?.label ?? n.meta?.label ?? n.id,
2259
+ color: s?.color ?? Dn(n),
2260
+ shape: s?.shape ?? Un(n),
2261
+ legend: Gn(o, i),
2262
+ order: s?.order
2182
2263
  });
2183
2264
  }
2184
2265
  return e.map((n, i) => ({ row: n, index: i })).sort((n, i) => {
2185
- const o = n.row.order ?? Number.POSITIVE_INFINITY, s = i.row.order ?? Number.POSITIVE_INFINITY;
2186
- return o - s || n.index - i.index;
2266
+ const s = n.row.order ?? Number.POSITIVE_INFINITY, o = i.row.order ?? Number.POSITIVE_INFINITY;
2267
+ return s - o || n.index - i.index;
2187
2268
  }).map((n) => n.row);
2188
2269
  }
2189
- function Fn(r) {
2190
- if (!r || r.kind !== "categories" || r.entries.length <= kt) return r;
2191
- const t = r.entries.slice(0, kt), e = r.entries.length - kt;
2270
+ function jn(r) {
2271
+ if (!r || r.kind !== "categories" || r.entries.length <= Nt) return r;
2272
+ const t = r.entries.slice(0, Nt), e = r.entries.length - Nt;
2192
2273
  return {
2193
2274
  ...r,
2194
2275
  entries: [...t, { color: r.defaultColor ?? "#999", label: `+${e} more` }]
2195
2276
  };
2196
2277
  }
2197
- function In(r, t) {
2278
+ function Gn(r, t) {
2198
2279
  const e = t.filter((i) => i.match != null);
2199
2280
  if (!r || r.kind === "ramp" || e.length === 0) return r;
2200
2281
  const n = [];
2201
2282
  for (const i of r.entries) {
2202
- const o = e.find((s) => s.match === i.label);
2203
- o?.hide || n.push({ color: o?.color ?? i.color, label: o?.label ?? i.label });
2283
+ const s = e.find((o) => o.match === i.label);
2284
+ s?.hide || n.push({ color: s?.color ?? i.color, label: s?.label ?? i.label });
2204
2285
  }
2205
2286
  return { ...r, entries: n };
2206
2287
  }
2207
- function On(r) {
2288
+ function qn(r) {
2208
2289
  const t = [];
2209
2290
  for (const e of r.querySelectorAll(":scope > om-legend-row")) {
2210
2291
  const n = e.getAttribute("layer");
2211
2292
  if (!n) continue;
2212
- const i = e.getAttribute("order"), o = i == null || i.trim() === "" ? void 0 : Number(i);
2293
+ const i = e.getAttribute("order"), s = i == null || i.trim() === "" ? void 0 : Number(i);
2213
2294
  t.push({
2214
2295
  layer: n,
2215
2296
  match: e.getAttribute("match") ?? void 0,
2216
2297
  label: e.getAttribute("label") ?? void 0,
2217
2298
  hide: e.hasAttribute("hide"),
2218
- order: o != null && Number.isFinite(o) ? o : void 0,
2299
+ order: s != null && Number.isFinite(s) ? s : void 0,
2219
2300
  color: e.getAttribute("color") ?? void 0,
2220
2301
  shape: e.getAttribute("shape") ?? void 0
2221
2302
  });
2222
2303
  }
2223
2304
  return t;
2224
2305
  }
2225
- function ir(r) {
2306
+ function lr(r) {
2226
2307
  const t = [];
2227
2308
  for (const e of r.querySelectorAll(":scope > om-legend-row")) {
2228
2309
  if (e.hasAttribute("hide")) continue;
@@ -2237,17 +2318,17 @@ function ir(r) {
2237
2318
  }
2238
2319
  return t.sort((e, n) => (e.order ?? Number.POSITIVE_INFINITY) - (n.order ?? Number.POSITIVE_INFINITY));
2239
2320
  }
2240
- const Me = "data-om-carto-legend-rows";
2241
- class sr extends O {
2321
+ const xe = "data-om-carto-legend-rows";
2322
+ class cr extends O {
2242
2323
  static observedAttributes = [...T["om-legend"]];
2243
2324
  get derived() {
2244
2325
  return this.getAttribute("derived") !== "false";
2245
2326
  }
2246
2327
  /** The rows this legend currently shows — recomputed on demand, never stored. */
2247
2328
  get rows() {
2248
- if (!this.derived) return ir(this);
2329
+ if (!this.derived) return lr(this);
2249
2330
  const n = U(this)?.mapElement?.getLayers?.();
2250
- return n ? Rn(n, On(this)) : [];
2331
+ return n ? zn(n, qn(this)) : [];
2251
2332
  }
2252
2333
  /** Inner padding in mm — authored, else the 2 mm the theme always used. */
2253
2334
  get paddingMm() {
@@ -2274,18 +2355,18 @@ class sr extends O {
2274
2355
  }
2275
2356
  renderRows(t) {
2276
2357
  const e = this.ownerDocument;
2277
- this.querySelector(`:scope > [${Me}]`)?.remove(), Br(this);
2358
+ this.querySelector(`:scope > [${xe}]`)?.remove(), Zr(this);
2278
2359
  const n = e.createElement("div");
2279
- n.setAttribute(Me, ""), n.style.cssText = `padding:${this.paddingMm}mm;font-size:${this.fontMm}mm;line-height:1.35;`;
2360
+ n.setAttribute(xe, ""), n.style.cssText = `padding:${this.paddingMm}mm;font-size:${this.fontMm}mm;line-height:1.35;`;
2280
2361
  const i = this.getAttribute("title");
2281
2362
  if (i) {
2282
- const s = e.createElement("div");
2283
- s.textContent = i, s.style.cssText = "font-weight:600;margin-bottom:1.2mm;color:var(--om-carto-legend-title-ink);", n.appendChild(s);
2363
+ const o = e.createElement("div");
2364
+ o.textContent = i, o.style.cssText = "font-weight:600;margin-bottom:1.2mm;color:var(--om-carto-legend-title-ink);", n.appendChild(o);
2284
2365
  }
2285
- const o = Number(this.getAttribute("columns"));
2286
- Number.isFinite(o) && o > 1 && (n.style.columnCount = String(Math.floor(o)), n.style.columnGap = "3mm");
2287
- for (const s of t)
2288
- n.appendChild(this.buildRow(e, s)), s.legend && n.appendChild(this.buildSymbology(e, s));
2366
+ const s = Number(this.getAttribute("columns"));
2367
+ Number.isFinite(s) && s > 1 && (n.style.columnCount = String(Math.floor(s)), n.style.columnGap = "3mm");
2368
+ for (const o of t)
2369
+ n.appendChild(this.buildRow(e, o)), o.legend && n.appendChild(this.buildSymbology(e, o));
2289
2370
  this.appendChild(n);
2290
2371
  }
2291
2372
  buildRow(t, e) {
@@ -2296,147 +2377,147 @@ class sr extends O {
2296
2377
  }
2297
2378
  /** The swatch geometry carries meaning: an area, a line and a point read differently. */
2298
2379
  buildSwatch(t, e, n) {
2299
- const i = t.createElement("span"), o = "display:inline-block;flex:none;width:3.2mm;height:3.2mm;";
2300
- return n === "line" ? i.style.cssText = `${o}height:0.9mm;background:${e};` : n === "point" ? i.style.cssText = `${o}border-radius:50%;background:${e};` : n === "ramp" ? i.style.cssText = `${o}width:6mm;background:linear-gradient(to right, ${e}, transparent);` : i.style.cssText = `${o}background:${e};border:0.15mm solid rgba(0,0,0,.35);`, i;
2380
+ const i = t.createElement("span"), s = "display:inline-block;flex:none;width:3.2mm;height:3.2mm;";
2381
+ return n === "line" ? i.style.cssText = `${s}height:0.9mm;background:${e};` : n === "point" ? i.style.cssText = `${s}border-radius:50%;background:${e};` : n === "ramp" ? i.style.cssText = `${s}width:6mm;background:linear-gradient(to right, ${e}, transparent);` : i.style.cssText = `${s}background:${e};border:0.15mm solid rgba(0,0,0,.35);`, i;
2301
2382
  }
2302
2383
  buildSymbology(t, e) {
2303
2384
  const n = t.createElement("div");
2304
2385
  n.style.cssText = "margin:0.4mm 0 1.6mm 4.7mm;break-inside:avoid;";
2305
- const i = e.legend, o = t.createElement("div");
2306
- if (o.textContent = i.field, o.style.cssText = "font-size:2.1mm;opacity:.7;margin-bottom:0.5mm;", n.appendChild(o), i.kind === "ramp") {
2307
- const s = t.createElement("div");
2308
- s.style.cssText = `height:2.4mm;background:linear-gradient(to right, ${i.colors.join(", ")});border:0.15mm solid rgba(0,0,0,.25);`, n.appendChild(s);
2386
+ const i = e.legend, s = t.createElement("div");
2387
+ if (s.textContent = i.field, s.style.cssText = "font-size:2.1mm;opacity:.7;margin-bottom:0.5mm;", n.appendChild(s), i.kind === "ramp") {
2388
+ const o = t.createElement("div");
2389
+ o.style.cssText = `height:2.4mm;background:linear-gradient(to right, ${i.colors.join(", ")});border:0.15mm solid rgba(0,0,0,.25);`, n.appendChild(o);
2309
2390
  const a = t.createElement("div");
2310
- return a.style.cssText = "display:flex;justify-content:space-between;font-size:2.1mm;opacity:.75;", a.append(at(t, i.domain[0].toLocaleString("en-US")), at(t, i.domain[1].toLocaleString("en-US"))), n.appendChild(a), n;
2391
+ return a.style.cssText = "display:flex;justify-content:space-between;font-size:2.1mm;opacity:.75;", a.append(ct(t, i.domain[0].toLocaleString("en-US")), ct(t, i.domain[1].toLocaleString("en-US"))), n.appendChild(a), n;
2311
2392
  }
2312
- for (const s of i.entries) {
2393
+ for (const o of i.entries) {
2313
2394
  const a = t.createElement("div");
2314
- a.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", a.appendChild(this.buildSwatch(t, s.color, "polygon")), a.appendChild(at(t, s.label)), n.appendChild(a);
2395
+ a.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", a.appendChild(this.buildSwatch(t, o.color, "polygon")), a.appendChild(ct(t, o.label)), n.appendChild(a);
2315
2396
  }
2316
2397
  if (i.kind === "categories" && i.defaultColor) {
2317
- const s = t.createElement("div");
2318
- s.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", s.appendChild(this.buildSwatch(t, i.defaultColor, "polygon")), s.appendChild(at(t, "other")), n.appendChild(s);
2398
+ const o = t.createElement("div");
2399
+ o.style.cssText = "display:flex;align-items:center;gap:1.2mm;margin:0.3mm 0;font-size:2.3mm;", o.appendChild(this.buildSwatch(t, i.defaultColor, "polygon")), o.appendChild(ct(t, "other")), n.appendChild(o);
2319
2400
  }
2320
2401
  return n;
2321
2402
  }
2322
2403
  paintCartograph(t, e) {
2323
- const { w: n, h: i } = S(this), o = n * e.pxPerMm, s = i * e.pxPerMm;
2324
- if (o <= 0 || s <= 0) return;
2325
- const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = F(a?.backgroundColor);
2326
- l && (t.fillStyle = l, t.fillRect(0, 0, o, s));
2327
- const c = F(a?.borderTopColor), u = $t(a?.borderTopWidth) * e.scale;
2328
- c && u > 0 && (t.strokeStyle = c, t.lineWidth = u, t.strokeRect(u / 2, u / 2, o - u, s - u));
2329
- const m = F(a?.color) ?? "#111", d = a?.fontFamily || "system-ui, sans-serif", h = (M) => M * e.pxPerMm, f = this.paddingMm, g = this.fontMm;
2330
- let p = h(f);
2404
+ const { w: n, h: i } = S(this), s = n * e.pxPerMm, o = i * e.pxPerMm;
2405
+ if (s <= 0 || o <= 0) return;
2406
+ const a = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, l = I(a?.backgroundColor);
2407
+ l && (t.fillStyle = l, t.fillRect(0, 0, s, o));
2408
+ const c = I(a?.borderTopColor), u = Tt(a?.borderTopWidth) * e.scale;
2409
+ c && u > 0 && (t.strokeStyle = c, t.lineWidth = u, t.strokeRect(u / 2, u / 2, s - u, o - u));
2410
+ const h = I(a?.color) ?? "#111", d = a?.fontFamily || "system-ui, sans-serif", m = (M) => M * e.pxPerMm, f = this.paddingMm, g = this.fontMm;
2411
+ let p = m(f);
2331
2412
  const b = this.getAttribute("title");
2332
- b && (t.fillStyle = m, t.font = `600 ${h(g)}px ${d}`, t.textBaseline = "top", t.fillText(b, h(f), p), p += h(g * 1.55));
2413
+ b && (t.fillStyle = h, t.font = `600 ${m(g)}px ${d}`, t.textBaseline = "top", t.fillText(b, m(f), p), p += m(g * 1.55));
2333
2414
  const w = this.rows, y = Number(this.getAttribute("columns")), A = Math.min(w.length || 1, Number.isFinite(y) && y > 1 ? Math.floor(y) : 1), v = Math.max(1, Math.ceil(w.length / A)), $ = 3, G = Math.max(1, (n - f * 2 - $ * (A - 1)) / A), _ = p;
2334
2415
  let E = -1, N = f;
2335
- t.font = `${h(g)}px ${d}`;
2416
+ t.font = `${m(g)}px ${d}`;
2336
2417
  for (const [M, C] of w.entries()) {
2337
2418
  const P = Math.min(A - 1, Math.floor(M / v));
2338
- if (P !== E && (E = P, N = f + E * (G + $), p = E === 0 ? _ : h(f)), p > s || (t.fillStyle = C.color, C.shape === "line" ? t.fillRect(h(N), p + h(1.2), h(3.2), h(0.9)) : C.shape === "point" ? (t.beginPath(), t.arc(h(N + 1.6), p + h(1.6), h(1.6), 0, Math.PI * 2), t.fill()) : t.fillRect(h(N), p, h(3.2), h(3.2)), t.fillStyle = m, t.textBaseline = "top", t.fillText(C.label, h(N + 4.7), p + h(0.3)), p += h(g * 1.6), !C.legend)) continue;
2339
- const x = C.legend;
2340
- if (t.save(), t.font = `${h(2.1)}px ${d}`, t.globalAlpha = 0.7, t.fillText(x.field, h(N + 2.7), p), t.globalAlpha = 1, p += h(2.8), x.kind === "ramp") {
2341
- const L = Math.min(24, Math.max(1, G - 2.7)), R = N + 2.7, B = t.createLinearGradient(h(R), 0, h(R + L), 0);
2342
- x.colors.forEach((hr, mr) => B.addColorStop(x.colors.length === 1 ? 0 : mr / (x.colors.length - 1), hr)), t.fillStyle = B, t.fillRect(h(R), p, h(L), h(2.4)), p += h(3.4), t.fillStyle = m, t.font = `${h(2.1)}px ${d}`, t.fillText(x.domain[0].toLocaleString("en-US"), h(R), p);
2343
- const ur = x.domain[1].toLocaleString("en-US");
2344
- t.textAlign = "right", t.fillText(ur, h(R + L), p), t.textAlign = "left", p += h(3.2);
2419
+ if (P !== E && (E = P, N = f + E * (G + $), p = E === 0 ? _ : m(f)), p > o || (t.fillStyle = C.color, C.shape === "line" ? t.fillRect(m(N), p + m(1.2), m(3.2), m(0.9)) : C.shape === "point" ? (t.beginPath(), t.arc(m(N + 1.6), p + m(1.6), m(1.6), 0, Math.PI * 2), t.fill()) : t.fillRect(m(N), p, m(3.2), m(3.2)), t.fillStyle = h, t.textBaseline = "top", t.fillText(C.label, m(N + 4.7), p + m(0.3)), p += m(g * 1.6), !C.legend)) continue;
2420
+ const k = C.legend;
2421
+ if (t.save(), t.font = `${m(2.1)}px ${d}`, t.globalAlpha = 0.7, t.fillText(k.field, m(N + 2.7), p), t.globalAlpha = 1, p += m(2.8), k.kind === "ramp") {
2422
+ const L = Math.min(24, Math.max(1, G - 2.7)), R = N + 2.7, B = t.createLinearGradient(m(R), 0, m(R + L), 0);
2423
+ k.colors.forEach((pr, gr) => B.addColorStop(k.colors.length === 1 ? 0 : gr / (k.colors.length - 1), pr)), t.fillStyle = B, t.fillRect(m(R), p, m(L), m(2.4)), p += m(3.4), t.fillStyle = h, t.font = `${m(2.1)}px ${d}`, t.fillText(k.domain[0].toLocaleString("en-US"), m(R), p);
2424
+ const fr = k.domain[1].toLocaleString("en-US");
2425
+ t.textAlign = "right", t.fillText(fr, m(R + L), p), t.textAlign = "left", p += m(3.2);
2345
2426
  } else {
2346
- const L = [...x.entries];
2347
- x.kind === "categories" && x.defaultColor && L.push({ color: x.defaultColor, label: "other" }), t.font = `${h(2.3)}px ${d}`;
2427
+ const L = [...k.entries];
2428
+ k.kind === "categories" && k.defaultColor && L.push({ color: k.defaultColor, label: "other" }), t.font = `${m(2.3)}px ${d}`;
2348
2429
  for (const R of L) {
2349
- if (p > s) break;
2350
- t.fillStyle = R.color, t.fillRect(h(N + 2.7), p, h(2.6), h(2.6)), t.fillStyle = m, t.fillText(R.label, h(N + 6.3), p + h(0.2)), p += h(3.2);
2430
+ if (p > o) break;
2431
+ t.fillStyle = R.color, t.fillRect(m(N + 2.7), p, m(2.6), m(2.6)), t.fillStyle = h, t.fillText(R.label, m(N + 6.3), p + m(0.2)), p += m(3.2);
2351
2432
  }
2352
- p += h(1);
2433
+ p += m(1);
2353
2434
  }
2354
- t.restore(), t.font = `${h(2.6)}px ${d}`;
2435
+ t.restore(), t.font = `${m(2.6)}px ${d}`;
2355
2436
  }
2356
2437
  }
2357
2438
  }
2358
- const at = (r, t) => {
2439
+ const ct = (r, t) => {
2359
2440
  const e = r.createElement("span");
2360
2441
  return e.textContent = t, e;
2361
2442
  };
2362
- k("om-legend", sr);
2363
- const Se = 48, Ot = {
2443
+ x("om-legend", cr);
2444
+ const ke = 48, zt = {
2364
2445
  toLngLat: (r, t) => [r, t],
2365
2446
  fromLngLat: (r) => [r[0], r[1]]
2366
2447
  };
2367
- function Ce(r, t = 5) {
2368
- return !Number.isFinite(r) || r <= 0 ? 0 : ze(r / Math.max(1, t));
2448
+ function $e(r, t = 5) {
2449
+ return !Number.isFinite(r) || r <= 0 ? 0 : We(r / Math.max(1, t));
2369
2450
  }
2370
- function _n({ georef: r, plane: t = Ot, interval: e, intervalX: n, intervalY: i, labels: o = "outside", format: s }) {
2451
+ function Wn({ georef: r, plane: t = zt, interval: e, intervalX: n, intervalY: i, labels: s = "outside", format: o }) {
2371
2452
  if (r.degenerate) return null;
2372
2453
  const a = r.corners.map((y) => t.fromLngLat(y)), l = a.map((y) => y[0]), c = a.map((y) => y[1]);
2373
2454
  if (l.some((y) => !Number.isFinite(y)) || c.some((y) => !Number.isFinite(y))) return null;
2374
- const u = Math.min(...l), m = Math.max(...l), d = Math.min(...c), h = Math.max(...c), f = ke(n ?? e, Ce(m - u)), g = ke(i ?? e, Ce(h - d));
2375
- if (f <= 0 || g <= 0 || (m - u) / f > 500 || (h - d) / g > 500) return null;
2376
- const p = [], b = [], w = s ?? Dn;
2377
- for (let y = Math.ceil(u / f) * f; y <= m + 1e-9; y += f) {
2378
- const A = xe(r, t, y, d, h, "x");
2455
+ const u = Math.min(...l), h = Math.max(...l), d = Math.min(...c), m = Math.max(...c), f = Ee(n ?? e, $e(h - u)), g = Ee(i ?? e, $e(m - d));
2456
+ if (f <= 0 || g <= 0 || (h - u) / f > 500 || (m - d) / g > 500) return null;
2457
+ const p = [], b = [], w = o ?? Kn;
2458
+ for (let y = Math.ceil(u / f) * f; y <= h + 1e-9; y += f) {
2459
+ const A = Ne(r, t, y, d, m, "x");
2379
2460
  if (A) {
2380
2461
  p.push(A);
2381
- const v = t === Ot ? Ze(y) : y;
2382
- o !== "none" && Ee(b, A, r, w(v, "x"), "x", o);
2462
+ const v = t === zt ? rr(y) : y;
2463
+ s !== "none" && Te(b, A, r, w(v, "x"), "x", s);
2383
2464
  }
2384
2465
  }
2385
- for (let y = Math.ceil(d / g) * g; y <= h + 1e-9; y += g) {
2386
- const A = xe(r, t, y, u, m, "y");
2387
- A && (p.push(A), o !== "none" && Ee(b, A, r, w(y, "y"), "y", o));
2466
+ for (let y = Math.ceil(d / g) * g; y <= m + 1e-9; y += g) {
2467
+ const A = Ne(r, t, y, u, h, "y");
2468
+ A && (p.push(A), s !== "none" && Te(b, A, r, w(y, "y"), "y", s));
2388
2469
  }
2389
2470
  return { lines: p, labels: b, intervalX: f, intervalY: g };
2390
2471
  }
2391
- const ke = (r, t) => r != null && Number.isFinite(r) && r > 0 ? r : t;
2392
- function xe(r, t, e, n, i, o) {
2393
- const s = [];
2394
- for (let l = 0; l <= Se; l++) {
2395
- const c = n + (i - n) * l / Se, u = o === "x" ? t.toLngLat(e, c) : t.toLngLat(c, e);
2472
+ const Ee = (r, t) => r != null && Number.isFinite(r) && r > 0 ? r : t;
2473
+ function Ne(r, t, e, n, i, s) {
2474
+ const o = [];
2475
+ for (let l = 0; l <= ke; l++) {
2476
+ const c = n + (i - n) * l / ke, u = s === "x" ? t.toLngLat(e, c) : t.toLngLat(c, e);
2396
2477
  if (!Number.isFinite(u[0]) || !Number.isFinite(u[1])) continue;
2397
- const m = r.project(u);
2398
- m && s.push(m);
2478
+ const h = r.project(u);
2479
+ h && o.push(h);
2399
2480
  }
2400
- const a = Un(s, r.widthMm, r.heightMm);
2401
- return a.length >= 2 ? { points: a, value: e, axis: o } : null;
2481
+ const a = Bn(o, r.widthMm, r.heightMm);
2482
+ return a.length >= 2 ? { points: a, value: e, axis: s } : null;
2402
2483
  }
2403
- function Un(r, t, e) {
2484
+ function Bn(r, t, e) {
2404
2485
  const n = (a) => a.xMm >= -0.01 && a.xMm <= t + 0.01 && a.yMm >= -0.01 && a.yMm <= e + 0.01, i = r.findIndex(n);
2405
2486
  if (i === -1) return [];
2406
- let o = r.length - 1;
2407
- for (; o > i && !n(r[o]); ) o--;
2408
- return r.slice(Math.max(0, i - 1), Math.min(r.length, o + 2)).map((a) => ({ xMm: $e(a.xMm, 0, t), yMm: $e(a.yMm, 0, e) }));
2487
+ let s = r.length - 1;
2488
+ for (; s > i && !n(r[s]); ) s--;
2489
+ return r.slice(Math.max(0, i - 1), Math.min(r.length, s + 2)).map((a) => ({ xMm: Pe(a.xMm, 0, t), yMm: Pe(a.yMm, 0, e) }));
2409
2490
  }
2410
- const $e = (r, t, e) => Math.min(e, Math.max(t, r));
2411
- function Ee(r, t, e, n, i, o) {
2491
+ const Pe = (r, t, e) => Math.min(e, Math.max(t, r));
2492
+ function Te(r, t, e, n, i, s) {
2412
2493
  if (i === "x") {
2413
- const s = t.points.reduce((a, l) => l.yMm > a.yMm ? l : a);
2414
- if (Math.abs(s.yMm - e.heightMm) > 0.5) return;
2415
- r.push({ text: n, xMm: s.xMm, yMm: e.heightMm + (o === "outside" ? 3 : -1), edge: "bottom", axis: i });
2494
+ const o = t.points.reduce((a, l) => l.yMm > a.yMm ? l : a);
2495
+ if (Math.abs(o.yMm - e.heightMm) > 0.5) return;
2496
+ r.push({ text: n, xMm: o.xMm, yMm: e.heightMm + (s === "outside" ? 3 : -1), edge: "bottom", axis: i });
2416
2497
  } else {
2417
- const s = t.points.reduce((a, l) => l.xMm < a.xMm ? l : a);
2418
- if (Math.abs(s.xMm) > 0.5) return;
2419
- r.push({ text: n, xMm: o === "outside" ? -1.2 : 1.2, yMm: s.yMm, edge: "left", axis: i });
2498
+ const o = t.points.reduce((a, l) => l.xMm < a.xMm ? l : a);
2499
+ if (Math.abs(o.xMm) > 0.5) return;
2500
+ r.push({ text: n, xMm: s === "outside" ? -1.2 : 1.2, yMm: o.yMm, edge: "left", axis: i });
2420
2501
  }
2421
2502
  }
2422
- function Dn(r, t) {
2503
+ function Kn(r, t) {
2423
2504
  if (Math.abs(r) >= 1e3) return Math.round(r).toLocaleString("en-US");
2424
2505
  const e = Math.abs(r) < 1 ? 3 : Math.abs(r) < 10 ? 2 : 1;
2425
2506
  return `${Number(r.toFixed(e))}°`;
2426
2507
  }
2427
- function zn(r, t) {
2428
- const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), o = (n - i) * 60, s = Math.floor(o), a = Math.round((o - s) * 60), l = a === 60 ? s + 1 : s, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, m = a === 60 ? 0 : a;
2429
- return `${c}°${String(u).padStart(2, "0")}′${String(m).padStart(2, "0")}″${e}`;
2508
+ function Vn(r, t) {
2509
+ const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), s = (n - i) * 60, o = Math.floor(s), a = Math.round((s - o) * 60), l = a === 60 ? o + 1 : o, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, h = a === 60 ? 0 : a;
2510
+ return `${c}°${String(u).padStart(2, "0")}′${String(h).padStart(2, "0")}″${e}`;
2430
2511
  }
2431
- const lt = "http://www.w3.org/2000/svg", jn = ["solid", "cross", "markers"], j = 1.4;
2432
- class or extends O {
2512
+ const ut = "http://www.w3.org/2000/svg", Hn = ["solid", "cross", "markers"], j = 1.4;
2513
+ class ur extends O {
2433
2514
  static observedAttributes = [...T["om-graticule"]];
2434
2515
  resolvedPlane = null;
2435
2516
  resolvedPlaneKey = null;
2436
2517
  resolveToken = 0;
2437
2518
  get kind() {
2438
2519
  const t = this.getAttribute("kind");
2439
- return jn.includes(t) ? t : "solid";
2520
+ return Hn.includes(t) ? t : "solid";
2440
2521
  }
2441
2522
  get labelPlacement() {
2442
2523
  const t = this.getAttribute("labels");
@@ -2449,17 +2530,17 @@ class or extends O {
2449
2530
  const e = this.gridPlane();
2450
2531
  if (!e) return null;
2451
2532
  const n = (i) => {
2452
- const o = Number(this.getAttribute(i));
2453
- return Number.isFinite(o) && o > 0 ? o : null;
2533
+ const s = Number(this.getAttribute(i));
2534
+ return Number.isFinite(s) && s > 0 ? s : null;
2454
2535
  };
2455
- return _n({
2536
+ return Wn({
2456
2537
  georef: t,
2457
2538
  plane: e,
2458
2539
  interval: n("interval"),
2459
2540
  intervalX: n("interval-x"),
2460
2541
  intervalY: n("interval-y"),
2461
2542
  labels: this.labelPlacement,
2462
- format: this.getAttribute("format") === "dms" ? zn : void 0
2543
+ format: this.getAttribute("format") === "dms" ? Vn : void 0
2463
2544
  });
2464
2545
  }
2465
2546
  /**
@@ -2468,18 +2549,18 @@ class or extends O {
2468
2549
  * a re-render when it lands.
2469
2550
  */
2470
2551
  gridPlane() {
2471
- const t = Lt(this.getAttribute("crs"));
2472
- if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return Ot;
2552
+ const t = Ot(this.getAttribute("crs"));
2553
+ if (!t || t === "EPSG:4326" || t === "CRS:84" || t === "OGC:CRS84") return zt;
2473
2554
  const e = `${t}|${this.getAttribute("crs-def") ?? ""}`;
2474
2555
  if (this.resolvedPlaneKey === e) return this.resolvedPlane;
2475
2556
  const n = Y(t);
2476
2557
  if (n) {
2477
- const o = { toLngLat: (s, a) => n.inverse([s, a]), fromLngLat: (s) => n.forward(s) };
2478
- return this.resolvedPlane = o, this.resolvedPlaneKey = e, o;
2558
+ const s = { toLngLat: (o, a) => n.inverse([o, a]), fromLngLat: (o) => n.forward(o) };
2559
+ return this.resolvedPlane = s, this.resolvedPlaneKey = e, s;
2479
2560
  }
2480
2561
  const i = ++this.resolveToken;
2481
- return Rt(t, this.getAttribute("crs-def")).then((o) => {
2482
- i !== this.resolveToken || !o || (this.resolvedPlane = { toLngLat: (s, a) => o.inverse([s, a]), fromLngLat: (s) => o.forward(s) }, this.resolvedPlaneKey = e, this.scheduleRender());
2562
+ return _t(t, this.getAttribute("crs-def")).then((s) => {
2563
+ i !== this.resolveToken || !s || (this.resolvedPlane = { toLngLat: (o, a) => s.inverse([o, a]), fromLngLat: (o) => s.forward(o) }, this.resolvedPlaneKey = e, this.scheduleRender());
2483
2564
  }).catch(() => {
2484
2565
  }), null;
2485
2566
  }
@@ -2497,149 +2578,149 @@ class or extends O {
2497
2578
  this.renderSvg(e);
2498
2579
  }
2499
2580
  renderSvg(t) {
2500
- const { w: e, h: n } = S(this), i = this.ownerDocument, o = i.createElementNS(lt, "svg");
2501
- o.setAttribute("width", `${e}mm`), o.setAttribute("height", `${n}mm`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), o.style.cssText = "display:block;overflow:visible;";
2502
- const s = "var(--om-carto-graticule-ink)", a = this.kind;
2581
+ const { w: e, h: n } = S(this), i = this.ownerDocument, s = i.createElementNS(ut, "svg");
2582
+ s.setAttribute("width", `${e}mm`), s.setAttribute("height", `${n}mm`), s.setAttribute("viewBox", `0 0 ${e} ${n}`), s.style.cssText = "display:block;overflow:visible;";
2583
+ const o = "var(--om-carto-graticule-ink)", a = this.kind;
2503
2584
  for (const l of t.lines)
2504
2585
  if (a === "solid") {
2505
- const c = i.createElementNS(lt, "polyline");
2506
- c.setAttribute("points", l.points.map((u) => `${u.xMm.toFixed(3)},${u.yMm.toFixed(3)}`).join(" ")), c.setAttribute("fill", "none"), c.setAttribute("stroke", s), c.setAttribute("stroke-width", "0.15"), o.appendChild(c);
2586
+ const c = i.createElementNS(ut, "polyline");
2587
+ c.setAttribute("points", l.points.map((u) => `${u.xMm.toFixed(3)},${u.yMm.toFixed(3)}`).join(" ")), c.setAttribute("fill", "none"), c.setAttribute("stroke", o), c.setAttribute("stroke-width", "0.15"), s.appendChild(c);
2507
2588
  } else
2508
2589
  for (const c of this.tickPoints(l, a, t)) {
2509
- const u = i.createElementNS(lt, "path");
2510
- u.setAttribute("d", `M ${c.xMm - j} ${c.yMm} H ${c.xMm + j} M ${c.xMm} ${c.yMm - j} V ${c.yMm + j}`), u.setAttribute("stroke", s), u.setAttribute("stroke-width", "0.15"), o.appendChild(u);
2590
+ const u = i.createElementNS(ut, "path");
2591
+ u.setAttribute("d", `M ${c.xMm - j} ${c.yMm} H ${c.xMm + j} M ${c.xMm} ${c.yMm - j} V ${c.yMm + j}`), u.setAttribute("stroke", o), u.setAttribute("stroke-width", "0.15"), s.appendChild(u);
2511
2592
  }
2512
2593
  for (const l of t.labels) {
2513
- const c = i.createElementNS(lt, "text");
2514
- c.setAttribute("x", String(l.xMm)), c.setAttribute("y", String(l.yMm)), c.setAttribute("font-size", "2.2"), c.setAttribute("fill", s), c.setAttribute("font-family", "var(--om-carto-font)"), c.setAttribute("text-anchor", l.edge === "left" ? "end" : "middle"), c.textContent = l.text, o.appendChild(c);
2594
+ const c = i.createElementNS(ut, "text");
2595
+ c.setAttribute("x", String(l.xMm)), c.setAttribute("y", String(l.yMm)), c.setAttribute("font-size", "2.2"), c.setAttribute("fill", o), c.setAttribute("font-family", "var(--om-carto-font)"), c.setAttribute("text-anchor", l.edge === "left" ? "end" : "middle"), c.textContent = l.text, s.appendChild(c);
2515
2596
  }
2516
- this.replaceChildren(o);
2597
+ this.replaceChildren(s);
2517
2598
  }
2518
2599
  /** Intersections of this line with the perpendicular family. */
2519
2600
  tickPoints(t, e, n) {
2520
2601
  if (e === "markers") return [t.points[0], t.points[t.points.length - 1]];
2521
- const i = n.lines.filter((s) => s.axis !== t.axis), o = [];
2522
- for (const s of i) {
2523
- const a = Gn(t.points, s.points);
2524
- a && o.push(a);
2602
+ const i = n.lines.filter((o) => o.axis !== t.axis), s = [];
2603
+ for (const o of i) {
2604
+ const a = Yn(t.points, o.points);
2605
+ a && s.push(a);
2525
2606
  }
2526
- return o;
2607
+ return s;
2527
2608
  }
2528
2609
  paintCartograph(t, e) {
2529
2610
  const n = this.graticule;
2530
2611
  if (!n) return;
2531
- const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, o = F(i?.color) ?? "#ffffff", s = (l) => l * e.pxPerMm, a = this.kind;
2532
- t.save(), t.strokeStyle = o, t.fillStyle = o, t.lineWidth = s(0.15);
2612
+ const i = typeof getComputedStyle == "function" ? getComputedStyle(this) : null, s = I(i?.color) ?? "#ffffff", o = (l) => l * e.pxPerMm, a = this.kind;
2613
+ t.save(), t.strokeStyle = s, t.fillStyle = s, t.lineWidth = o(0.15);
2533
2614
  for (const l of n.lines)
2534
2615
  if (a === "solid")
2535
- t.beginPath(), l.points.forEach((c, u) => u === 0 ? t.moveTo(s(c.xMm), s(c.yMm)) : t.lineTo(s(c.xMm), s(c.yMm))), t.stroke();
2616
+ t.beginPath(), l.points.forEach((c, u) => u === 0 ? t.moveTo(o(c.xMm), o(c.yMm)) : t.lineTo(o(c.xMm), o(c.yMm))), t.stroke();
2536
2617
  else
2537
2618
  for (const c of this.tickPoints(l, a, n))
2538
- t.beginPath(), t.moveTo(s(c.xMm - j), s(c.yMm)), t.lineTo(s(c.xMm + j), s(c.yMm)), t.moveTo(s(c.xMm), s(c.yMm - j)), t.lineTo(s(c.xMm), s(c.yMm + j)), t.stroke();
2539
- t.font = `${s(2.2)}px ${i?.fontFamily || "system-ui, sans-serif"}`, t.textBaseline = "alphabetic";
2619
+ t.beginPath(), t.moveTo(o(c.xMm - j), o(c.yMm)), t.lineTo(o(c.xMm + j), o(c.yMm)), t.moveTo(o(c.xMm), o(c.yMm - j)), t.lineTo(o(c.xMm), o(c.yMm + j)), t.stroke();
2620
+ t.font = `${o(2.2)}px ${i?.fontFamily || "system-ui, sans-serif"}`, t.textBaseline = "alphabetic";
2540
2621
  for (const l of n.labels)
2541
- t.textAlign = l.edge === "left" ? "right" : "center", t.fillText(l.text, s(l.xMm), s(l.yMm));
2622
+ t.textAlign = l.edge === "left" ? "right" : "center", t.fillText(l.text, o(l.xMm), o(l.yMm));
2542
2623
  t.restore();
2543
2624
  }
2544
2625
  }
2545
- function Gn(r, t) {
2626
+ function Yn(r, t) {
2546
2627
  let e = null, n = Number.POSITIVE_INFINITY;
2547
2628
  for (const i of r)
2548
- for (const o of t) {
2549
- const s = (i.xMm - o.xMm) ** 2 + (i.yMm - o.yMm) ** 2;
2550
- s < n && (n = s, e = i);
2629
+ for (const s of t) {
2630
+ const o = (i.xMm - s.xMm) ** 2 + (i.yMm - s.yMm) ** 2;
2631
+ o < n && (n = o, e = i);
2551
2632
  }
2552
2633
  return n <= 1 ? e : null;
2553
2634
  }
2554
- k("om-graticule", or);
2555
- function qn(r, t) {
2635
+ x("om-graticule", ur);
2636
+ function Xn(r, t) {
2556
2637
  if (r == null || typeof r != "object") return;
2557
2638
  const e = r.properties;
2558
2639
  return e && t in e ? e[t] : r[t];
2559
2640
  }
2560
- function _t(r, t) {
2641
+ function jt(r, t) {
2561
2642
  if (Array.isArray(r)) {
2562
2643
  if (typeof r[0] == "number") {
2563
2644
  t.push([r[0], r[1]]);
2564
2645
  return;
2565
2646
  }
2566
- for (const e of r) _t(e, t);
2647
+ for (const e of r) jt(e, t);
2567
2648
  }
2568
2649
  }
2569
- function Wn(r) {
2650
+ function Jn(r) {
2570
2651
  return r ? r.tileData != null ? "tiled" : r.asset != null ? "asset" : null : "empty";
2571
2652
  }
2572
- function I(r, t) {
2573
- return qn(r, t);
2653
+ function F(r, t) {
2654
+ return Xn(r, t);
2574
2655
  }
2575
- function Ut(r) {
2656
+ function Gt(r) {
2576
2657
  const t = {}, e = (i) => {
2577
- for (const [o, s] of Object.entries(i))
2578
- s == null || typeof s == "object" || (t[o] = String(s));
2658
+ for (const [s, o] of Object.entries(i))
2659
+ o == null || typeof o == "object" || (t[s] = String(o));
2579
2660
  };
2580
2661
  e(r);
2581
2662
  const n = r.properties;
2582
2663
  return n && typeof n == "object" && e(n), t;
2583
2664
  }
2584
- function Bn(r) {
2665
+ function Zn(r) {
2585
2666
  let t = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
2586
- const o = [], s = r.geometry;
2587
- if (s?.coordinates != null) _t(s.coordinates, o);
2588
- else if (Array.isArray(r.coordinates)) _t(r.coordinates, o);
2667
+ const s = [], o = r.geometry;
2668
+ if (o?.coordinates != null) jt(o.coordinates, s);
2669
+ else if (Array.isArray(r.coordinates)) jt(r.coordinates, s);
2589
2670
  else {
2590
- const a = Number(I(r, "lng") ?? I(r, "longitude") ?? I(r, "lon") ?? I(r, "x")), l = Number(I(r, "lat") ?? I(r, "latitude") ?? I(r, "y"));
2591
- Number.isFinite(a) && Number.isFinite(l) && o.push([a, l]);
2671
+ const a = Number(F(r, "lng") ?? F(r, "longitude") ?? F(r, "lon") ?? F(r, "x")), l = Number(F(r, "lat") ?? F(r, "latitude") ?? F(r, "y"));
2672
+ Number.isFinite(a) && Number.isFinite(l) && s.push([a, l]);
2592
2673
  }
2593
- for (const [a, l] of o)
2674
+ for (const [a, l] of s)
2594
2675
  !Number.isFinite(a) || !Number.isFinite(l) || (t = Math.min(t, a), n = Math.max(n, a), e = Math.min(e, l), i = Math.max(i, l));
2595
2676
  return !Number.isFinite(t) || !Number.isFinite(e) ? null : [t, e, n, i];
2596
2677
  }
2597
- function Kn(r, t) {
2598
- const [e, n, i, o] = r, s = Math.max(i - e, 1e-4), a = Math.max(o - n, 1e-4), l = s * t, c = a * t;
2599
- return [e - l, n - c, i + l, o + c];
2600
- }
2601
- const Ei = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
2602
- function Vn({ features: r, filter: t, sort: e }) {
2603
- let n = t ? r.filter((o) => Hn(t, o)) : [...r];
2604
- const i = Yn(e);
2605
- return i.length > 0 && (n = [...n].sort((o, s) => {
2678
+ function Qn(r, t) {
2679
+ const [e, n, i, s] = r, o = Math.max(i - e, 1e-4), a = Math.max(s - n, 1e-4), l = o * t, c = a * t;
2680
+ return [e - l, n - c, i + l, s + c];
2681
+ }
2682
+ const Fi = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
2683
+ function ti({ features: r, filter: t, sort: e }) {
2684
+ let n = t ? r.filter((s) => ei(t, s)) : [...r];
2685
+ const i = ri(e);
2686
+ return i.length > 0 && (n = [...n].sort((s, o) => {
2606
2687
  for (const { field: a, descending: l } of i) {
2607
- const c = I(o, a), u = I(s, a);
2688
+ const c = F(s, a), u = F(o, a);
2608
2689
  if (c == null && u == null) continue;
2609
2690
  if (c == null) return 1;
2610
2691
  if (u == null) return -1;
2611
- const m = Xn(c, u);
2612
- if (m !== 0) return l ? -m : m;
2692
+ const h = ni(c, u);
2693
+ if (h !== 0) return l ? -h : h;
2613
2694
  }
2614
2695
  return 0;
2615
2696
  })), n;
2616
2697
  }
2617
- function Hn(r, t) {
2698
+ function ei(r, t) {
2618
2699
  try {
2619
2700
  return !!r(t);
2620
2701
  } catch {
2621
2702
  return !1;
2622
2703
  }
2623
2704
  }
2624
- function Yn(r) {
2705
+ function ri(r) {
2625
2706
  return r ? r.split(",").map((t) => t.trim()).filter(Boolean).map((t) => t.startsWith("-") ? { field: t.slice(1), descending: !0 } : { field: t, descending: !1 }) : [];
2626
2707
  }
2627
- function Xn(r, t) {
2708
+ function ni(r, t) {
2628
2709
  return typeof r == "number" && typeof t == "number" ? r - t : String(r).localeCompare(String(t), void 0, { numeric: !0, sensitivity: "base" });
2629
2710
  }
2630
- function Jn(r) {
2711
+ function ii(r) {
2631
2712
  const t = r.replace(/[\x00-\x1f<>:"/\\|?*]+/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 100);
2632
2713
  return t === "" ? "page" : t;
2633
2714
  }
2634
- function Zn(r, t, e) {
2715
+ function si(r, t, e) {
2635
2716
  const n = /* @__PURE__ */ new Map();
2636
- return t.map((i, o) => {
2637
- const s = Ut(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, m) => m === "index" ? String(o + 1) : m === "count" ? String(t.length) : s[m] ?? u), l = Jn(a), c = n.get(l) ?? 0;
2717
+ return t.map((i, s) => {
2718
+ const o = Gt(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, h) => h === "index" ? String(s + 1) : h === "count" ? String(t.length) : o[h] ?? u), l = ii(a), c = n.get(l) ?? 0;
2638
2719
  return n.set(l, c + 1), `${c === 0 ? l : `${l}-${c + 1}`}.${e}`;
2639
2720
  });
2640
2721
  }
2641
- const Ne = "data-om-carto-pager", Qn = "data-om-carto-screen-only", ti = "onlymap-cartograph", ei = "onlymap-cartograph-host";
2642
- class ar extends O {
2722
+ const Le = "data-om-carto-pager", oi = "data-om-carto-screen-only", ai = "onlymap-cartograph", li = "onlymap-cartograph-host";
2723
+ class hr extends O {
2643
2724
  static observedAttributes = [...T["om-atlas"]];
2644
2725
  /**
2645
2726
  * Pages are SNAPSHOTTED when iteration first starts. A streaming or polling
@@ -2689,7 +2770,7 @@ class ar extends O {
2689
2770
  */
2690
2771
  onHostMessage = (t) => {
2691
2772
  const e = t.data;
2692
- !e || e.source !== ei || e.type !== "atlas-seek" || typeof e.index == "number" && Number.isInteger(e.index) && this.seek(e.index);
2773
+ !e || e.source !== li || e.type !== "atlas-seek" || typeof e.index == "number" && Number.isInteger(e.index) && this.seek(e.index);
2693
2774
  };
2694
2775
  /** The frame whose layer drives the iteration — the same `for=` rule every furniture element follows. */
2695
2776
  get frame() {
@@ -2710,16 +2791,16 @@ class ar extends O {
2710
2791
  }
2711
2792
  /** Export filenames, one per page, already de-duplicated. */
2712
2793
  filenames(t = "png") {
2713
- return Zn(this.getAttribute("filename"), this.ensurePages(), t);
2794
+ return si(this.getAttribute("filename"), this.ensurePages(), t);
2714
2795
  }
2715
2796
  /** Human page labels, for an editor's stepper and PDF bookmarks. */
2716
2797
  pageName(t) {
2717
2798
  const e = this.ensurePages()[t];
2718
2799
  if (!e) return `Page ${t + 1}`;
2719
- const n = Ut(e), i = this.getAttribute("page-name");
2800
+ const n = Gt(e), i = this.getAttribute("page-name");
2720
2801
  return i ? i.replace(
2721
2802
  /\{\{\s*atlas\.([\w]+)\s*\}\}/g,
2722
- (o, s) => s === "index" ? String(t + 1) : s === "count" ? String(this.count) : n[s] ?? o
2803
+ (s, o) => o === "index" ? String(t + 1) : o === "count" ? String(this.count) : n[o] ?? s
2723
2804
  ) : n.name ?? n.title ?? `Page ${t + 1}`;
2724
2805
  }
2725
2806
  /**
@@ -2734,11 +2815,11 @@ class ar extends O {
2734
2815
  }
2735
2816
  ensurePages() {
2736
2817
  if (this.pages) return this.pages;
2737
- const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), o = e ? Wn(i) : null;
2738
- if (!e || o)
2739
- return this.rejection = e ? o : null, this.pages = [];
2740
- const s = this.materialize(i);
2741
- return this.pages = Vn({ features: s, filter: this.compileFilter(), sort: this.getAttribute("sort") }), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.pages.length - 1)), this.pages;
2818
+ const e = this.frame?.mapElement?.getLayers?.(), n = this.getAttribute("layer"), i = e?.find((a) => a.id === n), s = e ? Jn(i) : null;
2819
+ if (!e || s)
2820
+ return this.rejection = e ? s : null, this.pages = [];
2821
+ const o = this.materialize(i);
2822
+ return this.pages = ti({ features: o, filter: this.compileFilter(), sort: this.getAttribute("sort") }), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.pages.length - 1)), this.pages;
2742
2823
  }
2743
2824
  /**
2744
2825
  * Rows from the layer, with the layer's OWN declarative filters applied —
@@ -2748,11 +2829,11 @@ class ar extends O {
2748
2829
  materialize(t) {
2749
2830
  const e = J(), n = t.data;
2750
2831
  if (!n) return [];
2751
- const i = e?.asRows ? e.asRows(n) : Array.isArray(n) ? n : [], o = [t.filter, t.categoryFilter].filter(Boolean);
2752
- return o.length === 0 ? i : i.filter(
2753
- (s) => o.every((a) => {
2832
+ const i = e?.asRows ? e.asRows(n) : Array.isArray(n) ? n : [], s = [t.filter, t.categoryFilter].filter(Boolean);
2833
+ return s.length === 0 ? i : i.filter(
2834
+ (o) => s.every((a) => {
2754
2835
  if (!a.field) return !0;
2755
- const l = I(s, a.field);
2836
+ const l = F(o, a.field);
2756
2837
  if (a.range) {
2757
2838
  const c = Number(l);
2758
2839
  return Number.isFinite(c) && c >= a.range[0] && c <= a.range[1];
@@ -2787,14 +2868,14 @@ class ar extends O {
2787
2868
  const t = this.current;
2788
2869
  if (!t) return;
2789
2870
  const e = this.closest("om-cartograph");
2790
- for (const o of e?.querySelectorAll("om-frame") ?? []) {
2791
- if (o.getAttribute("atlas-fit") !== "feature") continue;
2792
- const s = Bn(t);
2793
- if (!s) continue;
2794
- const a = Number(o.getAttribute("atlas-margin")), l = Kn(s, Number.isFinite(a) && a > 0 ? a : 0.15);
2795
- o.fitBounds?.(l);
2796
- }
2797
- e?.setAtlasFields({ ...Ut(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture();
2871
+ for (const s of e?.querySelectorAll("om-frame") ?? []) {
2872
+ if (s.getAttribute("atlas-fit") !== "feature") continue;
2873
+ const o = Zn(t);
2874
+ if (!o) continue;
2875
+ const a = Number(s.getAttribute("atlas-margin")), l = Qn(o, Number.isFinite(a) && a > 0 ? a : 0.15);
2876
+ s.fitBounds?.(l);
2877
+ }
2878
+ e?.setAtlasFields({ ...Gt(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture();
2798
2879
  const n = this.pageName(this.currentIndex);
2799
2880
  this.dispatchEvent(
2800
2881
  new CustomEvent("om-atlas-page", {
@@ -2803,7 +2884,7 @@ class ar extends O {
2803
2884
  })
2804
2885
  ), this.renderPager();
2805
2886
  const i = typeof window < "u" ? window.parent : null;
2806
- i && i !== window && i.postMessage({ source: ti, type: "atlas-page", index: this.currentIndex, count: this.count, name: n }, "*");
2887
+ i && i !== window && i.postMessage({ source: ai, type: "atlas-page", index: this.currentIndex, count: this.count, name: n }, "*");
2807
2888
  }
2808
2889
  /**
2809
2890
  * Draw (or update) the reader's page control on the owning sheet:
@@ -2814,30 +2895,30 @@ class ar extends O {
2814
2895
  renderPager() {
2815
2896
  const t = this.closest("om-cartograph");
2816
2897
  if (!t) return;
2817
- const e = t.querySelector(`:scope > [${Ne}]`), n = this.count;
2898
+ const e = t.querySelector(`:scope > [${Le}]`), n = this.count;
2818
2899
  if (this.getAttribute("pager") === "none" || n === 0) {
2819
2900
  e?.remove(), this.pager = null;
2820
2901
  return;
2821
2902
  }
2822
- const i = this.ownerDocument, o = e ?? i.createElement("div");
2903
+ const i = this.ownerDocument, s = e ?? i.createElement("div");
2823
2904
  if (!e) {
2824
- o.setAttribute(Ne, ""), o.setAttribute(Qn, ""), o.setAttribute("role", "navigation"), o.setAttribute("aria-label", "Atlas pages"), o.style.cssText = "position:absolute;left:50%;bottom:4mm;transform:translateX(-50%);z-index:2147483000;display:flex;align-items:center;gap:8px;padding:4px 10px;border-radius:999px;background:rgba(20,20,24,.82);color:#fff;font:12px/1.2 system-ui,sans-serif;box-shadow:0 2px 10px rgba(0,0,0,.35);user-select:none;pointer-events:auto;";
2825
- for (const [u, m, d] of [
2905
+ s.setAttribute(Le, ""), s.setAttribute(oi, ""), s.setAttribute("role", "navigation"), s.setAttribute("aria-label", "Atlas pages"), s.style.cssText = "position:absolute;left:50%;bottom:4mm;transform:translateX(-50%);z-index:2147483000;display:flex;align-items:center;gap:8px;padding:4px 10px;border-radius:999px;background:rgba(20,20,24,.82);color:#fff;font:12px/1.2 system-ui,sans-serif;box-shadow:0 2px 10px rgba(0,0,0,.35);user-select:none;pointer-events:auto;";
2906
+ for (const [u, h, d] of [
2826
2907
  [-1, "‹", "Previous page"],
2827
2908
  [1, "›", "Next page"]
2828
2909
  ]) {
2829
- const h = i.createElement("button");
2830
- h.type = "button", h.setAttribute("data-om-carto-pager-step", String(u)), h.setAttribute("aria-label", d), h.textContent = m, h.style.cssText = "all:unset;cursor:pointer;padding:0 6px;font-size:16px;line-height:1;color:inherit;", h.addEventListener("click", () => this.seek(this.currentIndex + u)), o.appendChild(h);
2910
+ const m = i.createElement("button");
2911
+ m.type = "button", m.setAttribute("data-om-carto-pager-step", String(u)), m.setAttribute("aria-label", d), m.textContent = h, m.style.cssText = "all:unset;cursor:pointer;padding:0 6px;font-size:16px;line-height:1;color:inherit;", m.addEventListener("click", () => this.seek(this.currentIndex + u)), s.appendChild(m);
2831
2912
  }
2832
2913
  const c = i.createElement("span");
2833
- c.setAttribute("data-om-carto-pager-label", ""), o.insertBefore(c, o.lastElementChild), t.appendChild(o);
2914
+ c.setAttribute("data-om-carto-pager-label", ""), s.insertBefore(c, s.lastElementChild), t.appendChild(s);
2834
2915
  }
2835
- const s = o.querySelector("[data-om-carto-pager-label]");
2836
- s.textContent = `${this.currentIndex + 1} / ${n} · ${this.pageName(this.currentIndex)}`;
2837
- const [a, l] = o.querySelectorAll("button");
2916
+ const o = s.querySelector("[data-om-carto-pager-label]");
2917
+ o.textContent = `${this.currentIndex + 1} / ${n} · ${this.pageName(this.currentIndex)}`;
2918
+ const [a, l] = s.querySelectorAll("button");
2838
2919
  a && (a.disabled = this.currentIndex === 0), l && (l.disabled = this.currentIndex >= n - 1);
2839
2920
  for (const c of [a, l]) c && (c.style.opacity = c.disabled ? ".35" : "1");
2840
- this.pager = o;
2921
+ this.pager = s;
2841
2922
  }
2842
2923
  connectedCallback() {
2843
2924
  super.connectedCallback(), this.ownerDocument.addEventListener("keydown", this.onKeyDown), typeof window < "u" && window.addEventListener("message", this.onHostMessage);
@@ -2853,8 +2934,8 @@ class ar extends O {
2853
2934
  this.style.display = "none", this.refresh();
2854
2935
  }
2855
2936
  }
2856
- k("om-atlas", ar);
2857
- class ri extends De {
2937
+ x("om-atlas", hr);
2938
+ class ci extends Ge {
2858
2939
  static observedAttributes = [...T["om-source"]];
2859
2940
  connectedCallback() {
2860
2941
  this.style.display = "none";
@@ -2868,8 +2949,8 @@ class ri extends De {
2868
2949
  this.closest("om-frame")?.scheduleRender?.();
2869
2950
  }
2870
2951
  }
2871
- const ni = /* @__PURE__ */ new Set(["class", "style", "id", "hidden", "title", "lang", "dir", "slot", "part", "role", "tabindex"]), ii = /* @__PURE__ */ new Set(["style", "script", "img", "template", "om-map"]), si = ["data-om-carto-credit", "data-om-carto-marks", "data-om-carto-flattened"], oi = /* @__PURE__ */ new Set(["om-text", "om-legend", "om-scalebar", "om-north", "om-shape", "om-image"]), ai = /* @__PURE__ */ new Set(["om-frame", "om-legend", "om-scalebar", "om-north", "om-graticule", "om-text", "om-shape", "om-image"]), li = 0.02, ci = (r) => Math.max(0, Number(r.getAttribute("bleed")) || 0);
2872
- function lr(r) {
2952
+ const ui = /* @__PURE__ */ new Set(["class", "style", "id", "hidden", "title", "lang", "dir", "slot", "part", "role", "tabindex"]), hi = /* @__PURE__ */ new Set(["style", "script", "img", "template", "om-map"]), mi = ["data-om-carto-credit", "data-om-carto-marks", "data-om-carto-flattened"], di = /* @__PURE__ */ new Set(["om-text", "om-legend", "om-scalebar", "om-north", "om-shape", "om-image"]), fi = /* @__PURE__ */ new Set(["om-frame", "om-legend", "om-scalebar", "om-north", "om-graticule", "om-text", "om-shape", "om-image"]), pi = 0.02, gi = (r) => Math.max(0, Number(r.getAttribute("bleed")) || 0);
2953
+ function mr(r) {
2873
2954
  const t = r.tagName.toLowerCase();
2874
2955
  return r.id ? `${t}#${r.id}` : t;
2875
2956
  }
@@ -2879,97 +2960,97 @@ function H(r, t) {
2879
2960
  const n = Number(e);
2880
2961
  return Number.isFinite(n) ? n : null;
2881
2962
  }
2882
- function ui(r, t) {
2963
+ function bi(r, t) {
2883
2964
  return r.x < t.x + t.w && t.x < r.x + r.w && r.y < t.y + t.h && t.y < r.y + r.h;
2884
2965
  }
2885
- function hi(r, t) {
2966
+ function yi(r, t) {
2886
2967
  const e = r.getAttribute("style");
2887
2968
  if (!e) return null;
2888
2969
  const n = new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*(-?[\\d.]+)mm`, "i").exec(e);
2889
2970
  return n ? Number(n[1]) : null;
2890
2971
  }
2891
- function cr(r) {
2892
- const t = [], e = (s, a, l, c, u) => {
2893
- t.push({ severity: s, element: lr(a), ...u ? { attribute: u } : {}, message: l, fix: c });
2972
+ function dr(r) {
2973
+ const t = [], e = (o, a, l, c, u) => {
2974
+ t.push({ severity: o, element: mr(a), ...u ? { attribute: u } : {}, message: l, fix: c });
2894
2975
  }, n = [...r.querySelectorAll("om-cartograph")];
2895
2976
  if (n.length === 0 && r.tagName?.toLowerCase() === "om-cartograph" && n.push(r), n.length === 0)
2896
2977
  return { valid: !0, errors: [], warnings: [] };
2897
- for (const s of n) mi(s, e);
2898
- const i = t.filter((s) => s.severity === "error"), o = t.filter((s) => s.severity === "warning");
2899
- return { valid: i.length === 0, errors: i, warnings: o };
2978
+ for (const o of n) wi(o, e);
2979
+ const i = t.filter((o) => o.severity === "error"), s = t.filter((o) => o.severity === "warning");
2980
+ return { valid: i.length === 0, errors: i, warnings: s };
2900
2981
  }
2901
- function mi(r, t) {
2982
+ function wi(r, t) {
2902
2983
  const e = r.getAttribute("size"), n = H(r, "width") != null && H(r, "height") != null;
2903
- e && !te.includes(e) && !n && t(
2984
+ e && !se.includes(e) && !n && t(
2904
2985
  "error",
2905
2986
  r,
2906
2987
  `Unknown page size "${e}" and no width/height to fall back on.`,
2907
- `Use one of ${te.join(", ")}, or give width= and height= in millimetres.`,
2988
+ `Use one of ${se.join(", ")}, or give width= and height= in millimetres.`,
2908
2989
  "size"
2909
2990
  );
2910
2991
  const i = r.getAttribute("cvd");
2911
- i && i.trim().toLowerCase() !== "none" && !Dt(i) && t("warning", r, `Unknown cvd="${i}" — no simulation applied.`, `Use one of ${yr.join(", ")}.`, "cvd"), r.hasAttribute("crop-marks") && ci(r) <= 0 && t("warning", r, "crop-marks needs bleed to draw into — trim marks sit outside the page box.", 'Add bleed="3" (mm), or drop crop-marks.', "crop-marks");
2912
- const o = H(r, "safe-zone");
2913
- if (o != null && o > 0) {
2914
- const h = ht(r.getAttribute("size"), r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation"));
2915
- o * 2 >= Math.min(h.widthMm, h.heightMm) && t("warning", r, `safe-zone=${o}mm leaves no usable area on a ${h.widthMm} × ${h.heightMm} mm page.`, "Use a smaller inset — 5–10mm is typical.", "safe-zone");
2916
- }
2917
- const s = r.getAttribute("format");
2918
- s == null ? t("warning", r, "No format= on the cartograph root.", `Add format="${pt}" so future runtimes can migrate this document.`, "format") : s !== pt && t("warning", r, `Unrecognised document format "${s}".`, `This build understands "${pt}".`, "format");
2919
- const { widthMm: a, heightMm: l } = ht(e, r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation")), c = Math.max(0, H(r, "bleed") ?? 0), u = /* @__PURE__ */ new Set(), m = [...r.querySelectorAll("om-frame")];
2920
- for (const h of m)
2921
- h.id ? u.add(h.id) : t("error", h, "Frame has no id.", "Give every frame an id so furniture can reference it with for=.", "id");
2922
- for (const h of r.children) {
2923
- if (si.some((g) => h.hasAttribute(g))) continue;
2924
- const f = h.tagName.toLowerCase();
2925
- !gt.includes(f) && !ii.has(f) && t("error", h, `<${f}> is not a cartograph element.`, `Use one of ${gt.join(", ")}, or move this content inside an <om-text>.`);
2992
+ i && i.trim().toLowerCase() !== "none" && !qt(i) && t("warning", r, `Unknown cvd="${i}" — no simulation applied.`, `Use one of ${Mr.join(", ")}.`, "cvd"), r.hasAttribute("crop-marks") && gi(r) <= 0 && t("warning", r, "crop-marks needs bleed to draw into — trim marks sit outside the page box.", 'Add bleed="3" (mm), or drop crop-marks.', "crop-marks");
2993
+ const s = H(r, "safe-zone");
2994
+ if (s != null && s > 0) {
2995
+ const m = dt(r.getAttribute("size"), r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation"));
2996
+ s * 2 >= Math.min(m.widthMm, m.heightMm) && t("warning", r, `safe-zone=${s}mm leaves no usable area on a ${m.widthMm} × ${m.heightMm} mm page.`, "Use a smaller inset — 5–10mm is typical.", "safe-zone");
2997
+ }
2998
+ const o = r.getAttribute("format");
2999
+ o == null ? t("warning", r, "No format= on the cartograph root.", `Add format="${bt}" so future runtimes can migrate this document.`, "format") : o !== bt && t("warning", r, `Unrecognised document format "${o}".`, `This build understands "${bt}".`, "format");
3000
+ const { widthMm: a, heightMm: l } = dt(e, r.getAttribute("width"), r.getAttribute("height"), r.getAttribute("orientation")), c = Math.max(0, H(r, "bleed") ?? 0), u = /* @__PURE__ */ new Set(), h = [...r.querySelectorAll("om-frame")];
3001
+ for (const m of h)
3002
+ m.id ? u.add(m.id) : t("error", m, "Frame has no id.", "Give every frame an id so furniture can reference it with for=.", "id");
3003
+ for (const m of r.children) {
3004
+ if (mi.some((g) => m.hasAttribute(g))) continue;
3005
+ const f = m.tagName.toLowerCase();
3006
+ !yt.includes(f) && !hi.has(f) && t("error", m, `<${f}> is not a cartograph element.`, `Use one of ${yt.join(", ")}, or move this content inside an <om-text>.`);
2926
3007
  }
2927
3008
  const d = [];
2928
- for (const h of [r, ...r.querySelectorAll("*")]) {
2929
- const f = h.tagName.toLowerCase();
2930
- if (gt.includes(f) && !h.closest("om-map")) {
2931
- if (di(h, f, t), ai.has(f)) {
2932
- const g = S(h);
2933
- fi(h, g, a, l, c, t), oi.has(f) && !h.hasAttribute("hidden") && d.push({ el: h, box: g });
3009
+ for (const m of [r, ...r.querySelectorAll("*")]) {
3010
+ const f = m.tagName.toLowerCase();
3011
+ if (yt.includes(f) && !m.closest("om-map")) {
3012
+ if (vi(m, f, t), fi.has(f)) {
3013
+ const g = S(m);
3014
+ Ai(m, g, a, l, c, t), di.has(f) && !m.hasAttribute("hidden") && d.push({ el: m, box: g });
2934
3015
  }
2935
- f === "om-frame" && pi(h, t), f === "om-source" && gi(h, t), f === "om-legend" && bi(h, m, t), f === "om-atlas" && yi(h, m, t), f === "om-scalebar" && wi(h, m, t), f === "om-text" && vi(h, m, t);
3016
+ f === "om-frame" && Mi(m, t), f === "om-source" && Si(m, t), f === "om-legend" && Ci(m, h, t), f === "om-atlas" && xi(m, h, t), f === "om-scalebar" && ki(m, h, t), f === "om-text" && $i(m, h, t);
2936
3017
  for (const g of ["for", "overview-of"]) {
2937
- const p = h.getAttribute(g);
2938
- p && !u.has(p) && t("error", h, `${g}="${p}" references no frame on this page.`, `Point it at one of: ${[...u].join(", ") || "(no frames)"}.`, g);
3018
+ const p = m.getAttribute(g);
3019
+ p && !u.has(p) && t("error", m, `${g}="${p}" references no frame on this page.`, `Point it at one of: ${[...u].join(", ") || "(no frames)"}.`, g);
2939
3020
  }
2940
3021
  }
2941
3022
  }
2942
- for (let h = 0; h < d.length; h++)
2943
- for (let f = h + 1; f < d.length; f++) {
2944
- const g = d[h], p = d[f];
2945
- g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 || ui(g.box, p.box) && t(
3023
+ for (let m = 0; m < d.length; m++)
3024
+ for (let f = m + 1; f < d.length; f++) {
3025
+ const g = d[m], p = d[f];
3026
+ g.box.w <= 0 || g.box.h <= 0 || p.box.w <= 0 || p.box.h <= 0 || bi(g.box, p.box) && t(
2946
3027
  "warning",
2947
3028
  g.el,
2948
- `Overlaps ${lr(p.el)} on the page.`,
3029
+ `Overlaps ${mr(p.el)} on the page.`,
2949
3030
  "Move one of them — furniture overlapping furniture usually means a stale layout (frames may sit under anything)."
2950
3031
  );
2951
3032
  }
2952
3033
  }
2953
- function di(r, t, e) {
3034
+ function vi(r, t, e) {
2954
3035
  const n = new Set(T[t] ?? []);
2955
3036
  for (const i of r.attributes) {
2956
- const o = i.name.toLowerCase();
2957
- if (n.has(o) || ni.has(o) || o.startsWith("data-") || o.startsWith("aria-")) continue;
2958
- const s = Tr.get(o);
2959
- if (s) {
2960
- e("warning", r, `Attribute "${o}" has no effect: ${s}`, "Remove it, or use the documented alternative.", o);
3037
+ const s = i.name.toLowerCase();
3038
+ if (n.has(s) || ui.has(s) || s.startsWith("data-") || s.startsWith("aria-")) continue;
3039
+ const o = Ur.get(s);
3040
+ if (o) {
3041
+ e("warning", r, `Attribute "${s}" has no effect: ${o}`, "Remove it, or use the documented alternative.", s);
2961
3042
  continue;
2962
3043
  }
2963
- e("warning", r, `Unknown attribute "${o}" on <${t}> — likely a typo.`, `Valid attributes: ${[...n].join(", ")}.`, o);
3044
+ e("warning", r, `Unknown attribute "${s}" on <${t}> — likely a typo.`, `Valid attributes: ${[...n].join(", ")}.`, s);
2964
3045
  }
2965
3046
  }
2966
- function fi(r, t, e, n, i, o) {
3047
+ function Ai(r, t, e, n, i, s) {
2967
3048
  if (t.w <= 0 || t.h <= 0) {
2968
- o("error", r, `Element has no size (w=${t.w}, h=${t.h}).`, "Give w= and h= in millimetres — both greater than zero.", t.w <= 0 ? "w" : "h");
3049
+ s("error", r, `Element has no size (w=${t.w}, h=${t.h}).`, "Give w= and h= in millimetres — both greater than zero.", t.w <= 0 ? "w" : "h");
2969
3050
  return;
2970
3051
  }
2971
- const s = -i, a = e + i, l = n + i;
2972
- (t.x < s || t.y < s || t.x + t.w > a + 1e-6 || t.y + t.h > l + 1e-6) && o(
3052
+ const o = -i, a = e + i, l = n + i;
3053
+ (t.x < o || t.y < o || t.x + t.w > a + 1e-6 || t.y + t.h > l + 1e-6) && s(
2973
3054
  "error",
2974
3055
  r,
2975
3056
  `Element box (${t.x}, ${t.y}, ${t.w} × ${t.h} mm) falls outside the ${e} × ${n} mm page${i ? ` (+${i}mm bleed)` : ""}.`,
@@ -2981,18 +3062,18 @@ function fi(r, t, e, n, i, o) {
2981
3062
  ["width", t.w],
2982
3063
  ["height", t.h]
2983
3064
  ];
2984
- for (const [u, m] of c) {
2985
- const d = hi(r, u);
2986
- d != null && Math.abs(d - m) > 0.01 && o(
3065
+ for (const [u, h] of c) {
3066
+ const d = yi(r, u);
3067
+ d != null && Math.abs(d - h) > 0.01 && s(
2987
3068
  "error",
2988
3069
  r,
2989
- `Inline style ${u}:${d}mm disagrees with the placement attribute (${m}mm).`,
3070
+ `Inline style ${u}:${d}mm disagrees with the placement attribute (${h}mm).`,
2990
3071
  "The attributes are authoritative — make the inline style match, or drop it and let the runtime write it.",
2991
3072
  "style"
2992
3073
  );
2993
3074
  }
2994
3075
  }
2995
- function pi(r, t) {
3076
+ function Mi(r, t) {
2996
3077
  if ((r.getAttribute("mode") === "static" ? "static" : "live") === "static") {
2997
3078
  const n = r.getAttribute("corners"), i = X(n);
2998
3079
  i || t(
@@ -3001,20 +3082,20 @@ function pi(r, t) {
3001
3082
  n == null ? "Static frame has no corners=." : `Static frame has malformed corners= ("${n}").`,
3002
3083
  'Give four lon/lat pairs in tl, tr, br, bl order — corners="[[lng,lat],[lng,lat],[lng,lat],[lng,lat]]".',
3003
3084
  "corners"
3004
- ), !r.querySelector(":scope > img") && !r.querySelector(`:scope > svg[${Et}]`) && t(
3085
+ ), !r.querySelector(":scope > img") && !r.querySelector(`:scope > svg[${Lt}]`) && t(
3005
3086
  "error",
3006
3087
  r,
3007
3088
  "Static frame has no <img> or inline <svg> child to place.",
3008
3089
  'Add the georeferenced picture as a child — an <img> raster, or the inline <svg> that snapshot({format: "svg"}) produces.'
3009
3090
  );
3010
- const o = S(r), s = Y(r.getAttribute("crs"));
3011
- if (i && s && o.w > 0 && o.h > 0) {
3012
- const a = tt({ corners: i, widthMm: o.w, heightMm: o.h, crsForward: s });
3091
+ const s = S(r), o = Y(r.getAttribute("crs"));
3092
+ if (i && o && s.w > 0 && s.h > 0) {
3093
+ const a = tt({ corners: i, widthMm: s.w, heightMm: s.h, crsForward: o });
3013
3094
  if (a.degenerate)
3014
3095
  t("error", r, "Frame corners are degenerate (collinear or coincident) — nothing can be placed on this frame.", "Check the corner order: tl, tr, br, bl.", "corners");
3015
3096
  else {
3016
- const l = fn(a);
3017
- l != null && l > li && t(
3097
+ const l = An(a);
3098
+ l != null && l > pi && t(
3018
3099
  "warning",
3019
3100
  r,
3020
3101
  `Ground scale varies ${(l * 100).toFixed(1)}% across this frame, so a single scale bar is only true near its anchor.`,
@@ -3023,7 +3104,7 @@ function pi(r, t) {
3023
3104
  }
3024
3105
  }
3025
3106
  } else {
3026
- ut(r) || t(
3107
+ mt(r) || t(
3027
3108
  "error",
3028
3109
  r,
3029
3110
  "Live frame has no valid camera.",
@@ -3069,7 +3150,7 @@ function pi(r, t) {
3069
3150
  );
3070
3151
  }
3071
3152
  }
3072
- function gi(r, t) {
3153
+ function Si(r, t) {
3073
3154
  const e = r.parentElement;
3074
3155
  if (e?.tagName.toLowerCase() !== "om-frame") {
3075
3156
  t(
@@ -3085,7 +3166,7 @@ function gi(r, t) {
3085
3166
  t("error", r, "<om-source> has no src=.", "Give it a map document (.html) or a capture image.", "src");
3086
3167
  return;
3087
3168
  }
3088
- const i = It(n);
3169
+ const i = Dt(n);
3089
3170
  if (!i) {
3090
3171
  t(
3091
3172
  "error",
@@ -3097,22 +3178,22 @@ function gi(r, t) {
3097
3178
  return;
3098
3179
  }
3099
3180
  if (i === "raster") {
3100
- const o = r.getAttribute("corners");
3101
- X(o) || t(
3181
+ const s = r.getAttribute("corners");
3182
+ X(s) || t(
3102
3183
  "error",
3103
3184
  r,
3104
- o == null ? "A capture <om-source> has no corners=, so nothing on the sheet could be placed against it." : `A capture <om-source> has malformed corners= ("${o}").`,
3185
+ s == null ? "A capture <om-source> has no corners=, so nothing on the sheet could be placed against it." : `A capture <om-source> has malformed corners= ("${s}").`,
3105
3186
  'Give four lon/lat pairs in tl, tr, br, bl order — corners="[[lng,lat],[lng,lat],[lng,lat],[lng,lat]]". These are the coordinates that were true when the capture was taken.',
3106
3187
  "corners"
3107
3188
  );
3108
3189
  } else
3109
- for (const o of ["corners", "crs", "crs-def"])
3110
- r.hasAttribute(o) && t(
3190
+ for (const s of ["corners", "crs", "crs-def"])
3191
+ r.hasAttribute(s) && t(
3111
3192
  "warning",
3112
3193
  r,
3113
- `${o}= is ignored on a map-document <om-source> — a map carries its own projection and its corners come from the frame's camera.`,
3194
+ `${s}= is ignored on a map-document <om-source> — a map carries its own projection and its corners come from the frame's camera.`,
3114
3195
  "Remove it. It belongs on a capture <om-source>, whose georeference is otherwise unknowable.",
3115
- o
3196
+ s
3116
3197
  );
3117
3198
  e.getAttribute("mode") === "static" && t(
3118
3199
  "warning",
@@ -3121,12 +3202,12 @@ function gi(r, t) {
3121
3202
  'Remove mode="static" to let the frame resolve its sources, or drop the <om-source>.'
3122
3203
  );
3123
3204
  }
3124
- function Wt(r, t) {
3205
+ function Yt(r, t) {
3125
3206
  const e = r.getAttribute("for");
3126
3207
  return e ? t.find((n) => n.id === e) : t.length === 1 ? t[0] : void 0;
3127
3208
  }
3128
- function bi(r, t, e) {
3129
- const n = r.getAttribute("derived") !== "false", i = Wt(r, t);
3209
+ function Ci(r, t, e) {
3210
+ const n = r.getAttribute("derived") !== "false", i = Yt(r, t);
3130
3211
  n && i?.getAttribute("mode") === "static" && e(
3131
3212
  "warning",
3132
3213
  r,
@@ -3134,30 +3215,30 @@ function bi(r, t, e) {
3134
3215
  'Write the rows as <om-legend-row color= label= shape=> children and set derived="false".',
3135
3216
  "derived"
3136
3217
  );
3137
- const o = ir(r);
3138
- if (o.length < 2) return;
3139
- const s = Ar(o.map((a) => ({ label: a.label, color: a.color, layer: a.layerId })));
3140
- if (s.collapses.length > 0 && s.worstType) {
3141
- const a = s.collapses.filter((c) => c.type === s.worstType), l = a.slice(0, 3).map((c) => `"${c.a.label}"/"${c.b.label}"`).join(", ");
3218
+ const s = lr(r);
3219
+ if (s.length < 2) return;
3220
+ const o = xr(s.map((a) => ({ label: a.label, color: a.color, layer: a.layerId })));
3221
+ if (o.collapses.length > 0 && o.worstType) {
3222
+ const a = o.collapses.filter((c) => c.type === o.worstType), l = a.slice(0, 3).map((c) => `"${c.a.label}"/"${c.b.label}"`).join(", ");
3142
3223
  e(
3143
3224
  "warning",
3144
3225
  r,
3145
- `Under ${s.worstType}, ${a.length === 1 ? "one legend pair becomes" : `${a.length} legend pairs become`} indistinguishable: ${l}.`,
3226
+ `Under ${o.worstType}, ${a.length === 1 ? "one legend pair becomes" : `${a.length} legend pairs become`} indistinguishable: ${l}.`,
3146
3227
  "Pick colours that differ in lightness as well as hue, or add a pattern or label to separate them."
3147
3228
  );
3148
3229
  }
3149
3230
  }
3150
- function yi(r, t, e) {
3231
+ function xi(r, t, e) {
3151
3232
  const n = r.getAttribute("pager");
3152
3233
  n != null && n !== "auto" && n !== "none" && e("warning", r, `pager="${n}" is not a value; the control is drawn as if "auto".`, 'Use pager="none" to remove the on-screen page control, or omit the attribute.', "pager");
3153
3234
  const i = r.getAttribute("layer");
3154
3235
  i || e("error", r, "Atlas has no layer= to iterate.", 'Name a layer inside the frame, e.g. layer="parcels".', "layer");
3155
- const o = r.getAttribute("for"), s = Wt(r, t);
3156
- if (!s) {
3157
- !o && t.length !== 1 && e("error", r, `Atlas does not say which frame drives it, and the page has ${t.length} frames.`, 'Add for="<frame id>".', "for");
3236
+ const s = r.getAttribute("for"), o = Yt(r, t);
3237
+ if (!o) {
3238
+ !s && t.length !== 1 && e("error", r, `Atlas does not say which frame drives it, and the page has ${t.length} frames.`, 'Add for="<frame id>".', "for");
3158
3239
  return;
3159
3240
  }
3160
- if (s.getAttribute("mode") === "static") {
3241
+ if (o.getAttribute("mode") === "static") {
3161
3242
  e(
3162
3243
  "error",
3163
3244
  r,
@@ -3167,11 +3248,11 @@ function yi(r, t, e) {
3167
3248
  );
3168
3249
  return;
3169
3250
  }
3170
- const a = s.querySelector(":scope > om-map");
3251
+ const a = o.querySelector(":scope > om-map");
3171
3252
  if (a && i) {
3172
3253
  const l = [...a.querySelectorAll("om-layer")].find((u) => u.id === i);
3173
3254
  if (!l) {
3174
- e("error", r, `Atlas layer "${i}" is not in frame #${s.id}'s map.`, "Check the layer id, or point the atlas at the frame that has it.", "layer");
3255
+ e("error", r, `Atlas layer "${i}" is not in frame #${o.id}'s map.`, "Check the layer id, or point the atlas at the frame that has it.", "layer");
3175
3256
  return;
3176
3257
  }
3177
3258
  const c = l.getAttribute("data") ?? "";
@@ -3184,14 +3265,14 @@ function yi(r, t, e) {
3184
3265
  );
3185
3266
  }
3186
3267
  }
3187
- function wi(r, t, e) {
3268
+ function ki(r, t, e) {
3188
3269
  const n = H(r, "segment-length");
3189
3270
  if (n == null) return;
3190
- const i = Wt(r, t);
3271
+ const i = Yt(r, t);
3191
3272
  if (!i) return;
3192
- const o = X(i.getAttribute("corners")), s = Y(i.getAttribute("crs")), a = S(i);
3193
- if (!o || !s || a.w <= 0 || a.h <= 0) return;
3194
- const l = tt({ corners: o, widthMm: a.w, heightMm: a.h, crsForward: s }), c = S(r), u = je({
3273
+ const s = X(i.getAttribute("corners")), o = Y(i.getAttribute("crs")), a = S(i);
3274
+ if (!s || !o || a.w <= 0 || a.h <= 0) return;
3275
+ const l = tt({ corners: s, widthMm: a.w, heightMm: a.h, crsForward: o }), c = S(r), u = Be({
3195
3276
  groundMetersPerMm: l.groundMetersPerMm(),
3196
3277
  maxWidthMm: c.w,
3197
3278
  segments: H(r, "segments") ?? void 0,
@@ -3205,148 +3286,148 @@ function wi(r, t, e) {
3205
3286
  "segment-length"
3206
3287
  );
3207
3288
  }
3208
- function vi(r, t, e) {
3209
- const n = r.textContent ?? "", i = /* @__PURE__ */ new Set(["title", "attribution", "date", "notes", "scale", "crs"]), o = new Set(t.map((s) => s.id).filter(Boolean));
3210
- for (const s of jr(n))
3211
- if (!s.startsWith("atlas.")) {
3212
- if (s.startsWith("frame.")) {
3213
- const a = s.slice(6), l = a.lastIndexOf("."), c = l > 0 ? a.slice(0, l) : "", u = l > 0 ? a.slice(l + 1) : "";
3214
- o.has(c) ? u !== "scale" && u !== "crs" && e("warning", r, `{{${s}}} — frames provide scale and crs.`, `Use {{frame.${c}.scale}} or {{frame.${c}.crs}}.`) : e("warning", r, `{{${s}}} references no frame with id "${c}".`, `Frames on this page: ${[...o].join(", ") || "(none)"}.`);
3289
+ function $i(r, t, e) {
3290
+ const n = r.textContent ?? "", i = /* @__PURE__ */ new Set(["title", "attribution", "date", "notes", "scale", "crs"]), s = new Set(t.map((o) => o.id).filter(Boolean));
3291
+ for (const o of Hr(n))
3292
+ if (!o.startsWith("atlas.")) {
3293
+ if (o.startsWith("frame.")) {
3294
+ const a = o.slice(6), l = a.lastIndexOf("."), c = l > 0 ? a.slice(0, l) : "", u = l > 0 ? a.slice(l + 1) : "";
3295
+ s.has(c) ? u !== "scale" && u !== "crs" && e("warning", r, `{{${o}}} — frames provide scale and crs.`, `Use {{frame.${c}.scale}} or {{frame.${c}.crs}}.`) : e("warning", r, `{{${o}}} references no frame with id "${c}".`, `Frames on this page: ${[...s].join(", ") || "(none)"}.`);
3215
3296
  continue;
3216
3297
  }
3217
- if ((s === "scale" || s === "crs") && t.length !== 1) {
3298
+ if ((o === "scale" || o === "crs") && t.length !== 1) {
3218
3299
  e(
3219
3300
  "warning",
3220
3301
  r,
3221
- `{{${s}}} is ambiguous with ${t.length} frames on the page.`,
3222
- `Name the frame: {{frame.<id>.${s}}}.`
3302
+ `{{${o}}} is ambiguous with ${t.length} frames on the page.`,
3303
+ `Name the frame: {{frame.<id>.${o}}}.`
3223
3304
  );
3224
3305
  continue;
3225
3306
  }
3226
- i.has(s) || e("warning", r, `Unknown token {{${s}}} — it will render literally.`, `Known tokens: ${[...i].join(", ")}, frame.<id>.scale, frame.<id>.crs, atlas.<field>.`);
3307
+ i.has(o) || e("warning", r, `Unknown token {{${o}}} — it will render literally.`, `Known tokens: ${[...i].join(", ")}, frame.<id>.scale, frame.<id>.crs, atlas.<field>.`);
3227
3308
  }
3228
3309
  }
3229
- function Ni(r) {
3230
- return cr(Pr(r));
3310
+ function Oi(r) {
3311
+ return dr(Ir(r));
3231
3312
  }
3232
- async function Pi(r) {
3233
- const t = cr(r), e = [...r.querySelectorAll("om-frame")].filter((a) => a.querySelector(":scope > om-map"));
3313
+ async function _i(r) {
3314
+ const t = dr(r), e = [...r.querySelectorAll("om-frame")].filter((a) => a.querySelector(":scope > om-map"));
3234
3315
  if (e.length === 0) return t;
3235
- const { loadCore: n } = await Promise.resolve().then(() => fr), i = await n(), o = [...t.errors], s = [...t.warnings];
3316
+ const { loadCore: n } = await Promise.resolve().then(() => yr), i = await n(), s = [...t.errors], o = [...t.warnings];
3236
3317
  for (const a of e) {
3237
3318
  const l = a.id ? `om-frame#${a.id}` : "om-frame", c = i.validateManifest(a);
3238
- for (const u of c.errors) o.push({ ...u, element: `${l} > ${u.element}` });
3239
- for (const u of c.warnings) s.push({ ...u, element: `${l} > ${u.element}` });
3319
+ for (const u of c.errors) s.push({ ...u, element: `${l} > ${u.element}` });
3320
+ for (const u of c.warnings) o.push({ ...u, element: `${l} > ${u.element}` });
3240
3321
  }
3241
- return { valid: o.length === 0, errors: o, warnings: s };
3322
+ return { valid: s.length === 0, errors: s, warnings: o };
3242
3323
  }
3243
- function Ti() {
3244
- k("om-cartograph", He), k("om-text", Ye), k("om-frame", Qe), k("om-scalebar", tr), k("om-north", er), k("om-shape", rr), k("om-image", nr), k("om-legend", sr), k("om-graticule", or), k("om-atlas", ar), k("om-source", ri);
3324
+ function Ui() {
3325
+ x("om-cartograph", Ze), x("om-text", Qe), x("om-frame", nr), x("om-scalebar", ir), x("om-north", sr), x("om-shape", or), x("om-image", ar), x("om-legend", cr), x("om-graticule", ur), x("om-atlas", hr), x("om-source", ci);
3245
3326
  }
3246
- Pe(() => import("@nika-js/onlymap"));
3247
- Nr();
3327
+ Re(() => import("@nika-js/onlymap"));
3328
+ Rr();
3248
3329
  export {
3249
3330
  T as CARTOGRAPH_ELEMENT_ATTRS,
3250
- pt as CARTOGRAPH_FORMAT,
3251
- gt as CARTOGRAPH_TAG_NAMES,
3252
- Ai as CARTOGRAPH_THEMES,
3253
- vr as COLLAPSE_THRESHOLD,
3254
- zt as CVD_MATRICES,
3255
- mt as CVD_TYPES,
3256
- yr as CVD_VALUES,
3257
- Ot as GEOGRAPHIC_PLANE,
3258
- Tr as INERT_RESERVED_CARTOGRAPH_ATTRS,
3259
- Ie as MAX_CANVAS_AREA,
3260
- Fe as MAX_CANVAS_DIMENSION,
3261
- kt as MAX_CATEGORY_ENTRIES,
3262
- ar as OmAtlasElement,
3263
- He as OmCartographElement,
3264
- Qe as OmFrameElement,
3265
- or as OmGraticuleElement,
3266
- nr as OmImageElement,
3267
- sr as OmLegendElement,
3268
- er as OmNorthElement,
3269
- tr as OmScalebarElement,
3270
- rr as OmShapeElement,
3271
- Ye as OmTextElement,
3272
- Kt as PAGE_PRESETS,
3273
- te as PAGE_SIZE_NAMES,
3331
+ bt as CARTOGRAPH_FORMAT,
3332
+ yt as CARTOGRAPH_TAG_NAMES,
3333
+ Ei as CARTOGRAPH_THEMES,
3334
+ Cr as COLLAPSE_THRESHOLD,
3335
+ Wt as CVD_MATRICES,
3336
+ ft as CVD_TYPES,
3337
+ Mr as CVD_VALUES,
3338
+ zt as GEOGRAPHIC_PLANE,
3339
+ Ur as INERT_RESERVED_CARTOGRAPH_ATTRS,
3340
+ Ue as MAX_CANVAS_AREA,
3341
+ _e as MAX_CANVAS_DIMENSION,
3342
+ Nt as MAX_CATEGORY_ENTRIES,
3343
+ hr as OmAtlasElement,
3344
+ Ze as OmCartographElement,
3345
+ nr as OmFrameElement,
3346
+ ur as OmGraticuleElement,
3347
+ ar as OmImageElement,
3348
+ cr as OmLegendElement,
3349
+ sr as OmNorthElement,
3350
+ ir as OmScalebarElement,
3351
+ or as OmShapeElement,
3352
+ Qe as OmTextElement,
3353
+ Jt as PAGE_PRESETS,
3354
+ se as PAGE_SIZE_NAMES,
3274
3355
  z as PLACED_ATTR_NAMES,
3275
3356
  D as PX_PER_MM,
3276
- Ur as SCALE_GROUP_SEPARATOR,
3277
- $r as URL_ACTION_TIMEOUT_MS,
3278
- Yr as alignOffset,
3279
- Ke as allFrames,
3280
- Mr as applyCvdToCanvas,
3281
- Gr as applyTokens,
3282
- Er as applyUrlActions,
3283
- Ut as atlasFields,
3284
- Ei as boundsArea,
3357
+ Br as SCALE_GROUP_SEPARATOR,
3358
+ Tr as URL_ACTION_TIMEOUT_MS,
3359
+ rn as alignOffset,
3360
+ Xe as allFrames,
3361
+ kr as applyCvdToCanvas,
3362
+ Yr as applyTokens,
3363
+ Lr as applyUrlActions,
3364
+ Gt as atlasFields,
3365
+ Fi as boundsArea,
3285
3366
  S as boxMm,
3286
- _n as buildGraticule,
3287
- Vn as buildPages,
3288
- je as buildScalebar,
3289
- _r as buildScalebarDrawing,
3367
+ Wn as buildGraticule,
3368
+ ti as buildPages,
3369
+ Be as buildScalebar,
3370
+ Wr as buildScalebarDrawing,
3290
3371
  Y as builtinCrsForward,
3291
- Mi as canvasMeasurer,
3292
- Br as clearUnlinked,
3293
- xi as cornersFromBounds,
3294
- Ft as cornersFromCamera,
3372
+ Ni as canvasMeasurer,
3373
+ Zr as clearUnlinked,
3374
+ Ri as cornersFromBounds,
3375
+ Ut as cornersFromCamera,
3295
3376
  tt as createFrameGeoref,
3296
- br as createZip,
3297
- Ti as defineCartographElements,
3298
- Xt as deltaE00,
3299
- Rn as deriveLegendRows,
3300
- Sr as ensureCvdFilters,
3301
- Bn as featureBounds,
3302
- I as fieldOf,
3303
- Be as findFrame,
3304
- zn as formatDms,
3305
- Dr as formatScaleDenominator,
3306
- Nr as installUrlActions,
3307
- dr as isCoreLoaded,
3308
- qr as isoDate,
3309
- Hr as layoutText,
3310
- Ar as lintLegendColours,
3311
- Te as loadCore,
3312
- $i as maxGeoreferenceablePitch,
3313
- Si as mercatorForward,
3314
- Ci as mercatorInverse,
3315
- Ce as niceInterval,
3316
- ze as niceNumberBelow,
3317
- Lt as normalizeCrs,
3318
- dn as northBearingDegrees,
3319
- We as ownerCartograph,
3320
- Kn as padBounds,
3321
- Bt as paintEnvForDpi,
3322
- wr as parseColor,
3377
+ Ar as createZip,
3378
+ Ui as defineCartographElements,
3379
+ ee as deltaE00,
3380
+ zn as deriveLegendRows,
3381
+ $r as ensureCvdFilters,
3382
+ Zn as featureBounds,
3383
+ F as fieldOf,
3384
+ Ye as findFrame,
3385
+ Vn as formatDms,
3386
+ Kr as formatScaleDenominator,
3387
+ Rr as installUrlActions,
3388
+ br as isCoreLoaded,
3389
+ Xr as isoDate,
3390
+ en as layoutText,
3391
+ xr as lintLegendColours,
3392
+ Ie as loadCore,
3393
+ Ii as maxGeoreferenceablePitch,
3394
+ Pi as mercatorForward,
3395
+ Ti as mercatorInverse,
3396
+ $e as niceInterval,
3397
+ We as niceNumberBelow,
3398
+ Ot as normalizeCrs,
3399
+ vn as northBearingDegrees,
3400
+ He as ownerCartograph,
3401
+ Qn as padBounds,
3402
+ Xt as paintEnvForDpi,
3403
+ Sr as parseColor,
3323
3404
  X as parseCorners,
3324
- Yn as parseSort,
3405
+ ri as parseSort,
3325
3406
  J as peekCore,
3326
- ut as readCamera,
3327
- ir as readLiteralRows,
3328
- On as readOverrides,
3407
+ mt as readCamera,
3408
+ lr as readLiteralRows,
3409
+ qn as readOverrides,
3329
3410
  U as referencedFrame,
3330
- Wn as rejectionFor,
3331
- jt as renderCartograph,
3332
- _e as renderCartographAtlas,
3333
- Rt as resolveCrsForward,
3334
- Dt as resolveCvdType,
3335
- Zn as resolveFilenames,
3336
- ht as resolvePageSize,
3337
- zr as resolveToken,
3338
- qe as resolveTokens,
3339
- Ln as rowColorFor,
3340
- gn as sanitizeAdoptedMap,
3341
- Jn as sanitizeFilename,
3342
- fn as scaleVariation,
3343
- Pe as setCoreLoader,
3344
- Ht as simulate,
3345
- Tn as swatchShapeFor,
3346
- jr as tokensIn,
3347
- ki as utmDef,
3348
- cr as validateCartograph,
3349
- Pi as validateCartographDeep,
3350
- Ni as validateCartographString,
3351
- Qt as whenPageReady
3411
+ Jn as rejectionFor,
3412
+ Bt as renderCartograph,
3413
+ ze as renderCartographAtlas,
3414
+ _t as resolveCrsForward,
3415
+ qt as resolveCvdType,
3416
+ si as resolveFilenames,
3417
+ dt as resolvePageSize,
3418
+ Vr as resolveToken,
3419
+ Ve as resolveTokens,
3420
+ Dn as rowColorFor,
3421
+ Sn as sanitizeAdoptedMap,
3422
+ ii as sanitizeFilename,
3423
+ An as scaleVariation,
3424
+ Re as setCoreLoader,
3425
+ Qt as simulate,
3426
+ Un as swatchShapeFor,
3427
+ Hr as tokensIn,
3428
+ Li as utmDef,
3429
+ dr as validateCartograph,
3430
+ _i as validateCartographDeep,
3431
+ Oi as validateCartographString,
3432
+ ie as whenPageReady
3352
3433
  };