@thibezer/ui-components-kit 2.28.1 → 2.28.2

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 (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/camadas.cjs +43 -43
  3. package/dist/camadas.js +788 -802
  4. package/dist/canvas.cjs +38 -38
  5. package/dist/canvas.js +1045 -1022
  6. package/dist/components/ui-camadas/camadas-metricas.d.ts +2 -3
  7. package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +12 -0
  8. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +6 -1
  9. package/dist/custom-elements.json +26706 -26600
  10. package/dist/feature_caixa-BLVtatpp.cjs +1 -0
  11. package/dist/feature_caixa-CHAdzESq.js +806 -0
  12. package/dist/{feature_desenho-BH-E1Q9Q.cjs → feature_desenho-DRHnu8u8.cjs} +1 -1
  13. package/dist/{feature_desenho-CC8Mp5Gp.js → feature_desenho-edf-dHuf.js} +2 -2
  14. package/dist/feature_metricas-CKQGG2nz.cjs +1 -0
  15. package/dist/feature_metricas-DGfd21VR.js +130 -0
  16. package/dist/geometria-px-DEAIxMG5.js +512 -0
  17. package/dist/geometria-px-DJcNHXbE.cjs +1 -0
  18. package/dist/gerencigeo-canvas/dms.d.ts +7 -0
  19. package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +1 -4
  20. package/dist/gerencigeo-canvas/utils.d.ts +1 -3
  21. package/dist/mapa.cjs +1 -1
  22. package/dist/mapa.js +1 -1
  23. package/dist/motor.cjs +1 -1
  24. package/dist/motor.js +113 -111
  25. package/dist/prancha-nucleo.cjs +3 -3
  26. package/dist/prancha-nucleo.js +283 -282
  27. package/dist/prancha.cjs +1 -1
  28. package/dist/prancha.js +3 -3
  29. package/dist/utils-B2HuBLwz.js +108 -0
  30. package/dist/utils-DpPysTeU.cjs +1 -0
  31. package/package.json +1 -1
  32. package/dist/feature_caixa-4M4MkFH7.cjs +0 -1
  33. package/dist/feature_caixa-BVc5LenS.js +0 -824
  34. package/dist/geometria-px-Cyi_oPD6.cjs +0 -1
  35. package/dist/geometria-px-DHMPUsxC.js +0 -639
  36. package/dist/utils-ClVgqVyJ.cjs +0 -1
  37. package/dist/utils-DrHoxxmf.js +0 -83
@@ -0,0 +1,512 @@
1
+ var W = Object.defineProperty;
2
+ var tt = (t, n, o) => n in t ? W(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
+ var f = (t, n, o) => tt(t, typeof n != "symbol" ? n + "" : n, o);
4
+ import { l as nt, p as V, b as ot } from "./feature_metricas-DGfd21VR.js";
5
+ const y = 16, it = 256;
6
+ function T(t, n) {
7
+ const [[o, i], [a, e]] = nt(t.geometria, n);
8
+ return { minLon: i, minLat: o, maxLon: e, maxLat: a };
9
+ }
10
+ function I(t, n) {
11
+ return t.minLon <= n.maxLon && t.maxLon >= n.minLon && t.minLat <= n.maxLat && t.maxLat >= n.minLat;
12
+ }
13
+ function j(t) {
14
+ let n = 1 / 0, o = 1 / 0, i = -1 / 0, a = -1 / 0;
15
+ for (const e of t)
16
+ e.minLon < n && (n = e.minLon), e.minLat < o && (o = e.minLat), e.maxLon > i && (i = e.maxLon), e.maxLat > a && (a = e.maxLat);
17
+ return { minLon: n, minLat: o, maxLon: i, maxLat: a };
18
+ }
19
+ function O(t) {
20
+ const n = t.length, o = Math.ceil(n / y), a = Math.ceil(Math.sqrt(o)) * y, e = [...t].sort((r, c) => r.minLon + r.maxLon - (c.minLon + c.maxLon)), s = [];
21
+ for (let r = 0; r < n; r += a) {
22
+ const c = e.slice(r, r + a).sort((u, d) => u.minLat + u.maxLat - (d.minLat + d.maxLat));
23
+ for (let u = 0; u < c.length; u += y) s.push(c.slice(u, u + y));
24
+ }
25
+ return s;
26
+ }
27
+ function at(t) {
28
+ if (t.length === 0) return null;
29
+ let n = O(t).map((o) => ({ ...j(o), folhas: o }));
30
+ for (; n.length > 1; )
31
+ n = O(n).map((o) => ({ ...j(o), filhos: o }));
32
+ return n[0];
33
+ }
34
+ class Dt {
35
+ /** `espaco` define o envelope do círculo (sem ele, o geográfico de sempre). */
36
+ constructor(n) {
37
+ f(this, "raiz", null);
38
+ /** Itens vivos: a fonte da verdade (a árvore pode conter itens já removidos/atualizados). */
39
+ f(this, "itens", /* @__PURE__ */ new Map());
40
+ /** Itens que entraram ou mudaram depois da última montagem. */
41
+ f(this, "delta", /* @__PURE__ */ new Map());
42
+ /** Ids que estão na árvore mas foram removidos ou substituídos. */
43
+ f(this, "obsoletos", /* @__PURE__ */ new Set());
44
+ this.espaco = n;
45
+ }
46
+ get tamanho() {
47
+ return this.itens.size;
48
+ }
49
+ construir(n) {
50
+ this.itens.clear();
51
+ for (const o of n)
52
+ o.excluida || this.itens.set(o.id, { id: o.id, ...T(o, this.espaco) });
53
+ this.remontar();
54
+ }
55
+ inserir(n) {
56
+ this.atualizar(n);
57
+ }
58
+ /** Insere ou substitui; feição `excluida` sai do índice. */
59
+ atualizar(n) {
60
+ if (n.excluida) {
61
+ this.remover(n.id);
62
+ return;
63
+ }
64
+ const o = { id: n.id, ...T(n, this.espaco) };
65
+ this.itens.has(n.id) && this.obsoletos.add(n.id), this.itens.set(n.id, o), this.delta.set(n.id, o), this.compactarSeNecessario();
66
+ }
67
+ remover(n) {
68
+ this.itens.delete(n) && (this.obsoletos.add(n), this.delta.delete(n), this.compactarSeNecessario());
69
+ }
70
+ limpar() {
71
+ this.itens.clear(), this.remontar();
72
+ }
73
+ /** Ids das feições cujo envelope toca `caixa`. */
74
+ consultar(n) {
75
+ const o = [], i = this.raiz ? [this.raiz] : [];
76
+ for (; i.length > 0; ) {
77
+ const a = i.pop();
78
+ if (I(a, n))
79
+ if (a.folhas)
80
+ for (const e of a.folhas)
81
+ !this.obsoletos.has(e.id) && I(e, n) && o.push(e.id);
82
+ else a.filhos && i.push(...a.filhos);
83
+ }
84
+ for (const a of this.delta.values()) I(a, n) && o.push(a.id);
85
+ return o;
86
+ }
87
+ intersecta(n) {
88
+ return this.consultar(n).length > 0;
89
+ }
90
+ /** Envelope da feição indexada, se houver. */
91
+ caixaDe(n) {
92
+ return this.itens.get(n);
93
+ }
94
+ compactarSeNecessario() {
95
+ this.delta.size + this.obsoletos.size > Math.max(it, this.itens.size * 0.1) && this.remontar();
96
+ }
97
+ remontar() {
98
+ this.raiz = at([...this.itens.values()]), this.delta.clear(), this.obsoletos.clear();
99
+ }
100
+ }
101
+ const et = 17, rt = 9, st = 1.2;
102
+ function ct(t) {
103
+ return !Number.isFinite(t) || t >= et ? 0 : 360 / (256 * 2 ** t) * st;
104
+ }
105
+ function E(t) {
106
+ return Number.isFinite(t) ? 1 / Math.max(0.05, Math.cos(Math.max(-85, Math.min(85, t)) * Math.PI / 180)) : 1;
107
+ }
108
+ function ut(t, n, o, i) {
109
+ const a = o[1] - n[1], e = (o[0] - n[0]) * i, s = a * a + e * e, r = (t[0] - n[0]) * i;
110
+ let c = s === 0 ? 0 : ((t[1] - n[1]) * a + r * e) / s;
111
+ return c = Math.max(0, Math.min(1, c)), Math.hypot(t[1] - (n[1] + c * a), r - c * e);
112
+ }
113
+ function q(t, n, o = 1) {
114
+ if (!(n > 0) || t.length < 3) return t;
115
+ const i = Number.isFinite(o) && o > 0 ? o : 1, a = new Uint8Array(t.length);
116
+ a[0] = 1, a[t.length - 1] = 1;
117
+ const e = [[0, t.length - 1]];
118
+ for (; e.length > 0; ) {
119
+ const [s, r] = e.pop();
120
+ let c = 0, u = -1;
121
+ for (let d = s + 1; d < r; d++) {
122
+ const l = ut(t[d], t[s], t[r], i);
123
+ l > c && (c = l, u = d);
124
+ }
125
+ u !== -1 && c > n && (a[u] = 1, e.push([s, u], [u, r]));
126
+ }
127
+ return t.filter((s, r) => a[r] === 1);
128
+ }
129
+ function dt(t, n, o = 1) {
130
+ if (!(n > 0) || t.length < 4) return t;
131
+ const i = [...t, t[0]], a = q(i, n, o);
132
+ return a.pop(), a.length >= 3 ? a : t;
133
+ }
134
+ function ht(t) {
135
+ return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva ? 0 : t.tipo === "LineString" ? V(t).reduce((n, o) => n + o.length, 0) : t.tipo === "Polygon" ? t.aneis.reduce((n, o) => n + o.length, 0) : 0;
136
+ }
137
+ function _t(t, n) {
138
+ var i, a, e, s;
139
+ const o = ct(n);
140
+ if (o === 0 || ht(t) < rt) return t;
141
+ if (t.tipo === "LineString") {
142
+ const r = V(t), c = E(((a = (i = r[0]) == null ? void 0 : i[0]) == null ? void 0 : a[0]) ?? NaN);
143
+ return ot(r.map((u) => q(u, o, c)));
144
+ }
145
+ if (t.tipo === "Polygon") {
146
+ const r = E(((s = (e = t.aneis[0]) == null ? void 0 : e[0]) == null ? void 0 : s[0]) ?? NaN);
147
+ return { tipo: "Polygon", aneis: t.aneis.map((c) => dt(c, o, r)) };
148
+ }
149
+ return t;
150
+ }
151
+ const lt = /* @__PURE__ */ new Set(["previa", "prévia", "preview", "rascunho", "draft", "proposta"]);
152
+ function b(t) {
153
+ var o, i;
154
+ const n = [t.status, (o = t.propriedades) == null ? void 0 : o.status, (i = t.propriedades) == null ? void 0 : i.tipo_geometria];
155
+ for (const a of n)
156
+ if (typeof a == "string" && lt.has(a.trim().toLowerCase())) return "previa";
157
+ return "oficial";
158
+ }
159
+ function x(t) {
160
+ var o;
161
+ const n = t.entidadeId ?? ((o = t.propriedades) == null ? void 0 : o.entidadeId);
162
+ return typeof n == "string" || typeof n == "number" ? String(n) : t.id;
163
+ }
164
+ const P = (t, n) => `${t}\0${n}`;
165
+ class wt {
166
+ constructor() {
167
+ /** Mostra as prévias de todas as entidades. */
168
+ f(this, "global", !1);
169
+ f(this, "individuais", /* @__PURE__ */ new Set());
170
+ }
171
+ alternarIndividual(n, o) {
172
+ const i = P(n, o);
173
+ return this.individuais.has(i) ? this.individuais.delete(i) : this.individuais.add(i), this.individuais.has(i);
174
+ }
175
+ definirIndividual(n, o, i) {
176
+ const a = P(n, o);
177
+ i ? this.individuais.add(a) : this.individuais.delete(a);
178
+ }
179
+ individualAtiva(n, o) {
180
+ return this.individuais.has(P(n, o));
181
+ }
182
+ /** Entidades da camada que têm geometria oficial. */
183
+ static oficiais(n) {
184
+ const o = /* @__PURE__ */ new Set();
185
+ for (const i of n) !i.excluida && b(i) === "oficial" && o.add(x(i));
186
+ return o;
187
+ }
188
+ /** A feição aparece? `comOficial` = entidades da camada com geometria oficial (ver `oficiais`). */
189
+ visivel(n, o) {
190
+ if (b(n) === "oficial") return !0;
191
+ const i = x(n);
192
+ return this.global || !o.has(i) || this.individualAtiva(n.camadaId, i);
193
+ }
194
+ /** A prévia está sendo mostrada por pedido (global ou individual), e não só por falta de oficial? */
195
+ previaSolicitada(n) {
196
+ return this.global || this.individualAtiva(n.camadaId, x(n));
197
+ }
198
+ }
199
+ const G = /* @__PURE__ */ new Set(["simetrico", "suave", "livre"]), D = 1e-6;
200
+ function Ft(t) {
201
+ if (!t.entrada && !t.saida) return "canto";
202
+ if (t.modo && G.has(t.modo)) return t.modo;
203
+ if (!t.entrada || !t.saida) return "simetrico";
204
+ const n = t.ponto[0] - t.entrada[0], o = t.ponto[1] - t.entrada[1], i = t.saida[0] - t.ponto[0], a = t.saida[1] - t.ponto[1], e = Math.hypot(n, o), s = Math.hypot(i, a);
205
+ return e === 0 || s === 0 || !(Math.abs(n * a - o * i) <= D * e * s && n * i + o * a > 0) ? "livre" : Math.abs(e - s) <= D * Math.max(e, s) ? "simetrico" : "suave";
206
+ }
207
+ const ft = 24, pt = 2, _ = (t) => typeof t == "number" && Number.isFinite(t), S = (t) => Array.isArray(t) && t.length === 2 && _(t[0]) && _(t[1]);
208
+ function Rt(t, n) {
209
+ return [2 * t[0] - n[0], 2 * t[1] - n[1]];
210
+ }
211
+ function mt(t) {
212
+ return t.some((n) => n.entrada !== void 0 || n.saida !== void 0);
213
+ }
214
+ function H(t, n) {
215
+ return [t.saida ?? t.ponto, n.entrada ?? n.ponto];
216
+ }
217
+ function X(t, n) {
218
+ const o = [];
219
+ for (let i = 0; i < t - 1; i++) o.push([i, i + 1]);
220
+ return n && t > 2 && o.push([t - 1, 0]), o;
221
+ }
222
+ function Lt(t, n, o, i, a) {
223
+ const e = 1 - a, s = e * e * e, r = 3 * e * e * a, c = 3 * e * a * a, u = a * a * a;
224
+ return [s * t[0] + r * n[0] + c * o[0] + u * i[0], s * t[1] + r * n[1] + c * o[1] + u * i[1]];
225
+ }
226
+ function $t(t, n = !1, o = ft) {
227
+ if (t.length === 0) return [];
228
+ const i = [[t[0].ponto[0], t[0].ponto[1]]];
229
+ for (const [a, e] of X(t.length, n)) {
230
+ const s = t[a], r = t[e];
231
+ if (!(s.saida === void 0 && r.entrada === void 0)) {
232
+ const [u, d] = H(s, r);
233
+ for (let l = 1; l < o; l++) i.push(Lt(s.ponto, u, d, r.ponto, l / o));
234
+ }
235
+ e !== 0 && i.push([r.ponto[0], r.ponto[1]]);
236
+ }
237
+ return i;
238
+ }
239
+ function Mt(t, n) {
240
+ if (t.length === 0) return [];
241
+ const o = [{ cmd: "M", pts: [t[0].ponto] }];
242
+ for (const [i, a] of X(t.length, n)) {
243
+ const e = t[i], s = t[a];
244
+ if (e.saida === void 0 && s.entrada === void 0)
245
+ o.push({ cmd: "L", pts: [s.ponto] });
246
+ else {
247
+ const [r, c] = H(e, s);
248
+ o.push({ cmd: "C", pts: [r, c, s.ponto] });
249
+ }
250
+ }
251
+ return o;
252
+ }
253
+ function zt(t, n, o) {
254
+ const i = (e) => String(Math.round(e * 100) / 100), a = Mt(t, n).map((e) => e.cmd + e.pts.map((s) => {
255
+ const r = o(s);
256
+ return `${i(r.x)} ${i(r.y)}`;
257
+ }).join(" ")).join("");
258
+ return a && n ? `${a}Z` : a;
259
+ }
260
+ function Ut(t, n = pt) {
261
+ if (!Array.isArray(t) || t.length < n) return null;
262
+ const o = [];
263
+ for (const i of t) {
264
+ if (!i || typeof i != "object" || !S(i.ponto)) return null;
265
+ const a = i, e = { ponto: [a.ponto[0], a.ponto[1]] };
266
+ S(a.entrada) && (e.entrada = [a.entrada[0], a.entrada[1]]), S(a.saida) && (e.saida = [a.saida[0], a.saida[1]]), typeof a.modo == "string" && G.has(a.modo) && (e.entrada || e.saida) && (e.modo = a.modo), o.push(e);
267
+ }
268
+ return mt(o) ? o : null;
269
+ }
270
+ function kt(t, n) {
271
+ return t.map((o) => {
272
+ const i = { ponto: n(o.ponto) };
273
+ return o.entrada && (i.entrada = n(o.entrada)), o.saida && (i.saida = n(o.saida)), o.modo && (i.modo = o.modo), i;
274
+ });
275
+ }
276
+ function Vt(t) {
277
+ return t.tipo === "LineString" ? t.curva && t.curva.length >= 2 && !(t.partes && t.partes.length > 1) ? t.curva : null : t.tipo === "Polygon" && t.curva && t.curva.length >= 3 && t.aneis.length === 1 ? t.curva : null;
278
+ }
279
+ const vt = [
280
+ "continua",
281
+ "tracejada",
282
+ "tracejada-curta",
283
+ "tracejada-longa",
284
+ "pontilhada",
285
+ "traco-ponto",
286
+ "traco-ponto-ponto",
287
+ "oculta",
288
+ "centro",
289
+ "fantasma",
290
+ "divisa"
291
+ ], At = {
292
+ tracejada: [12, 6],
293
+ "tracejada-curta": [6, 4],
294
+ "tracejada-longa": [24, 8],
295
+ pontilhada: [0, 4],
296
+ "traco-ponto": [12, 4, 0, 4],
297
+ "traco-ponto-ponto": [12, 4, 0, 4, 0, 4],
298
+ oculta: [6, 3],
299
+ centro: [24, 4, 6, 4],
300
+ fantasma: [24, 4, 6, 4, 6, 4],
301
+ divisa: [12, 4, 12, 4, 0, 4]
302
+ }, w = { arredondada: "round", reta: "butt", quadrada: "square" }, F = { arredondada: "round", chanfrada: "bevel", angular: "miter" }, yt = 0.05, gt = 100, R = {
303
+ continuous: "continua",
304
+ dashed: "tracejada",
305
+ dashed2: "tracejada-curta",
306
+ dashedx2: "tracejada-longa",
307
+ dot: "pontilhada",
308
+ dotted: "pontilhada",
309
+ dashdot: "traco-ponto",
310
+ divide: "traco-ponto-ponto",
311
+ hidden: "oculta",
312
+ center: "centro",
313
+ phantom: "fantasma",
314
+ border: "divisa"
315
+ };
316
+ function $(t) {
317
+ return typeof t == "string" && vt.includes(t);
318
+ }
319
+ function Z(t) {
320
+ if ($(t)) return t;
321
+ if (typeof t != "string") return;
322
+ const n = t.trim().toLowerCase();
323
+ return $(n) ? n : Object.prototype.hasOwnProperty.call(R, n) ? R[n] : void 0;
324
+ }
325
+ function z(t) {
326
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(w, t) ? w[t] : void 0;
327
+ }
328
+ function U(t) {
329
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(F, t) ? F[t] : void 0;
330
+ }
331
+ function It(t) {
332
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 1 : Math.min(gt, Math.max(yt, t));
333
+ }
334
+ function k(t, n, o = 1, i = "round") {
335
+ const a = Z(t);
336
+ if (!a || a === "continua") return;
337
+ const e = Number.isFinite(n) && n > 0 ? n : 1, s = It(o) * Math.max(1, e / 2), r = i === "butt" ? e : 0, c = i === "butt" ? 0 : e;
338
+ return At[a].map((u, d) => {
339
+ const l = d % 2 === 0 ? u === 0 ? r : u * s : u * s + c;
340
+ return Math.round(l * 100) / 100;
341
+ }).join(" ");
342
+ }
343
+ const xt = "#38bdf8", Pt = "#38bdf8", St = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;
344
+ function C(t, n) {
345
+ return typeof t == "string" && St.test(t.trim()) ? t.trim() : n;
346
+ }
347
+ const p = (t) => typeof t == "number" && Number.isFinite(t);
348
+ function qt(t, n, o = !1) {
349
+ const i = t.estilo ?? {}, a = C(i.corTraco ?? n.corPrimaria, xt), e = t.geometria.tipo, s = e === "Polygon" || e === "Circle", r = e === "Point", c = r && C(i.corContorno, "") || a, u = r && p(i.espessuraContorno) && i.espessuraContorno >= 0 ? i.espessuraContorno : void 0, d = u ?? (p(i.espessuraTraco) ? i.espessuraTraco : void 0) ?? (p(n.espessuraLinha) ? n.espessuraLinha : 2), l = p(i.opacidadePreenchimento) ? i.opacidadePreenchimento : s ? 0.2 : 0.85, h = o ? d + 2 : d, m = z(i.terminacaoTraco) ?? z(n.terminacaoLinha) ?? "round", M = p(i.opacidadeTraco) ? i.opacidadeTraco : p(n.opacidadeLinha) ? n.opacidadeLinha : 1;
350
+ return {
351
+ cor: o ? Pt : c,
352
+ traco: !(u === 0 && !o),
353
+ peso: h,
354
+ dash: Ct(t, n, h, m),
355
+ // selecionada fica opaca: a seleção precisa aparecer mesmo numa linha quase transparente
356
+ opacidadeTraco: o ? 1 : Math.min(1, Math.max(0, M)),
357
+ terminacao: m,
358
+ juncao: U(i.juncaoTraco) ?? U(n.juncaoLinha) ?? "round",
359
+ deslocamentoDash: p(i.deslocamentoTracejado) ? i.deslocamentoTracejado : 0,
360
+ preencher: s || r,
361
+ corPreenchimento: C(i.corPreenchimento, a),
362
+ opacidadePreenchimento: o ? Math.min(1, l + 0.18) : l
363
+ };
364
+ }
365
+ function Ct(t, n, o, i) {
366
+ const a = t.estilo ?? {};
367
+ if (a.dashArray) return a.dashArray;
368
+ if (a.tipoLinha !== void 0 && a.tipoLinha !== null) {
369
+ const e = k(a.tipoLinha, o, a.escalaTipoLinha ?? n.escalaTipoLinha, i);
370
+ if (e || Z(a.tipoLinha) === "continua") return e;
371
+ }
372
+ return b(t) === "previa" ? "6 4" : n.dashArray ? n.dashArray : k(n.tipoLinha, o, n.escalaTipoLinha, i);
373
+ }
374
+ function Gt(t, n) {
375
+ var i;
376
+ const o = ((i = t.estilo) == null ? void 0 : i.tamanhoIcone) ?? n.tamanhoMarcador ?? 8;
377
+ return (p(o) && o > 0 ? o : 8) / 2;
378
+ }
379
+ class Ht {
380
+ constructor() {
381
+ f(this, "porChave", /* @__PURE__ */ new Map());
382
+ }
383
+ interno(n) {
384
+ const o = `${n.cor}|${n.traco ? 1 : 0}|${n.peso}|${n.dash ?? ""}|${n.opacidadeTraco ?? 1}|${n.terminacao ?? ""}|${n.juncao ?? ""}|${n.deslocamentoDash ?? 0}|${n.preencher ? 1 : 0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`, i = this.porChave.get(o);
385
+ return i || (this.porChave.set(o, n), n);
386
+ }
387
+ limpar() {
388
+ this.porChave.clear();
389
+ }
390
+ }
391
+ const bt = 256, L = 85.0511287798, Nt = 4007501668557849e-8;
392
+ function B(t, n, o, i, a) {
393
+ const e = o > L ? L : o < -L ? -L : o, s = Math.sin(e * Math.PI / 180);
394
+ t[n] = (i + 180) / 360 * a, t[n + 1] = (0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * a;
395
+ }
396
+ const g = (t) => bt * 2 ** t;
397
+ function Xt(t, n, o) {
398
+ const i = g(o);
399
+ return [Math.atan(Math.sinh(Math.PI * (1 - 2 * n / i))) * 180 / Math.PI, t / i * 360 - 180];
400
+ }
401
+ function Zt(t, n) {
402
+ const o = g(n), i = new Float64Array(t.length * 2);
403
+ for (let a = 0; a < t.length; a++) {
404
+ const e = t[a];
405
+ B(i, a * 2, e[0], e[1], o);
406
+ }
407
+ return i;
408
+ }
409
+ function Bt(t, n, o) {
410
+ const i = new Float64Array(2);
411
+ return B(i, 0, t, n, g(o)), i;
412
+ }
413
+ function Tt(t, n) {
414
+ const o = Math.max(-L, Math.min(L, t));
415
+ return Nt * Math.cos(o * Math.PI / 180) / g(n);
416
+ }
417
+ function Jt(t, n, o) {
418
+ const i = Tt(t, o), a = n / i;
419
+ return Number.isFinite(a) && a >= 0 ? a : 0;
420
+ }
421
+ function Qt(t) {
422
+ let n = 1 / 0, o = 1 / 0, i = -1 / 0, a = -1 / 0;
423
+ for (const e of t)
424
+ for (let s = 0; s + 1 < e.length; s += 2) {
425
+ const r = e[s], c = e[s + 1];
426
+ Number.isFinite(r) && Number.isFinite(c) && (r < n && (n = r), r > i && (i = r), c < o && (o = c), c > a && (a = c));
427
+ }
428
+ return n <= i && o <= a ? { minX: n, minY: o, maxX: i, maxY: a } : null;
429
+ }
430
+ function jt(t, n, o, i, a, e) {
431
+ const s = a - o, r = e - i, c = s * s + r * r;
432
+ let u = c === 0 ? 0 : ((t - o) * s + (n - i) * r) / c;
433
+ return u = u < 0 ? 0 : u > 1 ? 1 : u, Math.hypot(t - (o + u * s), n - (i + u * r));
434
+ }
435
+ function Yt(t, n, o) {
436
+ const i = t.length >> 1;
437
+ if (!(n > 0) || i < 3) return t;
438
+ let a = t, e = i;
439
+ o && (a = new Float64Array((i + 1) * 2), a.set(t), a[i * 2] = t[0], a[i * 2 + 1] = t[1], e = i + 1);
440
+ const s = new Uint8Array(e);
441
+ s[0] = 1, s[e - 1] = 1;
442
+ const r = [0, e - 1];
443
+ for (; r.length > 0; ) {
444
+ const h = r.pop(), m = r.pop();
445
+ let M = 0, v = -1;
446
+ const J = a[m * 2], Q = a[m * 2 + 1], Y = a[h * 2], K = a[h * 2 + 1];
447
+ for (let A = m + 1; A < h; A++) {
448
+ const N = jt(a[A * 2], a[A * 2 + 1], J, Q, Y, K);
449
+ N > M && (M = N, v = A);
450
+ }
451
+ v !== -1 && M > n && (s[v] = 1, r.push(m, v, v, h));
452
+ }
453
+ const c = o ? e - 1 : e;
454
+ let u = 0;
455
+ for (let h = 0; h < c; h++) s[h] && u++;
456
+ if (o && u < 3 || u === c) return t;
457
+ const d = new Float64Array(u * 2);
458
+ let l = 0;
459
+ for (let h = 0; h < c; h++)
460
+ s[h] && (d[l++] = a[h * 2], d[l++] = a[h * 2 + 1]);
461
+ return d;
462
+ }
463
+ export {
464
+ Qt as A,
465
+ k as B,
466
+ Pt as C,
467
+ jt as D,
468
+ $ as E,
469
+ g as F,
470
+ E as G,
471
+ It as H,
472
+ Dt as I,
473
+ Tt as J,
474
+ Bt as K,
475
+ B as L,
476
+ rt as M,
477
+ Zt as N,
478
+ Jt as O,
479
+ dt as P,
480
+ q as Q,
481
+ wt as R,
482
+ Yt as S,
483
+ vt as T,
484
+ ct as U,
485
+ et as Z,
486
+ $t as a,
487
+ Ft as b,
488
+ H as c,
489
+ C as d,
490
+ Rt as e,
491
+ Mt as f,
492
+ zt as g,
493
+ xt as h,
494
+ x as i,
495
+ _t as j,
496
+ I as k,
497
+ qt as l,
498
+ kt as m,
499
+ Vt as n,
500
+ Xt as o,
501
+ Lt as p,
502
+ Ut as q,
503
+ Gt as r,
504
+ b as s,
505
+ mt as t,
506
+ U as u,
507
+ ht as v,
508
+ z as w,
509
+ Z as x,
510
+ Ht as y,
511
+ T as z
512
+ };
@@ -0,0 +1 @@
1
+ "use strict";var ft=Object.defineProperty;var pt=(t,n,o)=>n in t?ft(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o;var f=(t,n,o)=>pt(t,typeof n!="symbol"?n+"":n,o);const S=require("./feature_metricas-CKQGG2nz.cjs"),y=16,mt=256;function D(t,n){const[[o,i],[a,e]]=S.limitesDaGeometria(t.geometria,n);return{minLon:i,minLat:o,maxLon:e,maxLat:a}}function P(t,n){return t.minLon<=n.maxLon&&t.maxLon>=n.minLon&&t.minLat<=n.maxLat&&t.maxLat>=n.minLat}function U(t){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const e of t)e.minLon<n&&(n=e.minLon),e.minLat<o&&(o=e.minLat),e.maxLon>i&&(i=e.maxLon),e.maxLat>a&&(a=e.maxLat);return{minLon:n,minLat:o,maxLon:i,maxLat:a}}function V(t){const n=t.length,o=Math.ceil(n/y),a=Math.ceil(Math.sqrt(o))*y,e=[...t].sort((r,c)=>r.minLon+r.maxLon-(c.minLon+c.maxLon)),s=[];for(let r=0;r<n;r+=a){const c=e.slice(r,r+a).sort((u,d)=>u.minLat+u.maxLat-(d.minLat+d.maxLat));for(let u=0;u<c.length;u+=y)s.push(c.slice(u,u+y))}return s}function Lt(t){if(t.length===0)return null;let n=V(t).map(o=>({...U(o),folhas:o}));for(;n.length>1;)n=V(n).map(o=>({...U(o),filhos:o}));return n[0]}class At{constructor(n){f(this,"raiz",null);f(this,"itens",new Map);f(this,"delta",new Map);f(this,"obsoletos",new Set);this.espaco=n}get tamanho(){return this.itens.size}construir(n){this.itens.clear();for(const o of n)o.excluida||this.itens.set(o.id,{id:o.id,...D(o,this.espaco)});this.remontar()}inserir(n){this.atualizar(n)}atualizar(n){if(n.excluida){this.remover(n.id);return}const o={id:n.id,...D(n,this.espaco)};this.itens.has(n.id)&&this.obsoletos.add(n.id),this.itens.set(n.id,o),this.delta.set(n.id,o),this.compactarSeNecessario()}remover(n){this.itens.delete(n)&&(this.obsoletos.add(n),this.delta.delete(n),this.compactarSeNecessario())}limpar(){this.itens.clear(),this.remontar()}consultar(n){const o=[],i=this.raiz?[this.raiz]:[];for(;i.length>0;){const a=i.pop();if(P(a,n))if(a.folhas)for(const e of a.folhas)!this.obsoletos.has(e.id)&&P(e,n)&&o.push(e.id);else a.filhos&&i.push(...a.filhos)}for(const a of this.delta.values())P(a,n)&&o.push(a.id);return o}intersecta(n){return this.consultar(n).length>0}caixaDe(n){return this.itens.get(n)}compactarSeNecessario(){this.delta.size+this.obsoletos.size>Math.max(mt,this.itens.size*.1)&&this.remontar()}remontar(){this.raiz=Lt([...this.itens.values()]),this.delta.clear(),this.obsoletos.clear()}}const X=17,Y=9,Mt=1.2;function B(t){return!Number.isFinite(t)||t>=X?0:360/(256*2**t)*Mt}function b(t){return Number.isFinite(t)?1/Math.max(.05,Math.cos(Math.max(-85,Math.min(85,t))*Math.PI/180)):1}function vt(t,n,o,i){const a=o[1]-n[1],e=(o[0]-n[0])*i,s=a*a+e*e,r=(t[0]-n[0])*i;let c=s===0?0:((t[1]-n[1])*a+r*e)/s;return c=Math.max(0,Math.min(1,c)),Math.hypot(t[1]-(n[1]+c*a),r-c*e)}function w(t,n,o=1){if(!(n>0)||t.length<3)return t;const i=Number.isFinite(o)&&o>0?o:1,a=new Uint8Array(t.length);a[0]=1,a[t.length-1]=1;const e=[[0,t.length-1]];for(;e.length>0;){const[s,r]=e.pop();let c=0,u=-1;for(let d=s+1;d<r;d++){const h=vt(t[d],t[s],t[r],i);h>c&&(c=h,u=d)}u!==-1&&c>n&&(a[u]=1,e.push([s,u],[u,r]))}return t.filter((s,r)=>a[r]===1)}function J(t,n,o=1){if(!(n>0)||t.length<4)return t;const i=[...t,t[0]],a=w(i,n,o);return a.pop(),a.length>=3?a:t}function Q(t){return(t.tipo==="LineString"||t.tipo==="Polygon")&&t.curva?0:t.tipo==="LineString"?S.partesDaLinha(t).reduce((n,o)=>n+o.length,0):t.tipo==="Polygon"?t.aneis.reduce((n,o)=>n+o.length,0):0}function It(t,n){var i,a,e,s;const o=B(n);if(o===0||Q(t)<Y)return t;if(t.tipo==="LineString"){const r=S.partesDaLinha(t),c=b(((a=(i=r[0])==null?void 0:i[0])==null?void 0:a[0])??NaN);return S.criarLinha(r.map(u=>w(u,o,c)))}if(t.tipo==="Polygon"){const r=b(((s=(e=t.aneis[0])==null?void 0:e[0])==null?void 0:s[0])??NaN);return{tipo:"Polygon",aneis:t.aneis.map(c=>J(c,o,r))}}return t}const yt=new Set(["previa","prévia","preview","rascunho","draft","proposta"]);function x(t){var o,i;const n=[t.status,(o=t.propriedades)==null?void 0:o.status,(i=t.propriedades)==null?void 0:i.tipo_geometria];for(const a of n)if(typeof a=="string"&&yt.has(a.trim().toLowerCase()))return"previa";return"oficial"}function g(t){var o;const n=t.entidadeId??((o=t.propriedades)==null?void 0:o.entidadeId);return typeof n=="string"||typeof n=="number"?String(n):t.id}const T=(t,n)=>`${t}\0${n}`;class Pt{constructor(){f(this,"global",!1);f(this,"individuais",new Set)}alternarIndividual(n,o){const i=T(n,o);return this.individuais.has(i)?this.individuais.delete(i):this.individuais.add(i),this.individuais.has(i)}definirIndividual(n,o,i){const a=T(n,o);i?this.individuais.add(a):this.individuais.delete(a)}individualAtiva(n,o){return this.individuais.has(T(n,o))}static oficiais(n){const o=new Set;for(const i of n)!i.excluida&&x(i)==="oficial"&&o.add(g(i));return o}visivel(n,o){if(x(n)==="oficial")return!0;const i=g(n);return this.global||!o.has(i)||this.individualAtiva(n.camadaId,i)}previaSolicitada(n){return this.global||this.individualAtiva(n.camadaId,g(n))}}const K=new Set(["simetrico","suave","livre"]),k=1e-6;function gt(t){if(!t.entrada&&!t.saida)return"canto";if(t.modo&&K.has(t.modo))return t.modo;if(!t.entrada||!t.saida)return"simetrico";const n=t.ponto[0]-t.entrada[0],o=t.ponto[1]-t.entrada[1],i=t.saida[0]-t.ponto[0],a=t.saida[1]-t.ponto[1],e=Math.hypot(n,o),s=Math.hypot(i,a);return e===0||s===0||!(Math.abs(n*a-o*i)<=k*e*s&&n*i+o*a>0)?"livre":Math.abs(e-s)<=k*Math.max(e,s)?"simetrico":"suave"}const Ct=24,St=2,Z=t=>typeof t=="number"&&Number.isFinite(t),N=t=>Array.isArray(t)&&t.length===2&&Z(t[0])&&Z(t[1]);function xt(t,n){return[2*t[0]-n[0],2*t[1]-n[1]]}function W(t){return t.some(n=>n.entrada!==void 0||n.saida!==void 0)}function R(t,n){return[t.saida??t.ponto,n.entrada??n.ponto]}function tt(t,n){const o=[];for(let i=0;i<t-1;i++)o.push([i,i+1]);return n&&t>2&&o.push([t-1,0]),o}function nt(t,n,o,i,a){const e=1-a,s=e*e*e,r=3*e*e*a,c=3*e*a*a,u=a*a*a;return[s*t[0]+r*n[0]+c*o[0]+u*i[0],s*t[1]+r*n[1]+c*o[1]+u*i[1]]}function Tt(t,n=!1,o=Ct){if(t.length===0)return[];const i=[[t[0].ponto[0],t[0].ponto[1]]];for(const[a,e]of tt(t.length,n)){const s=t[a],r=t[e];if(!(s.saida===void 0&&r.entrada===void 0)){const[u,d]=R(s,r);for(let h=1;h<o;h++)i.push(nt(s.ponto,u,d,r.ponto,h/o))}e!==0&&i.push([r.ponto[0],r.ponto[1]])}return i}function ot(t,n){if(t.length===0)return[];const o=[{cmd:"M",pts:[t[0].ponto]}];for(const[i,a]of tt(t.length,n)){const e=t[i],s=t[a];if(e.saida===void 0&&s.entrada===void 0)o.push({cmd:"L",pts:[s.ponto]});else{const[r,c]=R(e,s);o.push({cmd:"C",pts:[r,c,s.ponto]})}}return o}function Nt(t,n,o){const i=e=>String(Math.round(e*100)/100),a=ot(t,n).map(e=>e.cmd+e.pts.map(s=>{const r=o(s);return`${i(r.x)} ${i(r.y)}`}).join(" ")).join("");return a&&n?`${a}Z`:a}function Dt(t,n=St){if(!Array.isArray(t)||t.length<n)return null;const o=[];for(const i of t){if(!i||typeof i!="object"||!N(i.ponto))return null;const a=i,e={ponto:[a.ponto[0],a.ponto[1]]};N(a.entrada)&&(e.entrada=[a.entrada[0],a.entrada[1]]),N(a.saida)&&(e.saida=[a.saida[0],a.saida[1]]),typeof a.modo=="string"&&K.has(a.modo)&&(e.entrada||e.saida)&&(e.modo=a.modo),o.push(e)}return W(o)?o:null}function bt(t,n){return t.map(o=>{const i={ponto:n(o.ponto)};return o.entrada&&(i.entrada=n(o.entrada)),o.saida&&(i.saida=n(o.saida)),o.modo&&(i.modo=o.modo),i})}function Ot(t){return t.tipo==="LineString"?t.curva&&t.curva.length>=2&&!(t.partes&&t.partes.length>1)?t.curva:null:t.tipo==="Polygon"&&t.curva&&t.curva.length>=3&&t.aneis.length===1?t.curva:null}const it=["continua","tracejada","tracejada-curta","tracejada-longa","pontilhada","traco-ponto","traco-ponto-ponto","oculta","centro","fantasma","divisa"],jt={tracejada:[12,6],"tracejada-curta":[6,4],"tracejada-longa":[24,8],pontilhada:[0,4],"traco-ponto":[12,4,0,4],"traco-ponto-ponto":[12,4,0,4,0,4],oculta:[6,3],centro:[24,4,6,4],fantasma:[24,4,6,4,6,4],divisa:[12,4,12,4,0,4]},G={arredondada:"round",reta:"butt",quadrada:"square"},q={arredondada:"round",chanfrada:"bevel",angular:"miter"},Et=.05,_t=100,H={continuous:"continua",dashed:"tracejada",dashed2:"tracejada-curta",dashedx2:"tracejada-longa",dot:"pontilhada",dotted:"pontilhada",dashdot:"traco-ponto",divide:"traco-ponto-ponto",hidden:"oculta",center:"centro",phantom:"fantasma",border:"divisa"};function O(t){return typeof t=="string"&&it.includes(t)}function F(t){if(O(t))return t;if(typeof t!="string")return;const n=t.trim().toLowerCase();return O(n)?n:Object.prototype.hasOwnProperty.call(H,n)?H[n]:void 0}function j(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(G,t)?G[t]:void 0}function E(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(q,t)?q[t]:void 0}function at(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?1:Math.min(_t,Math.max(Et,t))}function _(t,n,o=1,i="round"){const a=F(t);if(!a||a==="continua")return;const e=Number.isFinite(n)&&n>0?n:1,s=at(o)*Math.max(1,e/2),r=i==="butt"?e:0,c=i==="butt"?0:e;return jt[a].map((u,d)=>{const h=d%2===0?u===0?r:u*s:u*s+c;return Math.round(h*100)/100}).join(" ")}const et="#38bdf8",rt="#38bdf8",wt=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;function C(t,n){return typeof t=="string"&&wt.test(t.trim())?t.trim():n}const p=t=>typeof t=="number"&&Number.isFinite(t);function Rt(t,n,o=!1){const i=t.estilo??{},a=C(i.corTraco??n.corPrimaria,et),e=t.geometria.tipo,s=e==="Polygon"||e==="Circle",r=e==="Point",c=r&&C(i.corContorno,"")||a,u=r&&p(i.espessuraContorno)&&i.espessuraContorno>=0?i.espessuraContorno:void 0,d=u??(p(i.espessuraTraco)?i.espessuraTraco:void 0)??(p(n.espessuraLinha)?n.espessuraLinha:2),h=p(i.opacidadePreenchimento)?i.opacidadePreenchimento:s?.2:.85,l=o?d+2:d,m=j(i.terminacaoTraco)??j(n.terminacaoLinha)??"round",A=p(i.opacidadeTraco)?i.opacidadeTraco:p(n.opacidadeLinha)?n.opacidadeLinha:1;return{cor:o?rt:c,traco:!(u===0&&!o),peso:l,dash:Ft(t,n,l,m),opacidadeTraco:o?1:Math.min(1,Math.max(0,A)),terminacao:m,juncao:E(i.juncaoTraco)??E(n.juncaoLinha)??"round",deslocamentoDash:p(i.deslocamentoTracejado)?i.deslocamentoTracejado:0,preencher:s||r,corPreenchimento:C(i.corPreenchimento,a),opacidadePreenchimento:o?Math.min(1,h+.18):h}}function Ft(t,n,o,i){const a=t.estilo??{};if(a.dashArray)return a.dashArray;if(a.tipoLinha!==void 0&&a.tipoLinha!==null){const e=_(a.tipoLinha,o,a.escalaTipoLinha??n.escalaTipoLinha,i);if(e||F(a.tipoLinha)==="continua")return e}return x(t)==="previa"?"6 4":n.dashArray?n.dashArray:_(n.tipoLinha,o,n.escalaTipoLinha,i)}function $t(t,n){var i;const o=((i=t.estilo)==null?void 0:i.tamanhoIcone)??n.tamanhoMarcador??8;return(p(o)&&o>0?o:8)/2}class zt{constructor(){f(this,"porChave",new Map)}interno(n){const o=`${n.cor}|${n.traco?1:0}|${n.peso}|${n.dash??""}|${n.opacidadeTraco??1}|${n.terminacao??""}|${n.juncao??""}|${n.deslocamentoDash??0}|${n.preencher?1:0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`,i=this.porChave.get(o);return i||(this.porChave.set(o,n),n)}limpar(){this.porChave.clear()}}const Ut=256,L=85.0511287798,Vt=4007501668557849e-8;function $(t,n,o,i,a){const e=o>L?L:o<-L?-L:o,s=Math.sin(e*Math.PI/180);t[n]=(i+180)/360*a,t[n+1]=(.5-Math.log((1+s)/(1-s))/(4*Math.PI))*a}const I=t=>Ut*2**t;function kt(t,n,o){const i=I(o);return[Math.atan(Math.sinh(Math.PI*(1-2*n/i)))*180/Math.PI,t/i*360-180]}function Zt(t,n){const o=I(n),i=new Float64Array(t.length*2);for(let a=0;a<t.length;a++){const e=t[a];$(i,a*2,e[0],e[1],o)}return i}function Gt(t,n,o){const i=new Float64Array(2);return $(i,0,t,n,I(o)),i}function st(t,n){const o=Math.max(-L,Math.min(L,t));return Vt*Math.cos(o*Math.PI/180)/I(n)}function qt(t,n,o){const i=st(t,o),a=n/i;return Number.isFinite(a)&&a>=0?a:0}function Ht(t){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const e of t)for(let s=0;s+1<e.length;s+=2){const r=e[s],c=e[s+1];Number.isFinite(r)&&Number.isFinite(c)&&(r<n&&(n=r),r>i&&(i=r),c<o&&(o=c),c>a&&(a=c))}return n<=i&&o<=a?{minX:n,minY:o,maxX:i,maxY:a}:null}function ct(t,n,o,i,a,e){const s=a-o,r=e-i,c=s*s+r*r;let u=c===0?0:((t-o)*s+(n-i)*r)/c;return u=u<0?0:u>1?1:u,Math.hypot(t-(o+u*s),n-(i+u*r))}function Xt(t,n,o){const i=t.length>>1;if(!(n>0)||i<3)return t;let a=t,e=i;o&&(a=new Float64Array((i+1)*2),a.set(t),a[i*2]=t[0],a[i*2+1]=t[1],e=i+1);const s=new Uint8Array(e);s[0]=1,s[e-1]=1;const r=[0,e-1];for(;r.length>0;){const l=r.pop(),m=r.pop();let A=0,M=-1;const ut=a[m*2],dt=a[m*2+1],lt=a[l*2],ht=a[l*2+1];for(let v=m+1;v<l;v++){const z=ct(a[v*2],a[v*2+1],ut,dt,lt,ht);z>A&&(A=z,M=v)}M!==-1&&A>n&&(s[M]=1,r.push(m,M,M,l))}const c=o?e-1:e;let u=0;for(let l=0;l<c;l++)s[l]&&u++;if(o&&u<3||u===c)return t;const d=new Float64Array(u*2);let h=0;for(let l=0;l<c;l++)s[l]&&(d[h++]=a[l*2],d[h++]=a[l*2+1]);return d}exports.COR_PADRAO=et;exports.COR_SELECAO=rt;exports.IndiceEspacial=At;exports.InternadorEstilos=zt;exports.MIN_VERTICES_SIMPLIFICAR=Y;exports.RegraVersoes=Pt;exports.TIPOS_LINHA=it;exports.ZOOM_SEM_SIMPLIFICACAO=X;exports.amostrarCurva=Tt;exports.caixaDaFeicao=D;exports.caixaPx=Ht;exports.caixasSeTocam=P;exports.caminhoSvg=Nt;exports.controlesDoSegmento=R;exports.corSegura=C;exports.dashTipoLinha=_;exports.distSegmentoPx=ct;exports.ehTipoLinha=O;exports.entidadeDe=g;exports.escalaDoZoom=I;exports.escalaLatitude=b;exports.escalaTipoLinhaSegura=at;exports.espelhoDaAlca=xt;exports.estiloVetorDe=Rt;exports.juncaoCanvas=E;exports.latLonDoMundo=kt;exports.metrosPorPixel=st;exports.moverNos=bt;exports.normalizarNos=Dt;exports.normalizarTipoLinha=F;exports.nosDaGeometria=Ot;exports.passosDaCurva=ot;exports.pontoDaCubica=nt;exports.projetarCentro=Gt;exports.projetarEm=$;exports.projetarVertices=Zt;exports.raioCirculoPx=qt;exports.raioPontoPx=$t;exports.simplificarAnel=J;exports.simplificarGeometria=It;exports.simplificarLinha=w;exports.simplificarPx=Xt;exports.statusDe=x;exports.temAlcas=W;exports.terminacaoCanvas=j;exports.tipoDoNo=gt;exports.toleranciaPorZoom=B;exports.vertices=Q;
@@ -0,0 +1,7 @@
1
+ /** `-23.5` -> `23°30'00.00"S`. `eixo` escolhe N/S ou L/O (leste/oeste). */
2
+ export declare function ddParaDms(valor: number, eixo: 'lat' | 'lon', casas?: number): string;
3
+ /**
4
+ * Aceita `23°30'00.00"S`, `23 30 0 S`, `-23°30'`, vírgula decimal. Só o último componente pode ter decimais e os graus vão
5
+ * até 180 (`-23.456.7`, `23.5 30` e `200 0 0` são recusados). Devolve `null` se não entender.
6
+ */
7
+ export declare function dmsParaDd(texto: string): number | null;
@@ -39,10 +39,7 @@ export type UnidadeComprimento = 'm' | 'km' | 'ft' | 'mi';
39
39
  export type UnidadeArea = 'm2' | 'ha' | 'km2' | 'ac' | 'alqueire';
40
40
  export declare function converterComprimento(valor: number, de: UnidadeComprimento, para: UnidadeComprimento): number;
41
41
  export declare function converterArea(valor: number, de: UnidadeArea, para: UnidadeArea): number;
42
- /** `-23.5` -> `23°30'00.00"S`. `eixo` escolhe N/S ou L/O (leste/oeste). */
43
- export declare function ddParaDms(valor: number, eixo: 'lat' | 'lon', casas?: number): string;
44
- /** Aceita `23°30'00.00"S`, `23 30 0 S`, `-23°30'`, vírgula decimal. Devolve `null` se não entender. */
45
- export declare function dmsParaDd(texto: string): number | null;
42
+ export { ddParaDms, dmsParaDd } from './dms';
46
43
  /** Distância entre dois pontos na unidade do espaço (metros no geográfico, o padrão); útil para testes e ferramentas. */
47
44
  export declare function distanciaEntre(a: LatLonPar, b: LatLonPar, espaco?: Espaco): number;
48
45
  /** Cópia profunda de uma feição com novo id (para duplicar/dividir). */
@@ -1,7 +1,4 @@
1
1
  import { PopupAcaoCAD } from './types';
2
- /**
3
- * Utilitários auxiliares para o ecossistema de Canvas e Mapas CAD
4
- */
5
2
  export declare const escapeHtml: (unsafe: string | null | undefined) => string;
6
3
  export declare const formatUTM: (val: number | null | undefined, casas?: number) => string;
7
4
  export interface CoordenadaUTM {
@@ -24,6 +21,7 @@ export interface CoordenadaGeo {
24
21
  }
25
22
  /**
26
23
  * Converte e valida coordenadas geográficas (Lat/Lon) em graus decimais WGS-84.
24
+ * - Aceita DMS em texto (`23°45'30"S`, `46 37 59,88 O`) e recusa texto ambíguo (`-23.456,7`) em vez de truncá-lo
27
25
  * - Trata números e strings no formato brasileiro (vírgula como separador decimal: "-23,7661")
28
26
  * - Filtra valores inválidos, NaN, Null Island (0, 0)
29
27
  * - Identifica e rejeita coordenadas planas métricas (UTM/SIRGAS2000 acima de 90°/180°)
package/dist/mapa.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var x=Object.defineProperty;var I=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>I(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const n=require("./kit-base-BmkPi5Rz.cjs"),g=require("./utils-ClVgqVyJ.cjs"),z=":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";function m(){return n.obterLeafletSincrono()??null}async function _(){return await n.carregarLeaflet()??null}function E(r){return{osm:{nome:"OpenStreetMap",layer:()=>r.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})},satelite:{nome:"Satélite (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"})},topografia:{nome:"Topografia",layer:()=>r.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",{attribution:'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'})},ruas:{nome:"Ruas (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012"})}}}const u={lat:-23.55052,lng:-46.633308,zoom:13},L="#00f5a0",w="#3388ff",O=3,p=r=>Number.isFinite(r);function v(r,e,t){const i=parseFloat(r??""),o=parseFloat(e??""),a=parseInt(t??"",10);return{lat:p(i)&&Math.abs(i)<=90?i:u.lat,lng:p(o)&&Math.abs(o)<=180?o:u.lng,zoom:p(a)&&a>=0&&a<=22?a:u.zoom}}function k(r,e){const t=parseInt(r??"",10);return p(t)&&t>0?t:e}const P=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,R=/^(?:rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/deg-]+\)$/i,N=/^[a-z]{3,30}$/i;function y(r,e){const t=(r??"").trim();return P.test(t)||R.test(t)||N.test(t)?t:e}function U(r,e){const t=(r??"").split(",").map(i=>i.trim().toLowerCase()).filter(i=>e.includes(i));return t.length>0?t:["osm"]}function A(r){if(!r)return[];let e;try{e=JSON.parse(r)}catch(i){return console.error('Formato inválido para atributo pontos no <ui-mapa-linha>. Deve ser um JSON array, ex: "[[lat, lng], ...]"',i),[]}if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!Array.isArray(i)||i.length<2)continue;const[o,a]=i;typeof o=="number"&&typeof a=="number"&&p(o)&&p(a)&&Math.abs(o)<=90&&Math.abs(a)<=180&&t.push([o,a])}return t}const D="Mapa",G=`
1
+ "use strict";var x=Object.defineProperty;var I=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>I(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const n=require("./kit-base-BmkPi5Rz.cjs"),g=require("./utils-DpPysTeU.cjs"),z=":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";function m(){return n.obterLeafletSincrono()??null}async function _(){return await n.carregarLeaflet()??null}function E(r){return{osm:{nome:"OpenStreetMap",layer:()=>r.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})},satelite:{nome:"Satélite (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"})},topografia:{nome:"Topografia",layer:()=>r.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",{attribution:'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'})},ruas:{nome:"Ruas (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012"})}}}const u={lat:-23.55052,lng:-46.633308,zoom:13},L="#00f5a0",w="#3388ff",O=3,p=r=>Number.isFinite(r);function v(r,e,t){const i=parseFloat(r??""),o=parseFloat(e??""),a=parseInt(t??"",10);return{lat:p(i)&&Math.abs(i)<=90?i:u.lat,lng:p(o)&&Math.abs(o)<=180?o:u.lng,zoom:p(a)&&a>=0&&a<=22?a:u.zoom}}function k(r,e){const t=parseInt(r??"",10);return p(t)&&t>0?t:e}const P=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,R=/^(?:rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/deg-]+\)$/i,N=/^[a-z]{3,30}$/i;function y(r,e){const t=(r??"").trim();return P.test(t)||R.test(t)||N.test(t)?t:e}function U(r,e){const t=(r??"").split(",").map(i=>i.trim().toLowerCase()).filter(i=>e.includes(i));return t.length>0?t:["osm"]}function A(r){if(!r)return[];let e;try{e=JSON.parse(r)}catch(i){return console.error('Formato inválido para atributo pontos no <ui-mapa-linha>. Deve ser um JSON array, ex: "[[lat, lng], ...]"',i),[]}if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!Array.isArray(i)||i.length<2)continue;const[o,a]=i;typeof o=="number"&&typeof a=="number"&&p(o)&&p(a)&&Math.abs(o)<=90&&Math.abs(a)<=180&&t.push([o,a])}return t}const D="Mapa",G=`
2
2
  <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 140px; padding: 16px; box-sizing: border-box; text-align: center; color: var(--ui-cor-texto-secundario, #888899); font-family: var(--ui-fonte-base, 'Inter', sans-serif); font-size: 12px; background: var(--ui-cor-superficie, #141417); border-radius: var(--ui-raio-borda, 6px); border: 1px dashed var(--ui-cor-borda, rgba(255,255,255,0.15));">
3
3
  <span style="font-size: 20px; margin-bottom: 6px;" aria-hidden="true">🗺️</span>
4
4
  <strong style="color: var(--ui-cor-texto, #e1e1e6); margin-bottom: 4px;">Leaflet não encontrado</strong>
package/dist/mapa.js CHANGED
@@ -3,7 +3,7 @@ var x = (r, e, t) => e in r ? C(r, e, { enumerable: !0, configurable: !0, writab
3
3
  var s = (r, e, t) => x(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  /* empty css */
5
5
  import { c as z, o as S, S as m, l as I, d } from "./kit-base-CBXA66aM.js";
6
- import { p as v } from "./utils-DrHoxxmf.js";
6
+ import { p as v } from "./utils-B2HuBLwz.js";
7
7
  const _ = ":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";
8
8
  function h() {
9
9
  return S() ?? null;