@thibezer/ui-components-kit 2.28.2 → 2.29.0

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 (50) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/camadas.cjs +87 -87
  3. package/dist/camadas.js +1871 -1302
  4. package/dist/canvas.cjs +31 -31
  5. package/dist/canvas.js +1666 -1585
  6. package/dist/components/ui-barra-ferramentas/ribbon-atualizacao.d.ts +10 -0
  7. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +25 -5
  8. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -0
  9. package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +26 -5
  10. package/dist/components/ui-camadas/camadas-colecao.d.ts +15 -0
  11. package/dist/components/ui-camadas/camadas-host.d.ts +12 -0
  12. package/dist/components/ui-camadas/camadas-janela-dom.d.ts +44 -0
  13. package/dist/components/ui-camadas/camadas-linha-feicao.d.ts +10 -1
  14. package/dist/components/ui-camadas/camadas-render.d.ts +19 -2
  15. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +6 -0
  16. package/dist/components/ui-camadas/camadas-virtual.d.ts +135 -0
  17. package/dist/components/ui-camadas/ui-camadas.d.ts +51 -2
  18. package/dist/custom-elements.json +13584 -11420
  19. package/dist/feature_caixa-DOchASgS.js +828 -0
  20. package/dist/feature_caixa-MrJEfMol.cjs +1 -0
  21. package/dist/{feature_desenho-edf-dHuf.js → feature_desenho-Cq3H27as.js} +2 -2
  22. package/dist/{feature_desenho-DRHnu8u8.cjs → feature_desenho-eq3MIZR9.cjs} +1 -1
  23. package/dist/geometria-px-BlB0OczX.cjs +1 -0
  24. package/dist/geometria-px-BxTQKrZN.js +577 -0
  25. package/dist/gerencigeo-canvas/feature_adapters.d.ts +7 -0
  26. package/dist/gerencigeo-canvas/feature_indice.d.ts +7 -0
  27. package/dist/gerencigeo-canvas/feature_lod.d.ts +16 -0
  28. package/dist/gerencigeo-canvas/motor/dados-camada.d.ts +11 -1
  29. package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +9 -0
  30. package/dist/gerencigeo-canvas/motor/motor-formas.d.ts +28 -5
  31. package/dist/gerencigeo-canvas/motor/tipos.d.ts +7 -3
  32. package/dist/gerencigeo-canvas/qualidade.d.ts +5 -0
  33. package/dist/gerencigeo-canvas/renderers/canvas_formas_leaflet.d.ts +10 -0
  34. package/dist/gerencigeo-canvas/renderers/feicoes_canvas_renderer.d.ts +10 -0
  35. package/dist/gerencigeo-canvas/renderers/renderizador_formas.d.ts +7 -0
  36. package/dist/index.cjs +4 -4
  37. package/dist/index.js +84 -82
  38. package/dist/motor.cjs +1 -1
  39. package/dist/motor.js +616 -497
  40. package/dist/prancha-nucleo.cjs +1 -1
  41. package/dist/prancha-nucleo.js +3 -3
  42. package/dist/prancha.cjs +1 -1
  43. package/dist/prancha.js +3 -3
  44. package/dist/tools.cjs +5 -5
  45. package/dist/tools.js +438 -369
  46. package/package.json +1 -1
  47. package/dist/feature_caixa-BLVtatpp.cjs +0 -1
  48. package/dist/feature_caixa-CHAdzESq.js +0 -806
  49. package/dist/geometria-px-DEAIxMG5.js +0 -512
  50. package/dist/geometria-px-DJcNHXbE.cjs +0 -1
package/dist/camadas.js CHANGED
@@ -1,12 +1,12 @@
1
- var Va = Object.defineProperty;
2
- var Ua = (e, t, a) => t in e ? Va(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var E = (e, t, a) => Ua(e, typeof t != "symbol" ? t + "" : t, a);
1
+ var wt = Object.defineProperty;
2
+ var At = (e, t, a) => t in e ? wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var E = (e, t, a) => At(e, typeof t != "symbol" ? t + "" : t, a);
4
4
  /* empty css */
5
- import { h as ea, K as Ya, S as Ka, A as Qa, L as He, g as Ge, s as Xa, d as Pe } from "./kit-base-CBXA66aM.js";
6
- import { a as Wa } from "./ui-seletor-cor-CPjA9vhZ.js";
7
- import { UIMapaBase as Rr, UISeletorMapaBase as Or } from "./seletor-mapa-base.js";
8
- import { a as Ja, d as aa } from "./feature_metricas-DGfd21VR.js";
9
- const y = {
5
+ import { h as va, K as Et, S as It, A as kt, L as Xe, g as Ze, s as Lt, d as Ne } from "./kit-base-CBXA66aM.js";
6
+ import { a as Ct } from "./ui-seletor-cor-CPjA9vhZ.js";
7
+ import { UIMapaBase as zi, UISeletorMapaBase as Pi } from "./seletor-mapa-base.js";
8
+ import { a as Ft, d as ba } from "./feature_metricas-DGfd21VR.js";
9
+ const A = {
10
10
  camadas: `<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
11
11
  <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
12
12
  <polyline points="2 17 12 22 22 17"></polyline>
@@ -104,54 +104,54 @@ const y = {
104
104
  <line x1="9" y1="3" x2="9" y2="21"></line>
105
105
  <line x1="15" y1="3" x2="15" y2="21"></line>
106
106
  </svg>`
107
- }, Le = (e) => Array.isArray(e) && e.length >= 2 && Number.isFinite(e[0]) && Number.isFinite(e[1]);
108
- function Be(e) {
107
+ }, qe = (e) => Array.isArray(e) && e.length >= 2 && Number.isFinite(e[0]) && Number.isFinite(e[1]);
108
+ function He(e) {
109
109
  const t = [];
110
- for (const r of e) Le(r) && t.push([r[0], r[1]]);
110
+ for (const r of e) qe(r) && t.push([r[0], r[1]]);
111
111
  return t.some((r) => Math.abs(r[0]) > 90) && t.every((r) => Math.abs(r[1]) <= 90) ? t.map((r) => [r[1], r[0]]) : t;
112
112
  }
113
- function zr(e, t) {
114
- if (!Le(e) || !Le(t)) return 0;
115
- const a = Be([e, t]);
113
+ function Ii(e, t) {
114
+ if (!qe(e) || !qe(t)) return 0;
115
+ const a = He([e, t]);
116
116
  if (a.length < 2 || Math.abs(a[0][0]) > 90 || Math.abs(a[1][0]) > 90) return 0;
117
- const r = aa(a[0], a[1]);
117
+ const r = ba(a[0], a[1]);
118
118
  return Number.isFinite(r) ? r : 0;
119
119
  }
120
- function ta(e) {
120
+ function ya(e) {
121
121
  if (!Array.isArray(e) || e.length === 0) return 0;
122
122
  if (Array.isArray(e[0]) && Array.isArray(e[0][0]))
123
- return e.reduce((r, i) => r + ta(i), 0);
124
- const t = Be(e);
123
+ return e.reduce((r, i) => r + ya(i), 0);
124
+ const t = He(e);
125
125
  let a = 0;
126
126
  for (let r = 1; r < t.length; r++) {
127
- const i = aa(t[r - 1], t[r]);
127
+ const i = ba(t[r - 1], t[r]);
128
128
  Number.isFinite(i) && (a += i);
129
129
  }
130
130
  return a;
131
131
  }
132
- function we(e) {
132
+ function Ce(e) {
133
133
  if (!Array.isArray(e)) return 0;
134
- const t = Be(e);
134
+ const t = He(e);
135
135
  if (t.length > 3 && t[0][0] === t[t.length - 1][0] && t[0][1] === t[t.length - 1][1] && t.pop(), t.length < 3) return 0;
136
- const a = Ja([t]);
136
+ const a = Ft([t]);
137
137
  return Number.isFinite(a) ? a : 0;
138
138
  }
139
- function ra(e) {
139
+ function xa(e) {
140
140
  if (!Array.isArray(e) || e.length === 0) return 0;
141
141
  if (Array.isArray(e[0]) && typeof e[0][0] == "number")
142
- return we(e);
142
+ return Ce(e);
143
143
  if (Array.isArray(e[0]) && Array.isArray(e[0][0])) {
144
144
  if (Array.isArray(e[0][0][0]))
145
- return e.reduce((r, i) => r + ra(i), 0);
146
- const t = we(e[0]);
145
+ return e.reduce((r, i) => r + xa(i), 0);
146
+ const t = Ce(e[0]);
147
147
  let a = 0;
148
148
  for (let r = 1; r < e.length; r++)
149
- a += we(e[r]);
149
+ a += Ce(e[r]);
150
150
  return Math.max(0, t - a);
151
151
  }
152
152
  return 0;
153
153
  }
154
- function Mr(e) {
154
+ function ki(e) {
155
155
  if (!e || e.length === 0) return "";
156
156
  const t = (i) => i.type || i.geometryType, a = e.filter((i) => {
157
157
  const o = t(i);
@@ -159,7 +159,7 @@ function Mr(e) {
159
159
  });
160
160
  if (a.length > 0) {
161
161
  const i = a.reduce(
162
- (o, n) => o + (ra(n.coordinates) || 0),
162
+ (o, n) => o + (xa(n.coordinates) || 0),
163
163
  0
164
164
  );
165
165
  return i >= 1e4 ? `${(i / 1e4).toLocaleString("pt-BR", {
@@ -173,7 +173,7 @@ function Mr(e) {
173
173
  });
174
174
  if (r.length > 0) {
175
175
  const i = r.reduce(
176
- (o, n) => o + (ta(n.coordinates) || 0),
176
+ (o, n) => o + (ya(n.coordinates) || 0),
177
177
  0
178
178
  );
179
179
  return i >= 1e3 ? `${(i / 1e3).toLocaleString("pt-BR", {
@@ -183,23 +183,23 @@ function Mr(e) {
183
183
  }
184
184
  return "";
185
185
  }
186
- function z(e) {
186
+ function S(e) {
187
187
  return e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
188
188
  }
189
- const Za = /^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\(\s*[\w.%\s,/+-]+\)|[a-z]{3,30})$/i;
190
- function J(e, t = "#00E08A") {
189
+ const St = /^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\(\s*[\w.%\s,/+-]+\)|[a-z]{3,30})$/i;
190
+ function Z(e, t = "#00E08A") {
191
191
  if (!e || typeof e != "string") return t;
192
192
  const a = e.trim();
193
- return Za.test(a) ? a : t;
193
+ return St.test(a) ? a : t;
194
194
  }
195
- function Ae(e) {
195
+ function Fe(e) {
196
196
  return Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0");
197
197
  }
198
- function et(e, t, a) {
199
- const r = t / 100, i = a / 100, o = (d) => (d + e / 30) % 12, n = r * Math.min(i, 1 - i), s = (d) => i - n * Math.max(-1, Math.min(o(d) - 3, Math.min(9 - o(d), 1)));
198
+ function $t(e, t, a) {
199
+ const r = t / 100, i = a / 100, o = (l) => (l + e / 30) % 12, n = r * Math.min(i, 1 - i), s = (l) => i - n * Math.max(-1, Math.min(o(l) - 3, Math.min(9 - o(l), 1)));
200
200
  return [s(0) * 255, s(8) * 255, s(4) * 255];
201
201
  }
202
- function at(e, t = "#000000") {
202
+ function Mt(e, t = "#000000") {
203
203
  if (!e || typeof e != "string") return t;
204
204
  const a = e.trim().toLowerCase(), r = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(a);
205
205
  if (r) {
@@ -210,19 +210,19 @@ function at(e, t = "#000000") {
210
210
  if (i) {
211
211
  const o = i[2].split(/[\s,/]+/).filter(Boolean).map((n) => parseFloat(n));
212
212
  if (o.length >= 3 && o.slice(0, 3).every((n) => !isNaN(n))) {
213
- const [n, s, d] = o, [l, c, f] = i[1] === "rgb" ? [n, s, d] : et(n, s, d);
214
- return `#${Ae(l)}${Ae(c)}${Ae(f)}`;
213
+ const [n, s, l] = o, [c, f, p] = i[1] === "rgb" ? [n, s, l] : $t(n, s, l);
214
+ return `#${Fe(c)}${Fe(f)}${Fe(p)}`;
215
215
  }
216
216
  }
217
217
  return t;
218
218
  }
219
- function D(e, t, a) {
219
+ function M(e, t, a) {
220
220
  const r = e.querySelectorAll(`[${t}]`);
221
221
  for (let i = 0; i < r.length; i++)
222
222
  if (r[i].getAttribute(t) === a) return r[i];
223
223
  return null;
224
224
  }
225
- function ia(e, t = 80) {
225
+ function wa(e, t = 80) {
226
226
  let a = null;
227
227
  return (...r) => {
228
228
  a && clearTimeout(a), a = setTimeout(() => {
@@ -230,10 +230,10 @@ function ia(e, t = 80) {
230
230
  }, t);
231
231
  };
232
232
  }
233
- function j(e, t) {
233
+ function R(e, t) {
234
234
  e.setAttribute("title", t), e.setAttribute("aria-label", t);
235
235
  }
236
- const oa = [
236
+ const Aa = [
237
237
  {
238
238
  id: "none",
239
239
  nome: "Sem Mapa",
@@ -276,18 +276,18 @@ const oa = [
276
276
  thumbnailUrl: "https://images.unsplash.com/photo-1518709268805-4e9042af9f23?w=160&auto=format&fit=crop&q=80"
277
277
  }
278
278
  ];
279
- function na(e, t) {
279
+ function Ea(e, t) {
280
280
  const a = Array.isArray(e) ? e.find((r) => r.id === t) : void 0;
281
281
  return a && typeof a.nome == "string" ? a.nome : "";
282
282
  }
283
- function tt(e = oa, t = "satelite", a = !1) {
283
+ function zt(e = Aa, t = "satelite", a = !1) {
284
284
  if (!e || e.length === 0) return "";
285
285
  const r = e.map((i) => {
286
- const o = t === i.id, n = z(i.id), s = z(i.nome), d = z(i.descricao || i.nome);
287
- let l = "";
288
- return i.thumbnailUrl ? l = `<img class="ui-basemap-preview" src="${z(i.thumbnailUrl)}" alt="" loading="lazy" referrerpolicy="no-referrer" data-basemap-thumb />` : l = `<div class="ui-basemap-preview-none">${y.gradeCad}</div>`, `
289
- <div class="ui-basemap-card ${o ? "active" : ""}" data-basemap-id="${n}" role="button" tabindex="0" aria-pressed="${o}" title="${d}">
290
- ${l}
286
+ const o = t === i.id, n = S(i.id), s = S(i.nome), l = S(i.descricao || i.nome);
287
+ let c = "";
288
+ return i.thumbnailUrl ? c = `<img class="ui-basemap-preview" src="${S(i.thumbnailUrl)}" alt="" loading="lazy" referrerpolicy="no-referrer" data-basemap-thumb />` : c = `<div class="ui-basemap-preview-none">${A.gradeCad}</div>`, `
289
+ <div class="ui-basemap-card ${o ? "active" : ""}" data-basemap-id="${n}" role="button" tabindex="0" aria-pressed="${o}" title="${l}">
290
+ ${c}
291
291
  <span>${s}</span>
292
292
  </div>
293
293
  `;
@@ -296,8 +296,8 @@ function tt(e = oa, t = "satelite", a = !1) {
296
296
  <div class="ui-basemap-section ${a ? "recolhido" : ""}" part="mapas-base">
297
297
  <button type="button" class="ui-basemap-toggle" data-basemap-toggle="alternar" aria-expanded="${!a}" aria-controls="ui-basemap-grid" title="${a ? "Mostrar mapas base" : "Recolher mapas base"}">
298
298
  <span class="ui-basemap-title">Mapa Base</span>
299
- <span class="ui-basemap-atual" data-basemap-atual>${z(na(e, t))}</span>
300
- <span class="ui-chevron-icon ${a ? "" : "open"}">${y.chevronDir}</span>
299
+ <span class="ui-basemap-atual" data-basemap-atual>${S(Ea(e, t))}</span>
300
+ <span class="ui-chevron-icon ${a ? "" : "open"}">${A.chevronDir}</span>
301
301
  </button>
302
302
  ${a ? "" : `<div class="ui-basemap-grid" id="ui-basemap-grid">
303
303
  ${r}
@@ -305,50 +305,50 @@ function tt(e = oa, t = "satelite", a = !1) {
305
305
  </div>
306
306
  `;
307
307
  }
308
- function ie(e) {
308
+ function te(e) {
309
309
  if (!Array.isArray(e) || e.length === 0) return [];
310
- const t = e.filter((l) => !!(l && typeof l == "object" && l.id)), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
311
- t.forEach((l, c) => {
312
- a.set(l.id, l), r.set(l.id, c);
310
+ const t = e.filter((c) => !!(c && typeof c == "object" && c.id)), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
311
+ t.forEach((c, f) => {
312
+ a.set(c.id, c), r.set(c.id, f);
313
313
  });
314
314
  const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
315
- for (const l of t) {
316
- if (o.has(l.id)) continue;
317
- const c = [], f = /* @__PURE__ */ new Map();
318
- let u = l;
319
- for (; u && u.parentId && a.has(u.parentId) && u.parentId !== u.id; ) {
320
- if (f.has(u.id)) {
321
- const p = f.get(u.id), m = c.slice(p);
322
- let g = m[0];
323
- for (const b of m)
324
- (r.get(b) ?? 1 / 0) < (r.get(g) ?? 1 / 0) && (g = b);
325
- i.add(g);
315
+ for (const c of t) {
316
+ if (o.has(c.id)) continue;
317
+ const f = [], p = /* @__PURE__ */ new Map();
318
+ let d = c;
319
+ for (; d && d.parentId && a.has(d.parentId) && d.parentId !== d.id; ) {
320
+ if (p.has(d.id)) {
321
+ const u = p.get(d.id), h = f.slice(u);
322
+ let m = h[0];
323
+ for (const g of h)
324
+ (r.get(g) ?? 1 / 0) < (r.get(m) ?? 1 / 0) && (m = g);
325
+ i.add(m);
326
326
  break;
327
327
  }
328
- if (o.has(u.id)) break;
329
- f.set(u.id, c.length), c.push(u.id), u = a.get(u.parentId);
328
+ if (o.has(d.id)) break;
329
+ p.set(d.id, f.length), f.push(d.id), d = a.get(d.parentId);
330
330
  }
331
- for (const p of c) o.add(p);
331
+ for (const u of f) o.add(u);
332
332
  }
333
333
  const n = /* @__PURE__ */ new Map(), s = [];
334
- t.forEach((l) => {
335
- !i.has(l.id) && !!(l.parentId && a.has(l.parentId) && l.parentId !== l.id) && l.parentId ? (n.has(l.parentId) || n.set(l.parentId, []), n.get(l.parentId).push(l)) : s.push(l);
334
+ t.forEach((c) => {
335
+ !i.has(c.id) && !!(c.parentId && a.has(c.parentId) && c.parentId !== c.id) && c.parentId ? (n.has(c.parentId) || n.set(c.parentId, []), n.get(c.parentId).push(c)) : s.push(c);
336
336
  });
337
- function d(l, c, f) {
338
- const u = new Set(f);
339
- u.add(l.id);
340
- const m = (n.get(l.id) || (Array.isArray(l.children) ? l.children : [])).filter(
341
- (g) => !!(g && typeof g == "object" && g.id && !u.has(g.id))
337
+ function l(c, f, p) {
338
+ const d = new Set(p);
339
+ d.add(c.id);
340
+ const h = (n.get(c.id) || (Array.isArray(c.children) ? c.children : [])).filter(
341
+ (m) => !!(m && typeof m == "object" && m.id && !d.has(m.id))
342
342
  );
343
343
  return {
344
- camada: l,
345
- depth: c,
346
- subcamadas: m.map((g) => d(g, c + 1, u))
344
+ camada: c,
345
+ depth: f,
346
+ subcamadas: h.map((m) => l(m, f + 1, d))
347
347
  };
348
348
  }
349
- return s.map((l) => d(l, 0, /* @__PURE__ */ new Set()));
349
+ return s.map((c) => l(c, 0, /* @__PURE__ */ new Set()));
350
350
  }
351
- function qe(e, t) {
351
+ function Ve(e, t) {
352
352
  const a = /* @__PURE__ */ new Set();
353
353
  if (!t || !Array.isArray(e)) return a;
354
354
  const r = /* @__PURE__ */ new Map();
@@ -366,12 +366,12 @@ function qe(e, t) {
366
366
  }
367
367
  return a;
368
368
  }
369
- function rt(e, t, a) {
369
+ function Pt(e, t, a) {
370
370
  if (!a || !Array.isArray(t) || t.length === 0) return [];
371
- const r = qe(e, a);
371
+ const r = Ve(e, a);
372
372
  return t.filter((i) => !!(i && i.layerId && r.has(i.layerId)));
373
373
  }
374
- function ge(e) {
374
+ function le(e) {
375
375
  const t = /* @__PURE__ */ new Map();
376
376
  e.forEach((r) => r && r.id && t.set(r.id, r));
377
377
  const a = /* @__PURE__ */ new Map();
@@ -385,8 +385,8 @@ function ge(e) {
385
385
  }
386
386
  return a;
387
387
  }
388
- function pe(e) {
389
- const t = ge(e);
388
+ function we(e) {
389
+ const t = le(e);
390
390
  return new Set(
391
391
  e.filter((a) => {
392
392
  var r;
@@ -394,24 +394,24 @@ function pe(e) {
394
394
  }).map((a) => a.id)
395
395
  );
396
396
  }
397
- function sa(e) {
398
- const t = ie(e), a = pe(e), r = (i) => {
399
- const o = i.camada, n = i.depth, s = i.subcamadas, d = n > 0 ? "&nbsp;&nbsp;".repeat(n) + "↳ " : s.length > 0 || o.isGroup ? "📁 " : "", l = a.has(o.id), c = `<option value="${z(o.id)}"${l ? " disabled" : ""}>${d}${z(o.name)}${l ? " 🔒" : ""}</option>`, f = s.map((u) => r(u)).join("");
400
- return c + f;
397
+ function Ia(e) {
398
+ const t = te(e), a = we(e), r = (i) => {
399
+ const o = i.camada, n = i.depth, s = i.subcamadas, l = n > 0 ? "&nbsp;&nbsp;".repeat(n) + "↳ " : s.length > 0 || o.isGroup ? "📁 " : "", c = a.has(o.id), f = `<option value="${S(o.id)}"${c ? " disabled" : ""}>${l}${S(o.name)}${c ? " 🔒" : ""}</option>`, p = s.map((d) => r(d)).join("");
400
+ return f + p;
401
401
  };
402
402
  return t.map((i) => r(i)).join("");
403
403
  }
404
- function la(e, t) {
404
+ function ka(e, t) {
405
405
  return t > 0 ? {
406
- icone: y.alvoEnquadrar,
406
+ icone: A.alvoEnquadrar,
407
407
  texto: `${t} ${t > 1 ? "selecionados" : "selecionado"}`
408
408
  } : {
409
- icone: y.camadas,
409
+ icone: A.camadas,
410
410
  texto: `${e} ${e > 1 ? "camadas" : "camada"}`
411
411
  };
412
412
  }
413
- function it(e, t, a) {
414
- const r = t.filter((d) => a.has(d.id)), i = r.length > 0, o = i ? r.length : e.length, n = la(e.length, r.length), s = sa(e);
413
+ function qt(e, t, a) {
414
+ const r = t.filter((l) => a.has(l.id)), i = r.length > 0, o = i ? r.length : e.length, n = ka(e.length, r.length), s = Ia(e);
415
415
  return `
416
416
  <div class="ui-tree-footer ${i ? "tem-selecao" : "sem-selecao"}" part="rodape">
417
417
  <div class="ui-footer-left">
@@ -422,11 +422,11 @@ function it(e, t, a) {
422
422
  <!-- Criação de camadas/grupos quando não há nada selecionado -->
423
423
  <div class="ui-footer-actions-gerais" style="display: ${i ? "none" : "flex"};">
424
424
  <button type="button" class="ui-footer-chip-btn" id="btn-footer-new-group" title="Criar Nova Pasta/Grupo de Camadas" aria-label="Criar Grupo de Camadas">
425
- ${y.moverPasta}
425
+ ${A.moverPasta}
426
426
  <span>Grupo</span>
427
427
  </button>
428
428
  <button type="button" class="ui-footer-chip-btn primario" id="btn-footer-new-layer" title="Criar Nova Camada Vetorial" aria-label="Criar Nova Camada">
429
- ${y.mais}
429
+ ${A.mais}
430
430
  <span>Camada</span>
431
431
  </button>
432
432
  </div>
@@ -441,120 +441,131 @@ function it(e, t, a) {
441
441
  </div>
442
442
 
443
443
  <button type="button" class="ui-footer-btn btn-danger-footer ${i ? "" : "disabled"}" id="btn-footer-del" title="Excluir selecionados" aria-label="Excluir selecionados" ${i ? "" : "disabled"}>
444
- ${y.lixeira}
444
+ ${A.lixeira}
445
445
  </button>
446
446
  </div>
447
447
  </div>
448
448
  `;
449
449
  }
450
- const Ee = 64;
451
- function _e(e) {
450
+ const Se = 64;
451
+ function ea(e) {
452
452
  return Array.isArray(e) && e.length >= 2 && Number.isFinite(e[0]) && Number.isFinite(e[1]);
453
453
  }
454
- function da(e) {
455
- return !Array.isArray(e) || e.length === 0 ? [] : _e(e[0]) ? [e.filter(_e)] : e.flatMap(da);
454
+ function La(e) {
455
+ return !Array.isArray(e) || e.length === 0 ? [] : ea(e[0]) ? [e.filter(ea)] : e.flatMap(La);
456
456
  }
457
- function Ve(e) {
458
- if (e.length <= Ee) return e;
459
- const t = e.length / Ee, a = [];
460
- for (let r = 0; r < Ee; r++) a.push(e[Math.floor(r * t)]);
457
+ function aa(e) {
458
+ if (e.length <= Se) return e;
459
+ const t = e.length / Se, a = [];
460
+ for (let r = 0; r < Se; r++) a.push(e[Math.floor(r * t)]);
461
461
  return a.push(e[e.length - 1]), a;
462
462
  }
463
- function ot(e, t, a) {
464
- const r = da(t).filter((L) => L.length > 0);
463
+ function Bt(e, t, a) {
464
+ const r = La(t).filter((F) => F.length > 0);
465
465
  if (r.length === 0) return "";
466
466
  let i = 1 / 0, o = -1 / 0, n = 1 / 0, s = -1 / 0;
467
- for (const L of r)
468
- for (const [S, x] of L)
469
- x < i && (i = x), x > o && (o = x), -S < n && (n = -S), -S > s && (s = -S);
470
- const d = 16, l = 2, c = d - l * 2, f = o - i, u = s - n, p = Math.max(f, u), m = p > 0 ? c / p : 0, g = l + (c - f * m) / 2, b = l + (c - u * m) / 2, h = (L) => Math.round(L * 100) / 100, v = ([L, S]) => `${h(g + (S - i) * m)},${h(b + (-L - n) * m)}`, A = e === "polygon" || e === "multipolygon", I = e === "linestring" || e === "multilinestring", w = (L) => `<svg viewBox="0 0 ${d} ${d}" width="100%" height="100%" aria-hidden="true">${L}</svg>`;
471
- if (A) {
472
- const L = r.filter((S) => S.length >= 3).map((S) => `M${Ve(S).map(v).join("L")}Z`).join("");
473
- return L ? w(
474
- `<path d="${L}" fill="${a}" fill-opacity="0.45" fill-rule="evenodd" stroke="${a}" stroke-width="1.2" stroke-linejoin="round"/>`
467
+ for (const F of r)
468
+ for (const [I, P] of F)
469
+ P < i && (i = P), P > o && (o = P), -I < n && (n = -I), -I > s && (s = -I);
470
+ const l = 16, c = 2, f = l - c * 2, p = o - i, d = s - n, u = Math.max(p, d), h = u > 0 ? f / u : 0, m = c + (f - p * h) / 2, g = c + (f - d * h) / 2, y = (F) => Math.round(F * 100) / 100, v = ([F, I]) => `${y(m + (I - i) * h)},${y(g + (-F - n) * h)}`, b = e === "polygon" || e === "multipolygon", w = e === "linestring" || e === "multilinestring", x = (F) => `<svg viewBox="0 0 ${l} ${l}" width="100%" height="100%" aria-hidden="true">${F}</svg>`;
471
+ if (b) {
472
+ const F = r.filter((I) => I.length >= 3).map((I) => `M${aa(I).map(v).join("L")}Z`).join("");
473
+ return F ? x(
474
+ `<path d="${F}" fill="${a}" fill-opacity="0.45" fill-rule="evenodd" stroke="${a}" stroke-width="1.2" stroke-linejoin="round"/>`
475
475
  ) : "";
476
476
  }
477
- if (I) {
478
- const L = r.filter((S) => S.length >= 2).map((S) => `M${Ve(S).map(v).join("L")}`).join("");
479
- return L ? w(
480
- `<path d="${L}" fill="none" stroke="${a}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>`
477
+ if (w) {
478
+ const F = r.filter((I) => I.length >= 2).map((I) => `M${aa(I).map(v).join("L")}`).join("");
479
+ return F ? x(
480
+ `<path d="${F}" fill="none" stroke="${a}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>`
481
481
  ) : "";
482
482
  }
483
483
  return "";
484
484
  }
485
- function ca(e, t, a) {
486
- const r = J(t, "#00E08A"), i = (e || "").toLowerCase(), o = a !== void 0 ? ot(i, a, r) : "";
485
+ function Ca(e, t, a) {
486
+ const r = Z(t, "#00E08A"), i = (e || "").toLowerCase(), o = a !== void 0 ? Bt(i, a, r) : "";
487
487
  return o || (i === "polygon" || i === "multipolygon" ? `<svg viewBox="0 0 16 16" width="11" height="11"><polygon points="2,14 14,14 12,2 4,4" fill="${r}" fill-opacity="0.45" stroke="${r}" stroke-width="1.5"/></svg>` : i === "linestring" || i === "multilinestring" ? `<svg viewBox="0 0 16 16" width="11" height="11"><polyline points="2,13 8,3 14,10" fill="none" stroke="${r}" stroke-width="2"/></svg>` : i === "text" ? `<svg viewBox="0 0 16 16" width="11" height="11"><text x="8" y="12" font-size="12" font-weight="bold" fill="${r}" text-anchor="middle" font-family="sans-serif">T</text></svg>` : `<svg viewBox="0 0 16 16" width="11" height="11"><circle cx="8" cy="8" r="4.2" fill="${r}" stroke="#ffffff" stroke-width="1.2"/></svg>`);
488
488
  }
489
- function Se(e, t, a) {
489
+ function Be(e, t, a) {
490
490
  return {
491
- camadaIdSeguro: z(e.id),
492
- corCamada: J(e.color, "#00E08A"),
491
+ camadaIdSeguro: S(e.id),
492
+ corCamada: Z(e.color, "#00E08A"),
493
493
  profundidade: t,
494
494
  esmaecida: e.visible === !1 || (a == null ? void 0 : a.ocultaPorAncestral) === !0,
495
495
  travadaPelaCamada: e.locked === !0 || (a == null ? void 0 : a.travadaPorAncestral) === !0
496
496
  };
497
497
  }
498
- const Ie = (e, t, a) => `${e} ${e === 1 ? t : a}`;
499
- function ua(e, t, a) {
500
- return a === 0 ? Ie(e, "feição", "feições") : `${Ie(e, "feição", "feições")} no grupo (${t} nesta camada) · ${Ie(a, "subcamada", "subcamadas")}`;
498
+ const $e = (e, t, a) => `${e} ${e === 1 ? t : a}`;
499
+ function Fa(e, t, a) {
500
+ return a === 0 ? $e(e, "feição", "feições") : `${$e(e, "feição", "feições")} no grupo (${t} nesta camada) · ${$e(a, "subcamada", "subcamadas")}`;
501
501
  }
502
- function pa(e, t, a, r) {
503
- return e === 0 && r ? "" : `<span class="ui-count-chip" title="${ua(e, t, a)}">${e}</span>`;
502
+ function Sa(e, t, a, r) {
503
+ return e === 0 && r ? "" : `<span class="ui-count-chip" title="${Fa(e, t, a)}">${e}</span>`;
504
504
  }
505
- function fa(e, t) {
505
+ function $a(e, t) {
506
506
  const a = t - e;
507
507
  return {
508
508
  resumo: `Exibindo ${e} de ${t} feições. Use a busca acima para filtrar.`,
509
509
  botao: `Mostrar mais (+${Math.min(80, a)})`
510
510
  };
511
511
  }
512
- function ma(e, t, a) {
513
- const r = fa(t, a);
512
+ function Ma(e, t, a) {
513
+ const r = $a(t, a);
514
514
  return `<div class="ui-truncate-notice" role="note">
515
515
  <span>${r.resumo}</span>
516
516
  <button type="button" class="ui-truncate-more-btn" data-layer-show-more="${e}">${r.botao}</button>
517
517
  </div>`;
518
518
  }
519
- function ga(e) {
519
+ function za(e) {
520
520
  return `<div class="ui-empty-row"><span>${e ? "Grupo vazio (adicione subcamadas ou feições)" : "Camada vazia"}</span></div>`;
521
521
  }
522
- const nt = ["name", "color", "visible", "locked", "status", "type", "geometryType", "coordinates", "layerId"];
523
- function st(e, t) {
524
- return nt.every((a) => e[a] === t[a]);
522
+ const ta = ["name", "color", "visible", "locked", "status", "type", "geometryType", "coordinates", "layerId"];
523
+ function Dt(e, t) {
524
+ for (let a = 0; a < ta.length; a++) {
525
+ const r = ta[a];
526
+ if (e[r] !== t[r]) return !1;
527
+ }
528
+ return !0;
529
+ }
530
+ function Pa(e) {
531
+ return e ? ` aria-posinset="${e.posicao}" aria-setsize="${e.total}"` : "";
525
532
  }
526
- function Fe(e, t, a, r) {
527
- const { camadaIdSeguro: i, corCamada: o, profundidade: n } = t, s = z(e.id), d = z(e.name || "Feição"), l = J(e.color, o), c = e.visible !== !1, f = t.travadaPelaCamada, u = e.locked === !0 || f, p = f ? "Bloqueada pela camada" : u ? "Desbloquear Feição" : "Bloquear Feição", m = e.status === "previa" ? '<span class="ui-previa-dot" title="Geometria prévia" aria-label="Geometria prévia"></span>' : "";
533
+ function ra(e, t, a) {
534
+ const r = Number.isFinite(a) && a > 0 ? Math.round(a) : 0;
535
+ return `<div class="ui-virtual-espaco" data-virtual-espaco="${e}:${t}" aria-hidden="true" style="height: ${r}px;"></div>`;
536
+ }
537
+ function De(e, t, a, r, i) {
538
+ const { camadaIdSeguro: o, corCamada: n, profundidade: s } = t, l = S(e.id), c = S(e.name || "Feição"), f = Z(e.color, n), p = e.visible !== !1, d = t.travadaPelaCamada, u = e.locked === !0 || d, h = d ? "Bloqueada pela camada" : u ? "Desbloquear Feição" : "Bloquear Feição", m = e.status === "previa" ? '<span class="ui-previa-dot" title="Geometria prévia" aria-label="Geometria prévia"></span>' : "";
528
539
  return `
529
- <div class="ui-feat-row ${a ? "selected-row" : ""} ${c ? "" : "hidden-row"} ${t.esmaecida ? "herdado-oculto" : ""}" data-feat-row="${s}" data-feat-select="${s}" data-feat-layer="${i}" role="treeitem" aria-level="${n + 2}" aria-selected="${a}" tabindex="-1" draggable="true" part="${a ? "feicao feicao-selecionada" : "feicao"}" style="--layer-depth: ${n + 1};" title="Clique para selecionar | Arraste para reordenar">
530
- <div class="ui-col ui-col-eye" data-feat-eye="${s}" role="button" tabindex="0" aria-label="${c ? "Ocultar Feição" : "Exibir Feição"}" title="${c ? "Ocultar Feição" : "Exibir Feição"}">
531
- ${c ? y.olhoAberto : y.olhoFechado}
540
+ <div class="ui-feat-row ${a ? "selected-row" : ""} ${p ? "" : "hidden-row"} ${t.esmaecida ? "herdado-oculto" : ""}" data-feat-row="${l}" data-feat-select="${l}" data-feat-layer="${o}" role="treeitem" aria-level="${s + 2}" aria-selected="${a}" tabindex="-1" draggable="true" part="${a ? "feicao feicao-selecionada" : "feicao"}" style="--layer-depth: ${s + 1};" title="Clique para selecionar | Arraste para reordenar"${Pa(i)}>
541
+ <div class="ui-col ui-col-eye" data-feat-eye="${l}" role="button" tabindex="0" aria-label="${p ? "Ocultar Feição" : "Exibir Feição"}" title="${p ? "Ocultar Feição" : "Exibir Feição"}">
542
+ ${p ? A.olhoAberto : A.olhoFechado}
532
543
  </div>
533
544
 
534
- <div class="ui-col ui-col-lock ${u ? "" : "ui-lock-open"}" data-feat-lock="${s}" ${f ? 'data-locked-by-layer="true"' : ""} role="button" tabindex="0" aria-label="${p}" title="${p}">
535
- ${u ? y.cadeadoTrancado : y.cadeadoAberto}
545
+ <div class="ui-col ui-col-lock ${u ? "" : "ui-lock-open"}" data-feat-lock="${l}" ${d ? 'data-locked-by-layer="true"' : ""} role="button" tabindex="0" aria-label="${h}" title="${h}">
546
+ ${u ? A.cadeadoTrancado : A.cadeadoAberto}
536
547
  </div>
537
548
 
538
- <div class="ui-col ui-col-colorbar" style="background: ${o};"></div>
549
+ <div class="ui-col ui-col-colorbar" style="background: ${n};"></div>
539
550
  <div class="ui-col ui-col-thumb">
540
- <div class="ui-thumb-box">${ca(e.type || e.geometryType, l, e.coordinates)}</div>
551
+ <div class="ui-thumb-box">${Ca(e.type || e.geometryType, f, e.coordinates)}</div>
541
552
  </div>
542
553
 
543
- <div class="ui-col ui-col-name" data-feat-name-trigger="${s}" title="Duplo clique para renomear">
544
- ${r ? `<input type="text" class="ui-inline-rename-input" data-inline-feat-input="${s}" value="${d}" />` : `<span class="ui-name-text">${d}</span>${m}`}
554
+ <div class="ui-col ui-col-name" data-feat-name-trigger="${l}" title="Duplo clique para renomear">
555
+ ${r ? `<input type="text" class="ui-inline-rename-input" data-inline-feat-input="${l}" value="${c}" />` : `<span class="ui-name-text">${c}</span>${m}`}
545
556
  </div>
546
557
 
547
558
  <div class="ui-col ui-col-actions">
548
- <button type="button" class="ui-micro-btn" data-feat-fit="${s}" title="Enquadrar no mapa" aria-label="Enquadrar feição no mapa">${y.alvoEnquadrar}</button>
559
+ <button type="button" class="ui-micro-btn" data-feat-fit="${l}" title="Enquadrar no mapa" aria-label="Enquadrar feição no mapa">${A.alvoEnquadrar}</button>
549
560
  </div>
550
561
 
551
- <div class="ui-col ui-col-target" data-feat-target="${s}" role="button" tabindex="0" aria-label="Selecionar feição" title="Selecionar feição">
562
+ <div class="ui-col ui-col-target" data-feat-target="${l}" role="button" tabindex="0" aria-label="Selecionar feição" title="Selecionar feição">
552
563
  <div class="ui-target-circle ${a ? "selected" : ""}"></div>
553
564
  </div>
554
565
  </div>
555
566
  `;
556
567
  }
557
- function N(e, t, a) {
568
+ function T(e, t, a) {
558
569
  const r = /* @__PURE__ */ new Set();
559
570
  let i = e.find((o) => o.id === t);
560
571
  for (; i && i.parentId; ) {
@@ -563,46 +574,46 @@ function N(e, t, a) {
563
574
  }
564
575
  return !1;
565
576
  }
566
- function ke(e) {
577
+ function Me(e) {
567
578
  return Number.isFinite(e) ? e < 0.25 ? "acima" : e > 0.75 ? "abaixo" : "dentro" : "dentro";
568
579
  }
569
- function Ue(e, t, a, r) {
580
+ function ia(e, t, a, r) {
570
581
  if (!t || !a || t === a) return null;
571
- const i = e.find((l) => l.id === t), o = e.find((l) => l.id === a);
582
+ const i = e.find((c) => c.id === t), o = e.find((c) => c.id === a);
572
583
  if (!i || !o) return null;
573
584
  const n = i.parentId !== void 0 ? i.parentId : null;
574
585
  if (r === "dentro")
575
- return N(e, o.id, i.id) ? null : (i.parentId = o.id, { tipo: "hierarquia", camada: i, novoParentId: o.id, parentAnteriorId: n });
576
- if (N(e, o.id, i.id)) return null;
577
- const s = e.findIndex((l) => l.id === t);
586
+ return T(e, o.id, i.id) ? null : (i.parentId = o.id, { tipo: "hierarquia", camada: i, novoParentId: o.id, parentAnteriorId: n });
587
+ if (T(e, o.id, i.id)) return null;
588
+ const s = e.findIndex((c) => c.id === t);
578
589
  e.splice(s, 1);
579
- const d = e.findIndex((l) => l.id === a);
580
- return d === -1 ? e.push(i) : e.splice(r === "acima" ? d : d + 1, 0, i), i.parentId = o.parentId ?? null, { tipo: "ordem", camada: i, parentAnteriorId: n, novoParentId: i.parentId };
590
+ const l = e.findIndex((c) => c.id === a);
591
+ return l === -1 ? e.push(i) : e.splice(r === "acima" ? l : l + 1, 0, i), i.parentId = o.parentId ?? null, { tipo: "ordem", camada: i, parentAnteriorId: n, novoParentId: i.parentId };
581
592
  }
582
- function lt(e, t, a, r) {
593
+ function Rt(e, t, a, r) {
583
594
  const i = e.find((s) => s.id === a), o = t.find((s) => s.id === r);
584
595
  if (!i || !o || i.layerId === r) return null;
585
596
  const n = i.layerId;
586
597
  return i.layerId = r, { feicao: i, camadaOrigemId: n, camadaDestinoId: r, mudouDeCamada: !0 };
587
598
  }
588
- function dt(e, t, a, r) {
599
+ function Tt(e, t, a, r) {
589
600
  if (!t || !a || t === a) return null;
590
- const i = e.findIndex((f) => f.id === t);
601
+ const i = e.findIndex((p) => p.id === t);
591
602
  if (i === -1) return null;
592
- const o = e.find((f) => f.id === a);
603
+ const o = e.find((p) => p.id === a);
593
604
  if (!o) return null;
594
- const [n] = e.splice(i, 1), s = n.layerId, d = o.layerId, l = s !== d;
595
- l && (n.layerId = d);
596
- const c = e.findIndex((f) => f.id === a);
597
- return c === -1 ? e.push(n) : e.splice(r ? c : c + 1, 0, n), { feicao: n, camadaOrigemId: s, camadaDestinoId: d, mudouDeCamada: l };
605
+ const [n] = e.splice(i, 1), s = n.layerId, l = o.layerId, c = s !== l;
606
+ c && (n.layerId = l);
607
+ const f = e.findIndex((p) => p.id === a);
608
+ return f === -1 ? e.push(n) : e.splice(r ? f : f + 1, 0, n), { feicao: n, camadaOrigemId: s, camadaDestinoId: l, mudouDeCamada: c };
598
609
  }
599
- function H(e) {
610
+ function O(e) {
600
611
  return `L:${e}`;
601
612
  }
602
- function O(e) {
613
+ function B(e) {
603
614
  return `F:${e}`;
604
615
  }
605
- function ha(e, t, a) {
616
+ function qa(e, t, a) {
606
617
  if (!a || a.length === 0)
607
618
  return [
608
619
  ...e.map((s) => ({ tipo: "layer", nodo: s })),
@@ -612,53 +623,53 @@ function ha(e, t, a) {
612
623
  for (const s of a)
613
624
  if (!o.has(s)) {
614
625
  if (s.startsWith("L:")) {
615
- const d = s.slice(2), l = r.get(d);
616
- l && (o.add(s), n.push({ tipo: "layer", nodo: l }));
626
+ const l = s.slice(2), c = r.get(l);
627
+ c && (o.add(s), n.push({ tipo: "layer", nodo: c }));
617
628
  } else if (s.startsWith("F:")) {
618
- const d = s.slice(2), l = i.get(d);
619
- l && (o.add(s), n.push({ tipo: "feature", feicao: l }));
629
+ const l = s.slice(2), c = i.get(l);
630
+ c && (o.add(s), n.push({ tipo: "feature", feicao: c }));
620
631
  }
621
632
  }
622
633
  for (const s of e) {
623
- const d = H(s.camada.id);
624
- o.has(d) || (o.add(d), n.push({ tipo: "layer", nodo: s }));
634
+ const l = O(s.camada.id);
635
+ o.has(l) || (o.add(l), n.push({ tipo: "layer", nodo: s }));
625
636
  }
626
637
  for (const s of t) {
627
- const d = O(s.id);
628
- o.has(d) || (o.add(d), n.push({ tipo: "feature", feicao: s }));
638
+ const l = B(s.id);
639
+ o.has(l) || (o.add(l), n.push({ tipo: "feature", feicao: s }));
629
640
  }
630
641
  return n;
631
642
  }
632
- function he(e, t, a, r) {
633
- const i = a.filter((c) => c.parentId === t).map((c) => c.id), o = r.filter((c) => c.layerId === t).map((c) => c.id), n = /* @__PURE__ */ new Set([
634
- ...i.map(H),
635
- ...o.map(O)
636
- ]), s = e.get(t), d = [], l = /* @__PURE__ */ new Set();
643
+ function Ee(e, t, a, r) {
644
+ const i = a.filter((f) => f.parentId === t).map((f) => f.id), o = r.filter((f) => f.layerId === t).map((f) => f.id), n = /* @__PURE__ */ new Set([
645
+ ...i.map(O),
646
+ ...o.map(B)
647
+ ]), s = e.get(t), l = [], c = /* @__PURE__ */ new Set();
637
648
  if (s)
638
- for (const c of s)
639
- n.has(c) && !l.has(c) && (l.add(c), d.push(c));
640
- for (const c of i) {
641
- const f = H(c);
642
- l.has(f) || (l.add(f), d.push(f));
649
+ for (const f of s)
650
+ n.has(f) && !c.has(f) && (c.add(f), l.push(f));
651
+ for (const f of i) {
652
+ const p = O(f);
653
+ c.has(p) || (c.add(p), l.push(p));
643
654
  }
644
- for (const c of o) {
645
- const f = O(c);
646
- l.has(f) || (l.add(f), d.push(f));
655
+ for (const f of o) {
656
+ const p = B(f);
657
+ c.has(p) || (c.add(p), l.push(p));
647
658
  }
648
- return d;
659
+ return l;
649
660
  }
650
- function ve(e, t, a, r) {
661
+ function Ie(e, t, a, r) {
651
662
  const i = e.filter((n) => n !== t), o = i.indexOf(a);
652
663
  o === -1 ? i.push(t) : i.splice(r ? o : o + 1, 0, t), e.length = 0, e.push(...i);
653
664
  }
654
- function G(e, t, a) {
665
+ function N(e, t, a) {
655
666
  if (!t) return;
656
667
  const r = e.get(t);
657
668
  if (!r) return;
658
669
  const i = r.filter((o) => o !== a);
659
670
  i.length === 0 ? e.delete(t) : e.set(t, i);
660
671
  }
661
- function ct(e, t) {
672
+ function Ot(e, t) {
662
673
  const a = t.filter((n) => n.startsWith("L:")).map((n) => n.slice(2));
663
674
  if (a.length < 2) return;
664
675
  const r = new Set(a), i = [], o = /* @__PURE__ */ new Map();
@@ -670,7 +681,7 @@ function ct(e, t) {
670
681
  s && (e[i[n]] = s);
671
682
  }
672
683
  }
673
- function ut(e, t) {
684
+ function jt(e, t) {
674
685
  const a = t.filter((n) => n.startsWith("F:")).map((n) => n.slice(2));
675
686
  if (a.length < 2) return;
676
687
  const r = new Set(a), i = [], o = /* @__PURE__ */ new Map();
@@ -682,168 +693,316 @@ function ut(e, t) {
682
693
  s && (e[i[n]] = s);
683
694
  }
684
695
  }
685
- function Ye(e, t, a, r, i, o) {
696
+ function oa(e, t, a, r, i, o) {
686
697
  if (!r || !i) return null;
687
- const n = e.find((f) => f.id === r), s = t.find((f) => f.id === i);
698
+ const n = e.find((p) => p.id === r), s = t.find((p) => p.id === i);
688
699
  if (!n || !s || !s.layerId) return null;
689
- const d = s.layerId;
690
- if (d === r || N(e, d, r)) return null;
691
- const l = n.parentId !== void 0 ? n.parentId : null;
692
- l && l !== d && G(a, l, H(r)), n.parentId = d;
693
- const c = he(a, d, e, t);
694
- return ve(c, H(r), O(i), o), a.set(d, c), ct(e, c), {
695
- tipo: l !== d ? "hierarquia" : "ordem",
700
+ const l = s.layerId;
701
+ if (l === r || T(e, l, r)) return null;
702
+ const c = n.parentId !== void 0 ? n.parentId : null;
703
+ c && c !== l && N(a, c, O(r)), n.parentId = l;
704
+ const f = Ee(a, l, e, t);
705
+ return Ie(f, O(r), B(i), o), a.set(l, f), Ot(e, f), {
706
+ tipo: c !== l ? "hierarquia" : "ordem",
696
707
  camada: n,
697
- parentAnteriorId: l,
698
- novoParentId: d
708
+ parentAnteriorId: c,
709
+ novoParentId: l
699
710
  };
700
711
  }
701
- function pt(e, t, a, r, i, o) {
712
+ function Nt(e, t, a, r, i, o) {
702
713
  if (!r || !i) return null;
703
- const n = t.find((u) => u.id === r), s = e.find((u) => u.id === i);
714
+ const n = t.find((d) => d.id === r), s = e.find((d) => d.id === i);
704
715
  if (!n || !s || !s.parentId) return null;
705
- const d = s.parentId, l = n.layerId, c = l !== d;
706
- c && (G(a, l, O(r)), n.layerId = d);
707
- const f = he(a, d, e, t);
708
- return ve(f, O(r), H(i), o), a.set(d, f), ut(t, f), { feicao: n, camadaOrigemId: l, camadaDestinoId: d, mudouDeCamada: c };
716
+ const l = s.parentId, c = n.layerId, f = c !== l;
717
+ f && (N(a, c, B(r)), n.layerId = l);
718
+ const p = Ee(a, l, e, t);
719
+ return Ie(p, B(r), O(i), o), a.set(l, p), jt(t, p), { feicao: n, camadaOrigemId: c, camadaDestinoId: l, mudouDeCamada: f };
709
720
  }
710
- function Ke(e, t, a, r, i, o, n, s) {
711
- const d = H(r);
712
- if (n && (n !== s || o === "dentro") && G(a, n, d), o !== "dentro" && s && a.has(s)) {
713
- const l = he(a, s, e, t);
714
- ve(l, d, H(i), o === "acima"), a.set(s, l);
721
+ function na(e, t, a, r, i, o, n, s) {
722
+ const l = O(r);
723
+ if (n && (n !== s || o === "dentro") && N(a, n, l), o !== "dentro" && s && a.has(s)) {
724
+ const c = Ee(a, s, e, t);
725
+ Ie(c, l, O(i), o === "acima"), a.set(s, c);
715
726
  }
716
727
  }
717
- function ft(e, t, a, r, i, o, n, s) {
718
- const d = O(r);
719
- if (n && n !== s && G(a, n, d), s && a.has(s)) {
720
- const l = he(a, s, e, t);
721
- ve(l, d, O(i), o), a.set(s, l);
728
+ function Ht(e, t, a, r, i, o, n, s) {
729
+ const l = B(r);
730
+ if (n && n !== s && N(a, n, l), s && a.has(s)) {
731
+ const c = Ee(a, s, e, t);
732
+ Ie(c, l, B(i), o), a.set(s, c);
722
733
  }
723
734
  }
724
- function va(e, t, a, r) {
725
- const i = O(t);
726
- if (G(e, a, i), r && e.has(r)) {
735
+ function Ba(e, t, a, r) {
736
+ const i = B(t);
737
+ if (N(e, a, i), r && e.has(r)) {
727
738
  const o = e.get(r);
728
739
  o.includes(i) || o.push(i);
729
740
  }
730
741
  }
731
- const De = 80;
732
- function $e(e, t) {
742
+ const _e = 80;
743
+ function Re(e, t) {
733
744
  const a = (t || "").trim().toLowerCase();
734
745
  return a ? e.filter(
735
746
  (r) => (r.name || "").toLowerCase().includes(a) || (r.category || "").toLowerCase().includes(a) || (r.type || "").toLowerCase().includes(a)
736
747
  ) : e;
737
748
  }
738
- function be(e, t, a) {
739
- var u, p;
749
+ function ke(e, t, a) {
750
+ var d, u;
740
751
  const r = (a || "").trim().toLowerCase();
741
752
  if (!r) return null;
742
753
  const i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
743
- for (const m of e)
744
- i.set(m.id, m), m.parentId && m.parentId !== m.id && (o.has(m.parentId) || o.set(m.parentId, []), o.get(m.parentId).push(m.id));
754
+ for (const h of e)
755
+ i.set(h.id, h), h.parentId && h.parentId !== h.id && (o.has(h.parentId) || o.set(h.parentId, []), o.get(h.parentId).push(h.id));
745
756
  const n = /* @__PURE__ */ new Map();
746
- for (const m of t) {
747
- const g = m.layerId || "";
748
- n.has(g) || n.set(g, []), n.get(g).push(m);
749
- }
750
- const s = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
751
- for (const m of e)
752
- (typeof m.name == "string" ? m.name.toLowerCase() : "").includes(r) ? (s.add(m.id), d.add(m.id)) : $e(n.get(m.id) || [], r).length > 0 && d.add(m.id);
753
- const l = new Set(d);
754
- for (const m of d) {
755
- const g = /* @__PURE__ */ new Set([m]);
756
- let b = (u = i.get(m)) == null ? void 0 : u.parentId;
757
- for (; b && i.has(b) && !g.has(b); )
758
- g.add(b), l.add(b), b = (p = i.get(b)) == null ? void 0 : p.parentId;
759
- }
760
- const c = [...s];
761
- for (; c.length > 0; ) {
762
- const m = c.pop();
763
- for (const g of o.get(m) || [])
764
- l.has(g) || (l.add(g), c.push(g));
765
- }
766
- const f = /* @__PURE__ */ new Map();
767
- for (const m of l) {
768
- const g = n.get(m) || [];
769
- f.set(m, s.has(m) ? g : $e(g, r));
770
- }
771
- return { camadasVisiveis: l, feicoesPorCamada: f };
772
- }
773
- function ba(e, t, a, r) {
757
+ for (const h of t) {
758
+ const m = h.layerId || "";
759
+ n.has(m) || n.set(m, []), n.get(m).push(h);
760
+ }
761
+ const s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
762
+ for (const h of e)
763
+ (typeof h.name == "string" ? h.name.toLowerCase() : "").includes(r) ? (s.add(h.id), l.add(h.id)) : Re(n.get(h.id) || [], r).length > 0 && l.add(h.id);
764
+ const c = new Set(l);
765
+ for (const h of l) {
766
+ const m = /* @__PURE__ */ new Set([h]);
767
+ let g = (d = i.get(h)) == null ? void 0 : d.parentId;
768
+ for (; g && i.has(g) && !m.has(g); )
769
+ m.add(g), c.add(g), g = (u = i.get(g)) == null ? void 0 : u.parentId;
770
+ }
771
+ const f = [...s];
772
+ for (; f.length > 0; ) {
773
+ const h = f.pop();
774
+ for (const m of o.get(h) || [])
775
+ c.has(m) || (c.add(m), f.push(m));
776
+ }
777
+ const p = /* @__PURE__ */ new Map();
778
+ for (const h of c) {
779
+ const m = n.get(h) || [];
780
+ p.set(h, s.has(h) ? m : Re(m, r));
781
+ }
782
+ return { camadasVisiveis: c, feicoesPorCamada: p };
783
+ }
784
+ function Da(e, t, a, r) {
774
785
  const i = /* @__PURE__ */ new Map(), o = (n) => {
775
- const s = n.camada.id, l = !r || r.has(s) ? t.get(s) ?? [] : [];
776
- let c = l.length, f = 0;
777
- for (let p = 0; p < l.length; p++)
778
- a.has(l[p].id) && f++;
779
- for (const p of n.subcamadas) {
780
- if (r && !r.has(p.camada.id)) continue;
781
- const m = o(p);
782
- c += m.total, f += m.selecionadas;
786
+ const s = n.camada.id, c = !r || r.has(s) ? t.get(s) ?? [] : [];
787
+ let f = c.length, p = 0;
788
+ for (let u = 0; u < c.length; u++)
789
+ a.has(c[u].id) && p++;
790
+ for (const u of n.subcamadas) {
791
+ if (r && !r.has(u.camada.id)) continue;
792
+ const h = o(u);
793
+ f += h.total, p += h.selecionadas;
783
794
  }
784
- const u = { total: c, selecionadas: f };
785
- return i.set(s, u), u;
795
+ const d = { total: f, selecionadas: p };
796
+ return i.set(s, d), d;
786
797
  };
787
798
  for (const n of e)
788
799
  (!r || r.has(n.camada.id)) && o(n);
789
800
  return i;
790
801
  }
791
- function mt(e, t, a, r = "") {
802
+ function Vt(e, t, a, r = "") {
792
803
  if (!a || !Array.isArray(t) || t.length === 0) return [];
793
- const i = qe(e, a), o = be(e, t, r);
804
+ const i = Ve(e, a), o = ke(e, t, r);
794
805
  if (!o)
795
806
  return t.filter((s) => !!(s && s.layerId && i.has(s.layerId)));
796
807
  const n = [];
797
808
  for (const s of i) {
798
809
  if (!o.camadasVisiveis.has(s)) continue;
799
- const d = o.feicoesPorCamada.get(s);
800
- d && d.length > 0 && n.push(...d);
810
+ const l = o.feicoesPorCamada.get(s);
811
+ l && l.length > 0 && n.push(...l);
801
812
  }
802
813
  return n;
803
814
  }
804
- function ya(e, t, a, r = "", i = De, o, n) {
805
- const s = be(e, t, r), d = [], l = /* @__PURE__ */ new Map();
806
- for (let u = 0; u < t.length; u++) {
807
- const p = t[u];
808
- if (!p || !p.id) continue;
809
- const m = p.layerId || "";
810
- l.has(m) || l.set(m, []), l.get(m).push(p);
815
+ function _t(e, t, a, r = "", i = _e, o, n) {
816
+ const s = ke(e, t, r), l = [], c = /* @__PURE__ */ new Map();
817
+ for (let d = 0; d < t.length; d++) {
818
+ const u = t[d];
819
+ if (!u || !u.id) continue;
820
+ const h = u.layerId || "";
821
+ c.has(h) || c.set(h, []), c.get(h).push(u);
811
822
  }
812
823
  if (e.length === 0) {
813
- const u = (r || "").trim().toLowerCase();
814
- return (l.get("") ?? []).filter((m) => !u || String(m.name ?? "").toLowerCase().includes(u)).slice(0, i).map((m) => m.id);
815
- }
816
- const c = ie(e);
817
- function f(u) {
818
- const p = u.camada;
819
- if (s && !s.camadasVisiveis.has(p.id) || !(s ? !0 : a.has(p.id))) return;
820
- const g = s ? s.feicoesPorCamada.get(p.id) || [] : l.get(p.id) || [], b = (o == null ? void 0 : o.get(p.id)) ?? i, h = g.slice(0, b), v = s ? u.subcamadas.filter((I) => s.camadasVisiveis.has(I.camada.id)) : u.subcamadas, A = ha(v, h, n == null ? void 0 : n.get(p.id));
821
- for (const I of A)
822
- I.tipo === "layer" ? f(I.nodo) : d.push(I.feicao.id);
823
- }
824
- for (const u of c)
825
- f(u);
826
- return d;
827
- }
828
- function gt(e, t, a, r, i, o) {
824
+ const d = (r || "").trim().toLowerCase();
825
+ return (c.get("") ?? []).filter((h) => !d || String(h.name ?? "").toLowerCase().includes(d)).slice(0, i).map((h) => h.id);
826
+ }
827
+ const f = te(e);
828
+ function p(d) {
829
+ const u = d.camada;
830
+ if (s && !s.camadasVisiveis.has(u.id) || !(s ? !0 : a.has(u.id))) return;
831
+ const m = s ? s.feicoesPorCamada.get(u.id) || [] : c.get(u.id) || [], g = (o == null ? void 0 : o.get(u.id)) ?? i, y = m.slice(0, g), v = s ? d.subcamadas.filter((w) => s.camadasVisiveis.has(w.camada.id)) : d.subcamadas, b = qa(v, y, n == null ? void 0 : n.get(u.id));
832
+ for (const w of b)
833
+ w.tipo === "layer" ? p(w.nodo) : l.push(w.feicao.id);
834
+ }
835
+ for (const d of f)
836
+ p(d);
837
+ return l;
838
+ }
839
+ function Gt(e, t, a, r, i, o) {
829
840
  if (!e.includes(r)) return null;
830
841
  const n = new Set(t);
831
842
  let s = a;
832
843
  if (o && a && e.includes(a)) {
833
- const d = e.indexOf(a), l = e.indexOf(r), c = Math.min(d, l), f = Math.max(d, l);
844
+ const l = e.indexOf(a), c = e.indexOf(r), f = Math.min(l, c), p = Math.max(l, c);
834
845
  i || n.clear();
835
- for (let u = c; u <= f; u++)
836
- n.add(e[u]);
846
+ for (let d = f; d <= p; d++)
847
+ n.add(e[d]);
837
848
  } else i ? (n.has(r) ? n.delete(r) : n.add(r), s = r) : (n.clear(), n.add(r), s = r);
838
849
  return { selecionados: n, ultimoClicadoId: s };
839
850
  }
840
- function Te(e, t) {
851
+ function Ra(e, t) {
841
852
  if (e.size === 0) return;
842
853
  const a = new Set(t.map((r) => r.id));
843
854
  for (const r of e)
844
855
  a.has(r) || e.delete(r);
845
856
  }
846
- function ht(e) {
857
+ const Ut = 30, Yt = 4, Ae = { normal: 25, compacto: 22 }, Jt = 42, Kt = 22, Wt = 190, Qt = 1, sa = /* @__PURE__ */ new WeakMap();
858
+ function Xt(e, t) {
859
+ let a = sa.get(e);
860
+ if (!a) {
861
+ a = /* @__PURE__ */ new Map();
862
+ for (const r of e.containers.values())
863
+ if (r.exibido)
864
+ for (const i of r.filhos) {
865
+ if (i.tipo !== "corrida") continue;
866
+ const { chave: o, camadaId: n, feicoes: s } = i.corrida;
867
+ for (let l = 0; l < s.length; l++) {
868
+ const c = s[l].id;
869
+ a.has(c) || a.set(c, { chave: o, indice: l, camadaId: n });
870
+ }
871
+ }
872
+ sa.set(e, a);
873
+ }
874
+ return a.get(t);
875
+ }
876
+ function Zt(e) {
877
+ const t = /* @__PURE__ */ new Map(), a = e.camadasVisiveis ?? null, r = /* @__PURE__ */ new Set(), i = (n, s) => {
878
+ var w;
879
+ const l = n.camada;
880
+ if (r.has(l.id)) return;
881
+ r.add(l.id);
882
+ const c = a ? n.subcamadas.filter((x) => a.has(x.camada.id)) : n.subcamadas, f = e.feicoesPorCamada.get(l.id) ?? [], p = Number(e.limite(l.id)), d = Number.isFinite(p) || p === 1 / 0 ? Math.max(0, p) : 0, u = f.length > d ? f.slice(0, d) : f, h = s && e.expandida(l.id), m = [];
883
+ let g = 0, y = null, v = 0;
884
+ const b = (w = e.ordemFilhosPorPai) == null ? void 0 : w.get(l.id);
885
+ if (!b || b.length === 0) {
886
+ for (const x of c) m.push({ tipo: "camada", nodo: x, posicao: ++g });
887
+ u.length > 0 && (m.push({
888
+ tipo: "corrida",
889
+ corrida: { chave: `${l.id}#0`, camadaId: l.id, feicoes: u, posInicial: g + 1 }
890
+ }), g += u.length);
891
+ } else for (const x of qa(c, u, b)) {
892
+ if (g++, x.tipo === "layer") {
893
+ y = null, m.push({ tipo: "camada", nodo: x.nodo, posicao: g });
894
+ continue;
895
+ }
896
+ y || (y = { chave: `${l.id}#${v++}`, camadaId: l.id, feicoes: [], posInicial: g }, m.push({ tipo: "corrida", corrida: y })), y.feicoes.push(x.feicao);
897
+ }
898
+ t.set(l.id, {
899
+ camada: l,
900
+ profundidade: n.depth,
901
+ exibido: h,
902
+ filhos: m,
903
+ totalIrmaos: g,
904
+ totalFeicoes: f.length,
905
+ feicoesExibidas: u.length,
906
+ limite: d
907
+ });
908
+ for (const x of c) i(x, h);
909
+ }, o = a ? e.hierarquia.filter((n) => a.has(n.camada.id)) : e.hierarquia;
910
+ for (const n of o) i(n, !0);
911
+ return { raizes: o, containers: t };
912
+ }
913
+ function ye(e, t) {
914
+ return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t;
915
+ }
916
+ function er(e, t, a, r, i, o = Yt) {
917
+ const n = Math.max(0, Math.floor(Number.isFinite(t) ? t : 0)), s = ye(a, Ae.normal), l = Number.isFinite(e) ? e : 0, c = Number.isFinite(r) ? Math.max(0, r) : 0, f = Number.isFinite(i) ? Math.max(0, i) : 0, p = Math.max(0, o) * s, d = Math.min(n, Math.max(0, Math.floor((c - p - l) / s))), u = Math.min(n, Math.max(d, Math.ceil((c + f + p - l) / s)));
918
+ return { inicio: d, fim: u };
919
+ }
920
+ function Ta(e, t, a = null) {
921
+ const r = t !== null && Number.isFinite(t.altura) && t.altura > 0, i = ye(t == null ? void 0 : t.alturaLinha, Ae.normal), o = ye(t == null ? void 0 : t.alturaDrawer, Wt), n = ye(t == null ? void 0 : t.alturaAviso, Jt), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set();
922
+ let c = 0;
923
+ const f = (p, d) => {
924
+ const u = p.camada.id;
925
+ if (l.has(u)) return;
926
+ l.add(u);
927
+ const h = e.containers.get(u);
928
+ if (!h) return;
929
+ d && (c += i, a === u && (c += o));
930
+ const m = d && h.exibido;
931
+ for (const g of h.filhos) {
932
+ if (g.tipo === "camada") {
933
+ f(g.nodo, m);
934
+ continue;
935
+ }
936
+ const y = g.corrida.feicoes.length;
937
+ if (!m) {
938
+ s.set(g.corrida.chave, { topo: c, inicio: 0, fim: 0, virtual: !1 });
939
+ continue;
940
+ }
941
+ const v = r && y > Ut, b = v ? er(c, y, i, t.topo, t.altura) : { inicio: 0, fim: y };
942
+ s.set(g.corrida.chave, { topo: c, inicio: b.inicio, fim: b.fim, virtual: v }), c += y * i;
943
+ }
944
+ m && (h.totalFeicoes > h.feicoesExibidas && (c += n), h.filhos.length === 0 && h.totalFeicoes === 0 && (c += Kt)), d && (c += Qt);
945
+ };
946
+ for (const p of e.raizes) f(p, !0);
947
+ return { janelas: s, alturaLinha: i };
948
+ }
949
+ function Oa(e) {
950
+ return !!e && Number.isFinite(e.altura) && e.altura > 0;
951
+ }
952
+ function Ge(e, t, a = null) {
953
+ const r = Oa(t), i = Zt(r ? { ...e, limite: () => 1 / 0 } : e), { janelas: o, alturaLinha: n } = Ta(i, t, a);
954
+ return { estrutura: i, janelas: o, alturaLinha: n, semLimite: r };
955
+ }
956
+ function ja(e, t) {
957
+ return e.filhos.some((a) => {
958
+ var r;
959
+ return a.tipo === "corrida" && ((r = t.get(a.corrida.chave)) == null ? void 0 : r.virtual) === !0;
960
+ });
961
+ }
962
+ function ar(e, t, a) {
963
+ for (const r of e.filhos) {
964
+ if (r.tipo !== "corrida") continue;
965
+ const i = t.get(r.corrida.chave), o = a.get(r.corrida.chave);
966
+ if (!i || !o || i.inicio !== o.inicio || i.fim !== o.fim || i.virtual !== o.virtual || o.virtual && i.topo !== o.topo) return !0;
967
+ }
968
+ return !1;
969
+ }
970
+ function tr(e) {
971
+ const t = [], a = /* @__PURE__ */ new Set(), r = (i) => {
972
+ const o = i.camada.id;
973
+ if (a.has(o)) return;
974
+ a.add(o), t.push(`L:${o}`);
975
+ const n = e.containers.get(o);
976
+ if (!(!n || !n.exibido))
977
+ for (const s of n.filhos)
978
+ if (s.tipo === "camada") r(s.nodo);
979
+ else for (const l of s.corrida.feicoes) t.push(`F:${l.id}`);
980
+ };
981
+ for (const i of e.raizes) r(i);
982
+ return t;
983
+ }
984
+ function ze(e, t) {
985
+ const a = Xt(e.estrutura, t);
986
+ if (!a) return null;
987
+ const r = e.janelas.get(a.chave);
988
+ return r ? r.topo + a.indice * e.alturaLinha : null;
989
+ }
990
+ function la(e, t, a, r) {
991
+ return ![e, t, a, r].every(Number.isFinite) || r <= 0 || e + t > a && e < a + r ? null : Math.max(0, Math.round(e - (r - t) / 2));
992
+ }
993
+ function Li(e) {
994
+ return Na(e).html;
995
+ }
996
+ function rr(e, t, a, r, i, o) {
997
+ const n = [], s = S(e.chave);
998
+ t.virtual && n.push(ra(s, "antes", t.inicio * a));
999
+ for (let l = t.inicio; l < t.fim; l++) {
1000
+ const c = o ? { posicao: e.posInicial + l, total: i } : null;
1001
+ n.push(r(e.feicoes[l], c));
1002
+ }
1003
+ return t.virtual && n.push(ra(s, "depois", (e.feicoes.length - t.fim) * a)), n.join("");
1004
+ }
1005
+ function Na(e) {
847
1006
  const {
848
1007
  camadas: t,
849
1008
  feicoes: a,
@@ -852,69 +1011,81 @@ function ht(e) {
852
1011
  selectedFeatureIds: o,
853
1012
  activeSettingsLayerId: n,
854
1013
  editingLayerId: s,
855
- editingFeatureId: d,
856
- searchQuery: l,
857
- titulo: c = "CAMADAS",
858
- mostrarBusca: f = !0,
859
- limitesPorCamada: u,
860
- limiteFeicoesPorCamada: p = De,
861
- mostrarBotaoColapsar: m = !1,
862
- ordemFilhosPorPai: g
863
- } = e, b = (l || "").trim().toLowerCase(), h = be(t, a, b), v = /* @__PURE__ */ new Map();
864
- for (let $ = 0; $ < a.length; $++) {
865
- const k = a[$];
866
- if (!k || !k.id) continue;
867
- const B = k.layerId || "";
868
- v.has(B) || v.set(B, []), v.get(B).push(k);
869
- }
870
- const A = ge(t), I = ie(t), w = ba(
871
- I,
872
- h ? h.feicoesPorCamada : v,
1014
+ editingFeatureId: l,
1015
+ searchQuery: c,
1016
+ titulo: f = "CAMADAS",
1017
+ mostrarBusca: p = !0,
1018
+ limitesPorCamada: d,
1019
+ limiteFeicoesPorCamada: u = _e,
1020
+ mostrarBotaoColapsar: h = !1,
1021
+ ordemFilhosPorPai: m,
1022
+ viewport: g = null
1023
+ } = e, y = (c || "").trim().toLowerCase(), v = ke(t, a, y), b = /* @__PURE__ */ new Map();
1024
+ for (let L = 0; L < a.length; L++) {
1025
+ const K = a[L];
1026
+ if (!K || !K.id) continue;
1027
+ const k = K.layerId || "";
1028
+ b.has(k) || b.set(k, []), b.get(k).push(K);
1029
+ }
1030
+ const w = le(t), x = te(t), F = Da(
1031
+ x,
1032
+ v ? v.feicoesPorCamada : b,
873
1033
  o,
874
- h == null ? void 0 : h.camadasVisiveis
875
- ), L = t.every(($) => $.visible !== !1), S = t.length > 0 && t.every(($) => i.has($.id)), x = f ? `
1034
+ v == null ? void 0 : v.camadasVisiveis
1035
+ ), I = Ge(
1036
+ {
1037
+ hierarquia: x,
1038
+ feicoesPorCamada: v ? v.feicoesPorCamada : b,
1039
+ camadasVisiveis: (v == null ? void 0 : v.camadasVisiveis) ?? null,
1040
+ expandida: (L) => y ? !0 : i.has(L),
1041
+ limite: (L) => (d == null ? void 0 : d.get(L)) ?? u,
1042
+ ordemFilhosPorPai: m
1043
+ },
1044
+ g,
1045
+ n
1046
+ ), P = t.every((L) => L.visible !== !1), Y = t.length > 0 && t.every((L) => i.has(L.id)), de = p ? `
876
1047
  <div class="ui-tree-search-wrapper" part="busca">
877
- <span class="ui-tree-search-icon">${y.busca}</span>
878
- <input type="text" class="ui-tree-search-input" id="input-layer-search" aria-label="Buscar camada ou feição" placeholder="Buscar camada ou feição..." value="${z(
879
- l
1048
+ <span class="ui-tree-search-icon">${A.busca}</span>
1049
+ <input type="text" class="ui-tree-search-input" id="input-layer-search" aria-label="Buscar camada ou feição" placeholder="Buscar camada ou feição..." value="${S(
1050
+ c
880
1051
  )}" />
881
- ${l ? `<button type="button" class="ui-tree-search-clear" id="btn-clear-layer-search" title="Limpar busca" aria-label="Limpar busca">${y.fechar}</button>` : ""}
1052
+ ${c ? `<button type="button" class="ui-tree-search-clear" id="btn-clear-layer-search" title="Limpar busca" aria-label="Limpar busca">${A.fechar}</button>` : ""}
882
1053
  </div>
883
- ` : "", P = `
1054
+ ` : "", H = `
884
1055
  <div class="ui-tree-toolbar" part="toolbar">
885
1056
  <div class="ui-tree-title-group">
886
- <span class="ui-tree-section-title">${z(c || "CAMADAS")}</span>
1057
+ <span class="ui-tree-section-title">${S(f || "CAMADAS")}</span>
887
1058
  <span class="ui-tree-count-badge">${t.length}</span>
888
1059
  </div>
889
1060
  <div class="ui-tree-actions">
890
- <button type="button" id="btn-toggle-all-vis" class="ui-tree-action-btn" title="${L ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas"}" aria-label="${L ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas"}">
891
- ${L ? y.olhoAberto : y.olhoFechado}
1061
+ <button type="button" id="btn-toggle-all-vis" class="ui-tree-action-btn" title="${P ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas"}" aria-label="${P ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas"}">
1062
+ ${P ? A.olhoAberto : A.olhoFechado}
892
1063
  </button>
893
- <button type="button" id="btn-toggle-all-expand" class="ui-tree-action-btn" aria-label="${S ? "Recolher Todos os Grupos" : "Expandir Todos os Grupos"}" title="${S ? "Recolher Todos os Grupos" : "Expandir Todos os Grupos"}">
894
- <span class="ui-chevron-icon ${S ? "open" : ""}">${y.chevronDir}</span>
1064
+ <button type="button" id="btn-toggle-all-expand" class="ui-tree-action-btn" aria-label="${Y ? "Recolher Todos os Grupos" : "Expandir Todos os Grupos"}" title="${Y ? "Recolher Todos os Grupos" : "Expandir Todos os Grupos"}">
1065
+ <span class="ui-chevron-icon ${Y ? "open" : ""}">${A.chevronDir}</span>
895
1066
  </button>
896
- ${m ? `<button type="button" id="btn-colapsar" class="ui-camadas-btn-colapsar" title="Recolher painel" aria-label="Recolher painel">${y.recolherPainel}</button>` : ""}
1067
+ ${h ? `<button type="button" id="btn-colapsar" class="ui-camadas-btn-colapsar" title="Recolher painel" aria-label="Recolher painel">${A.recolherPainel}</button>` : ""}
897
1068
  </div>
898
1069
  </div>
899
- ${x}
900
- `, C = ($) => {
901
- const k = $.camada;
902
- if (h && !h.camadasVisiveis.has(k.id)) return "";
903
- const B = $.depth, Q = $.subcamadas, Oe = h ? Q.filter((R) => h.camadasVisiveis.has(R.camada.id)) : Q, oe = !!(k.isGroup || Q.length > 0), F = z(k.id), ne = z(k.name || (oe ? "Novo Grupo" : "Camada")), _ = J(k.color, "#00E08A"), se = k.visible !== !1, le = k.locked === !0, de = b ? !0 : i.has(k.id), ce = n === k.id, ye = r === k.id, V = A.get(k.id), Ma = (V == null ? void 0 : V.ocultaPorAncestral) === !0, Pa = (V == null ? void 0 : V.travadaPorAncestral) === !0, U = h ? h.feicoesPorCamada.get(k.id) || [] : v.get(k.id) || [], Y = w.get(k.id) ?? { total: 0, selecionadas: 0 }, Ba = Y.total > 0 && Y.selecionadas === Y.total, qa = Y.selecionadas > 0 && Y.selecionadas < Y.total, xe = (u == null ? void 0 : u.get(k.id)) ?? p, Da = U.slice(0, xe), Ta = U.length > xe, Ra = Se(k, B, V), Oa = (R) => Fe(R, Ra, o.has(R.id), d === R.id), ja = Ta ? ma(F, xe, U.length) : "", je = Number(k.opacity ?? 1), Ne = Number.isFinite(je) ? Math.min(1, Math.max(0, je)) : 1, Na = Math.round(Ne * 100), Ha = ce ? (() => {
904
- const R = qe(t, k.id);
905
- return t.filter((X) => !R.has(X.id)).map(
906
- (X) => `<option value="${z(X.id)}" ${k.parentId === X.id ? "selected" : ""}>${X.isGroup ? "📁 " : ""}${z(X.name)}</option>`
1070
+ ${de}
1071
+ `, J = (L, K = null) => {
1072
+ const k = L.camada;
1073
+ if (v && !v.camadasVisiveis.has(k.id)) return "";
1074
+ const j = L.depth, W = L.subcamadas, lt = v ? W.filter(($) => v.camadasVisiveis.has($.camada.id)) : W, D = I.estrutura.containers.get(k.id), fe = !!(k.isGroup || W.length > 0), C = S(k.id), pe = S(k.name || (fe ? "Novo Grupo" : "Camada")), V = Z(k.color, "#00E08A"), me = k.visible !== !1, he = k.locked === !0, ge = y ? !0 : i.has(k.id), ve = n === k.id, Le = r === k.id, _ = w.get(k.id), ct = (_ == null ? void 0 : _.ocultaPorAncestral) === !0, dt = (_ == null ? void 0 : _.travadaPorAncestral) === !0, Q = v ? v.feicoesPorCamada.get(k.id) || [] : b.get(k.id) || [], G = F.get(k.id) ?? { total: 0, selecionadas: 0 }, ut = G.total > 0 && G.selecionadas === G.total, ft = G.selecionadas > 0 && G.selecionadas < G.total, Je = (D == null ? void 0 : D.limite) ?? (d == null ? void 0 : d.get(k.id)) ?? u, pt = Q.length > Je, mt = Be(k, j, _), ht = ($, q) => De($, mt, o.has($.id), l === $.id, q), gt = pt ? Ma(C, Je, Q.length) : "", Ke = Number(k.opacity ?? 1), We = Number.isFinite(Ke) ? Math.min(1, Math.max(0, Ke)) : 1, vt = Math.round(We * 100), bt = ve ? (() => {
1075
+ const $ = Ve(t, k.id);
1076
+ return t.filter((q) => !$.has(q.id)).map(
1077
+ (q) => `<option value="${S(q.id)}" ${k.parentId === q.id ? "selected" : ""}>${q.isGroup ? "📁 " : ""}${S(q.name)}</option>`
907
1078
  ).join("");
908
- })() : "", Ga = ce ? `
909
- <div class="ui-layer-settings-drawer" id="settings-drawer-${F}" part="drawer" style="--drawer-cor-camada: ${_};">
1079
+ })() : "", yt = ve ? `
1080
+ <div class="ui-layer-settings-drawer" id="settings-drawer-${C}" part="drawer" style="--drawer-cor-camada: ${V};">
910
1081
  <div class="ui-drawer-header">
911
1082
  <div class="ui-drawer-header-left">
912
- <span class="ui-drawer-icon">${y.engrenagem}</span>
1083
+ <span class="ui-drawer-icon">${A.engrenagem}</span>
913
1084
  <span class="ui-drawer-title">Configurações da Camada</span>
914
- <span class="ui-drawer-layer-chip" title="${ne}">${ne}</span>
1085
+ <span class="ui-drawer-layer-chip" title="${pe}">${pe}</span>
915
1086
  </div>
916
- <button type="button" class="ui-drawer-btn-fechar" data-layer-settings-close="${F}" title="Fechar configurações (Esc)" aria-label="Fechar configurações">
917
- ${y.fechar}
1087
+ <button type="button" class="ui-drawer-btn-fechar" data-layer-settings-close="${C}" title="Fechar configurações (Esc)" aria-label="Fechar configurações">
1088
+ ${A.fechar}
918
1089
  </button>
919
1090
  </div>
920
1091
 
@@ -926,9 +1097,9 @@ function ht(e) {
926
1097
  </div>
927
1098
  <div class="ui-drawer-color-group">
928
1099
  <label class="ui-drawer-color-pill" title="Clique para alterar a cor da camada">
929
- <span class="ui-drawer-color-sample" id="sample-color-${F}" style="background-color: ${_};"></span>
930
- <span class="ui-drawer-color-hex" id="hex-color-${F}">${_.toUpperCase()}</span>
931
- <input type="color" aria-label="Cor da camada" data-layer-color-picker="${F}" value="${at(_, "#00e08a")}" class="ui-drawer-color-native" />
1100
+ <span class="ui-drawer-color-sample" id="sample-color-${C}" style="background-color: ${V};"></span>
1101
+ <span class="ui-drawer-color-hex" id="hex-color-${C}">${V.toUpperCase()}</span>
1102
+ <input type="color" aria-label="Cor da camada" data-layer-color-picker="${C}" value="${Mt(V, "#00e08a")}" class="ui-drawer-color-native" />
932
1103
  </label>
933
1104
  </div>
934
1105
  </div>
@@ -937,10 +1108,10 @@ function ht(e) {
937
1108
  <div class="ui-drawer-row">
938
1109
  <div class="ui-drawer-row-label">
939
1110
  <span>Opacidade</span>
940
- <span class="ui-drawer-badge" id="badge-op-${F}">${Na}%</span>
1111
+ <span class="ui-drawer-badge" id="badge-op-${C}">${vt}%</span>
941
1112
  </div>
942
1113
  <div class="ui-drawer-slider-container">
943
- <input type="range" aria-label="Opacidade da camada" min="0.05" max="1" step="0.05" value="${Number(Ne) || 0}" data-layer-opacity-slider="${F}" class="ui-drawer-slider" />
1114
+ <input type="range" aria-label="Opacidade da camada" min="0.05" max="1" step="0.05" value="${Number(We) || 0}" data-layer-opacity-slider="${C}" class="ui-drawer-slider" />
944
1115
  </div>
945
1116
  </div>
946
1117
 
@@ -950,9 +1121,9 @@ function ht(e) {
950
1121
  <span>Pertence ao Grupo</span>
951
1122
  </div>
952
1123
  <div class="ui-drawer-select-wrapper">
953
- <select class="ui-drawer-select" data-layer-parent-select="${F}" aria-label="Grupo pai da camada">
1124
+ <select class="ui-drawer-select" data-layer-parent-select="${C}" aria-label="Grupo pai da camada">
954
1125
  <option value="" ${k.parentId ? "" : "selected"}>(Nenhum - Nível Principal)</option>
955
- ${Ha}
1126
+ ${bt}
956
1127
  </select>
957
1128
  </div>
958
1129
  </div>
@@ -960,78 +1131,86 @@ function ht(e) {
960
1131
 
961
1132
  <div class="ui-drawer-footer">
962
1133
  <div class="ui-drawer-meta-info">
963
- <span>${Q.length > 0 ? `${Q.length} subcamadas · ` : ""}${U.length} ${U.length === 1 ? "feição" : "feições"}</span>
1134
+ <span>${W.length > 0 ? `${W.length} subcamadas · ` : ""}${Q.length} ${Q.length === 1 ? "feição" : "feições"}</span>
964
1135
  </div>
965
1136
  <div class="ui-drawer-actions">
966
- <button type="button" class="ui-drawer-btn-sublayer" data-add-sublayer="${F}" title="Adicionar nova camada dentro desta">
967
- ${y.mais} Subcamada
1137
+ <button type="button" class="ui-drawer-btn-sublayer" data-add-sublayer="${C}" title="Adicionar nova camada dentro desta">
1138
+ ${A.mais} Subcamada
968
1139
  </button>
969
- <button type="button" class="ui-drawer-btn-danger" data-delete-layer="${F}" title="Excluir esta camada e suas feições">
970
- ${y.lixeira}
1140
+ <button type="button" class="ui-drawer-btn-danger" data-delete-layer="${C}" title="Excluir esta camada e suas feições">
1141
+ ${A.lixeira}
971
1142
  <span class="ui-btn-label">Excluir</span>
972
1143
  </button>
973
1144
  </div>
974
1145
  </div>
975
1146
  </div>
976
- ` : "", _a = ha(
977
- Oe,
978
- Da,
979
- g == null ? void 0 : g.get(k.id)
980
- ).map((R) => R.tipo === "layer" ? C(R.nodo) : Oa(R.feicao)).join("");
1147
+ ` : "", Qe = D ? ja(D, I.janelas) : !1, xt = ((D == null ? void 0 : D.filhos) ?? []).map(($) => {
1148
+ if ($.tipo === "camada")
1149
+ return J($.nodo, Qe ? { posicao: $.posicao, total: D.totalIrmaos } : null);
1150
+ const q = I.janelas.get($.corrida.chave);
1151
+ return q ? rr(
1152
+ $.corrida,
1153
+ q,
1154
+ I.alturaLinha,
1155
+ ht,
1156
+ D.totalIrmaos,
1157
+ Qe
1158
+ ) : "";
1159
+ }).join("");
981
1160
  return `
982
- <div class="ui-layer-group ${B > 0 ? "is-sublayer-group" : ""}" data-layer-id="${F}" data-layer-depth="${B}" role="treeitem" aria-level="${B + 1}" aria-expanded="${de}" part="grupo" style="--layer-active-color: ${_};">
983
- <div class="ui-layer-row ${se ? "" : "hidden-layer"} ${ye ? "active-drawing-layer" : ""} ${B > 0 ? "is-sublayer" : ""} ${oe ? "is-group-row" : ""} ${Ma ? "herdado-oculto" : ""} ${Pa ? "herdado-travado" : ""}" data-layer-row="${F}" data-layer-id="${F}" tabindex="-1" draggable="true" part="${ye ? "camada camada-ativa" : "camada"}" ${ye ? 'aria-current="true"' : ""} style="--layer-depth: ${B};">
984
- <div class="ui-col ui-col-drag" title="Arrastar para reordenar Z-Index">${y.dragHandle}</div>
1161
+ <div class="ui-layer-group ${j > 0 ? "is-sublayer-group" : ""}" data-layer-id="${C}" data-layer-depth="${j}" role="treeitem" aria-level="${j + 1}" aria-expanded="${ge}" part="grupo" style="--layer-active-color: ${V};"${Pa(K)}>
1162
+ <div class="ui-layer-row ${me ? "" : "hidden-layer"} ${Le ? "active-drawing-layer" : ""} ${j > 0 ? "is-sublayer" : ""} ${fe ? "is-group-row" : ""} ${ct ? "herdado-oculto" : ""} ${dt ? "herdado-travado" : ""}" data-layer-row="${C}" data-layer-id="${C}" tabindex="-1" draggable="true" part="${Le ? "camada camada-ativa" : "camada"}" ${Le ? 'aria-current="true"' : ""} style="--layer-depth: ${j};">
1163
+ <div class="ui-col ui-col-drag" title="Arrastar para reordenar Z-Index">${A.dragHandle}</div>
985
1164
 
986
- <div class="ui-col ui-col-eye" data-layer-eye="${F}" role="button" tabindex="0" aria-label="${se ? "Ocultar Camada" : "Exibir Camada"}" title="${se ? "Ocultar Camada" : "Exibir Camada"}">
987
- ${se ? y.olhoAberto : y.olhoFechado}
1165
+ <div class="ui-col ui-col-eye" data-layer-eye="${C}" role="button" tabindex="0" aria-label="${me ? "Ocultar Camada" : "Exibir Camada"}" title="${me ? "Ocultar Camada" : "Exibir Camada"}">
1166
+ ${me ? A.olhoAberto : A.olhoFechado}
988
1167
  </div>
989
1168
 
990
- <div class="ui-col ui-col-lock ${le ? "" : "ui-lock-open"}" data-layer-lock="${F}" role="button" tabindex="0" aria-label="${le ? "Desbloquear Camada" : "Bloquear Camada"}" title="${le ? "Desbloquear Camada" : "Bloquear Camada"}">
991
- ${le ? y.cadeadoTrancado : y.cadeadoAberto}
1169
+ <div class="ui-col ui-col-lock ${he ? "" : "ui-lock-open"}" data-layer-lock="${C}" role="button" tabindex="0" aria-label="${he ? "Desbloquear Camada" : "Bloquear Camada"}" title="${he ? "Desbloquear Camada" : "Bloquear Camada"}">
1170
+ ${he ? A.cadeadoTrancado : A.cadeadoAberto}
992
1171
  </div>
993
1172
 
994
- <div class="ui-col ui-col-colorbar ui-col-colorbar-editavel" data-layer-color="${F}" role="button" tabindex="0" style="background: ${_};" aria-label="Alterar cor da camada" title="Alterar cor da camada (usada no destaque de seleção)"></div>
1173
+ <div class="ui-col ui-col-colorbar ui-col-colorbar-editavel" data-layer-color="${C}" role="button" tabindex="0" style="background: ${V};" aria-label="Alterar cor da camada" title="Alterar cor da camada (usada no destaque de seleção)"></div>
995
1174
 
996
- <div class="ui-col ui-col-chevron" data-layer-expand="${F}" role="button" tabindex="0" aria-label="${de ? "Recolher grupo" : "Expandir grupo"}">
997
- <span class="ui-chevron-icon ${de ? "open" : ""}">${y.chevronDir}</span>
1175
+ <div class="ui-col ui-col-chevron" data-layer-expand="${C}" role="button" tabindex="0" aria-label="${ge ? "Recolher grupo" : "Expandir grupo"}">
1176
+ <span class="ui-chevron-icon ${ge ? "open" : ""}">${A.chevronDir}</span>
998
1177
  </div>
999
1178
 
1000
- <div class="ui-col ui-col-name" data-layer-name-trigger="${F}" title="Clique para ativar camada de desenho | Duplo clique para renomear">
1001
- ${s === k.id ? `<input type="text" class="ui-inline-rename-input" data-inline-layer-input="${F}" value="${ne}" />` : `<span class="ui-name-text">${ne}</span>
1002
- ${pa(Y.total, U.length, Q.length, oe)}`}
1179
+ <div class="ui-col ui-col-name" data-layer-name-trigger="${C}" title="Clique para ativar camada de desenho | Duplo clique para renomear">
1180
+ ${s === k.id ? `<input type="text" class="ui-inline-rename-input" data-inline-layer-input="${C}" value="${pe}" />` : `<span class="ui-name-text">${pe}</span>
1181
+ ${Sa(G.total, Q.length, W.length, fe)}`}
1003
1182
  </div>
1004
1183
 
1005
1184
  <div class="ui-col ui-col-actions">
1006
- <button type="button" class="ui-micro-btn" data-layer-fit="${F}" title="Enquadrar camada no mapa" aria-label="Enquadrar camada no mapa">${y.alvoEnquadrar}</button>
1007
- <button type="button" class="ui-micro-btn ${ce ? "active" : ""}" data-layer-settings="${F}" title="Ajustar cor, hierarquia, opacidade e excluir" aria-label="Configurações da camada" aria-expanded="${ce}">${y.engrenagem}</button>
1185
+ <button type="button" class="ui-micro-btn" data-layer-fit="${C}" title="Enquadrar camada no mapa" aria-label="Enquadrar camada no mapa">${A.alvoEnquadrar}</button>
1186
+ <button type="button" class="ui-micro-btn ${ve ? "active" : ""}" data-layer-settings="${C}" title="Ajustar cor, hierarquia, opacidade e excluir" aria-label="Configurações da camada" aria-expanded="${ve}">${A.engrenagem}</button>
1008
1187
  </div>
1009
1188
 
1010
- <div class="ui-col ui-col-target" data-layer-target="${F}" role="button" tabindex="0" aria-label="Selecionar todas as feições deste grupo" title="Selecionar todas as feições deste grupo">
1011
- <div class="ui-target-circle ${Ba ? "selected" : qa ? "partial" : ""}"></div>
1189
+ <div class="ui-col ui-col-target" data-layer-target="${C}" role="button" tabindex="0" aria-label="Selecionar todas as feições deste grupo" title="Selecionar todas as feições deste grupo">
1190
+ <div class="ui-target-circle ${ut ? "selected" : ft ? "partial" : ""}"></div>
1012
1191
  </div>
1013
1192
  </div>
1014
1193
 
1015
- ${Ga}
1194
+ ${yt}
1016
1195
 
1017
- <div class="ui-children-container ${B > 0 ? "is-subchildren" : ""}" role="group" style="--parent-depth: ${B}; --parent-layer-color: ${_}; display: ${de ? "block" : "none"};">
1018
- ${_a}
1019
- ${ja}
1020
- ${Oe.length === 0 && U.length === 0 ? ga(oe) : ""}
1196
+ <div class="ui-children-container ${j > 0 ? "is-subchildren" : ""}" role="group" style="--parent-depth: ${j}; --parent-layer-color: ${V}; display: ${ge ? "block" : "none"};">
1197
+ ${xt}
1198
+ ${gt}
1199
+ ${lt.length === 0 && Q.length === 0 ? za(fe) : ""}
1021
1200
  </div>
1022
1201
  </div>
1023
1202
  `;
1024
- }, M = t.length === 0 ? (v.get("") ?? []).filter(($) => !b || String($.name ?? "").toLowerCase().includes(b)) : [], T = Se({ id: "" }, 0, void 0), Z = M.slice(0, p).map(($) => Fe($, T, o.has($.id), d === $.id)).join(""), za = h && h.camadasVisiveis.size === 0 && !Z ? `<div class="ui-search-empty" role="status">Nenhum resultado para “${z((l || "").trim())}”</div>` : Z || I.map(($) => C($)).join("");
1025
- return `
1026
- ${P}
1203
+ }, ue = t.length === 0 ? (b.get("") ?? []).filter((L) => !y || String(L.name ?? "").toLowerCase().includes(y)) : [], nt = Be({ id: "" }, 0, void 0), Ye = ue.slice(0, u).map((L) => De(L, nt, o.has(L.id), l === L.id)).join(""), st = v && v.camadasVisiveis.size === 0 && !Ye ? `<div class="ui-search-empty" role="status">Nenhum resultado para “${S((c || "").trim())}”</div>` : Ye || I.estrutura.raizes.map((L) => J(L)).join("");
1204
+ return { html: `
1205
+ ${H}
1027
1206
  <div class="ui-panel-box">
1028
1207
  <div class="ui-layer-tree" id="ui-layer-tree-mount" role="tree" aria-label="Camadas e feições" aria-multiselectable="true" part="arvore">
1029
- ${za}
1208
+ ${st}
1030
1209
  </div>
1031
1210
  </div>
1032
- `;
1211
+ `, plano: I };
1033
1212
  }
1034
- function vt(e) {
1213
+ function ir(e) {
1035
1214
  return [
1036
1215
  {
1037
1216
  gatilho: "data-layer-name-trigger",
@@ -1061,36 +1240,36 @@ function vt(e) {
1061
1240
  }
1062
1241
  ];
1063
1242
  }
1064
- function Qe(e, t, a = t) {
1065
- for (const r of vt(e))
1243
+ function ca(e, t, a = t) {
1244
+ for (const r of ir(e))
1066
1245
  a.querySelectorAll(`[${r.gatilho}]`).forEach((i) => {
1067
1246
  i.addEventListener("dblclick", (o) => {
1068
1247
  o.stopPropagation();
1069
1248
  const n = i.getAttribute(r.gatilho);
1070
1249
  if (!n) return;
1071
1250
  r.marcarEditando(n), e.solicitarRenderizacao();
1072
- const s = D(t, r.input, n);
1251
+ const s = M(t, r.input, n);
1073
1252
  if (!s) return;
1074
1253
  s.focus(), s.select();
1075
- let d = !1;
1076
- const l = (c, f = !1) => {
1077
- var u, p;
1078
- if (!d) {
1079
- if (d = !0, r.marcarEditando(null), c) {
1080
- const m = r.aplicar(n, s.value.trim());
1081
- m && (m.salvar && ((u = e.salvarLembrancaEstado) == null || u.call(e)), r.emitir(m.detalhe));
1254
+ let l = !1;
1255
+ const c = (f, p = !1) => {
1256
+ var d, u;
1257
+ if (!l) {
1258
+ if (l = !0, r.marcarEditando(null), f) {
1259
+ const h = r.aplicar(n, s.value.trim());
1260
+ h && (h.salvar && ((d = e.salvarLembrancaEstado) == null || d.call(e)), r.emitir(h.detalhe));
1082
1261
  }
1083
- e.solicitarRenderizacao(), f && ((p = D(t, r.linha, n)) == null || p.focus());
1262
+ e.solicitarRenderizacao(), p && ((u = M(t, r.linha, n)) == null || u.focus());
1084
1263
  }
1085
1264
  };
1086
- s.addEventListener("keydown", (c) => {
1087
- c.key === "Enter" ? (c.preventDefault(), l(!0, !0)) : c.key === "Escape" && (c.preventDefault(), l(!1, !0));
1088
- }), s.addEventListener("blur", () => l(!0));
1265
+ s.addEventListener("keydown", (f) => {
1266
+ f.key === "Enter" ? (f.preventDefault(), c(!0, !0)) : f.key === "Escape" && (f.preventDefault(), c(!1, !0));
1267
+ }), s.addEventListener("blur", () => c(!0));
1089
1268
  });
1090
1269
  });
1091
1270
  }
1092
- const bt = ["dragging", "drop-above", "drop-below", "drop-into"];
1093
- class yt {
1271
+ const or = ["dragging", "drop-above", "drop-below", "drop-into"];
1272
+ class nr {
1094
1273
  constructor(t, a) {
1095
1274
  E(this, "host");
1096
1275
  E(this, "shadow");
@@ -1116,11 +1295,11 @@ class yt {
1116
1295
  (t = this.cancelarToque) == null || t.call(this), this.cancelarToque = null;
1117
1296
  }
1118
1297
  bindInlineRename() {
1119
- Qe(this.host, this.shadow);
1298
+ ca(this.host, this.shadow);
1120
1299
  }
1121
1300
  limparClassesDeArraste() {
1122
1301
  this.shadow.querySelectorAll(".ui-layer-row, .ui-feat-row, .ui-layer-group").forEach((t) => {
1123
- t.classList.remove(...bt);
1302
+ t.classList.remove(...or);
1124
1303
  });
1125
1304
  }
1126
1305
  /** Depois de qualquer mudança na ordem/hierarquia de camadas. */
@@ -1142,7 +1321,7 @@ class yt {
1142
1321
  const r = this.host.feicoes.find((n) => n.id === t), i = r == null ? void 0 : r.layerId;
1143
1322
  if (!a || i === a) return !1;
1144
1323
  if ((r == null ? void 0 : r.locked) === !0) return !0;
1145
- const o = pe(this.host.camadas);
1324
+ const o = we(this.host.camadas);
1146
1325
  return o.has(a) || !!i && o.has(i);
1147
1326
  }
1148
1327
  arrasteBloqueado(t) {
@@ -1154,7 +1333,7 @@ class yt {
1154
1333
  }
1155
1334
  /** Atualização incremental: liga renomear e arraste só nas linhas de feição novas dentro de `raiz`. */
1156
1335
  bindLinhasFeicao(t) {
1157
- Qe(this.host, this.shadow, t), this.vincularArrasteFeicoes(t);
1336
+ ca(this.host, this.shadow, t), this.vincularArrasteFeicoes(t);
1158
1337
  }
1159
1338
  vincularArrasteCamadas(t) {
1160
1339
  t.querySelectorAll('.ui-layer-row[draggable="true"]').forEach((a) => {
@@ -1169,15 +1348,15 @@ class yt {
1169
1348
  }), a.addEventListener("dragover", (i) => {
1170
1349
  const o = i;
1171
1350
  if (o.preventDefault(), o.stopPropagation(), o.dataTransfer && (o.dataTransfer.dropEffect = "move"), this.arraste.tipo === "layer") {
1172
- if (this.arraste.camadaId === r || this.arraste.camadaId && N(this.host.camadas, r, this.arraste.camadaId))
1351
+ if (this.arraste.camadaId === r || this.arraste.camadaId && T(this.host.camadas, r, this.arraste.camadaId))
1173
1352
  return;
1174
- const n = a.getBoundingClientRect(), s = n.height > 0 ? ke((o.clientY - n.top) / n.height) : "dentro";
1353
+ const n = a.getBoundingClientRect(), s = n.height > 0 ? Me((o.clientY - n.top) / n.height) : "dentro";
1175
1354
  a.classList.toggle("drop-above", s === "acima"), a.classList.toggle("drop-below", s === "abaixo"), a.classList.toggle("drop-into", s === "dentro");
1176
1355
  } else if (this.arraste.tipo === "feature") {
1177
1356
  const n = this.host.camadas.find((s) => s.id === r);
1178
1357
  if (n != null && n.parentId) {
1179
- const s = a.getBoundingClientRect(), d = s.height > 0 ? ke((o.clientY - s.top) / s.height) : "dentro";
1180
- a.classList.toggle("drop-above", d === "acima"), a.classList.toggle("drop-below", d === "abaixo"), a.classList.toggle("drop-into", d === "dentro");
1358
+ const s = a.getBoundingClientRect(), l = s.height > 0 ? Me((o.clientY - s.top) / s.height) : "dentro";
1359
+ a.classList.toggle("drop-above", l === "acima"), a.classList.toggle("drop-below", l === "abaixo"), a.classList.toggle("drop-into", l === "dentro");
1181
1360
  } else
1182
1361
  a.classList.remove("drop-above", "drop-below"), a.classList.add("drop-into");
1183
1362
  }
@@ -1185,39 +1364,39 @@ class yt {
1185
1364
  const o = i.relatedTarget;
1186
1365
  o && a.contains(o) || a.classList.remove("drop-above", "drop-below", "drop-into");
1187
1366
  }), a.addEventListener("drop", (i) => {
1188
- var s, d, l, c, f;
1367
+ var s, l, c, f, p;
1189
1368
  const o = i;
1190
1369
  o.preventDefault(), o.stopPropagation();
1191
1370
  const n = a.classList.contains("drop-into") ? "dentro" : a.classList.contains("drop-above") ? "acima" : "abaixo";
1192
1371
  if (this.limparClassesDeArraste(), this.arraste.tipo === "layer") {
1193
- if (!this.arraste.camadaId || this.arraste.camadaId === r || !this.host.camadas.some((p) => p.id === this.arraste.camadaId) || !this.host.camadas.some((p) => p.id === r)) return;
1194
- const u = Ue(this.host.camadas, this.arraste.camadaId, r, n);
1195
- u && this.host.ordemFilhosPorPai && Ke(
1372
+ if (!this.arraste.camadaId || this.arraste.camadaId === r || !this.host.camadas.some((u) => u.id === this.arraste.camadaId) || !this.host.camadas.some((u) => u.id === r)) return;
1373
+ const d = ia(this.host.camadas, this.arraste.camadaId, r, n);
1374
+ d && this.host.ordemFilhosPorPai && na(
1196
1375
  this.host.camadas,
1197
1376
  this.host.feicoes,
1198
1377
  this.host.ordemFilhosPorPai,
1199
1378
  this.arraste.camadaId,
1200
1379
  r,
1201
1380
  n,
1202
- u.parentAnteriorId,
1203
- u.novoParentId
1204
- ), (u == null ? void 0 : u.tipo) === "hierarquia" ? ((s = this.host.expandedLayers) == null || s.add(u.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1205
- camadaId: u.camada.id,
1206
- novoParentId: u.novoParentId,
1207
- parentAnteriorId: u.parentAnteriorId,
1208
- camada: u.camada
1209
- })) : u && u.parentAnteriorId !== u.novoParentId && this.host.dispararEvento("ui-camada-mover-hierarquia", {
1210
- camadaId: u.camada.id,
1211
- novoParentId: u.novoParentId,
1212
- parentAnteriorId: u.parentAnteriorId,
1213
- camada: u.camada
1381
+ d.parentAnteriorId,
1382
+ d.novoParentId
1383
+ ), (d == null ? void 0 : d.tipo) === "hierarquia" ? ((s = this.host.expandedLayers) == null || s.add(d.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1384
+ camadaId: d.camada.id,
1385
+ novoParentId: d.novoParentId,
1386
+ parentAnteriorId: d.parentAnteriorId,
1387
+ camada: d.camada
1388
+ })) : d && d.parentAnteriorId !== d.novoParentId && this.host.dispararEvento("ui-camada-mover-hierarquia", {
1389
+ camadaId: d.camada.id,
1390
+ novoParentId: d.novoParentId,
1391
+ parentAnteriorId: d.parentAnteriorId,
1392
+ camada: d.camada
1214
1393
  }), this.aposReordenarCamadas();
1215
1394
  } else if (this.arraste.tipo === "feature") {
1216
1395
  if (!this.arraste.feicaoId) return;
1217
- const u = this.host.camadas.find((p) => p.id === r);
1218
- if (u != null && u.parentId && (n === "acima" || n === "abaixo")) {
1219
- if (this.trocaEntreCamadasTravada(this.arraste.feicaoId, u.parentId) || !this.host.ordemFilhosPorPai) return;
1220
- const p = pt(
1396
+ const d = this.host.camadas.find((u) => u.id === r);
1397
+ if (d != null && d.parentId && (n === "acima" || n === "abaixo")) {
1398
+ if (this.trocaEntreCamadasTravada(this.arraste.feicaoId, d.parentId) || !this.host.ordemFilhosPorPai) return;
1399
+ const u = Nt(
1221
1400
  this.host.camadas,
1222
1401
  this.host.feicoes,
1223
1402
  this.host.ordemFilhosPorPai,
@@ -1225,17 +1404,17 @@ class yt {
1225
1404
  r,
1226
1405
  n === "acima"
1227
1406
  );
1228
- if (!p) return;
1229
- this.host.dispararEvento("ui-feicoes-reordenadas", { feicoes: [...this.host.feicoes] }), p.mudouDeCamada && this.emitirFeicaoMovida(p), (l = (d = this.host).salvarLembrancaEstado) == null || l.call(d), this.host.solicitarRenderizacao();
1407
+ if (!u) return;
1408
+ this.host.dispararEvento("ui-feicoes-reordenadas", { feicoes: [...this.host.feicoes] }), u.mudouDeCamada && this.emitirFeicaoMovida(u), (c = (l = this.host).salvarLembrancaEstado) == null || c.call(l), this.host.solicitarRenderizacao();
1230
1409
  } else {
1231
1410
  if (this.trocaEntreCamadasTravada(this.arraste.feicaoId, r)) return;
1232
- const p = lt(this.host.feicoes, this.host.camadas, this.arraste.feicaoId, r);
1233
- p && (this.host.ordemFilhosPorPai && va(
1411
+ const u = Rt(this.host.feicoes, this.host.camadas, this.arraste.feicaoId, r);
1412
+ u && (this.host.ordemFilhosPorPai && Ba(
1234
1413
  this.host.ordemFilhosPorPai,
1235
- p.feicao.id,
1236
- p.camadaOrigemId,
1237
- p.camadaDestinoId
1238
- ), this.emitirFeicaoMovida(p), (f = (c = this.host).salvarLembrancaEstado) == null || f.call(c), this.host.solicitarRenderizacao());
1414
+ u.feicao.id,
1415
+ u.camadaOrigemId,
1416
+ u.camadaDestinoId
1417
+ ), this.emitirFeicaoMovida(u), (p = (f = this.host).salvarLembrancaEstado) == null || p.call(f), this.host.solicitarRenderizacao());
1239
1418
  }
1240
1419
  }
1241
1420
  }), a.addEventListener("dragend", () => {
@@ -1254,48 +1433,48 @@ class yt {
1254
1433
  }
1255
1434
  n.stopPropagation(), this.arraste.tipo = "feature", this.arraste.feicaoId = r, this.arraste.camadaId = i, n.dataTransfer && (n.dataTransfer.setData("text/plain", JSON.stringify({ type: "feature", id: r, layerId: i })), n.dataTransfer.effectAllowed = "move"), a.classList.add("dragging");
1256
1435
  }), a.addEventListener("dragover", (o) => {
1257
- const n = o, s = this.arraste.tipo === "feature" && this.arraste.feicaoId !== r, d = this.arraste.tipo === "layer" && !!this.arraste.camadaId && !!i && this.arraste.camadaId !== i && !N(this.host.camadas, i, this.arraste.camadaId);
1258
- if (!s && !d) return;
1436
+ const n = o, s = this.arraste.tipo === "feature" && this.arraste.feicaoId !== r, l = this.arraste.tipo === "layer" && !!this.arraste.camadaId && !!i && this.arraste.camadaId !== i && !T(this.host.camadas, i, this.arraste.camadaId);
1437
+ if (!s && !l) return;
1259
1438
  n.preventDefault(), n.stopPropagation(), n.dataTransfer && (n.dataTransfer.dropEffect = "move");
1260
- const l = a.getBoundingClientRect(), c = n.clientY - l.top < l.height / 2;
1261
- a.classList.toggle("drop-above", c), a.classList.toggle("drop-below", !c);
1439
+ const c = a.getBoundingClientRect(), f = n.clientY - c.top < c.height / 2;
1440
+ a.classList.toggle("drop-above", f), a.classList.toggle("drop-below", !f);
1262
1441
  }), a.addEventListener("dragleave", (o) => {
1263
1442
  const n = o.relatedTarget;
1264
1443
  n && a.contains(n) || a.classList.remove("drop-above", "drop-below");
1265
1444
  }), a.addEventListener("drop", (o) => {
1266
- var l, c, f;
1267
- const n = o, s = a.getBoundingClientRect(), d = a.classList.contains("drop-above") ? !0 : a.classList.contains("drop-below") ? !1 : s.height > 0 && n.clientY - s.top < s.height / 2;
1445
+ var c, f, p;
1446
+ const n = o, s = a.getBoundingClientRect(), l = a.classList.contains("drop-above") ? !0 : a.classList.contains("drop-below") ? !1 : s.height > 0 && n.clientY - s.top < s.height / 2;
1268
1447
  if (this.arraste.tipo === "feature") {
1269
1448
  if (!this.arraste.feicaoId || this.arraste.feicaoId === r || (n.preventDefault(), n.stopPropagation(), this.limparClassesDeArraste(), this.trocaEntreCamadasTravada(this.arraste.feicaoId, i))) return;
1270
- const u = dt(this.host.feicoes, this.arraste.feicaoId, r, d);
1271
- if (!u) return;
1272
- this.host.ordemFilhosPorPai && ft(
1449
+ const d = Tt(this.host.feicoes, this.arraste.feicaoId, r, l);
1450
+ if (!d) return;
1451
+ this.host.ordemFilhosPorPai && Ht(
1273
1452
  this.host.camadas,
1274
1453
  this.host.feicoes,
1275
1454
  this.host.ordemFilhosPorPai,
1276
1455
  this.arraste.feicaoId,
1277
1456
  r,
1278
- d,
1279
- u.camadaOrigemId,
1280
- u.camadaDestinoId
1281
- ), this.host.dispararEvento("ui-feicoes-reordenadas", { feicoes: [...this.host.feicoes] }), u.mudouDeCamada && this.emitirFeicaoMovida(u), (c = (l = this.host).salvarLembrancaEstado) == null || c.call(l), this.host.solicitarRenderizacao();
1457
+ l,
1458
+ d.camadaOrigemId,
1459
+ d.camadaDestinoId
1460
+ ), this.host.dispararEvento("ui-feicoes-reordenadas", { feicoes: [...this.host.feicoes] }), d.mudouDeCamada && this.emitirFeicaoMovida(d), (f = (c = this.host).salvarLembrancaEstado) == null || f.call(c), this.host.solicitarRenderizacao();
1282
1461
  } else if (this.arraste.tipo === "layer") {
1283
1462
  if (!this.arraste.camadaId || !i || !this.host.ordemFilhosPorPai) return;
1284
1463
  n.preventDefault(), n.stopPropagation(), this.limparClassesDeArraste();
1285
- const u = Ye(
1464
+ const d = oa(
1286
1465
  this.host.camadas,
1287
1466
  this.host.feicoes,
1288
1467
  this.host.ordemFilhosPorPai,
1289
1468
  this.arraste.camadaId,
1290
1469
  r,
1291
- d
1470
+ l
1292
1471
  );
1293
- if (!u) return;
1294
- u.parentAnteriorId !== u.novoParentId && u.novoParentId && ((f = this.host.expandedLayers) == null || f.add(u.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1295
- camadaId: u.camada.id,
1296
- novoParentId: u.novoParentId,
1297
- parentAnteriorId: u.parentAnteriorId,
1298
- camada: u.camada
1472
+ if (!d) return;
1473
+ d.parentAnteriorId !== d.novoParentId && d.novoParentId && ((p = this.host.expandedLayers) == null || p.add(d.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1474
+ camadaId: d.camada.id,
1475
+ novoParentId: d.novoParentId,
1476
+ parentAnteriorId: d.parentAnteriorId,
1477
+ camada: d.camada
1299
1478
  })), this.aposReordenarCamadas();
1300
1479
  }
1301
1480
  }), a.addEventListener("dragend", (o) => {
@@ -1315,55 +1494,55 @@ class yt {
1315
1494
  if (!a) return;
1316
1495
  const r = a.getAttribute("data-layer-id");
1317
1496
  r && t.addEventListener("pointerdown", (i) => {
1318
- var u;
1497
+ var d;
1319
1498
  const o = i;
1320
1499
  if (o.pointerType === "mouse" && o.button !== 0 || this.host.editingLayerId || this.host.editingFeatureId) return;
1321
- (u = this.cancelarToque) == null || u.call(this);
1500
+ (d = this.cancelarToque) == null || d.call(this);
1322
1501
  let n = null, s = "abaixo";
1323
- const d = (p) => {
1324
- p.preventDefault(), a.classList.add("dragging");
1325
- const m = this.shadow.elementFromPoint(p.clientX, p.clientY), g = m ? m.closest(".ui-layer-row, .ui-feat-row") : null;
1326
- if (n && n !== g && n.classList.remove("drop-above", "drop-below", "drop-into"), g && g !== a)
1327
- if (g.classList.contains("ui-feat-row")) {
1328
- const h = g.getAttribute("data-feat-layer");
1329
- if (!h || h === r || N(this.host.camadas, h, r)) {
1502
+ const l = (u) => {
1503
+ u.preventDefault(), a.classList.add("dragging");
1504
+ const h = this.shadow.elementFromPoint(u.clientX, u.clientY), m = h ? h.closest(".ui-layer-row, .ui-feat-row") : null;
1505
+ if (n && n !== m && n.classList.remove("drop-above", "drop-below", "drop-into"), m && m !== a)
1506
+ if (m.classList.contains("ui-feat-row")) {
1507
+ const y = m.getAttribute("data-feat-layer");
1508
+ if (!y || y === r || T(this.host.camadas, y, r)) {
1330
1509
  n = null;
1331
1510
  return;
1332
1511
  }
1333
- n = g;
1334
- const v = g.getBoundingClientRect(), A = v.height > 0 && p.clientY - v.top < v.height / 2;
1335
- s = A ? "acima" : "abaixo", g.classList.toggle("drop-above", A), g.classList.toggle("drop-below", !A), g.classList.remove("drop-into");
1512
+ n = m;
1513
+ const v = m.getBoundingClientRect(), b = v.height > 0 && u.clientY - v.top < v.height / 2;
1514
+ s = b ? "acima" : "abaixo", m.classList.toggle("drop-above", b), m.classList.toggle("drop-below", !b), m.classList.remove("drop-into");
1336
1515
  } else {
1337
- const h = g.getAttribute("data-layer-id");
1338
- if (h && N(this.host.camadas, h, r)) {
1516
+ const y = m.getAttribute("data-layer-id");
1517
+ if (y && T(this.host.camadas, y, r)) {
1339
1518
  n = null;
1340
1519
  return;
1341
1520
  }
1342
- n = g;
1343
- const v = g.getBoundingClientRect();
1344
- s = v.height > 0 ? ke((p.clientY - v.top) / v.height) : "abaixo", g.classList.toggle("drop-above", s === "acima"), g.classList.toggle("drop-below", s === "abaixo"), g.classList.toggle("drop-into", s === "dentro");
1521
+ n = m;
1522
+ const v = m.getBoundingClientRect();
1523
+ s = v.height > 0 ? Me((u.clientY - v.top) / v.height) : "abaixo", m.classList.toggle("drop-above", s === "acima"), m.classList.toggle("drop-below", s === "abaixo"), m.classList.toggle("drop-into", s === "dentro");
1345
1524
  }
1346
1525
  else
1347
1526
  n = null;
1348
- }, l = () => {
1349
- window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", c), this.cancelarToque = null;
1350
1527
  }, c = () => {
1351
- l(), this.limparClassesDeArraste();
1528
+ window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", p), window.removeEventListener("pointercancel", f), this.cancelarToque = null;
1352
1529
  }, f = () => {
1353
- var b, h;
1354
- l();
1355
- const p = n == null ? void 0 : n.getAttribute("data-layer-id"), m = n == null ? void 0 : n.getAttribute("data-feat-row");
1356
- if (this.limparClassesDeArraste(), m && this.host.ordemFilhosPorPai) {
1357
- const v = Ye(
1530
+ c(), this.limparClassesDeArraste();
1531
+ }, p = () => {
1532
+ var g, y;
1533
+ c();
1534
+ const u = n == null ? void 0 : n.getAttribute("data-layer-id"), h = n == null ? void 0 : n.getAttribute("data-feat-row");
1535
+ if (this.limparClassesDeArraste(), h && this.host.ordemFilhosPorPai) {
1536
+ const v = oa(
1358
1537
  this.host.camadas,
1359
1538
  this.host.feicoes,
1360
1539
  this.host.ordemFilhosPorPai,
1361
1540
  r,
1362
- m,
1541
+ h,
1363
1542
  s === "acima"
1364
1543
  );
1365
1544
  if (!v) return;
1366
- v.parentAnteriorId !== v.novoParentId && v.novoParentId && ((b = this.host.expandedLayers) == null || b.add(v.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1545
+ v.parentAnteriorId !== v.novoParentId && v.novoParentId && ((g = this.host.expandedLayers) == null || g.add(v.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1367
1546
  camadaId: v.camada.id,
1368
1547
  novoParentId: v.novoParentId,
1369
1548
  parentAnteriorId: v.parentAnteriorId,
@@ -1371,79 +1550,79 @@ class yt {
1371
1550
  })), this.aposReordenarCamadas();
1372
1551
  return;
1373
1552
  }
1374
- if (!p || p === r) return;
1375
- const g = Ue(this.host.camadas, r, p, s);
1376
- g && (this.host.ordemFilhosPorPai && Ke(
1553
+ if (!u || u === r) return;
1554
+ const m = ia(this.host.camadas, r, u, s);
1555
+ m && (this.host.ordemFilhosPorPai && na(
1377
1556
  this.host.camadas,
1378
1557
  this.host.feicoes,
1379
1558
  this.host.ordemFilhosPorPai,
1380
1559
  r,
1381
- p,
1560
+ u,
1382
1561
  s,
1383
- g.parentAnteriorId,
1384
- g.novoParentId
1385
- ), g.tipo === "hierarquia" ? ((h = this.host.expandedLayers) == null || h.add(g.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1386
- camadaId: g.camada.id,
1387
- novoParentId: g.novoParentId,
1388
- parentAnteriorId: g.parentAnteriorId,
1389
- camada: g.camada
1390
- })) : g.parentAnteriorId !== g.novoParentId && this.host.dispararEvento("ui-camada-mover-hierarquia", {
1391
- camadaId: g.camada.id,
1392
- novoParentId: g.novoParentId,
1393
- parentAnteriorId: g.parentAnteriorId,
1394
- camada: g.camada
1562
+ m.parentAnteriorId,
1563
+ m.novoParentId
1564
+ ), m.tipo === "hierarquia" ? ((y = this.host.expandedLayers) == null || y.add(m.novoParentId), this.host.dispararEvento("ui-camada-mover-hierarquia", {
1565
+ camadaId: m.camada.id,
1566
+ novoParentId: m.novoParentId,
1567
+ parentAnteriorId: m.parentAnteriorId,
1568
+ camada: m.camada
1569
+ })) : m.parentAnteriorId !== m.novoParentId && this.host.dispararEvento("ui-camada-mover-hierarquia", {
1570
+ camadaId: m.camada.id,
1571
+ novoParentId: m.novoParentId,
1572
+ parentAnteriorId: m.parentAnteriorId,
1573
+ camada: m.camada
1395
1574
  }), this.aposReordenarCamadas());
1396
1575
  };
1397
- this.cancelarToque = c, window.addEventListener("pointermove", d, { passive: !1 }), window.addEventListener("pointerup", f), window.addEventListener("pointercancel", c);
1576
+ this.cancelarToque = f, window.addEventListener("pointermove", l, { passive: !1 }), window.addEventListener("pointerup", p), window.addEventListener("pointercancel", f);
1398
1577
  });
1399
1578
  });
1400
1579
  }
1401
1580
  }
1402
- const xt = "ui_camadas_estado_";
1403
- function wt(e, t) {
1581
+ const sr = "ui_camadas_estado_";
1582
+ function lr(e, t) {
1404
1583
  const a = (e || t || "default").trim();
1405
- return `${xt}${a}`;
1584
+ return `${sr}${a}`;
1406
1585
  }
1407
- function ue(e) {
1586
+ function xe(e) {
1408
1587
  return !!e && typeof e == "object" && !Array.isArray(e);
1409
1588
  }
1410
- function Xe(e) {
1589
+ function da(e) {
1411
1590
  return e !== "__proto__" && e !== "constructor" && e !== "prototype";
1412
1591
  }
1413
- function ee(e) {
1592
+ function re(e) {
1414
1593
  return Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
1415
1594
  }
1416
- function We(e) {
1417
- if (!ue(e)) return;
1595
+ function ua(e) {
1596
+ if (!xe(e)) return;
1418
1597
  const t = {};
1419
1598
  return typeof e.name == "string" && (t.name = e.name), typeof e.visible == "boolean" && (t.visible = e.visible), typeof e.locked == "boolean" && (t.locked = e.locked), typeof e.opacity == "number" && Number.isFinite(e.opacity) && e.opacity >= 0 && e.opacity <= 1 && (t.opacity = e.opacity), typeof e.color == "string" && (t.color = e.color), (typeof e.parentId == "string" || e.parentId === null) && (t.parentId = e.parentId), t;
1420
1599
  }
1421
- function At(e) {
1422
- if (!ue(e)) return null;
1600
+ function cr(e) {
1601
+ if (!xe(e)) return null;
1423
1602
  const t = {};
1424
- if (ue(e.camadasOverrides))
1603
+ if (xe(e.camadasOverrides))
1425
1604
  for (const [r, i] of Object.entries(e.camadasOverrides)) {
1426
- if (!Xe(r)) continue;
1427
- const o = We(i);
1605
+ if (!da(r)) continue;
1606
+ const o = ua(i);
1428
1607
  if (!o) continue;
1429
- const n = We(i.origem);
1608
+ const n = ua(i.origem);
1430
1609
  t[r] = n ? { ...o, origem: n } : o;
1431
1610
  }
1432
1611
  const a = e.altura;
1433
1612
  return {
1434
1613
  versao: typeof e.versao == "number" ? e.versao : 1,
1435
- expandedLayerIds: ee(e.expandedLayerIds),
1436
- collapsedLayerIds: ee(e.collapsedLayerIds),
1614
+ expandedLayerIds: re(e.expandedLayerIds),
1615
+ collapsedLayerIds: re(e.collapsedLayerIds),
1437
1616
  camadaAtivaId: typeof e.camadaAtivaId == "string" ? e.camadaAtivaId : null,
1438
1617
  painelColapsado: typeof e.painelColapsado == "boolean" ? e.painelColapsado : void 0,
1439
- ordemCamadasIds: ee(e.ordemCamadasIds),
1440
- ordemOrigemIds: Array.isArray(e.ordemOrigemIds) ? ee(e.ordemOrigemIds) : void 0,
1618
+ ordemCamadasIds: re(e.ordemCamadasIds),
1619
+ ordemOrigemIds: Array.isArray(e.ordemOrigemIds) ? re(e.ordemOrigemIds) : void 0,
1441
1620
  ordemFilhosPorPai: (() => {
1442
- if (!ue(e.ordemFilhosPorPai)) return;
1621
+ if (!xe(e.ordemFilhosPorPai)) return;
1443
1622
  const r = {};
1444
1623
  for (const [i, o] of Object.entries(e.ordemFilhosPorPai)) {
1445
- if (!Xe(i)) continue;
1446
- const n = ee(o);
1624
+ if (!da(i)) continue;
1625
+ const n = re(o);
1447
1626
  n.length > 0 && (r[i] = n);
1448
1627
  }
1449
1628
  return Object.keys(r).length > 0 ? r : void 0;
@@ -1455,18 +1634,18 @@ function At(e) {
1455
1634
  ultimaAtualizacao: typeof e.ultimaAtualizacao == "number" ? e.ultimaAtualizacao : void 0
1456
1635
  };
1457
1636
  }
1458
- function ze(e) {
1637
+ function Te(e) {
1459
1638
  if (typeof window > "u" || typeof localStorage > "u")
1460
1639
  return null;
1461
1640
  try {
1462
1641
  const t = localStorage.getItem(e);
1463
- return t ? At(JSON.parse(t)) : null;
1642
+ return t ? cr(JSON.parse(t)) : null;
1464
1643
  } catch (t) {
1465
1644
  console.warn(`[UI-Camadas] Não foi possível carregar o estado persistido (${e}):`, t);
1466
1645
  }
1467
1646
  return null;
1468
1647
  }
1469
- function Et(e, t) {
1648
+ function dr(e, t) {
1470
1649
  if (!(typeof window > "u" || typeof localStorage > "u"))
1471
1650
  try {
1472
1651
  localStorage.setItem(e, JSON.stringify(t));
@@ -1474,14 +1653,14 @@ function Et(e, t) {
1474
1653
  console.warn(`[UI-Camadas] Não foi possível salvar o estado persistido (${e}):`, a);
1475
1654
  }
1476
1655
  }
1477
- function It(e) {
1656
+ function ur(e) {
1478
1657
  if (!(typeof window > "u" || typeof localStorage > "u"))
1479
1658
  try {
1480
1659
  localStorage.removeItem(e);
1481
1660
  } catch {
1482
1661
  }
1483
1662
  }
1484
- function xa(e) {
1663
+ function Ha(e) {
1485
1664
  return {
1486
1665
  name: e.name,
1487
1666
  visible: e.visible !== !1,
@@ -1491,61 +1670,61 @@ function xa(e) {
1491
1670
  parentId: e.parentId !== void 0 ? e.parentId : null
1492
1671
  };
1493
1672
  }
1494
- function kt(e, t, a, r) {
1495
- var f;
1673
+ function fr(e, t, a, r) {
1674
+ var p;
1496
1675
  if (!Array.isArray(e)) return;
1497
1676
  const i = (t == null ? void 0 : t.camadasOverrides) || {}, o = new Set((t == null ? void 0 : t.expandedLayerIds) || []), n = new Set((t == null ? void 0 : t.collapsedLayerIds) || []), s = o.size > 0 || n.size > 0;
1498
- for (let u = 0; u < e.length; u++) {
1499
- const p = e[u], m = i[p.id];
1500
- if (r == null || r.set(p.id, xa(p)), m) {
1501
- const g = m.origem, b = (h) => {
1502
- var A;
1503
- const v = (A = r == null ? void 0 : r.get(p.id)) == null ? void 0 : A[h];
1504
- return g !== void 0 && g[h] !== v;
1677
+ for (let d = 0; d < e.length; d++) {
1678
+ const u = e[d], h = i[u.id];
1679
+ if (r == null || r.set(u.id, Ha(u)), h) {
1680
+ const m = h.origem, g = (y) => {
1681
+ var b;
1682
+ const v = (b = r == null ? void 0 : r.get(u.id)) == null ? void 0 : b[y];
1683
+ return m !== void 0 && m[y] !== v;
1505
1684
  };
1506
- typeof m.name == "string" && m.name.trim() && !b("name") && (p.name = m.name), typeof m.visible == "boolean" && !b("visible") && (p.visible = m.visible), typeof m.locked == "boolean" && !b("locked") && (p.locked = m.locked), typeof m.opacity == "number" && !b("opacity") && (p.opacity = m.opacity), typeof m.color == "string" && !b("color") && (p.color = m.color), m.parentId !== void 0 && !b("parentId") && (p.parentId = m.parentId);
1685
+ typeof h.name == "string" && h.name.trim() && !g("name") && (u.name = h.name), typeof h.visible == "boolean" && !g("visible") && (u.visible = h.visible), typeof h.locked == "boolean" && !g("locked") && (u.locked = h.locked), typeof h.opacity == "number" && !g("opacity") && (u.opacity = h.opacity), typeof h.color == "string" && !g("color") && (u.color = h.color), h.parentId !== void 0 && !g("parentId") && (u.parentId = h.parentId);
1507
1686
  }
1508
- s ? o.has(p.id) ? a.add(p.id) : n.has(p.id) ? a.delete(p.id) : a.add(p.id) : a.add(p.id);
1687
+ s ? o.has(u.id) ? a.add(u.id) : n.has(u.id) ? a.delete(u.id) : a.add(u.id) : a.add(u.id);
1509
1688
  }
1510
- for (let u = 0; u < e.length; u++) {
1511
- const p = e[u];
1512
- p.parentId && (p.parentId === p.id || N(e, p.parentId, p.id)) && (p.parentId = ((f = r == null ? void 0 : r.get(p.id)) == null ? void 0 : f.parentId) ?? null);
1689
+ for (let d = 0; d < e.length; d++) {
1690
+ const u = e[d];
1691
+ u.parentId && (u.parentId === u.id || T(e, u.parentId, u.id)) && (u.parentId = ((p = r == null ? void 0 : r.get(u.id)) == null ? void 0 : p.parentId) ?? null);
1513
1692
  }
1514
- const d = new Set(e.map((u) => u.id)), l = t == null ? void 0 : t.ordemOrigemIds;
1515
- if (!(Array.isArray(l) && (() => {
1516
- const u = new Set(l), p = (m) => m.filter((g) => d.has(g) && u.has(g)).join("|");
1517
- return p(l) !== p(e.map((m) => m.id));
1693
+ const l = new Set(e.map((d) => d.id)), c = t == null ? void 0 : t.ordemOrigemIds;
1694
+ if (!(Array.isArray(c) && (() => {
1695
+ const d = new Set(c), u = (h) => h.filter((m) => l.has(m) && d.has(m)).join("|");
1696
+ return u(c) !== u(e.map((h) => h.id));
1518
1697
  })()) && Array.isArray(t == null ? void 0 : t.ordemCamadasIds) && t.ordemCamadasIds.length > 0) {
1519
- const u = /* @__PURE__ */ new Map();
1520
- t.ordemCamadasIds.forEach((p, m) => u.set(p, m)), e.sort((p, m) => {
1521
- const g = u.has(p.id) ? u.get(p.id) : 1 / 0, b = u.has(m.id) ? u.get(m.id) : 1 / 0;
1522
- return g - b;
1698
+ const d = /* @__PURE__ */ new Map();
1699
+ t.ordemCamadasIds.forEach((u, h) => d.set(u, h)), e.sort((u, h) => {
1700
+ const m = d.has(u.id) ? d.get(u.id) : 1 / 0, g = d.has(h.id) ? d.get(h.id) : 1 / 0;
1701
+ return m - g;
1523
1702
  });
1524
1703
  }
1525
1704
  }
1526
- function Ct(e) {
1705
+ function pr(e) {
1527
1706
  const { estadoAnterior: t, camadas: a, expandedLayers: r } = e;
1528
1707
  let i = (t == null ? void 0 : t.expandedLayerIds) || [], o = (t == null ? void 0 : t.collapsedLayerIds) || [], n = (t == null ? void 0 : t.ordemCamadasIds) || [], s = t == null ? void 0 : t.ordemOrigemIds;
1529
- const d = {
1708
+ const l = {
1530
1709
  ...(t == null ? void 0 : t.camadasOverrides) || {}
1531
1710
  };
1532
- a.length > 0 && (i = [], o = [], n = a.map((c) => c.id), s = e.origensCamadas ? [...e.origensCamadas.keys()] : n, a.forEach((c) => {
1533
- var f, u;
1534
- r.has(c.id) ? i.push(c.id) : o.push(c.id), d[c.id] = {
1535
- name: c.name,
1536
- visible: c.visible !== !1,
1537
- locked: !!c.locked,
1538
- opacity: typeof c.opacity == "number" ? c.opacity : 1,
1539
- color: c.color || "#00E08A",
1540
- parentId: c.parentId !== void 0 ? c.parentId : null,
1541
- origem: ((f = e.origensCamadas) == null ? void 0 : f.get(c.id)) ?? ((u = d[c.id]) == null ? void 0 : u.origem)
1711
+ a.length > 0 && (i = [], o = [], n = a.map((f) => f.id), s = e.origensCamadas ? [...e.origensCamadas.keys()] : n, a.forEach((f) => {
1712
+ var p, d;
1713
+ r.has(f.id) ? i.push(f.id) : o.push(f.id), l[f.id] = {
1714
+ name: f.name,
1715
+ visible: f.visible !== !1,
1716
+ locked: !!f.locked,
1717
+ opacity: typeof f.opacity == "number" ? f.opacity : 1,
1718
+ color: f.color || "#00E08A",
1719
+ parentId: f.parentId !== void 0 ? f.parentId : null,
1720
+ origem: ((p = e.origensCamadas) == null ? void 0 : p.get(f.id)) ?? ((d = l[f.id]) == null ? void 0 : d.origem)
1542
1721
  };
1543
1722
  }));
1544
- for (const c of e.camadasRemovidas ?? []) delete d[c];
1545
- let l;
1546
- return e.ordemFilhosPorPai && e.ordemFilhosPorPai.size > 0 ? (l = {}, e.ordemFilhosPorPai.forEach((c, f) => {
1547
- c.length > 0 && (l[f] = [...c]);
1548
- }), Object.keys(l).length === 0 && (l = void 0)) : !a.length && (t != null && t.ordemFilhosPorPai) && (l = t.ordemFilhosPorPai), {
1723
+ for (const f of e.camadasRemovidas ?? []) delete l[f];
1724
+ let c;
1725
+ return e.ordemFilhosPorPai && e.ordemFilhosPorPai.size > 0 ? (c = {}, e.ordemFilhosPorPai.forEach((f, p) => {
1726
+ f.length > 0 && (c[p] = [...f]);
1727
+ }), Object.keys(c).length === 0 && (c = void 0)) : !a.length && (t != null && t.ordemFilhosPorPai) && (c = t.ordemFilhosPorPai), {
1549
1728
  versao: 1,
1550
1729
  expandedLayerIds: i,
1551
1730
  collapsedLayerIds: o,
@@ -1553,29 +1732,29 @@ function Ct(e) {
1553
1732
  painelColapsado: e.painelColapsado,
1554
1733
  ordemCamadasIds: n,
1555
1734
  ordemOrigemIds: s,
1556
- ordemFilhosPorPai: l,
1735
+ ordemFilhosPorPai: c,
1557
1736
  mapaBaseAtivo: e.mapaBaseAtivo,
1558
1737
  densidade: e.densidade,
1559
1738
  altura: e.altura,
1560
- camadasOverrides: d,
1739
+ camadasOverrides: l,
1561
1740
  ultimaAtualizacao: Date.now()
1562
1741
  };
1563
1742
  }
1564
- const Lt = `:host{display:flex;flex-direction:column;box-sizing:border-box;font-family:inherit;font-size:11px;color:var(--ui-cor-texto, #e1e1e6);-webkit-user-select:none;user-select:none;width:100%;height:var(--ui-camadas-altura, 100%);min-height:var(--ui-camadas-min-altura, 140px);position:relative;--camada-respiro: 8px;--camada-barra-altura: 28px;--camada-linha-altura: 25px;--camada-thumb-tamanho: 20px;--camada-indent-nivel: 16px;--camada-transicao: .16s cubic-bezier(.16, 1, .3, 1)}:host([densidade="compacto"]){--camada-linha-altura: 22px;--camada-thumb-tamanho: 17px;font-size:10px}:host([flutuante]){position:absolute;top:10px;right:10px;bottom:46px;z-index:var(--ui-z-workspace-hud, 500);width:auto;height:var(--ui-camadas-altura, auto)}*,*:before,*:after{box-sizing:border-box}:host(:not([flutuante])) .ui-camadas-container{max-width:100%;min-width:0;border:none;box-shadow:none;border-radius:0;background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=esquerda]{border-left:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=direita]{border-right:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=ambas]{border-left:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent));border-right:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}.ui-camadas-container{display:flex;flex-direction:column;flex:1 1 auto;height:100%;min-height:0;width:100%;max-width:380px;min-width:270px;background:var(--ui-degrade-interno, var(--ui-camadas-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);box-shadow:var(--ui-sombra-lg, 0 10px 30px -4px rgba(0, 0, 0, .5)),0 0 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);overflow:hidden;position:relative;transition:transform .24s cubic-bezier(.16,1,.3,1),opacity .2s ease;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}:host([colapsado]) .ui-camadas-container{transform:translate(calc(100% + 24px));opacity:0;pointer-events:none}.ui-camadas-toggle-flutuante{display:none;position:absolute;top:10px;right:10px;z-index:calc(var(--ui-z-workspace-hud, 500) - 1);background:var(--ui-camadas-toggle-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .18));border-radius:var(--ui-raio-borda, 6px);color:var(--ui-cor-texto, #ffffff);width:34px;height:34px;cursor:pointer;align-items:center;justify-content:center;box-shadow:var(--ui-sombra-md, 0 8px 20px rgba(0, 0, 0, .45));transition:all var(--camada-transicao)}:host([colapsado][flutuante]) .ui-camadas-toggle-flutuante{display:flex}.ui-camadas-toggle-flutuante:hover{border-color:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-primaria, #00E08A);transform:scale(1.08);box-shadow:0 0 14px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 35%,transparent)}.ui-camadas-btn-colapsar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:22px;height:22px;cursor:pointer;border-radius:var(--ui-raio-sm, 4px);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all var(--camada-transicao)}.ui-camadas-btn-colapsar:hover{color:var(--ui-cor-texto, #ffffff);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .09))}.ui-camadas-corpo{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:0 var(--camada-respiro) var(--camada-respiro);display:flex;flex-direction:column;gap:6px;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent) transparent}.ui-camadas-corpo::-webkit-scrollbar{width:4px}.ui-camadas-corpo::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-radius:var(--ui-raio-sm, 4px)}.ui-camadas-corpo::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 32%,transparent)}.ui-tree-toolbar{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;height:var(--camada-barra-altura);min-height:var(--camada-barra-altura);flex-shrink:0;margin:0 calc(-1 * var(--camada-respiro));padding:0 var(--camada-respiro);gap:8px;border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .06))}.ui-tree-title-group{display:flex;align-items:center;gap:5px}.ui-tree-section-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--ui-cor-texto-secundario, #888899)}.ui-tree-count-badge{font-size:9px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent);color:var(--ui-cor-texto-secundario, #888899);padding:1px 5px;border-radius:8px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent)}.ui-tree-actions{display:flex;align-items:center;gap:3px}.ui-tree-action-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);border-radius:var(--ui-raio-sm, 4px);width:24px;height:24px;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-tree-action-btn:hover{color:var(--ui-cor-texto, #ffffff);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .09))}.ui-tree-btn-new{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent);border:none;color:var(--ui-cor-primaria, #00E08A);border-radius:var(--ui-raio-sm, 4px);height:24px;padding:0 8px;font-size:10px;font-weight:600;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-tree-btn-new:hover{background:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-tree-search-wrapper{position:relative;display:flex;align-items:center;margin:1px 0}.ui-tree-search-icon{position:absolute;left:8px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;display:flex;align-items:center}.ui-tree-search-input{width:100%;height:25px;background:var(--ui-cor-fundo, #0a0a0c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1));border-radius:var(--ui-raio-borda, 5px);padding:0 24px 0 26px;color:var(--ui-cor-texto, #ffffff);font-size:10.5px;outline:none;transition:border-color var(--camada-transicao),box-shadow var(--camada-transicao)}.ui-tree-search-input:focus{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)}.ui-tree-search-clear{position:absolute;right:5px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;width:18px;height:18px;display:flex;align-items:center;justify-content:center;border-radius:3px;transition:all var(--camada-transicao)}.ui-tree-search-clear:hover{color:var(--ui-cor-texto, #ffffff);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent)}.ui-panel-box{background:var(--ui-cor-fundo, #0c0c0f);border:none;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));border-radius:0;margin:0 calc(-1 * var(--camada-respiro)) calc(-1 * var(--camada-respiro));overflow:hidden;display:flex;flex-direction:column;flex:1 1 0%;min-height:140px}.ui-search-empty{padding:14px 10px;text-align:center;font-size:11px;color:var(--ui-cor-texto-secundario, #888899);overflow-wrap:anywhere}.ui-layer-tree{flex:1 1 0%;min-height:40px;overflow-y:auto;overflow-x:hidden}.ui-layer-group{border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .04));transition:background var(--camada-transicao)}.ui-layer-group.drop-into{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 9%,transparent)!important;outline:1.5px dashed var(--ui-cor-primaria, #00E08A);outline-offset:-1.5px}.ui-layer-row,.ui-feat-row{display:flex;align-items:center;height:var(--camada-linha-altura);min-height:var(--camada-linha-altura);max-height:var(--camada-linha-altura);padding:0 4px;-webkit-user-select:none;user-select:none;cursor:default;transition:background .1s ease;position:relative}.ui-layer-row{background:var(--ui-cor-fundo-elevado, #18181d);font-weight:600;cursor:pointer;border-left:3px solid transparent}.ui-layer-row:hover{background:var(--ui-cor-hover-menu, #22222a)}.ui-layer-row.active-drawing-layer{background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-primaria, #00E08A)) 18%,var(--ui-cor-fundo-elevado, #18181d))!important;border-left:3px solid var(--layer-active-color, var(--ui-cor-primaria, #00E08A))!important;box-shadow:inset 0 0 12px color-mix(in srgb,var(--layer-active-color, var(--ui-cor-primaria, #00E08A)) 10%,transparent)}.ui-layer-row.active-drawing-layer .ui-name-text{color:var(--ui-cor-texto, #e1e1e6);font-weight:700}.ui-feat-row{border-left:3px solid transparent;padding-left:13px;background:var(--ui-cor-fundo, #101014);font-weight:400;cursor:pointer}.ui-feat-row:hover{background:var(--ui-cor-hover-menu, #19191f)}.ui-feat-row.selected-row{background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 20%,var(--ui-cor-fundo, #101014))!important;outline:1px solid color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 55%,transparent)!important;outline-offset:-1px}.ui-layer-row.hidden-layer,.ui-feat-row.hidden-row{opacity:.52}.ui-layer-row.hidden-layer .ui-col-eye,.ui-feat-row.hidden-row .ui-col-eye{color:var(--ui-cor-texto-alerta, #ffb86c);opacity:.95}.ui-layer-row.dragging,.ui-feat-row.dragging{opacity:.35;background:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 16%,transparent)!important}.ui-layer-row.drop-above:before,.ui-feat-row.drop-above:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background:var(--ui-cor-texto-info, #33b5ff);box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 100%,transparent);z-index:20;pointer-events:none}.ui-layer-row.drop-below:after,.ui-feat-row.drop-below:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background:var(--ui-cor-texto-info, #33b5ff);box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 100%,transparent);z-index:20;pointer-events:none}.ui-layer-row.drop-into{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 16%,transparent)!important;outline:1.5px dashed var(--ui-cor-primaria, #00E08A)!important;outline-offset:-2px;border-radius:var(--ui-raio-sm, 4px)}.ui-layer-row.is-sublayer{background:color-mix(in srgb,var(--ui-cor-fundo-elevado, #18181d) 70%,transparent)}.ui-group-folder-icon{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-alerta, #ffb86c);margin-right:4px;flex-shrink:0}.ui-col{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:var(--camada-linha-altura)}.ui-col-drag{width:8px;margin-right:1px;cursor:grab;color:var(--ui-cor-texto-secundario, #888899);opacity:.35;touch-action:none;transition:opacity var(--camada-transicao),color var(--camada-transicao)}.ui-layer-row:hover .ui-col-drag,.ui-feat-row:hover .ui-col-drag{opacity:.9;color:var(--ui-cor-primaria, #00E08A)}.ui-col-drag:active{cursor:grabbing}.ui-col-eye{width:20px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);transition:color var(--camada-transicao)}.ui-col-eye:hover{color:var(--ui-cor-primaria, #00E08A)}.ui-col-lock{width:18px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);transition:color var(--camada-transicao)}.ui-col-lock:hover{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-col-colorbar{width:5px;height:16px;margin:0 3px 0 2px;border-radius:1.5px;flex-shrink:0}.ui-col-colorbar-editavel{position:relative;width:5px;height:18px;cursor:pointer}.ui-col-colorbar-editavel:before{content:"";position:absolute;top:-3px;right:-4px;bottom:-3px;left:-4px}.ui-col-colorbar-editavel:hover,.ui-col-colorbar-editavel:focus-visible{filter:brightness(1.3);outline:none}.ui-col-chevron,.ui-feat-row .ui-col-thumb{margin-left:calc(var(--layer-depth, 0) * var(--camada-indent-nivel, 16px))}.ui-col-chevron{width:14px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);display:flex;align-items:center;justify-content:center}.ui-chevron-icon{display:inline-flex;align-items:center;justify-content:center;transition:transform var(--camada-transicao)}.ui-chevron-icon.open{transform:rotate(90deg)}.ui-col-thumb{width:calc(var(--camada-thumb-tamanho) + 3px);margin-right:4px;display:flex;align-items:center;justify-content:center}.ui-thumb-box{width:var(--camada-thumb-tamanho);height:var(--camada-thumb-tamanho);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent);border-radius:3px;background:var(--ui-cor-fundo, #0d0d10);box-sizing:border-box;overflow:hidden;display:flex;align-items:center;justify-content:center}.ui-col-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;color:var(--ui-cor-texto, #e1e1e6);padding-left:2px;padding-right:4px;cursor:pointer;display:flex;align-items:center;justify-content:flex-start;text-align:left;gap:4px}.ui-name-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-count-chip{font-size:9px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;color:var(--ui-cor-texto-secundario, #888899);font-weight:400;padding:0 2px;flex-shrink:0}.ui-col-actions{display:flex;align-items:center;gap:2px;opacity:0;transition:opacity var(--camada-transicao)}.ui-layer-row:hover .ui-col-actions,.ui-feat-row:hover .ui-col-actions,.ui-layer-row:focus-within .ui-col-actions,.ui-feat-row:focus-within .ui-col-actions,.ui-col-actions:has(.ui-micro-btn.active){opacity:1}.ui-micro-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:18px;height:18px;padding:0;border-radius:3px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-micro-btn:hover{color:var(--ui-cor-primaria, #00E08A);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-micro-btn.active{color:var(--ui-cor-primaria, #00E08A);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)}.ui-col-target{width:22px;cursor:pointer}.ui-target-circle{width:11px;height:11px;border-radius:50%;border:1.5px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 32%,transparent);background:transparent;transition:all .12s ease}.ui-col-target:hover .ui-target-circle{border-color:var(--ui-cor-texto-info, #33b5ff);transform:scale(1.18)}.ui-target-circle.selected{border:2px solid var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));background:var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));box-shadow:inset 0 0 0 2px var(--ui-cor-superficie, #141418)}.ui-target-circle.partial{border:2px solid var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 40%,transparent)}.ui-inline-rename-input{width:100%;height:20px;background:var(--ui-cor-fundo, #0d0d10);color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-primaria, #00E08A);border-radius:3px;font-size:10.5px;padding:0 4px;outline:none;box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 40%,transparent)}.ui-layer-settings-drawer{background:linear-gradient(180deg,var(--ui-cor-fundo-elevado, #17171e) 0%,var(--ui-cor-superficie, #0f0f13) 100%);padding:10px 14px 12px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);border-left:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));display:flex;flex-direction:column;gap:10px;box-shadow:inset 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent),0 6px 16px #00000073;animation:drawerSlideDown .18s cubic-bezier(.16,1,.3,1);position:relative;z-index:10}@keyframes drawerSlideDown{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}.ui-drawer-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:6px;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent)}.ui-drawer-header-left{display:flex;align-items:center;gap:7px;min-width:0}.ui-drawer-icon{color:var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));display:flex;align-items:center;flex-shrink:0}.ui-drawer-title{font-size:10.5px;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);text-transform:uppercase;letter-spacing:.6px;white-space:nowrap}.ui-drawer-layer-chip{font-size:9.5px;font-weight:500;color:var(--ui-cor-texto-secundario, #888899);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent);padding:1px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-drawer-btn-fechar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:20px;height:20px;padding:0;border-radius:var(--ui-raio-sm, 4px);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-drawer-btn-fechar:hover{color:var(--ui-cor-texto, #e1e1e6);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-body{display:flex;flex-direction:column;gap:10px}.ui-drawer-row{display:flex;flex-direction:column;gap:5px}.ui-drawer-row-label{display:flex;justify-content:space-between;align-items:center;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--ui-cor-texto-secundario, #888899)}.ui-drawer-color-group{display:flex;align-items:center;justify-content:space-between;gap:8px}.ui-drawer-color-pill{position:relative;display:inline-flex;align-items:center;gap:6px;padding:3px 8px 3px 5px;background:var(--ui-cor-fundo, #0b0b0d);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent);border-radius:var(--ui-raio-sm, 4px);cursor:pointer;transition:all var(--camada-transicao);-webkit-user-select:none;user-select:none}.ui-drawer-color-pill:hover{border-color:var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);box-shadow:0 0 10px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-drawer-color-sample{width:14px;height:14px;border-radius:3px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 35%,transparent);box-shadow:var(--ui-sombra-sm, 0 1px 3px rgba(0, 0, 0, .5));flex-shrink:0;transition:background-color .1s ease}.ui-drawer-color-hex{font-size:10px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);letter-spacing:.5px}.ui-drawer-color-native{position:absolute;opacity:0;width:0;height:0;pointer-events:none}.ui-drawer-badge{font-size:9.5px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent);padding:1px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-slider-container{display:flex;flex-direction:column;gap:4px}.ui-drawer-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:5px;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent) 0%,var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A)) 100%);border-radius:3px;outline:none;margin:3px 0;cursor:pointer;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-slider::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--ui-camadas-slider-thumb, #ffffff);border:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));box-shadow:0 0 6px #0009,0 0 10px var(--drawer-cor-camada, rgba(0, 224, 138, .6));cursor:pointer;transition:transform .12s ease}.ui-drawer-slider::-webkit-slider-thumb:hover{transform:scale(1.22)}.ui-drawer-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--ui-camadas-slider-thumb, #ffffff);border:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));box-shadow:0 0 6px #0009,0 0 10px var(--drawer-cor-camada, rgba(0, 224, 138, .6));cursor:pointer}.ui-drawer-footer{display:flex;align-items:center;justify-content:space-between;padding-top:8px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent)}.ui-drawer-meta-info{font-size:9.5px;color:var(--ui-cor-texto-secundario, #888899);font-style:italic}.ui-drawer-actions{display:flex;align-items:center;gap:6px}.ui-drawer-btn-danger{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 10%,transparent);border:1px solid color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 35%,transparent);color:var(--ui-cor-texto-erro, #ff5555);border-radius:var(--ui-raio-sm, 4px);height:24px;padding:0 10px;font-size:10px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:5px;transition:all var(--camada-transicao)}.ui-drawer-btn-danger:hover{background:var(--ui-cor-botao-destrutivo-fundo, #d32f2f);color:var(--ui-cor-botao-destrutivo-texto, #ffffff);border-color:var(--ui-cor-botao-destrutivo-fundo, #d32f2f);box-shadow:0 0 10px color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 45%,transparent);transform:translateY(-.5px)}.ui-drawer-btn-danger.confirming{background:var(--ui-cor-botao-destrutivo-hover, #b71c1c);color:var(--ui-cor-botao-destrutivo-texto, #ffffff);border-color:var(--ui-cor-botao-destrutivo-hover, #b71c1c);animation:pulseDanger 1.2s infinite}@keyframes pulseDanger{0%{transform:scale(1)}50%{transform:scale(1.02)}to{transform:scale(1)}}.ui-previa-dot{width:6px;height:6px;margin-left:4px;border-radius:50%;flex-shrink:0;background:var(--ui-cor-texto-alerta, #ffb86c);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 25%,transparent)}.ui-tree-footer{height:var(--camada-barra-altura);min-height:var(--camada-barra-altura);background:var(--ui-cor-fundo-elevado, #121216);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));display:flex;align-items:center;justify-content:space-between;padding:0 var(--camada-respiro);gap:6px;box-sizing:border-box;overflow:hidden;position:relative;flex-shrink:0;margin:0 calc(-1 * var(--camada-respiro))}.ui-footer-left{display:flex;align-items:center;gap:5px;white-space:nowrap;min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis}.ui-footer-count{font-size:11px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-primaria, #00E08A);flex-shrink:0}.ui-footer-label{display:inline-flex;align-items:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0}.ui-footer-actions-gerais{display:flex;align-items:center;gap:4px;flex-shrink:0}.ui-footer-chip-btn{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:none;color:var(--ui-cor-texto-secundario, #a0a0b0);font-size:10px;font-weight:600;height:22px;padding:0 8px;border-radius:var(--ui-raio-sm, 4px);cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-footer-chip-btn:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #ffffff)}.ui-footer-chip-btn.primario{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent);color:var(--ui-cor-primaria, #00E08A)}.ui-footer-chip-btn.primario:hover{background:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-footer-right{display:flex;align-items:center;gap:4px;flex:1 1 auto;min-width:0}.ui-footer-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:22px;height:22px;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all var(--camada-transicao);flex-shrink:0}.ui-footer-btn:hover:not(.disabled){color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-footer-btn.disabled{opacity:.25;cursor:not-allowed}.ui-footer-btn.btn-danger-footer:hover:not(.disabled){color:var(--ui-cor-texto-erro, #ff5555);background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 15%,transparent)}.ui-footer-btn.confirming{background:var(--ui-cor-botao-destrutivo-hover, #b71c1c)!important;color:var(--ui-cor-botao-destrutivo-texto, #ffffff)!important}.ui-footer-move-wrapper{position:relative;display:flex;align-items:center;flex:1 1 auto;min-width:0}.ui-footer-select{-moz-appearance:none;appearance:none;-webkit-appearance:none;--_chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888899' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background:var(--_chevron) right 6px center / 10px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:none;color:var(--ui-cor-texto, #e1e1e6);border-radius:var(--ui-raio-sm, 4px);font:inherit;font-size:10px;font-weight:500;height:22px;padding:0 22px 0 8px;cursor:pointer;width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-footer-select:hover:not(:disabled){background:var(--_chevron) right 6px center / 10px no-repeat,var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-footer-select:focus-visible{outline:1px solid var(--ui-cor-primaria, #00E08A)}.ui-drawer-btn-sublayer{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #e1e1e6);font-size:10.5px;font-weight:500;padding:4px 8px;border-radius:4px;cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-drawer-btn-sublayer:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12));color:var(--ui-cor-primaria, #00E08A);border-color:var(--ui-cor-primaria, #00E08A)}.ui-drawer-select-wrapper{display:flex;align-items:center}.ui-drawer-select{background:var(--ui-cor-fundo, #16161c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .15));color:var(--ui-cor-texto, #e1e1e6);border-radius:4px;font-size:10.5px;height:24px;padding:0 6px;cursor:pointer;max-width:140px}.ui-basemap-section{display:flex;flex-direction:column;gap:4px;flex-shrink:0}.ui-basemap-toggle{display:flex;align-items:center;gap:6px;width:100%;padding:2px;background:transparent;border:0;border-radius:var(--ui-raio-sm, 4px);font:inherit;color:inherit;cursor:pointer;text-align:left}.ui-basemap-toggle:hover .ui-basemap-title{color:var(--ui-cor-texto, #e1e1e6)}.ui-basemap-toggle:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:1px}.ui-basemap-atual{flex:1 1 auto;min-width:0;font-size:10px;color:var(--ui-cor-primaria, #00E08A);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right}.ui-basemap-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--ui-cor-texto-secundario, #888899)}.ui-basemap-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:4px}.ui-basemap-section{container-type:inline-size}@container (min-width: 260px){.ui-basemap-grid{grid-template-columns:repeat(3,1fr)}}@container (min-width: 340px){.ui-basemap-grid{grid-template-columns:repeat(4,1fr)}}.ui-basemap-card{display:flex;flex-direction:column;align-items:center;gap:2px;padding:3px;border-radius:var(--ui-raio-borda, 5px);background:var(--ui-cor-fundo, #101014);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));cursor:pointer;transition:all var(--camada-transicao);text-align:center;overflow:hidden}.ui-basemap-card:hover{border-color:var(--ui-cor-primaria, #00E08A);background:var(--ui-cor-fundo-elevado, #17171c)}.ui-basemap-card.active{border-color:var(--ui-cor-primaria, #00E08A);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 12%,transparent);color:var(--ui-cor-primaria, #00E08A);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 35%,transparent)}.ui-basemap-preview{width:100%;height:22px;border-radius:3px;object-fit:cover;opacity:.85;transition:opacity var(--camada-transicao)}.ui-basemap-preview-none{width:100%;height:22px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent);border-radius:3px;color:var(--ui-cor-texto-secundario, #888899)}.ui-basemap-card:hover .ui-basemap-preview,.ui-basemap-card.active .ui-basemap-preview{opacity:1}.ui-basemap-card span{font-size:9.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.ui-layer-row.herdado-oculto,.ui-feat-row.herdado-oculto{opacity:.52}.ui-layer-row.herdado-travado .ui-col-lock.ui-lock-open{color:var(--ui-cor-texto-secundario, #888899);opacity:.7}.ui-search-hidden{display:none!important}.ui-empty-row{height:22px;display:flex;align-items:center;padding-left:36px;font-size:10px;color:var(--ui-cor-texto-secundario, #666677);font-style:italic;background:var(--ui-cor-fundo-recuado, rgba(0, 0, 0, .15))}.ui-camadas-resizer-altura{display:none;flex-shrink:0;width:100%;height:9px;background:var(--ui-cor-superficie, #141417);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));cursor:ns-resize;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;touch-action:none;transition:background .15s ease,border-color .15s ease;position:relative;z-index:10}:host([redimensionavel]) .ui-camadas-resizer-altura,:host([redimensionavel-altura]) .ui-camadas-resizer-altura{display:flex}.ui-camadas-resizer-altura:hover,.ui-camadas-resizer-altura.ui-camadas-resizer--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 9%,transparent);border-top-color:var(--ui-cor-primaria, #00E08A)}.ui-camadas-resizer-grip{width:32px;height:3px;border-radius:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 22%,transparent);transition:all .15s ease}.ui-camadas-resizer-altura:hover .ui-camadas-resizer-grip,.ui-camadas-resizer-altura.ui-camadas-resizer--ativo .ui-camadas-resizer-grip{background:var(--ui-cor-primaria, #00E08A);width:46px;box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 45%,transparent)}:host(.ui-camadas--redimensionando){-webkit-user-select:none!important;user-select:none!important;cursor:ns-resize!important}:host(.ui-camadas--redimensionando) *{-webkit-user-select:none!important;user-select:none!important}.ui-col-lock.ui-lock-open{opacity:.28}.ui-col-lock.ui-lock-open:hover,.ui-col-lock.ui-lock-open:focus-visible{opacity:.8}.ui-col-lock[data-locked-by-layer]{cursor:not-allowed}.ui-col[role=button]:focus-visible,.ui-basemap-card:focus-visible,.ui-feat-row:focus-visible,.ui-layer-row:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-footer-btn.confirming{color:var(--ui-cor-botao-destrutivo-texto, #ffffff);background:var(--ui-cor-botao-destrutivo-hover, #b71c1c);width:auto;padding:0 6px}.ui-truncate-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;margin:4px 8px 6px;background:color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 70%,transparent);border:1px dashed var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 4px);font-size:10px;color:var(--ui-cor-texto-secundario, #9696a6)}.ui-truncate-notice span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-truncate-more-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .18));border-radius:var(--ui-raio-borda, 4px);color:var(--ui-cor-primaria, #00E08A);font-size:10px;font-weight:500;cursor:pointer;white-space:nowrap;transition:all var(--camada-transicao)}.ui-truncate-more-btn:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-primaria, #00E08A)}.ui-truncate-more-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:1px}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-camadas-container[data-degrade]:not([data-degrade=false]){--ui-camadas-fundo: var(--ui-gradiente-superficie);--ui-camadas-toggle-fundo: var(--ui-gradiente-superficie)}`;
1565
- function St(e, t) {
1743
+ const mr = `:host{display:flex;flex-direction:column;box-sizing:border-box;font-family:inherit;font-size:11px;color:var(--ui-cor-texto, #e1e1e6);-webkit-user-select:none;user-select:none;width:100%;height:var(--ui-camadas-altura, 100%);min-height:var(--ui-camadas-min-altura, 140px);position:relative;--camada-respiro: 8px;--camada-barra-altura: 28px;--camada-linha-altura: 25px;--camada-thumb-tamanho: 20px;--camada-indent-nivel: 16px;--camada-transicao: .16s cubic-bezier(.16, 1, .3, 1)}:host([densidade="compacto"]){--camada-linha-altura: 22px;--camada-thumb-tamanho: 17px;font-size:10px}:host([flutuante]){position:absolute;top:10px;right:10px;bottom:46px;z-index:var(--ui-z-workspace-hud, 500);width:auto;height:var(--ui-camadas-altura, auto)}*,*:before,*:after{box-sizing:border-box}:host(:not([flutuante])) .ui-camadas-container{max-width:100%;min-width:0;border:none;box-shadow:none;border-radius:0;background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=esquerda]{border-left:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=direita]{border-right:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}:host(:not([flutuante])) .ui-camadas-container[data-borda-canvas=ambas]{border-left:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent));border-right:2px solid var(--ui-camadas-borda-canvas, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 18%, transparent))}.ui-camadas-container{display:flex;flex-direction:column;flex:1 1 auto;height:100%;min-height:0;width:100%;max-width:380px;min-width:270px;background:var(--ui-degrade-interno, var(--ui-camadas-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);box-shadow:var(--ui-sombra-lg, 0 10px 30px -4px rgba(0, 0, 0, .5)),0 0 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);overflow:hidden;position:relative;transition:transform .24s cubic-bezier(.16,1,.3,1),opacity .2s ease;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}:host([colapsado]) .ui-camadas-container{transform:translate(calc(100% + 24px));opacity:0;pointer-events:none}.ui-camadas-toggle-flutuante{display:none;position:absolute;top:10px;right:10px;z-index:calc(var(--ui-z-workspace-hud, 500) - 1);background:var(--ui-camadas-toggle-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .18));border-radius:var(--ui-raio-borda, 6px);color:var(--ui-cor-texto, #ffffff);width:34px;height:34px;cursor:pointer;align-items:center;justify-content:center;box-shadow:var(--ui-sombra-md, 0 8px 20px rgba(0, 0, 0, .45));transition:all var(--camada-transicao)}:host([colapsado][flutuante]) .ui-camadas-toggle-flutuante{display:flex}.ui-camadas-toggle-flutuante:hover{border-color:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-primaria, #00E08A);transform:scale(1.08);box-shadow:0 0 14px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 35%,transparent)}.ui-camadas-btn-colapsar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:22px;height:22px;cursor:pointer;border-radius:var(--ui-raio-sm, 4px);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all var(--camada-transicao)}.ui-camadas-btn-colapsar:hover{color:var(--ui-cor-texto, #ffffff);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .09))}.ui-camadas-corpo{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:0 var(--camada-respiro) var(--camada-respiro);display:flex;flex-direction:column;gap:6px;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent) transparent}.ui-camadas-corpo::-webkit-scrollbar{width:4px}.ui-camadas-corpo::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-radius:var(--ui-raio-sm, 4px)}.ui-camadas-corpo::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 32%,transparent)}.ui-tree-toolbar{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;height:var(--camada-barra-altura);min-height:var(--camada-barra-altura);flex-shrink:0;margin:0 calc(-1 * var(--camada-respiro));padding:0 var(--camada-respiro);gap:8px;border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .06))}.ui-tree-title-group{display:flex;align-items:center;gap:5px}.ui-tree-section-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--ui-cor-texto-secundario, #888899)}.ui-tree-count-badge{font-size:9px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent);color:var(--ui-cor-texto-secundario, #888899);padding:1px 5px;border-radius:8px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent)}.ui-tree-actions{display:flex;align-items:center;gap:3px}.ui-tree-action-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);border-radius:var(--ui-raio-sm, 4px);width:24px;height:24px;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-tree-action-btn:hover{color:var(--ui-cor-texto, #ffffff);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .09))}.ui-tree-btn-new{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent);border:none;color:var(--ui-cor-primaria, #00E08A);border-radius:var(--ui-raio-sm, 4px);height:24px;padding:0 8px;font-size:10px;font-weight:600;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-tree-btn-new:hover{background:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-tree-search-wrapper{position:relative;display:flex;align-items:center;margin:1px 0}.ui-tree-search-icon{position:absolute;left:8px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;display:flex;align-items:center}.ui-tree-search-input{width:100%;height:25px;background:var(--ui-cor-fundo, #0a0a0c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1));border-radius:var(--ui-raio-borda, 5px);padding:0 24px 0 26px;color:var(--ui-cor-texto, #ffffff);font-size:10.5px;outline:none;transition:border-color var(--camada-transicao),box-shadow var(--camada-transicao)}.ui-tree-search-input:focus{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)}.ui-tree-search-clear{position:absolute;right:5px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;width:18px;height:18px;display:flex;align-items:center;justify-content:center;border-radius:3px;transition:all var(--camada-transicao)}.ui-tree-search-clear:hover{color:var(--ui-cor-texto, #ffffff);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent)}.ui-panel-box{background:var(--ui-cor-fundo, #0c0c0f);border:none;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));border-radius:0;margin:0 calc(-1 * var(--camada-respiro)) calc(-1 * var(--camada-respiro));overflow:hidden;display:flex;flex-direction:column;flex:1 1 0%;min-height:140px}.ui-search-empty{padding:14px 10px;text-align:center;font-size:11px;color:var(--ui-cor-texto-secundario, #888899);overflow-wrap:anywhere}.ui-layer-tree{flex:1 1 0%;min-height:40px;overflow-y:auto;overflow-x:hidden}.ui-layer-group{border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .04));transition:background var(--camada-transicao)}.ui-layer-group.drop-into{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 9%,transparent)!important;outline:1.5px dashed var(--ui-cor-primaria, #00E08A);outline-offset:-1.5px}.ui-layer-row,.ui-feat-row{display:flex;align-items:center;height:var(--camada-linha-altura);min-height:var(--camada-linha-altura);max-height:var(--camada-linha-altura);padding:0 4px;-webkit-user-select:none;user-select:none;cursor:default;transition:background .1s ease;position:relative}.ui-layer-row{background:var(--ui-cor-fundo-elevado, #18181d);font-weight:600;cursor:pointer;border-left:3px solid transparent}.ui-layer-row:hover{background:var(--ui-cor-hover-menu, #22222a)}.ui-layer-row.active-drawing-layer{background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-primaria, #00E08A)) 18%,var(--ui-cor-fundo-elevado, #18181d))!important;border-left:3px solid var(--layer-active-color, var(--ui-cor-primaria, #00E08A))!important;box-shadow:inset 0 0 12px color-mix(in srgb,var(--layer-active-color, var(--ui-cor-primaria, #00E08A)) 10%,transparent)}.ui-layer-row.active-drawing-layer .ui-name-text{color:var(--ui-cor-texto, #e1e1e6);font-weight:700}.ui-feat-row{border-left:3px solid transparent;padding-left:13px;background:var(--ui-cor-fundo, #101014);font-weight:400;cursor:pointer}.ui-feat-row:hover{background:var(--ui-cor-hover-menu, #19191f)}.ui-feat-row.selected-row{background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 20%,var(--ui-cor-fundo, #101014))!important;outline:1px solid color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 55%,transparent)!important;outline-offset:-1px}.ui-layer-row.hidden-layer,.ui-feat-row.hidden-row{opacity:.52}.ui-layer-row.hidden-layer .ui-col-eye,.ui-feat-row.hidden-row .ui-col-eye{color:var(--ui-cor-texto-alerta, #ffb86c);opacity:.95}.ui-layer-row.dragging,.ui-feat-row.dragging{opacity:.35;background:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 16%,transparent)!important}.ui-layer-row.drop-above:before,.ui-feat-row.drop-above:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background:var(--ui-cor-texto-info, #33b5ff);box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 100%,transparent);z-index:20;pointer-events:none}.ui-layer-row.drop-below:after,.ui-feat-row.drop-below:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background:var(--ui-cor-texto-info, #33b5ff);box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 100%,transparent);z-index:20;pointer-events:none}.ui-layer-row.drop-into{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 16%,transparent)!important;outline:1.5px dashed var(--ui-cor-primaria, #00E08A)!important;outline-offset:-2px;border-radius:var(--ui-raio-sm, 4px)}.ui-layer-row.is-sublayer{background:color-mix(in srgb,var(--ui-cor-fundo-elevado, #18181d) 70%,transparent)}.ui-group-folder-icon{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-alerta, #ffb86c);margin-right:4px;flex-shrink:0}.ui-col{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:var(--camada-linha-altura)}.ui-col-drag{width:8px;margin-right:1px;cursor:grab;color:var(--ui-cor-texto-secundario, #888899);opacity:.35;touch-action:none;transition:opacity var(--camada-transicao),color var(--camada-transicao)}.ui-layer-row:hover .ui-col-drag,.ui-feat-row:hover .ui-col-drag{opacity:.9;color:var(--ui-cor-primaria, #00E08A)}.ui-col-drag:active{cursor:grabbing}.ui-col-eye{width:20px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);transition:color var(--camada-transicao)}.ui-col-eye:hover{color:var(--ui-cor-primaria, #00E08A)}.ui-col-lock{width:18px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);transition:color var(--camada-transicao)}.ui-col-lock:hover{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-col-colorbar{width:5px;height:16px;margin:0 3px 0 2px;border-radius:1.5px;flex-shrink:0}.ui-col-colorbar-editavel{position:relative;width:5px;height:18px;cursor:pointer}.ui-col-colorbar-editavel:before{content:"";position:absolute;top:-3px;right:-4px;bottom:-3px;left:-4px}.ui-col-colorbar-editavel:hover,.ui-col-colorbar-editavel:focus-visible{filter:brightness(1.3);outline:none}.ui-col-chevron,.ui-feat-row .ui-col-thumb{margin-left:calc(var(--layer-depth, 0) * var(--camada-indent-nivel, 16px))}.ui-col-chevron{width:14px;cursor:pointer;color:var(--ui-cor-texto-secundario, #888899);display:flex;align-items:center;justify-content:center}.ui-chevron-icon{display:inline-flex;align-items:center;justify-content:center;transition:transform var(--camada-transicao)}.ui-chevron-icon.open{transform:rotate(90deg)}.ui-col-thumb{width:calc(var(--camada-thumb-tamanho) + 3px);margin-right:4px;display:flex;align-items:center;justify-content:center}.ui-thumb-box{width:var(--camada-thumb-tamanho);height:var(--camada-thumb-tamanho);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent);border-radius:3px;background:var(--ui-cor-fundo, #0d0d10);box-sizing:border-box;overflow:hidden;display:flex;align-items:center;justify-content:center}.ui-col-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;color:var(--ui-cor-texto, #e1e1e6);padding-left:2px;padding-right:4px;cursor:pointer;display:flex;align-items:center;justify-content:flex-start;text-align:left;gap:4px}.ui-name-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-count-chip{font-size:9px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;color:var(--ui-cor-texto-secundario, #888899);font-weight:400;padding:0 2px;flex-shrink:0}.ui-col-actions{display:flex;align-items:center;gap:2px;opacity:0;transition:opacity var(--camada-transicao)}.ui-layer-row:hover .ui-col-actions,.ui-feat-row:hover .ui-col-actions,.ui-layer-row:focus-within .ui-col-actions,.ui-feat-row:focus-within .ui-col-actions,.ui-col-actions:has(.ui-micro-btn.active){opacity:1}.ui-micro-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:18px;height:18px;padding:0;border-radius:3px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-micro-btn:hover{color:var(--ui-cor-primaria, #00E08A);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-micro-btn.active{color:var(--ui-cor-primaria, #00E08A);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)}.ui-col-target{width:22px;cursor:pointer}.ui-target-circle{width:11px;height:11px;border-radius:50%;border:1.5px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 32%,transparent);background:transparent;transition:all .12s ease}.ui-col-target:hover .ui-target-circle{border-color:var(--ui-cor-texto-info, #33b5ff);transform:scale(1.18)}.ui-target-circle.selected{border:2px solid var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));background:var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));box-shadow:inset 0 0 0 2px var(--ui-cor-superficie, #141418)}.ui-target-circle.partial{border:2px solid var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff));background:color-mix(in srgb,var(--layer-active-color, var(--ui-cor-texto-info, #33b5ff)) 40%,transparent)}.ui-inline-rename-input{width:100%;height:20px;background:var(--ui-cor-fundo, #0d0d10);color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-primaria, #00E08A);border-radius:3px;font-size:10.5px;padding:0 4px;outline:none;box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 40%,transparent)}.ui-layer-settings-drawer{background:linear-gradient(180deg,var(--ui-cor-fundo-elevado, #17171e) 0%,var(--ui-cor-superficie, #0f0f13) 100%);padding:10px 14px 12px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);border-left:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));display:flex;flex-direction:column;gap:10px;box-shadow:inset 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent),0 6px 16px #00000073;animation:drawerSlideDown .18s cubic-bezier(.16,1,.3,1);position:relative;z-index:10}@keyframes drawerSlideDown{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}.ui-drawer-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:6px;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent)}.ui-drawer-header-left{display:flex;align-items:center;gap:7px;min-width:0}.ui-drawer-icon{color:var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));display:flex;align-items:center;flex-shrink:0}.ui-drawer-title{font-size:10.5px;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);text-transform:uppercase;letter-spacing:.6px;white-space:nowrap}.ui-drawer-layer-chip{font-size:9.5px;font-weight:500;color:var(--ui-cor-texto-secundario, #888899);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent);padding:1px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-drawer-btn-fechar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:20px;height:20px;padding:0;border-radius:var(--ui-raio-sm, 4px);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--camada-transicao)}.ui-drawer-btn-fechar:hover{color:var(--ui-cor-texto, #e1e1e6);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-body{display:flex;flex-direction:column;gap:10px}.ui-drawer-row{display:flex;flex-direction:column;gap:5px}.ui-drawer-row-label{display:flex;justify-content:space-between;align-items:center;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--ui-cor-texto-secundario, #888899)}.ui-drawer-color-group{display:flex;align-items:center;justify-content:space-between;gap:8px}.ui-drawer-color-pill{position:relative;display:inline-flex;align-items:center;gap:6px;padding:3px 8px 3px 5px;background:var(--ui-cor-fundo, #0b0b0d);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent);border-radius:var(--ui-raio-sm, 4px);cursor:pointer;transition:all var(--camada-transicao);-webkit-user-select:none;user-select:none}.ui-drawer-color-pill:hover{border-color:var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);box-shadow:0 0 10px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-drawer-color-sample{width:14px;height:14px;border-radius:3px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 35%,transparent);box-shadow:var(--ui-sombra-sm, 0 1px 3px rgba(0, 0, 0, .5));flex-shrink:0;transition:background-color .1s ease}.ui-drawer-color-hex{font-size:10px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);letter-spacing:.5px}.ui-drawer-color-native{position:absolute;opacity:0;width:0;height:0;pointer-events:none}.ui-drawer-badge{font-size:9.5px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-texto, #e1e1e6);background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent);padding:1px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-slider-container{display:flex;flex-direction:column;gap:4px}.ui-drawer-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:5px;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent) 0%,var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A)) 100%);border-radius:3px;outline:none;margin:3px 0;cursor:pointer;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent)}.ui-drawer-slider::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--ui-camadas-slider-thumb, #ffffff);border:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));box-shadow:0 0 6px #0009,0 0 10px var(--drawer-cor-camada, rgba(0, 224, 138, .6));cursor:pointer;transition:transform .12s ease}.ui-drawer-slider::-webkit-slider-thumb:hover{transform:scale(1.22)}.ui-drawer-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--ui-camadas-slider-thumb, #ffffff);border:3px solid var(--drawer-cor-camada, var(--ui-cor-primaria, #00E08A));box-shadow:0 0 6px #0009,0 0 10px var(--drawer-cor-camada, rgba(0, 224, 138, .6));cursor:pointer}.ui-drawer-footer{display:flex;align-items:center;justify-content:space-between;padding-top:8px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 7%,transparent)}.ui-drawer-meta-info{font-size:9.5px;color:var(--ui-cor-texto-secundario, #888899);font-style:italic}.ui-drawer-actions{display:flex;align-items:center;gap:6px}.ui-drawer-btn-danger{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 10%,transparent);border:1px solid color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 35%,transparent);color:var(--ui-cor-texto-erro, #ff5555);border-radius:var(--ui-raio-sm, 4px);height:24px;padding:0 10px;font-size:10px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:5px;transition:all var(--camada-transicao)}.ui-drawer-btn-danger:hover{background:var(--ui-cor-botao-destrutivo-fundo, #d32f2f);color:var(--ui-cor-botao-destrutivo-texto, #ffffff);border-color:var(--ui-cor-botao-destrutivo-fundo, #d32f2f);box-shadow:0 0 10px color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 45%,transparent);transform:translateY(-.5px)}.ui-drawer-btn-danger.confirming{background:var(--ui-cor-botao-destrutivo-hover, #b71c1c);color:var(--ui-cor-botao-destrutivo-texto, #ffffff);border-color:var(--ui-cor-botao-destrutivo-hover, #b71c1c);animation:pulseDanger 1.2s infinite}@keyframes pulseDanger{0%{transform:scale(1)}50%{transform:scale(1.02)}to{transform:scale(1)}}.ui-previa-dot{width:6px;height:6px;margin-left:4px;border-radius:50%;flex-shrink:0;background:var(--ui-cor-texto-alerta, #ffb86c);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 25%,transparent)}.ui-tree-footer{height:var(--camada-barra-altura);min-height:var(--camada-barra-altura);background:var(--ui-cor-fundo-elevado, #121216);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));display:flex;align-items:center;justify-content:space-between;padding:0 var(--camada-respiro);gap:6px;box-sizing:border-box;overflow:hidden;position:relative;flex-shrink:0;margin:0 calc(-1 * var(--camada-respiro))}.ui-footer-left{display:flex;align-items:center;gap:5px;white-space:nowrap;min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis}.ui-footer-count{font-size:11px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;font-weight:700;color:var(--ui-cor-primaria, #00E08A);flex-shrink:0}.ui-footer-label{display:inline-flex;align-items:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0}.ui-footer-actions-gerais{display:flex;align-items:center;gap:4px;flex-shrink:0}.ui-footer-chip-btn{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:none;color:var(--ui-cor-texto-secundario, #a0a0b0);font-size:10px;font-weight:600;height:22px;padding:0 8px;border-radius:var(--ui-raio-sm, 4px);cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-footer-chip-btn:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #ffffff)}.ui-footer-chip-btn.primario{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent);color:var(--ui-cor-primaria, #00E08A)}.ui-footer-chip-btn.primario:hover{background:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-footer-right{display:flex;align-items:center;gap:4px;flex:1 1 auto;min-width:0}.ui-footer-btn{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);width:22px;height:22px;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all var(--camada-transicao);flex-shrink:0}.ui-footer-btn:hover:not(.disabled){color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-footer-btn.disabled{opacity:.25;cursor:not-allowed}.ui-footer-btn.btn-danger-footer:hover:not(.disabled){color:var(--ui-cor-texto-erro, #ff5555);background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 15%,transparent)}.ui-footer-btn.confirming{background:var(--ui-cor-botao-destrutivo-hover, #b71c1c)!important;color:var(--ui-cor-botao-destrutivo-texto, #ffffff)!important}.ui-footer-move-wrapper{position:relative;display:flex;align-items:center;flex:1 1 auto;min-width:0}.ui-footer-select{-moz-appearance:none;appearance:none;-webkit-appearance:none;--_chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888899' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background:var(--_chevron) right 6px center / 10px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:none;color:var(--ui-cor-texto, #e1e1e6);border-radius:var(--ui-raio-sm, 4px);font:inherit;font-size:10px;font-weight:500;height:22px;padding:0 22px 0 8px;cursor:pointer;width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-footer-select:hover:not(:disabled){background:var(--_chevron) right 6px center / 10px no-repeat,var(--ui-cor-hover-menu, rgba(255, 255, 255, .12))}.ui-footer-select:focus-visible{outline:1px solid var(--ui-cor-primaria, #00E08A)}.ui-drawer-btn-sublayer{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #e1e1e6);font-size:10.5px;font-weight:500;padding:4px 8px;border-radius:4px;cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:all var(--camada-transicao)}.ui-drawer-btn-sublayer:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .12));color:var(--ui-cor-primaria, #00E08A);border-color:var(--ui-cor-primaria, #00E08A)}.ui-drawer-select-wrapper{display:flex;align-items:center}.ui-drawer-select{background:var(--ui-cor-fundo, #16161c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .15));color:var(--ui-cor-texto, #e1e1e6);border-radius:4px;font-size:10.5px;height:24px;padding:0 6px;cursor:pointer;max-width:140px}.ui-basemap-section{display:flex;flex-direction:column;gap:4px;flex-shrink:0}.ui-basemap-toggle{display:flex;align-items:center;gap:6px;width:100%;padding:2px;background:transparent;border:0;border-radius:var(--ui-raio-sm, 4px);font:inherit;color:inherit;cursor:pointer;text-align:left}.ui-basemap-toggle:hover .ui-basemap-title{color:var(--ui-cor-texto, #e1e1e6)}.ui-basemap-toggle:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:1px}.ui-basemap-atual{flex:1 1 auto;min-width:0;font-size:10px;color:var(--ui-cor-primaria, #00E08A);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right}.ui-basemap-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--ui-cor-texto-secundario, #888899)}.ui-basemap-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:4px}.ui-basemap-section{container-type:inline-size}@container (min-width: 260px){.ui-basemap-grid{grid-template-columns:repeat(3,1fr)}}@container (min-width: 340px){.ui-basemap-grid{grid-template-columns:repeat(4,1fr)}}.ui-basemap-card{display:flex;flex-direction:column;align-items:center;gap:2px;padding:3px;border-radius:var(--ui-raio-borda, 5px);background:var(--ui-cor-fundo, #101014);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));cursor:pointer;transition:all var(--camada-transicao);text-align:center;overflow:hidden}.ui-basemap-card:hover{border-color:var(--ui-cor-primaria, #00E08A);background:var(--ui-cor-fundo-elevado, #17171c)}.ui-basemap-card.active{border-color:var(--ui-cor-primaria, #00E08A);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 12%,transparent);color:var(--ui-cor-primaria, #00E08A);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 35%,transparent)}.ui-basemap-preview{width:100%;height:22px;border-radius:3px;object-fit:cover;opacity:.85;transition:opacity var(--camada-transicao)}.ui-basemap-preview-none{width:100%;height:22px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent);border-radius:3px;color:var(--ui-cor-texto-secundario, #888899)}.ui-basemap-card:hover .ui-basemap-preview,.ui-basemap-card.active .ui-basemap-preview{opacity:1}.ui-basemap-card span{font-size:9.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.ui-layer-row.herdado-oculto,.ui-feat-row.herdado-oculto{opacity:.52}.ui-layer-row.herdado-travado .ui-col-lock.ui-lock-open{color:var(--ui-cor-texto-secundario, #888899);opacity:.7}.ui-virtual-espaco{display:block;pointer-events:none}.ui-feat-row.ui-virtual-retida,.ui-search-hidden{display:none!important}.ui-empty-row{height:22px;display:flex;align-items:center;padding-left:36px;font-size:10px;color:var(--ui-cor-texto-secundario, #666677);font-style:italic;background:var(--ui-cor-fundo-recuado, rgba(0, 0, 0, .15))}.ui-camadas-resizer-altura{display:none;flex-shrink:0;width:100%;height:9px;background:var(--ui-cor-superficie, #141417);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));cursor:ns-resize;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;touch-action:none;transition:background .15s ease,border-color .15s ease;position:relative;z-index:10}:host([redimensionavel]) .ui-camadas-resizer-altura,:host([redimensionavel-altura]) .ui-camadas-resizer-altura{display:flex}.ui-camadas-resizer-altura:hover,.ui-camadas-resizer-altura.ui-camadas-resizer--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 9%,transparent);border-top-color:var(--ui-cor-primaria, #00E08A)}.ui-camadas-resizer-grip{width:32px;height:3px;border-radius:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 22%,transparent);transition:all .15s ease}.ui-camadas-resizer-altura:hover .ui-camadas-resizer-grip,.ui-camadas-resizer-altura.ui-camadas-resizer--ativo .ui-camadas-resizer-grip{background:var(--ui-cor-primaria, #00E08A);width:46px;box-shadow:0 0 8px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 45%,transparent)}:host(.ui-camadas--redimensionando){-webkit-user-select:none!important;user-select:none!important;cursor:ns-resize!important}:host(.ui-camadas--redimensionando) *{-webkit-user-select:none!important;user-select:none!important}.ui-col-lock.ui-lock-open{opacity:.28}.ui-col-lock.ui-lock-open:hover,.ui-col-lock.ui-lock-open:focus-visible{opacity:.8}.ui-col-lock[data-locked-by-layer]{cursor:not-allowed}.ui-col[role=button]:focus-visible,.ui-basemap-card:focus-visible,.ui-feat-row:focus-visible,.ui-layer-row:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-footer-btn.confirming{color:var(--ui-cor-botao-destrutivo-texto, #ffffff);background:var(--ui-cor-botao-destrutivo-hover, #b71c1c);width:auto;padding:0 6px}.ui-truncate-notice{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;margin:4px 8px 6px;background:color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 70%,transparent);border:1px dashed var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 4px);font-size:10px;color:var(--ui-cor-texto-secundario, #9696a6)}.ui-truncate-notice span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-truncate-more-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .18));border-radius:var(--ui-raio-borda, 4px);color:var(--ui-cor-primaria, #00E08A);font-size:10px;font-weight:500;cursor:pointer;white-space:nowrap;transition:all var(--camada-transicao)}.ui-truncate-more-btn:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-primaria, #00E08A)}.ui-truncate-more-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:1px}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-camadas-container[data-degrade]:not([data-degrade=false]){--ui-camadas-fundo: var(--ui-gradiente-superficie);--ui-camadas-toggle-fundo: var(--ui-gradiente-superficie)}`;
1744
+ function hr(e, t) {
1566
1745
  t.querySelectorAll("[data-layer-row]").forEach((r) => {
1567
1746
  const o = r.getAttribute("data-layer-row") === e.camadaAtivaId;
1568
- r.classList.toggle("active-drawing-layer", o), ea(r, "camada-ativa", o), o ? r.setAttribute("aria-current", "true") : r.removeAttribute("aria-current");
1747
+ r.classList.toggle("active-drawing-layer", o), va(r, "camada-ativa", o), o ? r.setAttribute("aria-current", "true") : r.removeAttribute("aria-current");
1569
1748
  });
1570
1749
  }
1571
- function Ft(e, t) {
1750
+ function gr(e, t) {
1572
1751
  t.querySelectorAll(".ui-feat-row").forEach((o) => {
1573
1752
  const n = o.getAttribute("data-feat-row"), s = n ? e.selectedFeatureIds.has(n) : !1;
1574
- o.classList.toggle("selected-row", s), ea(o, "feicao-selecionada", s), o.setAttribute("aria-selected", String(s));
1575
- const d = o.querySelector(".ui-target-circle");
1576
- d && d.classList.toggle("selected", s);
1753
+ o.classList.toggle("selected-row", s), va(o, "feicao-selecionada", s), o.setAttribute("aria-selected", String(s));
1754
+ const l = o.querySelector(".ui-target-circle");
1755
+ l && l.classList.toggle("selected", s);
1577
1756
  });
1578
- const a = be(e.camadas, e.feicoes, e.searchQuery);
1757
+ const a = ke(e.camadas, e.feicoes, e.searchQuery);
1579
1758
  let r;
1580
1759
  if (a)
1581
1760
  r = a.feicoesPorCamada;
@@ -1584,23 +1763,23 @@ function Ft(e, t) {
1584
1763
  for (let n = 0; n < e.feicoes.length; n++) {
1585
1764
  const s = e.feicoes[n];
1586
1765
  if (!s || !s.id) continue;
1587
- const d = s.layerId || "", l = o.get(d);
1588
- l ? l.push(s) : o.set(d, [s]);
1766
+ const l = s.layerId || "", c = o.get(l);
1767
+ c ? c.push(s) : o.set(l, [s]);
1589
1768
  }
1590
1769
  r = o;
1591
1770
  }
1592
- const i = ba(
1593
- ie(e.camadas),
1771
+ const i = Da(
1772
+ te(e.camadas),
1594
1773
  r,
1595
1774
  e.selectedFeatureIds,
1596
1775
  a == null ? void 0 : a.camadasVisiveis
1597
1776
  );
1598
1777
  t.querySelectorAll(".ui-layer-group").forEach((o) => {
1599
1778
  const n = o.getAttribute("data-layer-id") ?? "", s = i.get(n);
1600
- wa(o.querySelector(".ui-layer-row .ui-target-circle"), (s == null ? void 0 : s.total) ?? 0, (s == null ? void 0 : s.selecionadas) ?? 0);
1601
- }), Aa(e, t);
1779
+ Va(o.querySelector(".ui-layer-row .ui-target-circle"), (s == null ? void 0 : s.total) ?? 0, (s == null ? void 0 : s.selecionadas) ?? 0);
1780
+ }), _a(e, t);
1602
1781
  }
1603
- function wa(e, t, a) {
1782
+ function Va(e, t, a) {
1604
1783
  if (!e) return;
1605
1784
  if (t === 0) {
1606
1785
  e.classList.remove("selected", "partial");
@@ -1609,48 +1788,48 @@ function wa(e, t, a) {
1609
1788
  const r = a === t, i = a > 0 && !r;
1610
1789
  e.classList.toggle("selected", r), e.classList.toggle("partial", i);
1611
1790
  }
1612
- function Aa(e, t) {
1613
- const a = e.feicoes.filter((f) => e.selectedFeatureIds.has(f.id)), r = a.length > 0, i = t.getElementById("footer-count"), o = t.getElementById("footer-label");
1791
+ function _a(e, t) {
1792
+ const a = e.feicoes.filter((p) => e.selectedFeatureIds.has(p.id)), r = a.length > 0, i = t.getElementById("footer-count"), o = t.getElementById("footer-label");
1614
1793
  if (i && (i.textContent = String(r ? a.length : e.camadas.length)), o) {
1615
- const f = la(e.camadas.length, a.length);
1616
- o.innerHTML = f.icone, o.title = f.texto, o.setAttribute("aria-label", f.texto);
1794
+ const p = ka(e.camadas.length, a.length);
1795
+ o.innerHTML = p.icone, o.title = p.texto, o.setAttribute("aria-label", p.texto);
1617
1796
  }
1618
1797
  const n = t.querySelector(".ui-tree-footer");
1619
1798
  n && (n.classList.toggle("tem-selecao", r), n.classList.toggle("sem-selecao", !r));
1620
1799
  const s = t.querySelector(".ui-footer-actions-gerais");
1621
1800
  s && (s.style.display = r ? "none" : "flex");
1622
- const d = t.querySelector(".ui-footer-bulk-actions");
1623
- d && (d.style.display = r ? "flex" : "none"), ["btn-footer-del"].forEach((f) => {
1624
- const u = t.getElementById(f);
1625
- u && (u.disabled = !r, u.classList.toggle("disabled", !r));
1801
+ const l = t.querySelector(".ui-footer-bulk-actions");
1802
+ l && (l.style.display = r ? "flex" : "none"), ["btn-footer-del"].forEach((p) => {
1803
+ const d = t.getElementById(p);
1804
+ d && (d.disabled = !r, d.classList.toggle("disabled", !r));
1626
1805
  });
1627
- const l = t.querySelector(".ui-footer-move-wrapper");
1628
- l && l.classList.toggle("disabled", !r);
1629
- const c = t.getElementById("select-footer-move");
1630
- c && (c.disabled = !r);
1806
+ const c = t.querySelector(".ui-footer-move-wrapper");
1807
+ c && c.classList.toggle("disabled", !r);
1808
+ const f = t.getElementById("select-footer-move");
1809
+ f && (f.disabled = !r);
1631
1810
  }
1632
- function Je(e, t) {
1633
- const a = ge(e.camadas), r = new Map(e.camadas.map((n) => [n.id, n]));
1811
+ function fa(e, t) {
1812
+ const a = le(e.camadas), r = new Map(e.camadas.map((n) => [n.id, n]));
1634
1813
  t.querySelectorAll(".ui-layer-row").forEach((n) => {
1635
1814
  const s = a.get(n.getAttribute("data-layer-row") || "");
1636
1815
  n.classList.toggle("herdado-oculto", (s == null ? void 0 : s.ocultaPorAncestral) === !0), n.classList.toggle("herdado-travado", (s == null ? void 0 : s.travadaPorAncestral) === !0);
1637
1816
  });
1638
1817
  const i = new Map(e.feicoes.map((n) => [n.id, n]));
1639
1818
  t.querySelectorAll(".ui-feat-row").forEach((n) => {
1640
- const s = n.getAttribute("data-feat-layer") || "", d = r.get(s), l = a.get(s);
1641
- n.classList.toggle("herdado-oculto", (d == null ? void 0 : d.visible) === !1 || (l == null ? void 0 : l.ocultaPorAncestral) === !0);
1642
- const c = n.querySelector("[data-feat-lock]"), f = i.get(n.getAttribute("data-feat-row") || "");
1643
- if (!c || !f) return;
1644
- const u = (d == null ? void 0 : d.locked) === !0 || (l == null ? void 0 : l.travadaPorAncestral) === !0, p = f.locked === !0 || u;
1645
- c.innerHTML = p ? y.cadeadoTrancado : y.cadeadoAberto, c.classList.toggle("ui-lock-open", !p), u ? c.setAttribute("data-locked-by-layer", "true") : c.removeAttribute("data-locked-by-layer"), j(
1646
- c,
1647
- u ? "Bloqueada pela camada" : p ? "Desbloquear Feição" : "Bloquear Feição"
1819
+ const s = n.getAttribute("data-feat-layer") || "", l = r.get(s), c = a.get(s);
1820
+ n.classList.toggle("herdado-oculto", (l == null ? void 0 : l.visible) === !1 || (c == null ? void 0 : c.ocultaPorAncestral) === !0);
1821
+ const f = n.querySelector("[data-feat-lock]"), p = i.get(n.getAttribute("data-feat-row") || "");
1822
+ if (!f || !p) return;
1823
+ const d = (l == null ? void 0 : l.locked) === !0 || (c == null ? void 0 : c.travadaPorAncestral) === !0, u = p.locked === !0 || d;
1824
+ f.innerHTML = u ? A.cadeadoTrancado : A.cadeadoAberto, f.classList.toggle("ui-lock-open", !u), d ? f.setAttribute("data-locked-by-layer", "true") : f.removeAttribute("data-locked-by-layer"), R(
1825
+ f,
1826
+ d ? "Bloqueada pela camada" : u ? "Desbloquear Feição" : "Bloquear Feição"
1648
1827
  );
1649
1828
  });
1650
1829
  const o = t.getElementById("select-footer-move");
1651
- o && (o.innerHTML = `<option value="" disabled selected>Mover para...</option>${sa(e.camadas)}`);
1830
+ o && (o.innerHTML = `<option value="" disabled selected>Mover para...</option>${Ia(e.camadas)}`);
1652
1831
  }
1653
- function $t(e, t) {
1832
+ function vr(e, t) {
1654
1833
  t.querySelectorAll("[data-layer-row]").forEach((i) => {
1655
1834
  i.addEventListener("click", (o) => {
1656
1835
  if (o.target.closest(
@@ -1662,38 +1841,39 @@ function $t(e, t) {
1662
1841
  });
1663
1842
  }), t.querySelectorAll("[data-layer-expand]").forEach((i) => {
1664
1843
  i.addEventListener("click", (o) => {
1844
+ var f;
1665
1845
  o.stopPropagation();
1666
1846
  const n = i.getAttribute("data-layer-expand");
1667
1847
  if (!n) return;
1668
1848
  e.expandedLayers.has(n) ? e.expandedLayers.delete(n) : e.expandedLayers.add(n);
1669
- const s = i.closest(".ui-layer-group"), d = i.querySelector(".ui-chevron-icon"), l = e.expandedLayers.has(n);
1670
- if (d && d.classList.toggle("open", l), s) {
1671
- s.setAttribute("aria-expanded", String(l));
1672
- const c = s.querySelector(".ui-children-container");
1673
- c && (c.style.display = l ? "block" : "none");
1849
+ const s = i.closest(".ui-layer-group"), l = i.querySelector(".ui-chevron-icon"), c = e.expandedLayers.has(n);
1850
+ if (l && l.classList.toggle("open", c), s) {
1851
+ s.setAttribute("aria-expanded", String(c));
1852
+ const p = s.querySelector(".ui-children-container");
1853
+ p && (p.style.display = c ? "block" : "none");
1674
1854
  }
1675
- j(i, l ? "Recolher grupo" : "Expandir grupo"), zt(e, t), e.salvarLembrancaEstado();
1855
+ R(i, c ? "Recolher grupo" : "Expandir grupo"), br(e, t), (f = e.atualizarArvoreVirtual) == null || f.call(e, !0), e.salvarLembrancaEstado();
1676
1856
  });
1677
1857
  }), t.querySelectorAll("[data-layer-eye]").forEach((i) => {
1678
1858
  i.addEventListener("click", (o) => {
1679
1859
  o.stopPropagation();
1680
- const n = i.getAttribute("data-layer-eye"), s = e.camadas.find((d) => d.id === n);
1860
+ const n = i.getAttribute("data-layer-eye"), s = e.camadas.find((l) => l.id === n);
1681
1861
  if (s) {
1682
1862
  s.visible = s.visible === !1;
1683
- const d = s.visible !== !1;
1684
- i.innerHTML = d ? y.olhoAberto : y.olhoFechado, j(i, d ? "Ocultar Camada" : "Exibir Camada");
1685
- const l = i.closest(".ui-layer-row");
1686
- l && l.classList.toggle("hidden-layer", !d), Mt(e, t), Je(e, t), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-visibilidade", {
1863
+ const l = s.visible !== !1;
1864
+ i.innerHTML = l ? A.olhoAberto : A.olhoFechado, R(i, l ? "Ocultar Camada" : "Exibir Camada");
1865
+ const c = i.closest(".ui-layer-row");
1866
+ c && c.classList.toggle("hidden-layer", !l), yr(e, t), fa(e, t), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-visibilidade", {
1687
1867
  camadaId: s.id,
1688
- visivel: d
1868
+ visivel: l
1689
1869
  });
1690
1870
  }
1691
1871
  });
1692
1872
  }), t.querySelectorAll("[data-layer-lock]").forEach((i) => {
1693
1873
  i.addEventListener("click", (o) => {
1694
1874
  o.stopPropagation();
1695
- const n = i.getAttribute("data-layer-lock"), s = e.camadas.find((d) => d.id === n);
1696
- s && (s.locked = !s.locked, i.innerHTML = s.locked ? y.cadeadoTrancado : y.cadeadoAberto, i.classList.toggle("ui-lock-open", !s.locked), j(i, s.locked ? "Desbloquear Camada" : "Bloquear Camada"), Je(e, t), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-bloqueio", {
1875
+ const n = i.getAttribute("data-layer-lock"), s = e.camadas.find((l) => l.id === n);
1876
+ s && (s.locked = !s.locked, i.innerHTML = s.locked ? A.cadeadoTrancado : A.cadeadoAberto, i.classList.toggle("ui-lock-open", !s.locked), R(i, s.locked ? "Desbloquear Camada" : "Bloquear Camada"), fa(e, t), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-bloqueio", {
1697
1877
  camadaId: s.id,
1698
1878
  bloqueado: s.locked
1699
1879
  }));
@@ -1716,65 +1896,65 @@ function $t(e, t) {
1716
1896
  });
1717
1897
  });
1718
1898
  const a = (i, o, n) => {
1719
- const s = e.camadas.find((p) => p.id === i);
1899
+ const s = e.camadas.find((u) => u.id === i);
1720
1900
  if (!s) return;
1721
- const d = J(o, s.color || "#00E08A");
1722
- s.color = d;
1723
- const l = t.getElementById(`sample-color-${i}`);
1724
- l && (l.style.backgroundColor = d);
1725
- const c = t.getElementById(`hex-color-${i}`);
1726
- c && (c.textContent = d.toUpperCase());
1727
- const f = t.getElementById(`settings-drawer-${i}`);
1728
- f && f.style.setProperty("--drawer-cor-camada", d);
1729
- const u = D(t, "data-layer-row", i);
1730
- if (u) {
1731
- const p = u.closest(".ui-layer-group");
1732
- p == null || p.style.setProperty("--layer-active-color", d);
1733
- const m = p == null ? void 0 : p.querySelector(":scope > .ui-children-container");
1734
- m == null || m.style.setProperty("--parent-layer-color", d);
1735
- const g = u.querySelector(".ui-col-colorbar");
1736
- g && (g.style.backgroundColor = d);
1737
- const b = p == null ? void 0 : p.querySelectorAll(".ui-feat-row");
1738
- if (b && b.length > 0) {
1739
- const h = /* @__PURE__ */ new Map();
1901
+ const l = Z(o, s.color || "#00E08A");
1902
+ s.color = l;
1903
+ const c = t.getElementById(`sample-color-${i}`);
1904
+ c && (c.style.backgroundColor = l);
1905
+ const f = t.getElementById(`hex-color-${i}`);
1906
+ f && (f.textContent = l.toUpperCase());
1907
+ const p = t.getElementById(`settings-drawer-${i}`);
1908
+ p && p.style.setProperty("--drawer-cor-camada", l);
1909
+ const d = M(t, "data-layer-row", i);
1910
+ if (d) {
1911
+ const u = d.closest(".ui-layer-group");
1912
+ u == null || u.style.setProperty("--layer-active-color", l);
1913
+ const h = u == null ? void 0 : u.querySelector(":scope > .ui-children-container");
1914
+ h == null || h.style.setProperty("--parent-layer-color", l);
1915
+ const m = d.querySelector(".ui-col-colorbar");
1916
+ m && (m.style.backgroundColor = l);
1917
+ const g = u == null ? void 0 : u.querySelectorAll(".ui-feat-row");
1918
+ if (g && g.length > 0) {
1919
+ const y = /* @__PURE__ */ new Map();
1740
1920
  for (let v = 0; v < e.feicoes.length; v++) {
1741
- const A = e.feicoes[v];
1742
- A && A.layerId === i && h.set(A.id, A);
1921
+ const b = e.feicoes[v];
1922
+ b && b.layerId === i && y.set(b.id, b);
1743
1923
  }
1744
- b.forEach((v) => {
1924
+ g.forEach((v) => {
1745
1925
  if (v.getAttribute("data-feat-layer") !== i) return;
1746
- const A = v.querySelector(".ui-col-colorbar");
1747
- A && (A.style.backgroundColor = d);
1748
- const I = h.get(v.getAttribute("data-feat-row") || "");
1749
- if (!I || I.color) return;
1750
- const w = v.querySelector(".ui-thumb-box");
1751
- w && (w.innerHTML = ca(I.type || I.geometryType, d, I.coordinates));
1926
+ const b = v.querySelector(".ui-col-colorbar");
1927
+ b && (b.style.backgroundColor = l);
1928
+ const w = y.get(v.getAttribute("data-feat-row") || "");
1929
+ if (!w || w.color) return;
1930
+ const x = v.querySelector(".ui-thumb-box");
1931
+ x && (x.innerHTML = Ca(w.type || w.geometryType, l, w.coordinates));
1752
1932
  });
1753
1933
  }
1754
1934
  }
1755
- n ? e.salvarLembrancaEstado() : e.agendarSalvarLembranca(), e.dispararEvento("ui-camada-cor", { camadaId: s.id, cor: d });
1935
+ n ? e.salvarLembrancaEstado() : e.agendarSalvarLembranca(), e.dispararEvento("ui-camada-cor", { camadaId: s.id, cor: l });
1756
1936
  };
1757
1937
  t.querySelectorAll("[data-layer-color-picker]").forEach((i) => {
1758
- const o = i, n = (s) => (d) => {
1759
- const l = o.getAttribute("data-layer-color-picker");
1760
- if (!l) return;
1761
- const c = d.target.value;
1762
- a(l, c, s);
1938
+ const o = i, n = (s) => (l) => {
1939
+ const c = o.getAttribute("data-layer-color-picker");
1940
+ if (!c) return;
1941
+ const f = l.target.value;
1942
+ a(c, f, s);
1763
1943
  };
1764
1944
  o.addEventListener("input", n(!1)), o.addEventListener("change", n(!0));
1765
1945
  }), t.querySelectorAll("[data-layer-color]").forEach((i) => {
1766
1946
  const o = (n) => {
1767
1947
  n.stopPropagation();
1768
- const s = i.getAttribute("data-layer-color"), d = e.camadas.find((l) => l.id === s);
1769
- !s || !d || Wa({
1948
+ const s = i.getAttribute("data-layer-color"), l = e.camadas.find((c) => c.id === s);
1949
+ !s || !l || Ct({
1770
1950
  ancora: i,
1771
- titulo: `Cor · ${d.name || "Camada"}`,
1951
+ titulo: `Cor · ${l.name || "Camada"}`,
1772
1952
  modo: "simples",
1773
- cor: J(d.color, "#00E08A"),
1953
+ cor: Z(l.color, "#00E08A"),
1774
1954
  mostrarOpacidade: !1,
1775
- aoAlterar: (l) => a(s, l.cor, !1),
1776
- aoConfirmar: (l) => a(s, l.cor, !0),
1777
- aoCancelar: (l) => a(s, l.cor, !0)
1955
+ aoAlterar: (c) => a(s, c.cor, !1),
1956
+ aoConfirmar: (c) => a(s, c.cor, !0),
1957
+ aoCancelar: (c) => a(s, c.cor, !0)
1778
1958
  });
1779
1959
  };
1780
1960
  i.addEventListener("click", o), i.addEventListener("keydown", (n) => {
@@ -1783,13 +1963,13 @@ function $t(e, t) {
1783
1963
  });
1784
1964
  });
1785
1965
  const r = (i, o) => {
1786
- const n = e.camadas.find((l) => l.id === i);
1966
+ const n = e.camadas.find((c) => c.id === i);
1787
1967
  if (!n) return;
1788
1968
  n.opacity = o;
1789
1969
  const s = t.getElementById(`badge-op-${i}`);
1790
1970
  s && (s.textContent = `${Math.round(o * 100)}%`);
1791
- const d = D(t, "data-layer-opacity-slider", i);
1792
- d && parseFloat(d.value) !== o && (d.value = String(o)), e.agendarSalvarLembranca(), e.dispararEvento("ui-camada-opacidade", { camadaId: n.id, opacidade: o });
1971
+ const l = M(t, "data-layer-opacity-slider", i);
1972
+ l && parseFloat(l.value) !== o && (l.value = String(o)), e.agendarSalvarLembranca(), e.dispararEvento("ui-camada-opacidade", { camadaId: n.id, opacidade: o });
1793
1973
  };
1794
1974
  t.querySelectorAll("[data-layer-opacity-slider]").forEach((i) => {
1795
1975
  i.addEventListener("input", (o) => {
@@ -1807,36 +1987,36 @@ function $t(e, t) {
1807
1987
  };
1808
1988
  i.addEventListener("ui-cancelar-confirmacao", n), i.addEventListener("click", (s) => {
1809
1989
  s.stopPropagation();
1810
- const d = i.getAttribute("data-delete-layer");
1811
- if (!d) return;
1990
+ const l = i.getAttribute("data-delete-layer");
1991
+ if (!l) return;
1812
1992
  if (i.classList.contains("confirming")) {
1813
- n(), e.dispararEvento("ui-camada-excluida", { camadaId: d });
1814
- const c = e.selectedFeatureIds.size;
1815
- e.camadas.forEach((f) => {
1816
- f.parentId === d && (f.parentId = null);
1817
- }), e.removerCamada(d), e.selectedFeatureIds.size !== c && e.notificarMudancaSelecao();
1993
+ n(), e.dispararEvento("ui-camada-excluida", { camadaId: l });
1994
+ const f = e.selectedFeatureIds.size;
1995
+ e.camadas.forEach((p) => {
1996
+ p.parentId === l && (p.parentId = null);
1997
+ }), e.removerCamada(l), e.selectedFeatureIds.size !== f && e.notificarMudancaSelecao();
1818
1998
  } else {
1819
1999
  i.classList.add("confirming");
1820
- const c = i.querySelector(".ui-btn-label");
1821
- c && (c.textContent = "Confirmar Exclusão?"), o = setTimeout(() => {
2000
+ const f = i.querySelector(".ui-btn-label");
2001
+ f && (f.textContent = "Confirmar Exclusão?"), o = setTimeout(() => {
1822
2002
  o = null, i.isConnected && n();
1823
2003
  }, 3500);
1824
2004
  }
1825
2005
  });
1826
2006
  }), t.querySelectorAll("[data-layer-parent-select]").forEach((i) => {
1827
2007
  i.addEventListener("change", (o) => {
1828
- const n = o.target, s = n.getAttribute("data-layer-parent-select"), d = n.value || null, l = e.camadas.find((c) => c.id === s);
1829
- if (l) {
1830
- if (d && (d === l.id || N(e.camadas, d, l.id))) {
1831
- n.value = l.parentId || "";
2008
+ const n = o.target, s = n.getAttribute("data-layer-parent-select"), l = n.value || null, c = e.camadas.find((f) => f.id === s);
2009
+ if (c) {
2010
+ if (l && (l === c.id || T(e.camadas, l, c.id))) {
2011
+ n.value = c.parentId || "";
1832
2012
  return;
1833
2013
  }
1834
- const c = l.parentId ?? null;
1835
- l.parentId = d, d && e.expandedLayers.add(d), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-mover-hierarquia", {
1836
- camadaId: l.id,
1837
- novoParentId: d,
1838
- parentAnteriorId: c,
1839
- camada: l
2014
+ const f = c.parentId ?? null;
2015
+ c.parentId = l, l && e.expandedLayers.add(l), e.salvarLembrancaEstado(), e.dispararEvento("ui-camada-mover-hierarquia", {
2016
+ camadaId: c.id,
2017
+ novoParentId: l,
2018
+ parentAnteriorId: f,
2019
+ camada: c
1840
2020
  }), e.solicitarRenderizacao();
1841
2021
  }
1842
2022
  });
@@ -1846,18 +2026,18 @@ function $t(e, t) {
1846
2026
  const n = i.getAttribute("data-add-sublayer");
1847
2027
  e.dispararEvento("ui-camada-adicionar", { parentId: n });
1848
2028
  });
1849
- }), Ea(e, t), t.querySelectorAll("[data-layer-target]").forEach((i) => {
2029
+ }), Ga(e, t), t.querySelectorAll("[data-layer-target]").forEach((i) => {
1850
2030
  i.addEventListener("click", (o) => {
1851
2031
  o.stopPropagation();
1852
2032
  const n = o, s = i.getAttribute("data-layer-target");
1853
2033
  if (!s) return;
1854
- const d = mt(e.camadas, e.feicoes, s, e.searchQuery);
1855
- if (d.length === 0) return;
1856
- d.every((c) => e.selectedFeatureIds.has(c.id)) ? d.forEach((c) => e.selectedFeatureIds.delete(c.id)) : (!n.ctrlKey && !n.metaKey && e.selectedFeatureIds.clear(), d.forEach((c) => e.selectedFeatureIds.add(c.id))), e.lastClickedFeatureId = d[d.length - 1].id, e.sincronizarSelecaoDOM(), e.notificarMudancaSelecao();
2034
+ const l = Vt(e.camadas, e.feicoes, s, e.searchQuery);
2035
+ if (l.length === 0) return;
2036
+ l.every((f) => e.selectedFeatureIds.has(f.id)) ? l.forEach((f) => e.selectedFeatureIds.delete(f.id)) : (!n.ctrlKey && !n.metaKey && e.selectedFeatureIds.clear(), l.forEach((f) => e.selectedFeatureIds.add(f.id))), e.lastClickedFeatureId = l[l.length - 1].id, e.sincronizarSelecaoDOM(), e.notificarMudancaSelecao();
1857
2037
  });
1858
2038
  });
1859
2039
  }
1860
- function Ea(e, t) {
2040
+ function Ga(e, t) {
1861
2041
  t.querySelectorAll("[data-layer-show-more]").forEach((a) => {
1862
2042
  a.addEventListener("click", (r) => {
1863
2043
  r.stopPropagation();
@@ -1866,53 +2046,53 @@ function Ea(e, t) {
1866
2046
  });
1867
2047
  });
1868
2048
  }
1869
- function zt(e, t) {
2049
+ function br(e, t) {
1870
2050
  const a = t.getElementById("btn-toggle-all-expand");
1871
2051
  if (!a) return;
1872
2052
  const r = e.camadas.length > 0 && e.camadas.every((o) => e.expandedLayers.has(o.id)), i = a.querySelector(".ui-chevron-icon");
1873
- i && i.classList.toggle("open", r), j(
2053
+ i && i.classList.toggle("open", r), R(
1874
2054
  a,
1875
2055
  r ? "Recolher Todos os Grupos" : "Expandir Todos os Grupos"
1876
2056
  );
1877
2057
  }
1878
- function Mt(e, t) {
2058
+ function yr(e, t) {
1879
2059
  const a = t.getElementById("btn-toggle-all-vis");
1880
2060
  if (!a) return;
1881
2061
  const r = e.camadas.every((i) => i.visible !== !1);
1882
- a.innerHTML = r ? y.olhoAberto : y.olhoFechado, j(a, r ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas");
2062
+ a.innerHTML = r ? A.olhoAberto : A.olhoFechado, R(a, r ? "Ocultar Todas as Camadas" : "Exibir Todas as Camadas");
1883
2063
  }
1884
- function Pt(e, t) {
2064
+ function xr(e, t) {
1885
2065
  const a = t.getElementById("select-footer-move");
1886
2066
  a && a.addEventListener("change", (n) => {
1887
2067
  const s = n.target.value;
1888
2068
  if (!s) return;
1889
- const d = pe(e.camadas);
1890
- if (d.has(s)) {
2069
+ const l = we(e.camadas);
2070
+ if (l.has(s)) {
1891
2071
  a.value = "";
1892
2072
  return;
1893
2073
  }
1894
- const l = e.feicoes.filter(
1895
- (f) => e.selectedFeatureIds.has(f.id) && !d.has(f.layerId) && f.locked !== !0
2074
+ const c = e.feicoes.filter(
2075
+ (p) => e.selectedFeatureIds.has(p.id) && !l.has(p.layerId) && p.locked !== !0
1896
2076
  );
1897
- if (l.length === 0) {
2077
+ if (c.length === 0) {
1898
2078
  a.value = "";
1899
2079
  return;
1900
2080
  }
1901
- const c = new Map(l.map((f) => [f.id, f.layerId]));
1902
- l.forEach((f) => {
1903
- const u = f.layerId;
1904
- f.layerId = s, e.ordemFilhosPorPai && u !== s && va(e.ordemFilhosPorPai, f.id, u, s);
1905
- }), l.forEach((f) => {
1906
- c.get(f.id) !== s && e.dispararEvento("ui-feicao-movida", {
1907
- feicaoId: f.id,
1908
- camadaOrigemId: c.get(f.id),
2081
+ const f = new Map(c.map((p) => [p.id, p.layerId]));
2082
+ c.forEach((p) => {
2083
+ const d = p.layerId;
2084
+ p.layerId = s, e.ordemFilhosPorPai && d !== s && Ba(e.ordemFilhosPorPai, p.id, d, s);
2085
+ }), c.forEach((p) => {
2086
+ f.get(p.id) !== s && e.dispararEvento("ui-feicao-movida", {
2087
+ feicaoId: p.id,
2088
+ camadaOrigemId: f.get(p.id),
1909
2089
  camadaDestinoId: s,
1910
- feicao: f
2090
+ feicao: p
1911
2091
  });
1912
2092
  }), e.dispararEvento("ui-acao-massa", {
1913
2093
  acao: "mover",
1914
- feicoesIds: l.map((f) => f.id),
1915
- feicoes: l,
2094
+ feicoesIds: c.map((p) => p.id),
2095
+ feicoes: c,
1916
2096
  valor: s
1917
2097
  }), e.salvarLembrancaEstado(), e.solicitarRenderizacao();
1918
2098
  });
@@ -1927,50 +2107,50 @@ function Pt(e, t) {
1927
2107
  const o = t.getElementById("btn-footer-del");
1928
2108
  if (o) {
1929
2109
  let n = null;
1930
- const s = "Excluir selecionados", d = () => {
1931
- n && (clearTimeout(n), n = null), o.classList.remove("confirming"), j(o, s);
2110
+ const s = "Excluir selecionados", l = () => {
2111
+ n && (clearTimeout(n), n = null), o.classList.remove("confirming"), R(o, s);
1932
2112
  };
1933
- o.addEventListener("ui-cancelar-confirmacao", d), o.addEventListener("click", () => {
1934
- const l = pe(e.camadas), c = e.feicoes.filter(
1935
- (p) => e.selectedFeatureIds.has(p.id) && !l.has(p.layerId) && p.locked !== !0
2113
+ o.addEventListener("ui-cancelar-confirmacao", l), o.addEventListener("click", () => {
2114
+ const c = we(e.camadas), f = e.feicoes.filter(
2115
+ (u) => e.selectedFeatureIds.has(u.id) && !c.has(u.layerId) && u.locked !== !0
1936
2116
  );
1937
- if (c.length === 0) return;
1938
- const f = c.map((p) => p.id);
2117
+ if (f.length === 0) return;
2118
+ const p = f.map((u) => u.id);
1939
2119
  if (!o.classList.contains("confirming")) {
1940
- o.classList.add("confirming"), j(o, `Clique novamente para excluir ${f.length} selecionado(s)`), n = setTimeout(() => {
1941
- n = null, o.isConnected && d();
2120
+ o.classList.add("confirming"), R(o, `Clique novamente para excluir ${p.length} selecionado(s)`), n = setTimeout(() => {
2121
+ n = null, o.isConnected && l();
1942
2122
  }, 3500);
1943
2123
  return;
1944
2124
  }
1945
- d();
1946
- const u = new Set(f);
1947
- e.ordemFilhosPorPai && c.forEach((p) => {
1948
- G(e.ordemFilhosPorPai, p.layerId, O(p.id));
1949
- }), e.feicoes = e.feicoes.filter((p) => !u.has(p.id)), f.forEach((p) => e.selectedFeatureIds.delete(p)), e.lastClickedFeatureId && u.has(e.lastClickedFeatureId) && (e.lastClickedFeatureId = null), e.dispararEvento("ui-acao-massa", {
2125
+ l();
2126
+ const d = new Set(p);
2127
+ e.ordemFilhosPorPai && f.forEach((u) => {
2128
+ N(e.ordemFilhosPorPai, u.layerId, B(u.id));
2129
+ }), e.feicoes = e.feicoes.filter((u) => !d.has(u.id)), p.forEach((u) => e.selectedFeatureIds.delete(u)), e.lastClickedFeatureId && d.has(e.lastClickedFeatureId) && (e.lastClickedFeatureId = null), e.dispararEvento("ui-acao-massa", {
1950
2130
  acao: "excluir",
1951
- feicoesIds: f,
1952
- feicoes: c
2131
+ feicoesIds: p,
2132
+ feicoes: f
1953
2133
  }), e.salvarLembrancaEstado(), e.notificarMudancaSelecao(), e.solicitarRenderizacao();
1954
2134
  });
1955
2135
  }
1956
2136
  }
1957
- const Bt = [
2137
+ const wr = [
1958
2138
  { tipo: "olho", atributo: "data-layer-eye", entidade: "camada" },
1959
2139
  { tipo: "olho", atributo: "data-feat-eye", entidade: "feicao" },
1960
2140
  { tipo: "cadeado", atributo: "data-layer-lock", entidade: "camada" },
1961
2141
  { tipo: "cadeado", atributo: "data-feat-lock", entidade: "feicao" },
1962
2142
  { tipo: "selecao", atributo: "data-layer-target", entidade: "camada" },
1963
2143
  { tipo: "selecao", atributo: "data-feat-target", entidade: "feicao" }
1964
- ], Me = {
2144
+ ], Oe = {
1965
2145
  olho: "[data-layer-eye], [data-feat-eye]",
1966
2146
  cadeado: "[data-layer-lock], [data-feat-lock]",
1967
2147
  selecao: "[data-layer-target], [data-feat-target]"
1968
- }, qt = 3;
1969
- function Dt(e) {
1970
- return Bt.find((t) => e.hasAttribute(t.atributo)) ?? null;
2148
+ }, Ar = 3;
2149
+ function Er(e) {
2150
+ return wr.find((t) => e.hasAttribute(t.atributo)) ?? null;
1971
2151
  }
1972
- function Ce(e, t) {
1973
- const a = Dt(t);
2152
+ function Pe(e, t) {
2153
+ const a = Er(t);
1974
2154
  if (!a) return null;
1975
2155
  const r = t.getAttribute(a.atributo);
1976
2156
  if (!r) return null;
@@ -1984,13 +2164,13 @@ function Ce(e, t) {
1984
2164
  return o ? o.locked === !0 : null;
1985
2165
  }
1986
2166
  if (a.entidade === "feicao") return e.selectedFeatureIds.has(r);
1987
- const i = $e(
1988
- rt(e.camadas, e.feicoes, r),
2167
+ const i = Re(
2168
+ Pt(e.camadas, e.feicoes, r),
1989
2169
  e.searchQuery
1990
2170
  );
1991
2171
  return i.length === 0 ? null : i.every((o) => e.selectedFeatureIds.has(o.id));
1992
2172
  }
1993
- function Ze(e, t, a = !1) {
2173
+ function pa(e, t, a = !1) {
1994
2174
  e.dispatchEvent(
1995
2175
  new MouseEvent("click", {
1996
2176
  bubbles: !0,
@@ -2000,54 +2180,54 @@ function Ze(e, t, a = !1) {
2000
2180
  })
2001
2181
  );
2002
2182
  }
2003
- let q = null;
2004
- function Tt(e) {
2005
- (q == null ? void 0 : q.host) === e && q.cancelar();
2183
+ let z = null;
2184
+ function Ir(e) {
2185
+ (z == null ? void 0 : z.host) === e && z.cancelar();
2006
2186
  }
2007
- function Ia(e, t, a = t) {
2008
- Object.keys(Me).forEach((r) => {
2009
- a.querySelectorAll(Me[r]).forEach((i) => {
2010
- i.addEventListener("pointerdown", (o) => Rt(e, t, r, i, o));
2187
+ function Ua(e, t, a = t) {
2188
+ Object.keys(Oe).forEach((r) => {
2189
+ a.querySelectorAll(Oe[r]).forEach((i) => {
2190
+ i.addEventListener("pointerdown", (o) => kr(e, t, r, i, o));
2011
2191
  });
2012
2192
  });
2013
2193
  }
2014
- function Rt(e, t, a, r, i) {
2015
- if (i.pointerType === "mouse" && i.button !== 0 || e.editingLayerId || e.editingFeatureId || Ce(e, r) === null) return;
2016
- q == null || q.cancelar();
2017
- const o = Me[a], n = i.ctrlKey || i.metaKey, s = i.shiftKey;
2018
- let d = !1, l = !1, c = i.clientY;
2019
- const f = /* @__PURE__ */ new Set([r]), u = (w) => {
2020
- w.preventDefault(), w.stopImmediatePropagation();
2021
- }, p = (w) => {
2022
- w.stopPropagation(), w.preventDefault();
2023
- }, m = (w) => w.preventDefault(), g = (w) => {
2024
- f.has(w) || (f.add(w), Ce(e, w) !== l && Ze(w, a === "selecao"));
2025
- }, b = () => {
2026
- d = !0, Ze(r, n, s), l = Ce(e, r) === !0, t.addEventListener("selectstart", m), document.body.style.userSelect = "none";
2027
- }, h = (w) => {
2028
- var P, C;
2029
- if (!d) {
2030
- if (Math.hypot(w.clientX - i.clientX, w.clientY - i.clientY) < qt) return;
2031
- const M = (P = t.elementFromPoint(w.clientX, w.clientY)) == null ? void 0 : P.closest(o);
2032
- if (!M || M === r) return;
2033
- b();
2194
+ function kr(e, t, a, r, i) {
2195
+ if (i.pointerType === "mouse" && i.button !== 0 || e.editingLayerId || e.editingFeatureId || Pe(e, r) === null) return;
2196
+ z == null || z.cancelar();
2197
+ const o = Oe[a], n = i.ctrlKey || i.metaKey, s = i.shiftKey;
2198
+ let l = !1, c = !1, f = i.clientY;
2199
+ const p = /* @__PURE__ */ new Set([r]), d = (x) => {
2200
+ x.preventDefault(), x.stopImmediatePropagation();
2201
+ }, u = (x) => {
2202
+ x.stopPropagation(), x.preventDefault();
2203
+ }, h = (x) => x.preventDefault(), m = (x) => {
2204
+ p.has(x) || (p.add(x), Pe(e, x) !== c && pa(x, a === "selecao"));
2205
+ }, g = () => {
2206
+ l = !0, pa(r, n, s), c = Pe(e, r) === !0, t.addEventListener("selectstart", h), document.body.style.userSelect = "none";
2207
+ }, y = (x) => {
2208
+ var Y, de;
2209
+ if (!l) {
2210
+ if (Math.hypot(x.clientX - i.clientX, x.clientY - i.clientY) < Ar) return;
2211
+ const H = (Y = t.elementFromPoint(x.clientX, x.clientY)) == null ? void 0 : Y.closest(o);
2212
+ if (!H || H === r) return;
2213
+ g();
2034
2214
  }
2035
- w.preventDefault();
2036
- const L = Math.min(c, w.clientY), S = Math.max(c, w.clientY);
2037
- t.querySelectorAll(o).forEach((M) => {
2038
- const T = M.getBoundingClientRect();
2039
- if (T.height === 0) return;
2040
- const Z = T.top + T.height / 2;
2041
- Z >= L && Z <= S && g(M);
2215
+ x.preventDefault();
2216
+ const F = Math.min(f, x.clientY), I = Math.max(f, x.clientY);
2217
+ t.querySelectorAll(o).forEach((H) => {
2218
+ const J = H.getBoundingClientRect();
2219
+ if (J.height === 0) return;
2220
+ const ue = J.top + J.height / 2;
2221
+ ue >= F && ue <= I && m(H);
2042
2222
  });
2043
- const x = (C = t.elementFromPoint(w.clientX, w.clientY)) == null ? void 0 : C.closest(o);
2044
- x && g(x), c = w.clientY;
2045
- }, v = (w = !1) => {
2046
- (q == null ? void 0 : q.cancelar) === I && (q = null), window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", A), window.removeEventListener("pointercancel", A), window.removeEventListener("dragstart", u, !0), t.removeEventListener("selectstart", m), d && (document.body.style.userSelect = "", w || (window.addEventListener("click", p, { capture: !0, once: !0 }), setTimeout(() => window.removeEventListener("click", p, !0), 0)));
2047
- }, A = () => v(), I = () => v(!0);
2048
- q = { host: e, cancelar: I }, window.addEventListener("dragstart", u, !0), window.addEventListener("pointermove", h, { passive: !1 }), window.addEventListener("pointerup", A), window.addEventListener("pointercancel", A);
2049
- }
2050
- function Ot(e, t) {
2223
+ const P = (de = t.elementFromPoint(x.clientX, x.clientY)) == null ? void 0 : de.closest(o);
2224
+ P && m(P), f = x.clientY;
2225
+ }, v = (x = !1) => {
2226
+ (z == null ? void 0 : z.cancelar) === w && (z = null), window.removeEventListener("pointermove", y), window.removeEventListener("pointerup", b), window.removeEventListener("pointercancel", b), window.removeEventListener("dragstart", d, !0), t.removeEventListener("selectstart", h), l && (document.body.style.userSelect = "", x || (window.addEventListener("click", u, { capture: !0, once: !0 }), setTimeout(() => window.removeEventListener("click", u, !0), 0)));
2227
+ }, b = () => v(), w = () => v(!0);
2228
+ z = { host: e, cancelar: w }, window.addEventListener("dragstart", d, !0), window.addEventListener("pointermove", y, { passive: !1 }), window.addEventListener("pointerup", b), window.addEventListener("pointercancel", b);
2229
+ }
2230
+ function Lr(e, t) {
2051
2231
  const a = t.getElementById("btn-toggle-all-vis");
2052
2232
  a && a.addEventListener("click", () => e.alternarVisibilidadeTodas(!0));
2053
2233
  const r = t.getElementById("btn-toggle-all-expand");
@@ -2055,15 +2235,15 @@ function Ot(e, t) {
2055
2235
  o.stopPropagation(), e.camadas.length > 0 && e.camadas.every((s) => e.expandedLayers.has(s.id)) ? e.colapsarTodas() : e.expandirTodas();
2056
2236
  });
2057
2237
  const i = t.getElementById("btn-colapsar");
2058
- i && i.addEventListener("click", () => e.colapsar(!0)), jt(e, t);
2238
+ i && i.addEventListener("click", () => e.colapsar(!0)), Cr(e, t);
2059
2239
  }
2060
- function jt(e, t) {
2240
+ function Cr(e, t) {
2061
2241
  const a = t.getElementById("input-layer-search"), r = t.getElementById("btn-clear-layer-search"), i = () => {
2062
2242
  var o;
2063
2243
  e.searchQuery = "", e.solicitarRenderizacao(), (o = t.getElementById("input-layer-search")) == null || o.focus();
2064
2244
  };
2065
2245
  if (a) {
2066
- const o = ia(() => {
2246
+ const o = wa(() => {
2067
2247
  a.isConnected && e.solicitarRenderizacao();
2068
2248
  }, 75);
2069
2249
  a.addEventListener("input", (n) => {
@@ -2074,7 +2254,7 @@ function jt(e, t) {
2074
2254
  }
2075
2255
  r && r.addEventListener("click", i);
2076
2256
  }
2077
- function ka(e, t) {
2257
+ function Ya(e, t) {
2078
2258
  t.querySelectorAll("[data-feat-select]").forEach((a) => {
2079
2259
  a.addEventListener("click", (r) => {
2080
2260
  if (e.editingFeatureId) return;
@@ -2099,7 +2279,7 @@ function ka(e, t) {
2099
2279
  if (o) {
2100
2280
  o.visible = o.visible === !1;
2101
2281
  const n = o.visible !== !1;
2102
- a.innerHTML = n ? y.olhoAberto : y.olhoFechado, j(a, n ? "Ocultar Feição" : "Exibir Feição");
2282
+ a.innerHTML = n ? A.olhoAberto : A.olhoFechado, R(a, n ? "Ocultar Feição" : "Exibir Feição");
2103
2283
  const s = a.closest(".ui-feat-row");
2104
2284
  s && s.classList.toggle("hidden-row", !n), e.dispararEvento("ui-feicao-visibilidade", {
2105
2285
  feicaoId: o.id,
@@ -2111,7 +2291,7 @@ function ka(e, t) {
2111
2291
  a.addEventListener("click", (r) => {
2112
2292
  if (r.stopPropagation(), a.hasAttribute("data-locked-by-layer")) return;
2113
2293
  const i = a.getAttribute("data-feat-lock"), o = e.feicoes.find((n) => n.id === i);
2114
- o && (o.locked = !o.locked, a.innerHTML = o.locked ? y.cadeadoTrancado : y.cadeadoAberto, a.classList.toggle("ui-lock-open", !o.locked), j(a, o.locked ? "Desbloquear Feição" : "Bloquear Feição"), e.dispararEvento("ui-feicao-bloqueio", {
2294
+ o && (o.locked = !o.locked, a.innerHTML = o.locked ? A.cadeadoTrancado : A.cadeadoAberto, a.classList.toggle("ui-lock-open", !o.locked), R(a, o.locked ? "Desbloquear Feição" : "Bloquear Feição"), e.dispararEvento("ui-feicao-bloqueio", {
2115
2295
  feicaoId: o.id,
2116
2296
  bloqueado: o.locked
2117
2297
  }));
@@ -2124,7 +2304,7 @@ function ka(e, t) {
2124
2304
  });
2125
2305
  });
2126
2306
  }
2127
- function Nt(e, t) {
2307
+ function Fr(e, t) {
2128
2308
  var a;
2129
2309
  (a = t.querySelector("[data-basemap-toggle]")) == null || a.addEventListener("click", () => {
2130
2310
  e.alternarMapasBaseRecolhido(!0);
@@ -2135,10 +2315,341 @@ function Nt(e, t) {
2135
2315
  });
2136
2316
  });
2137
2317
  }
2138
- function Ht(e, t) {
2139
- Ot(e, t), $t(e, t), ka(e, t), Nt(e, t), Pt(e, t), Ia(e, t);
2318
+ function Sr(e, t) {
2319
+ Lr(e, t), vr(e, t), Ya(e, t), Fr(e, t), xr(e, t), Ua(e, t);
2320
+ }
2321
+ function Ue(e, t = null, a = /* @__PURE__ */ new Set()) {
2322
+ const r = [];
2323
+ if (!Array.isArray(e)) return r;
2324
+ for (const i of e) {
2325
+ if (!i || typeof i != "object" || !i.id) continue;
2326
+ const o = String(i.id);
2327
+ if (a.has(o)) continue;
2328
+ a.add(o);
2329
+ const n = { ...i, id: o };
2330
+ delete n.children, t && n.parentId === void 0 && (n.parentId = t), r.push(n), Array.isArray(i.children) && i.children.length > 0 && r.push(...Ue(i.children, o, a));
2331
+ }
2332
+ return r;
2333
+ }
2334
+ function $r(e, t) {
2335
+ const a = e ?? { camadas: /* @__PURE__ */ new Set(), idsAlterados: /* @__PURE__ */ new Set(), selecaoAfetada: !1 };
2336
+ if (t.camadas === "todas") a.camadas = "todas";
2337
+ else if (a.camadas !== "todas") for (const r of t.camadas) a.camadas.add(r);
2338
+ for (const r of t.idsAlterados) a.idsAlterados.add(r);
2339
+ return a.selecaoAfetada = a.selecaoAfetada || t.selecaoAfetada, a;
2340
+ }
2341
+ const ce = /* @__PURE__ */ new WeakMap();
2342
+ function ma(e) {
2343
+ const t = /* @__PURE__ */ new Map();
2344
+ for (let a = 0; a < e.length; a++) {
2345
+ const r = e[a];
2346
+ r && r.id && !t.has(r.id) && t.set(r.id, a);
2347
+ }
2348
+ return ce.set(e, { tamanho: e.length, posicoes: t }), t;
2349
+ }
2350
+ function Mr(e) {
2351
+ const t = Array.isArray(e) ? ce.get(e) : void 0;
2352
+ return t !== void 0 && t.tamanho === e.length && t.posicoes.size === e.length;
2353
+ }
2354
+ function ee(e, t) {
2355
+ var s, l;
2356
+ if (!Array.isArray(e)) return -1;
2357
+ const a = ce.get(e), r = a !== void 0 && a.tamanho === e.length, o = (r ? a.posicoes : ma(e)).get(t);
2358
+ if (o === void 0) return -1;
2359
+ if (((s = e[o]) == null ? void 0 : s.id) === t) return o;
2360
+ if (!r) return -1;
2361
+ const n = ma(e).get(t);
2362
+ return n !== void 0 && ((l = e[n]) == null ? void 0 : l.id) === t ? n : -1;
2363
+ }
2364
+ function zr(e, t) {
2365
+ const a = ce.get(e);
2366
+ !a || a.tamanho !== e.length - 1 || (a.posicoes.has(t) || a.posicoes.set(t, e.length - 1), a.tamanho = e.length);
2367
+ }
2368
+ function Pr(e) {
2369
+ const t = e.lastClickedFeatureId;
2370
+ t && !e.feicoes.some((a) => a.id === t) && (e.lastClickedFeatureId = null);
2371
+ }
2372
+ function Ja(e) {
2373
+ if (!Array.isArray(e)) return [];
2374
+ const t = /* @__PURE__ */ new Map(), a = [];
2375
+ for (const r of e) {
2376
+ if (!r || typeof r != "object" || !r.id) continue;
2377
+ const i = String(r.id);
2378
+ t.has(i) || (t.set(i, a.length), a.push({ ...r, id: i }));
2379
+ }
2380
+ return ce.set(a, { tamanho: a.length, posicoes: t }), a;
2140
2381
  }
2141
- function Gt(e) {
2382
+ function qr(e, t, a) {
2383
+ if (e.camadas = Array.isArray(t) ? Ue(t) : [], e.lembranca.limparOrigens(), e.persistir) {
2384
+ const o = e.lembranca.carregar();
2385
+ e.lembranca.reidratar(e.camadas, o, e.expandedLayers, e.ordemFilhosPorPai), o != null && o.camadaAtivaId && e.camadas.some((n) => n.id === o.camadaAtivaId) && (e.camadaAtivaId = o.camadaAtivaId);
2386
+ } else
2387
+ e.camadas.forEach((o) => {
2388
+ e.lembranca.registrarOrigem(o), e.expandedLayers.has(o.id) || e.expandedLayers.add(o.id);
2389
+ });
2390
+ if (Array.isArray(a)) {
2391
+ e.feicoes = Ja(a);
2392
+ const o = new Set(e.camadas.map((s) => s.id)), n = e.feicoes.filter((s) => s.layerId && !o.has(s.layerId));
2393
+ n.length > 0 && console.warn(
2394
+ `[UI-Camadas] ${n.length} feição(ões) possuem 'layerId' não cadastrado nas camadas:`,
2395
+ n.map((s) => ({ id: s.id, nome: s.name, layerId: s.layerId }))
2396
+ ), Ra(e.selectedFeatureIds, e.feicoes), Pr(e);
2397
+ }
2398
+ const r = new Set(e.camadas.map((o) => o.id));
2399
+ if (e.activeSettingsLayerId && !r.has(e.activeSettingsLayerId) && (e.activeSettingsLayerId = null), e.editingLayerId && !r.has(e.editingLayerId) && (e.editingLayerId = null), e.expandedFeatureLimits)
2400
+ for (const o of e.expandedFeatureLimits.keys())
2401
+ r.has(o) || e.expandedFeatureLimits.delete(o);
2402
+ const i = e.getAttribute("camada-ativa");
2403
+ e.camadas.length > 0 && (!i || !r.has(i)) && (e.camadaAtivaId = e.camadas[0].id), e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2404
+ }
2405
+ function Br(e, t) {
2406
+ const a = /* @__PURE__ */ new Set();
2407
+ for (let r = 0; r < t.length; r++) {
2408
+ const i = t[r], o = e[r], n = o && o.id === i.id ? o : e[ee(e, i.id)];
2409
+ (!n || !Dt(n, i)) && a.add(i.id);
2410
+ }
2411
+ return a;
2412
+ }
2413
+ function Dr(e, t) {
2414
+ const a = e.feicoes, r = Ja(t);
2415
+ e.feicoes = r;
2416
+ const i = (n) => !!n && ee(r, n) >= 0, o = e.selectedFeatureIds.size;
2417
+ for (const n of e.selectedFeatureIds)
2418
+ i(n) || e.selectedFeatureIds.delete(n);
2419
+ e.lastClickedFeatureId && !i(e.lastClickedFeatureId) && (e.lastClickedFeatureId = null), e.editingFeatureId && !i(e.editingFeatureId) && (e.editingFeatureId = null), e.solicitarAtualizacaoFeicoes({
2420
+ camadas: "todas",
2421
+ idsAlterados: Br(a, e.feicoes),
2422
+ selecaoAfetada: e.selectedFeatureIds.size !== o
2423
+ });
2424
+ }
2425
+ function Rr(e, t) {
2426
+ if (!t || !t.id) return;
2427
+ if (e.camadas.some((r) => r.id === t.id)) {
2428
+ console.warn(`[UI-Camadas] adicionarCamada ignorado: já existe uma camada com id '${t.id}'.`);
2429
+ return;
2430
+ }
2431
+ const a = new Set(e.camadas.map((r) => r.id));
2432
+ for (const r of Ue([t])) {
2433
+ if (a.has(r.id)) {
2434
+ console.warn(`[UI-Camadas] adicionarCamada: subcamada '${r.id}' ignorada, o id já existe.`);
2435
+ continue;
2436
+ }
2437
+ a.add(r.id), e.camadas.push(r), e.lembranca.registrarOrigem(r), e.expandedLayers.add(r.id), r.parentId && e.expandedLayers.add(r.parentId);
2438
+ }
2439
+ e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2440
+ }
2441
+ function Tr(e, t) {
2442
+ var r, i;
2443
+ const a = e.camadas.find((o) => o.id === t);
2444
+ e.camadas.forEach((o) => {
2445
+ o.parentId === t && (o.parentId = null);
2446
+ }), e.camadas = e.camadas.filter((o) => o.id !== t), e.feicoes = e.feicoes.filter((o) => o.layerId !== t), e.ordemFilhosPorPai && (e.ordemFilhosPorPai.delete(t), a != null && a.parentId && N(e.ordemFilhosPorPai, a.parentId, O(t))), e.lembranca.esquecerCamada(t), e.expandedLayers.delete(t), (r = e.expandedFeatureLimits) == null || r.delete(t), e.activeSettingsLayerId === t && (e.activeSettingsLayerId = null), e.editingLayerId === t && (e.editingLayerId = null), e.editingFeatureId && !e.feicoes.some((o) => o.id === e.editingFeatureId) && (e.editingFeatureId = null), Ra(e.selectedFeatureIds, e.feicoes), e.selectedFeatureIds.size === 0 && (e.lastClickedFeatureId = null), e.camadaAtivaId === t && (e.camadaAtivaId = ((i = e.camadas[0]) == null ? void 0 : i.id) ?? null), e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2447
+ }
2448
+ function Or(e, t) {
2449
+ if (!(!t || !t.id)) {
2450
+ if (ee(e.feicoes, t.id) !== -1) {
2451
+ console.warn(`[UI-Camadas] adicionarFeicao ignorado: já existe uma feição com id '${t.id}'.`);
2452
+ return;
2453
+ }
2454
+ e.feicoes.push({ ...t }), zr(e.feicoes, t.id), e.solicitarAtualizacaoFeicoes({
2455
+ camadas: /* @__PURE__ */ new Set([t.layerId || ""]),
2456
+ idsAlterados: /* @__PURE__ */ new Set(),
2457
+ selecaoAfetada: e.selectedFeatureIds.has(t.id)
2458
+ });
2459
+ }
2460
+ }
2461
+ function jr(e, t) {
2462
+ if (!t || typeof t != "object" || !t.id) return;
2463
+ const a = ee(e.feicoes, t.id);
2464
+ if (a !== -1) {
2465
+ const r = e.feicoes[a].layerId || "";
2466
+ e.feicoes[a] = { ...e.feicoes[a], ...t }, e.solicitarAtualizacaoFeicoes({
2467
+ camadas: /* @__PURE__ */ new Set([r, e.feicoes[a].layerId || ""]),
2468
+ idsAlterados: /* @__PURE__ */ new Set([t.id]),
2469
+ selecaoAfetada: !1
2470
+ });
2471
+ }
2472
+ }
2473
+ function Nr(e, t) {
2474
+ const a = e.feicoes.find((i) => i.id === t);
2475
+ e.feicoes = e.feicoes.filter((i) => i.id !== t), a != null && a.layerId && e.ordemFilhosPorPai && N(e.ordemFilhosPorPai, a.layerId, B(t));
2476
+ const r = e.selectedFeatureIds.delete(t);
2477
+ e.lastClickedFeatureId === t && (e.lastClickedFeatureId = null), e.editingFeatureId === t && (e.editingFeatureId = null), e.solicitarAtualizacaoFeicoes({
2478
+ camadas: new Set(a ? [a.layerId || ""] : []),
2479
+ idsAlterados: /* @__PURE__ */ new Set(),
2480
+ selecaoAfetada: r
2481
+ });
2482
+ }
2483
+ const be = "ui-virtual-retida";
2484
+ function oe(e) {
2485
+ var a;
2486
+ const t = e.nextSibling;
2487
+ t && t.nodeType === 3 && !(t.textContent ?? "").trim() && ((a = t.parentNode) == null || a.removeChild(t)), e.remove();
2488
+ }
2489
+ function Hr(e, t) {
2490
+ if (!e || !t.contains(e)) return null;
2491
+ const a = Array.from(e.attributes).find((r) => r.name.startsWith("data-") && r.value !== "");
2492
+ return a ? { nome: a.name, valor: a.value } : null;
2493
+ }
2494
+ function ha(e, t) {
2495
+ if (t) {
2496
+ const a = String(t.posicao), r = String(t.total);
2497
+ e.getAttribute("aria-posinset") !== a && e.setAttribute("aria-posinset", a), e.getAttribute("aria-setsize") !== r && e.setAttribute("aria-setsize", r);
2498
+ } else (e.hasAttribute("aria-posinset") || e.hasAttribute("aria-setsize")) && (e.removeAttribute("aria-posinset"), e.removeAttribute("aria-setsize"));
2499
+ }
2500
+ function Vr(e, t) {
2501
+ const a = ja(e, t.janelas), r = [];
2502
+ for (const i of e.filhos) {
2503
+ if (i.tipo === "camada") {
2504
+ r.push({
2505
+ tipo: "grupo",
2506
+ id: i.nodo.camada.id,
2507
+ aria: a ? { posicao: i.posicao, total: e.totalIrmaos } : null
2508
+ });
2509
+ continue;
2510
+ }
2511
+ const { corrida: o } = i, n = t.janelas.get(o.chave);
2512
+ if (n) {
2513
+ n.virtual && r.push({ tipo: "espaco", chave: `${o.chave}:antes`, altura: n.inicio * t.alturaLinha });
2514
+ for (let s = n.inicio; s < n.fim; s++)
2515
+ r.push({
2516
+ tipo: "feicao",
2517
+ feicao: o.feicoes[s],
2518
+ aria: a ? { posicao: o.posInicial + s, total: e.totalIrmaos } : null
2519
+ });
2520
+ n.virtual && r.push({
2521
+ tipo: "espaco",
2522
+ chave: `${o.chave}:depois`,
2523
+ altura: (o.feicoes.length - n.fim) * t.alturaLinha
2524
+ });
2525
+ }
2526
+ }
2527
+ return r;
2528
+ }
2529
+ function _r(e) {
2530
+ const t = document.createElement("div");
2531
+ return t.className = "ui-virtual-espaco", t.setAttribute("data-virtual-espaco", e), t.setAttribute("aria-hidden", "true"), t;
2532
+ }
2533
+ function Gr(e, t, a) {
2534
+ const r = Vr(a, e.plano), i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
2535
+ for (const m of r)
2536
+ m.tipo === "feicao" ? i.add(m.feicao.id) : m.tipo === "espaco" && o.add(m.chave);
2537
+ const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = e.shadow.activeElement;
2538
+ for (let m = t.firstElementChild, g; m; m = g) {
2539
+ g = m.nextElementSibling;
2540
+ const y = m.getAttribute("data-feat-row");
2541
+ if (y !== null) {
2542
+ const b = e.idsRefazer.has(y) && i.has(y) && !n.has(y);
2543
+ if (i.has(y) && !n.has(y) && !b) {
2544
+ n.set(y, m), m.classList.contains(be) && m.classList.remove(be);
2545
+ continue;
2546
+ }
2547
+ if (!b && m.classList.contains("dragging")) {
2548
+ m.classList.add(be);
2549
+ continue;
2550
+ }
2551
+ b ? c.set(y, { tabindex: m.getAttribute("tabindex"), foco: Hr(f, m) }) : (f && m.contains(f) && (e.focoPerdido = !0), m.getAttribute("tabindex") === "0" && (e.tabulavelRemovida = !0)), oe(m);
2552
+ continue;
2553
+ }
2554
+ const v = m.getAttribute("data-virtual-espaco");
2555
+ if (v !== null) {
2556
+ o.has(v) && !s.has(v) ? s.set(v, m) : oe(m);
2557
+ continue;
2558
+ }
2559
+ if (m.classList.contains("ui-layer-group")) {
2560
+ const b = m.getAttribute("data-layer-id");
2561
+ b !== null && !l.has(b) && l.set(b, m);
2562
+ }
2563
+ }
2564
+ const p = r.filter(
2565
+ (m) => m.tipo === "feicao" && !n.has(m.feicao.id)
2566
+ ), d = /* @__PURE__ */ new Map();
2567
+ if (p.length > 0) {
2568
+ const m = Be(a.camada, a.profundidade, e.herdado().get(a.camada.id)), g = p.map(
2569
+ (b) => De(
2570
+ b.feicao,
2571
+ m,
2572
+ e.selecionadas.has(b.feicao.id),
2573
+ e.editandoFeicaoId === b.feicao.id,
2574
+ b.aria
2575
+ )
2576
+ ).join(""), y = document.createElement("template");
2577
+ y.innerHTML = g;
2578
+ const v = Array.from(y.content.children);
2579
+ if (v.length !== p.length) return !1;
2580
+ e.ligar(y.content), v.forEach((b, w) => d.set(p[w].feicao.id, b));
2581
+ }
2582
+ const u = (m) => {
2583
+ let g = m;
2584
+ for (; g && g.classList.contains(be); ) g = g.nextElementSibling;
2585
+ return g;
2586
+ };
2587
+ let h = u(t.firstElementChild);
2588
+ for (const m of r) {
2589
+ let g;
2590
+ if (m.tipo === "grupo") {
2591
+ if (g = l.get(m.id), !g) return !1;
2592
+ ha(g, m.aria);
2593
+ } else if (m.tipo === "espaco") {
2594
+ g = s.get(m.chave) ?? _r(m.chave);
2595
+ const y = `${Math.max(0, Math.round(m.altura))}px`;
2596
+ g.style.height !== y && (g.style.height = y);
2597
+ } else {
2598
+ const y = n.get(m.feicao.id);
2599
+ if (g = y ?? d.get(m.feicao.id), !g) return !1;
2600
+ y && ha(y, m.aria);
2601
+ }
2602
+ g === h ? h = u(g.nextElementSibling) : t.insertBefore(g, h);
2603
+ }
2604
+ return c.forEach((m, g) => {
2605
+ const y = d.get(g);
2606
+ if (!y || (m.tabindex !== null && y.setAttribute("tabindex", m.tabindex), !m.foco)) return;
2607
+ const { nome: v, valor: b } = m.foco, w = y.getAttribute(v) === b ? y : Array.from(y.querySelectorAll(`[${v}]`)).find((x) => x.getAttribute(v) === b);
2608
+ w == null || w.focus({ preventScroll: !0 });
2609
+ }), !0;
2610
+ }
2611
+ function ae(e, t) {
2612
+ for (let a = e.firstElementChild; a; a = a.nextElementSibling)
2613
+ if (a.classList.contains(t)) return a;
2614
+ return null;
2615
+ }
2616
+ function Ka(e) {
2617
+ const t = /* @__PURE__ */ new Map(), a = (r) => {
2618
+ for (let i = r.firstElementChild; i; i = i.nextElementSibling) {
2619
+ if (!i.classList.contains("ui-layer-group")) continue;
2620
+ const o = i.getAttribute("data-layer-id");
2621
+ o !== null && !t.has(o) && t.set(o, i);
2622
+ const n = ae(i, "ui-children-container");
2623
+ n && a(n);
2624
+ }
2625
+ };
2626
+ return a(e), t;
2627
+ }
2628
+ function ga(e, t) {
2629
+ var o;
2630
+ const a = "[data-layer-row], [data-feat-row]", r = t ? ie(e, t) : null, i = Array.from(e.querySelectorAll('[data-layer-row][tabindex="0"], [data-feat-row][tabindex="0"]'));
2631
+ if (r) {
2632
+ i.forEach((n) => n !== r && n.setAttribute("tabindex", "-1")), r.getAttribute("tabindex") !== "0" && r.setAttribute("tabindex", "0");
2633
+ return;
2634
+ }
2635
+ if (i.length >= 1) {
2636
+ i.slice(1).forEach((n) => n.setAttribute("tabindex", "-1"));
2637
+ return;
2638
+ }
2639
+ (o = e.querySelector(a)) == null || o.setAttribute("tabindex", "0");
2640
+ }
2641
+ function Wa(e) {
2642
+ if (!e) return null;
2643
+ const t = e.getAttribute("data-layer-row");
2644
+ if (t !== null) return `L:${t}`;
2645
+ const a = e.getAttribute("data-feat-row");
2646
+ return a !== null ? `F:${a}` : null;
2647
+ }
2648
+ function ie(e, t) {
2649
+ const a = t.startsWith("L:") ? "data-layer-row" : t.startsWith("F:") ? "data-feat-row" : null;
2650
+ return a ? M(e, a, t.slice(2)) : null;
2651
+ }
2652
+ function Ur(e) {
2142
2653
  if (!e.arvoreRenderizada) return { incremental: !1, motivo: "arvore-nao-renderizada" };
2143
2654
  if (e.buscaAtiva) return { incremental: !1, motivo: "busca-ativa" };
2144
2655
  if (e.editandoCamada || e.editandoFeicao) return { incremental: !1, motivo: "edicao-inline" };
@@ -2149,12 +2660,12 @@ function Gt(e) {
2149
2660
  }
2150
2661
  return e.idsDuplicados ? { incremental: !1, motivo: "ids-duplicados" } : { incremental: !0 };
2151
2662
  }
2152
- function Ca(e, t = /* @__PURE__ */ new Map()) {
2663
+ function Qa(e, t = /* @__PURE__ */ new Map()) {
2153
2664
  for (const a of e)
2154
- t.set(a.camada.id, a), Ca(a.subcamadas, t);
2665
+ t.set(a.camada.id, a), Qa(a.subcamadas, t);
2155
2666
  return t;
2156
2667
  }
2157
- function _t(e) {
2668
+ function Xa(e) {
2158
2669
  const t = /* @__PURE__ */ new Map();
2159
2670
  for (let a = 0; a < e.length; a++) {
2160
2671
  const r = e[a];
@@ -2164,24 +2675,17 @@ function _t(e) {
2164
2675
  }
2165
2676
  return t;
2166
2677
  }
2167
- function ae(e, t) {
2168
- for (let a = e.firstElementChild; a; a = a.nextElementSibling)
2169
- if (a.classList.contains(t)) return a;
2170
- return null;
2171
- }
2172
- function Vt(e) {
2173
- const t = /* @__PURE__ */ new Map(), a = (r) => {
2174
- for (let i = r.firstElementChild; i; i = i.nextElementSibling) {
2175
- if (!i.classList.contains("ui-layer-group")) continue;
2176
- const o = i.getAttribute("data-layer-id");
2177
- o !== null && t.set(o, i);
2178
- const n = ae(i, "ui-children-container");
2179
- n && a(n);
2180
- }
2678
+ function Za(e, t, a) {
2679
+ return {
2680
+ hierarquia: t,
2681
+ feicoesPorCamada: a,
2682
+ camadasVisiveis: null,
2683
+ expandida: (r) => e.expandedLayers.has(r),
2684
+ limite: (r) => e.expandedFeatureLimits.get(r) ?? _e,
2685
+ ordemFilhosPorPai: e.ordemFilhosPorPai
2181
2686
  };
2182
- return a(e), t;
2183
2687
  }
2184
- function Ut(e) {
2688
+ function Yr(e) {
2185
2689
  if (!e || e.length < 2) return !1;
2186
2690
  const t = /* @__PURE__ */ new Set();
2187
2691
  for (const a of e) {
@@ -2190,7 +2694,7 @@ function Ut(e) {
2190
2694
  }
2191
2695
  return !1;
2192
2696
  }
2193
- function Yt(e, t) {
2697
+ function Jr(e, t) {
2194
2698
  var i;
2195
2699
  const a = new Map(t.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set();
2196
2700
  for (const o of e) {
@@ -2200,159 +2704,127 @@ function Yt(e, t) {
2200
2704
  }
2201
2705
  return r;
2202
2706
  }
2203
- function fe(e) {
2707
+ function je(e) {
2204
2708
  const t = document.createElement("template");
2205
2709
  return t.innerHTML = e, { modelo: t, elementos: Array.from(t.content.children) };
2206
2710
  }
2207
- function me(e) {
2208
- var a;
2209
- const t = e.nextSibling;
2210
- t && t.nodeType === 3 && !(t.textContent ?? "").trim() && ((a = t.parentNode) == null || a.removeChild(t)), e.remove();
2211
- }
2212
- function Kt(e, t) {
2213
- if (!e || !t.contains(e)) return null;
2214
- const a = Array.from(e.attributes).find((r) => r.name.startsWith("data-") && r.value !== "");
2215
- return a ? { nome: a.name, valor: a.value } : null;
2711
+ function et(e, t, a) {
2712
+ for (const r of a) {
2713
+ const i = e.plano.estrutura.containers.get(r), o = t.get(r), n = o ? ae(o, "ui-children-container") : null;
2714
+ if (!i || !n || !Gr(e, n, i)) return !1;
2715
+ }
2716
+ return !0;
2216
2717
  }
2217
- function Qt(e, t) {
2218
- var L, S;
2219
- const { host: a, shadow: r, mudanca: i } = e;
2220
- if ((S = (L = a.ordemFilhosPorPai) == null ? void 0 : L.get(t)) != null && S.length) return !1;
2221
- const o = e.grupos.get(t), n = e.nodos.get(t), s = o ? ae(o, "ui-children-container") : null;
2222
- if (!o || !n || !s) return !1;
2223
- const d = n.camada, l = e.porCamada.get(t) ?? [], c = a.expandedFeatureLimits.get(t) ?? De, f = l.slice(0, c), u = new Set(f.map((x) => x.id)), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), g = r.activeElement;
2224
- let b = null;
2225
- for (let x = s.firstElementChild, P; x; x = P) {
2226
- P = x.nextElementSibling;
2227
- const C = x.getAttribute("data-feat-row");
2228
- if (C === null) {
2229
- !b && !x.classList.contains("ui-layer-group") && (b = x);
2230
- continue;
2231
- }
2232
- const M = i.idsAlterados.has(C) && u.has(C) && !p.has(C);
2233
- !u.has(C) || p.has(C) || M ? (M && m.set(C, { tabindex: x.getAttribute("tabindex"), foco: Kt(g, x) }), me(x)) : (p.set(C, x), b || (b = x));
2234
- }
2235
- const h = f.filter((x) => !p.has(x.id));
2236
- let v = [];
2237
- if (h.length > 0) {
2238
- e.herdado || (e.herdado = ge(a.camadas));
2239
- const x = Se(d, n.depth, e.herdado.get(t)), P = h.map(
2240
- (T) => Fe(T, x, a.selectedFeatureIds.has(T.id), a.editingFeatureId === T.id)
2241
- ).join(""), { modelo: C, elementos: M } = fe(P);
2242
- if (M.length !== h.length) return !1;
2243
- e.ligar(C.content), v = M;
2244
- }
2245
- let A = b, I = 0;
2246
- const w = /* @__PURE__ */ new Map();
2247
- for (const x of f) {
2248
- const P = p.get(x.id);
2249
- if (P)
2250
- P === A ? A = P.nextElementSibling : s.insertBefore(P, A);
2251
- else {
2252
- const C = v[I++];
2253
- s.insertBefore(C, A), w.set(x.id, C);
2718
+ function at(e, t) {
2719
+ const a = [];
2720
+ return t.estrutura.containers.forEach((r, i) => {
2721
+ const o = e == null ? void 0 : e.estrutura.containers.get(i);
2722
+ if (!e || !o || o.exibido !== r.exibido) {
2723
+ a.push(i);
2724
+ return;
2254
2725
  }
2255
- }
2256
- return m.forEach((x, P) => {
2257
- const C = w.get(P);
2258
- if (!C || (x.tabindex !== null && C.setAttribute("tabindex", x.tabindex), !x.foco)) return;
2259
- const M = C.getAttribute(x.foco.nome) === x.foco.valor ? C : Array.from(C.querySelectorAll(`[${x.foco.nome}]`)).find(
2260
- (T) => T.getAttribute(x.foco.nome) === x.foco.valor
2261
- );
2262
- M == null || M.focus({ preventScroll: !0 });
2263
- }), Xt(e, s, n, c, l.length);
2264
- }
2265
- function Xt(e, t, a, r, i) {
2266
- const o = z(a.camada.id), n = !!(a.camada.isGroup || a.subcamadas.length > 0), s = i > r, d = a.subcamadas.length === 0 && i === 0, l = ae(t, "ui-truncate-notice"), c = ae(t, "ui-empty-row");
2267
- if (c && !d && me(c), l && !s && me(l), s)
2268
- if (l) {
2269
- const f = fa(r, i), u = l.querySelector("span"), p = l.querySelector(".ui-truncate-more-btn");
2270
- if (!u || !p) return !1;
2271
- u.textContent !== f.resumo && (u.textContent = f.resumo), p.textContent !== f.botao && (p.textContent = f.botao);
2726
+ ar(r, e.janelas, t.janelas) && a.push(i);
2727
+ }), a;
2728
+ }
2729
+ function Kr(e, t, a, r, i) {
2730
+ const o = S(a.camada.id), n = !!(a.camada.isGroup || a.subcamadas.length > 0), s = i > r, l = a.subcamadas.length === 0 && i === 0, c = ae(t, "ui-truncate-notice"), f = ae(t, "ui-empty-row");
2731
+ if (f && !l && oe(f), c && !s && oe(c), s)
2732
+ if (c) {
2733
+ const p = $a(r, i), d = c.querySelector("span"), u = c.querySelector(".ui-truncate-more-btn");
2734
+ if (!d || !u) return !1;
2735
+ d.textContent !== p.resumo && (d.textContent = p.resumo), u.textContent !== p.botao && (u.textContent = p.botao);
2272
2736
  } else {
2273
- const { modelo: f, elementos: u } = fe(ma(o, r, i));
2274
- if (u.length !== 1) return !1;
2275
- e.ligar(f.content), t.appendChild(u[0]);
2737
+ const { modelo: p, elementos: d } = je(Ma(o, r, i));
2738
+ if (d.length !== 1) return !1;
2739
+ e.ligar(p.content), t.appendChild(d[0]);
2276
2740
  }
2277
- if (d && !c) {
2278
- const { elementos: f } = fe(ga(n));
2279
- if (f.length !== 1) return !1;
2280
- t.appendChild(f[0]);
2741
+ if (l && !f) {
2742
+ const { elementos: p } = je(za(n));
2743
+ if (p.length !== 1) return !1;
2744
+ t.appendChild(p[0]);
2281
2745
  }
2282
2746
  return !0;
2283
2747
  }
2284
- function La(e, t, a) {
2748
+ function tt(e, t, a) {
2285
2749
  let r = 0, i = 0;
2286
2750
  const o = t.get(e.camada.id);
2287
2751
  if (o && (r += o.length, a.size > 0))
2288
2752
  for (let n = 0; n < o.length; n++)
2289
2753
  a.has(o[n].id) && i++;
2290
2754
  for (const n of e.subcamadas) {
2291
- const s = La(n, t, a);
2755
+ const s = tt(n, t, a);
2292
2756
  r += s.total, i += s.sel;
2293
2757
  }
2294
2758
  return { total: r, sel: i };
2295
2759
  }
2296
- function Wt(e, t) {
2760
+ function Wr(e, t) {
2297
2761
  const a = e.grupos.get(t), r = e.nodos.get(t), i = a ? ae(a, "ui-layer-row") : null, o = i == null ? void 0 : i.querySelector(".ui-col-name");
2298
2762
  if (!a || !r || !i || !o) return !1;
2299
- const { host: n } = e, { total: s, sel: d } = La(r, e.porCamada, n.selectedFeatureIds), l = (e.porCamada.get(t) ?? []).length, c = r.subcamadas.length, f = !!(r.camada.isGroup || c > 0), u = o.querySelector(".ui-count-chip");
2300
- if (u)
2301
- if (s === 0 && f)
2302
- me(u);
2763
+ const { host: n } = e, { total: s, sel: l } = tt(r, e.porCamada, n.selectedFeatureIds), c = (e.porCamada.get(t) ?? []).length, f = r.subcamadas.length, p = !!(r.camada.isGroup || f > 0), d = o.querySelector(".ui-count-chip");
2764
+ if (d)
2765
+ if (s === 0 && p)
2766
+ oe(d);
2303
2767
  else {
2304
- const p = String(s), m = ua(s, l, c);
2305
- u.textContent !== p && (u.textContent = p), u.getAttribute("title") !== m && u.setAttribute("title", m);
2768
+ const u = String(s), h = Fa(s, c, f);
2769
+ d.textContent !== u && (d.textContent = u), d.getAttribute("title") !== h && d.setAttribute("title", h);
2306
2770
  }
2307
2771
  else {
2308
- const p = pa(s, l, c, f);
2309
- if (p) {
2310
- const { elementos: m } = fe(p);
2311
- if (m.length !== 1) return !1;
2312
- o.appendChild(m[0]);
2772
+ const u = Sa(s, c, f, p);
2773
+ if (u) {
2774
+ const { elementos: h } = je(u);
2775
+ if (h.length !== 1) return !1;
2776
+ o.appendChild(h[0]);
2313
2777
  }
2314
2778
  }
2315
- return wa(i.querySelector(".ui-target-circle"), s, d), !0;
2779
+ return Va(i.querySelector(".ui-target-circle"), s, l), !0;
2316
2780
  }
2317
- function Jt(e, t, a, r) {
2781
+ function Qr(e, t, a, r, i = null, o) {
2318
2782
  if (e.camadas.length === 0) return !1;
2319
- const i = t.getElementById("ui-layer-tree-mount"), o = Ca(ie(e.camadas)), n = i ? Vt(i) : /* @__PURE__ */ new Map(), s = _t(e.feicoes), d = a.camadas === "todas" ? Array.from(o.keys()) : Array.from(a.camadas), l = d.map((u) => ({
2320
- existeNoModelo: o.has(u),
2321
- renderizadaNoDom: n.has(u),
2322
- drawerAberto: e.activeSettingsLayerId === u
2783
+ const n = t.getElementById("ui-layer-tree-mount"), s = te(e.camadas), l = Qa(s), c = n ? Ka(n) : /* @__PURE__ */ new Map(), f = Xa(e.feicoes), p = a.camadas === "todas" ? Array.from(l.keys()) : Array.from(a.camadas), d = p.map((b) => ({
2784
+ existeNoModelo: l.has(b),
2785
+ renderizadaNoDom: c.has(b),
2786
+ drawerAberto: e.activeSettingsLayerId === b
2323
2787
  }));
2324
- if (!Gt({
2325
- arvoreRenderizada: i !== null,
2788
+ if (!Ur({
2789
+ arvoreRenderizada: n !== null,
2326
2790
  buscaAtiva: (e.searchQuery || "").trim() !== "",
2327
2791
  editandoCamada: e.editingLayerId !== null,
2328
2792
  editandoFeicao: e.editingFeatureId !== null,
2329
- idsDuplicados: d.some((u) => Ut(s.get(u))),
2330
- camadasAfetadas: l
2793
+ // A lista saneada já vem com índice de ids únicos; só listas sem índice são varridas
2794
+ idsDuplicados: !Mr(e.feicoes) && p.some((b) => Yr(f.get(b))),
2795
+ camadasAfetadas: d
2331
2796
  }).incremental) return !1;
2332
- const f = {
2333
- host: e,
2797
+ const h = Ge(Za(e, s, f), i, e.activeSettingsLayerId);
2798
+ let m = null;
2799
+ const g = {
2334
2800
  shadow: t,
2335
- mudanca: a,
2336
- porCamada: s,
2337
- nodos: o,
2338
- grupos: n,
2339
- herdado: null,
2801
+ plano: h,
2802
+ selecionadas: e.selectedFeatureIds,
2803
+ editandoFeicaoId: e.editingFeatureId,
2804
+ herdado: () => m ?? (m = le(e.camadas)),
2805
+ idsRefazer: a.idsAlterados,
2340
2806
  ligar: r
2341
- };
2342
- for (const u of d)
2343
- if (!Qt(f, u)) return !1;
2344
- for (const u of Yt(d, e.camadas))
2345
- if (!Wt(f, u)) return !1;
2346
- return (a.selecaoAfetada || e.selectedFeatureIds.size > 0) && Aa(e, t), !0;
2347
- }
2348
- function Zt(e) {
2807
+ }, y = new Set(p);
2808
+ for (const b of at(e.planoVirtual, h)) y.add(b);
2809
+ if (!et(g, c, y)) return !1;
2810
+ o && (g.focoPerdido && (o.focoPerdido = !0), g.tabulavelRemovida && (o.tabulavelRemovida = !0));
2811
+ const v = { host: e, porCamada: f, nodos: l, grupos: c, ligar: r };
2812
+ for (const b of p) {
2813
+ const w = h.estrutura.containers.get(b), x = l.get(b), F = c.get(b), I = F ? ae(F, "ui-children-container") : null;
2814
+ if (!w || !x || !I || !Kr(v, I, x, w.limite, w.totalFeicoes)) return !1;
2815
+ }
2816
+ for (const b of Jr(p, e.camadas))
2817
+ if (!Wr(v, b)) return !1;
2818
+ return e.planoVirtual = h, (a.selecaoAfetada || e.selectedFeatureIds.size > 0) && _a(e, t), !0;
2819
+ }
2820
+ function Xr(e) {
2349
2821
  if (!e.isConnected) return;
2350
2822
  const t = document.createElement("div");
2351
- t.className = "ui-basemap-preview-none", t.innerHTML = y.gradeCad, e.replaceWith(t);
2823
+ t.className = "ui-basemap-preview-none", t.innerHTML = A.gradeCad, e.replaceWith(t);
2352
2824
  }
2353
- function er(e, t, a, r) {
2354
- var g, b;
2355
- const i = ht({
2825
+ function Zr(e, t, a, r, i = null) {
2826
+ var y, v;
2827
+ const { html: o, plano: n } = Na({
2356
2828
  camadas: e.camadas,
2357
2829
  feicoes: e.feicoes,
2358
2830
  camadaAtivaId: e.camadaAtivaId,
@@ -2366,50 +2838,145 @@ function er(e, t, a, r) {
2366
2838
  mostrarBusca: e.mostrarBusca,
2367
2839
  limitesPorCamada: e.expandedFeatureLimits,
2368
2840
  mostrarBotaoColapsar: e.flutuante && e.getAttribute("colapsavel") !== "false",
2369
- ordemFilhosPorPai: e.ordemFilhosPorPai
2370
- }), o = e.mostrarMapasBase ? tt(e.mapasBase, e.mapaBaseAtivo, e.mapasBaseRecolhido) : "", n = e.mostrarRodape ? it(e.camadas, e.feicoes, e.selectedFeatureIds) : "", s = t.getElementById("ui-layer-tree-mount"), d = a.scrollTop, l = s ? s.scrollTop : 0, c = t.activeElement, f = c && a.contains(c) ? c.id : "", u = c && !f && a.contains(c) ? Array.from(c.attributes).find((h) => h.name.startsWith("data-") && h.value !== "") : void 0, p = c && "selectionStart" in c ? c.selectionStart : null;
2841
+ ordemFilhosPorPai: e.ordemFilhosPorPai,
2842
+ viewport: i
2843
+ });
2844
+ e.planoVirtual = n;
2845
+ const s = e.mostrarMapasBase ? zt(e.mapasBase, e.mapaBaseAtivo, e.mapasBaseRecolhido) : "", l = e.mostrarRodape ? qt(e.camadas, e.feicoes, e.selectedFeatureIds) : "", c = t.getElementById("ui-layer-tree-mount"), f = a.scrollTop, p = c ? c.scrollTop : 0, d = t.activeElement, u = d && a.contains(d) ? d.id : "", h = d && !u && a.contains(d) ? Array.from(d.attributes).find((b) => b.name.startsWith("data-") && b.value !== "") : void 0, m = d && "selectionStart" in d ? d.selectionStart : null;
2371
2846
  a.innerHTML = `
2372
- ${i}
2373
- ${n}
2374
2847
  ${o}
2375
- `, a.scrollTop = d;
2376
- const m = t.getElementById("ui-layer-tree-mount");
2377
- if (m && (m.scrollTop = l), f) {
2378
- const h = t.getElementById(f);
2379
- if (h && (h.focus({ preventScroll: !0 }), p !== null && typeof h.setSelectionRange == "function"))
2848
+ ${l}
2849
+ ${s}
2850
+ `, a.scrollTop = f;
2851
+ const g = t.getElementById("ui-layer-tree-mount");
2852
+ if (g && (g.scrollTop = p), u) {
2853
+ const b = t.getElementById(u);
2854
+ if (b && (b.focus({ preventScroll: !0 }), m !== null && typeof b.setSelectionRange == "function"))
2380
2855
  try {
2381
- h.setSelectionRange(p, p);
2856
+ b.setSelectionRange(m, m);
2382
2857
  } catch {
2383
2858
  }
2384
2859
  }
2385
- !f && u && ((g = D(a, u.name, u.value)) == null || g.focus({ preventScroll: !0 })), (b = t.querySelector("[data-layer-row], [data-feat-row]")) == null || b.setAttribute("tabindex", "0"), a.querySelectorAll("img[data-basemap-thumb]").forEach((h) => {
2386
- const v = () => Zt(h);
2387
- h.addEventListener("error", v, { once: !0 }), h.complete && h.naturalWidth === 0 && h.getAttribute("src") && v();
2388
- }), Ht(e, t), r.bindAll();
2860
+ !u && h && ((y = M(a, h.name, h.value)) == null || y.focus({ preventScroll: !0 })), (v = t.querySelector("[data-layer-row], [data-feat-row]")) == null || v.setAttribute("tabindex", "0"), a.querySelectorAll("img[data-basemap-thumb]").forEach((b) => {
2861
+ const w = () => Xr(b);
2862
+ b.addEventListener("error", w, { once: !0 }), b.complete && b.naturalWidth === 0 && b.getAttribute("src") && w();
2863
+ }), Sr(e, t), r.bindAll();
2389
2864
  }
2390
- function ar(e, t, a, r) {
2865
+ function ei(e, t, a, r, i = null) {
2866
+ const o = {};
2391
2867
  try {
2392
- return Jt(e, t, r, (i) => {
2393
- ka(e, i), Ea(e, i), Ia(e, t, i), a.bindLinhasFeicao(i);
2394
- });
2395
- } catch (i) {
2396
- return console.warn("[UI-Camadas] atualização incremental falhou; redesenhando o painel.", i), !1;
2868
+ return { ok: Qr(e, t, r, rt(e, t, a), i, o), focoPerdido: o.focoPerdido === !0, tabulavelRemovida: o.tabulavelRemovida === !0 };
2869
+ } catch (n) {
2870
+ return console.warn("[UI-Camadas] atualização incremental falhou; redesenhando o painel.", n), { ok: !1, focoPerdido: !1 };
2397
2871
  }
2398
2872
  }
2399
- const tr = '[role="button"][tabindex]', te = "[data-layer-row], [data-feat-row]", rr = ["color", "range", "checkbox", "radio", "button"];
2400
- function Sa(e) {
2401
- return !e || !(e instanceof Element) || e instanceof HTMLInputElement && rr.includes(e.type) ? !1 : Ya({ composedPath: () => [e] });
2873
+ function rt(e, t, a) {
2874
+ return (r) => {
2875
+ Ya(e, r), Ga(e, r), Ua(e, t, r), a.bindLinhasFeicao(r);
2876
+ };
2402
2877
  }
2403
- function ir(e) {
2404
- return Array.from(e.querySelectorAll(te)).filter((t) => {
2878
+ function ai(e, t, a, r, i = !1) {
2879
+ const o = { ok: !1, focoPerdido: !1 }, n = e.planoVirtual, s = t.getElementById("ui-layer-tree-mount");
2880
+ if (!n || !s) return o;
2881
+ try {
2882
+ let l;
2883
+ if (Oa(r) !== n.semLimite) return o;
2884
+ if (i) {
2885
+ if (e.camadas.length === 0 || (e.searchQuery || "").trim() !== "") return o;
2886
+ const d = te(e.camadas);
2887
+ l = Ge(
2888
+ Za(e, d, Xa(e.feicoes)),
2889
+ r,
2890
+ e.activeSettingsLayerId
2891
+ );
2892
+ } else {
2893
+ const { janelas: d, alturaLinha: u } = Ta(n.estrutura, r, e.activeSettingsLayerId);
2894
+ l = { estrutura: n.estrutura, janelas: d, alturaLinha: u, semLimite: n.semLimite };
2895
+ }
2896
+ const c = at(n, l);
2897
+ if (c.length === 0)
2898
+ return e.planoVirtual = l, { ok: !0, focoPerdido: !1 };
2899
+ let f = null;
2900
+ const p = {
2901
+ shadow: t,
2902
+ plano: l,
2903
+ selecionadas: e.selectedFeatureIds,
2904
+ editandoFeicaoId: e.editingFeatureId,
2905
+ herdado: () => f ?? (f = le(e.camadas)),
2906
+ idsRefazer: /* @__PURE__ */ new Set(),
2907
+ ligar: rt(e, t, a)
2908
+ };
2909
+ return et(p, Ka(s), c) ? (e.planoVirtual = l, { ok: !0, focoPerdido: p.focoPerdido === !0, tabulavelRemovida: p.tabulavelRemovida === !0 }) : o;
2910
+ } catch (l) {
2911
+ return console.warn("[UI-Camadas] atualização da janela virtual falhou; redesenhando o painel.", l), o;
2912
+ }
2913
+ }
2914
+ function it(e) {
2915
+ var a;
2916
+ const t = e.camadas.length > 0 && ((a = e.planoVirtual) == null ? void 0 : a.semLimite) === !0;
2917
+ return _t(
2918
+ e.camadas,
2919
+ e.feicoes,
2920
+ e.expandedLayers,
2921
+ e.searchQuery,
2922
+ t ? 1 / 0 : void 0,
2923
+ t ? void 0 : e.expandedFeatureLimits,
2924
+ e.ordemFilhosPorPai
2925
+ );
2926
+ }
2927
+ function ti(e, t, a, r, i) {
2928
+ const o = it(e), n = !r && !o.includes(t) && e.feicoes.some((l) => l.id === t), s = Gt(
2929
+ n ? [...o, t] : o,
2930
+ e.selectedFeatureIds,
2931
+ e.lastClickedFeatureId,
2932
+ t,
2933
+ a,
2934
+ r
2935
+ );
2936
+ s && (e.selectedFeatureIds = s.selecionados, e.lastClickedFeatureId = s.ultimoClicadoId, e.sincronizarSelecaoDOM(), i && e.notificarMudancaSelecao());
2937
+ }
2938
+ function ri(e, t, a) {
2939
+ const r = t || [];
2940
+ r.length === e.selectedFeatureIds.size && r.every((n) => e.selectedFeatureIds.has(n)) || (e.selectedFeatureIds.clear(), r.forEach((n) => e.selectedFeatureIds.add(n)), e.lastClickedFeatureId = r.length > 0 ? r[r.length - 1] : null, e.sincronizarSelecaoDOM(), a && e.notificarMudancaSelecao());
2941
+ }
2942
+ function ii(e, t) {
2943
+ e.selectedFeatureIds.size !== 0 && (e.selectedFeatureIds.clear(), e.lastClickedFeatureId = null, e.sincronizarSelecaoDOM(), t && e.notificarMudancaSelecao());
2944
+ }
2945
+ function oi(e) {
2946
+ const t = e.feicoes.filter((a) => e.selectedFeatureIds.has(a.id));
2947
+ e.dispararEvento("ui-feicoes-selecionadas", {
2948
+ feicoesIds: Array.from(e.selectedFeatureIds),
2949
+ feicoes: t
2950
+ }), t.length === 1 ? e.dispararEvento("ui-feicao-selecionada", { feicaoId: t[0].id, feicao: t[0] }) : t.length === 0 && e.dispararEvento("ui-feicao-selecionada", { feicaoId: null, feicao: null });
2951
+ }
2952
+ const ni = '[role="button"][tabindex]', ne = "[data-layer-row], [data-feat-row]", si = ["color", "range", "checkbox", "radio", "button"];
2953
+ function ot(e) {
2954
+ return !e || !(e instanceof Element) || e instanceof HTMLInputElement && si.includes(e.type) ? !1 : Et({ composedPath: () => [e] });
2955
+ }
2956
+ function li(e) {
2957
+ return Array.from(e.querySelectorAll(ne)).filter((t) => {
2405
2958
  const a = t.closest(".ui-children-container");
2406
2959
  return !(a && a.style.display === "none") && !t.classList.contains("ui-search-hidden");
2407
2960
  });
2408
2961
  }
2409
- function K(e, t) {
2410
- t && (e.querySelectorAll(te).forEach((a) => a.setAttribute("tabindex", "-1")), t.setAttribute("tabindex", "0"), t.focus());
2962
+ function ci(e, t, a) {
2963
+ var s;
2964
+ const r = ((s = e.ordemLinhasNavegaveis) == null ? void 0 : s.call(e)) ?? null, i = Wa(a), o = r && i ? r.indexOf(i) : -1;
2965
+ if (r && o !== -1 && e.garantirLinhaRenderizada) {
2966
+ const l = e.garantirLinhaRenderizada.bind(e);
2967
+ return {
2968
+ indice: o,
2969
+ total: r.length,
2970
+ linhaEm: (c) => c >= 0 && c < r.length ? l(r[c]) ?? void 0 : void 0
2971
+ };
2972
+ }
2973
+ const n = li(t);
2974
+ return { indice: n.indexOf(a), total: n.length, linhaEm: (l) => n[l] };
2975
+ }
2976
+ function U(e, t) {
2977
+ t && (e.querySelectorAll(ne).forEach((a) => a.setAttribute("tabindex", "-1")), t.setAttribute("tabindex", "0"), t.focus());
2411
2978
  }
2412
- function or(e, t) {
2979
+ function di(e, t) {
2413
2980
  e.dispatchEvent(
2414
2981
  new MouseEvent("click", {
2415
2982
  bubbles: !0,
@@ -2418,9 +2985,9 @@ function or(e, t) {
2418
2985
  })
2419
2986
  );
2420
2987
  }
2421
- function nr(e, t, a) {
2988
+ function ui(e, t, a) {
2422
2989
  var i;
2423
- if (Sa(a.composedPath()[0])) return;
2990
+ if (ot(a.composedPath()[0])) return;
2424
2991
  const r = t.querySelector(".confirming");
2425
2992
  if (r) {
2426
2993
  a.preventDefault(), r.dispatchEvent(new Event("ui-cancelar-confirmacao")), r.classList.remove("confirming");
@@ -2429,144 +2996,114 @@ function nr(e, t, a) {
2429
2996
  if (e.activeSettingsLayerId) {
2430
2997
  a.preventDefault();
2431
2998
  const o = e.activeSettingsLayerId;
2432
- e.activeSettingsLayerId = null, e.solicitarRenderizacao(), (i = D(t, "data-layer-settings", o)) == null || i.focus();
2999
+ e.activeSettingsLayerId = null, e.solicitarRenderizacao(), (i = M(t, "data-layer-settings", o)) == null || i.focus();
2433
3000
  return;
2434
3001
  }
2435
3002
  e.selectedFeatureIds.size > 0 && (a.preventDefault(), e.limparSelecao(!0));
2436
3003
  }
2437
- function sr(e, t, a, r) {
2438
- var s, d, l;
3004
+ function fi(e, t, a, r) {
3005
+ var f, p, d;
2439
3006
  const i = r.composedPath()[0];
2440
- if (!(i instanceof HTMLElement) || Sa(i)) return;
2441
- if ((r.key === "Enter" || r.key === " ") && i.matches(tr)) {
2442
- r.preventDefault(), i.click();
3007
+ if (!(i instanceof HTMLElement) || ot(i)) return;
3008
+ let o = i;
3009
+ if (o.id === "ui-layer-tree-mount" && e.chaveLinhaFocada && e.garantirLinhaRenderizada) {
3010
+ const u = e.garantirLinhaRenderizada(e.chaveLinhaFocada);
3011
+ if (!u) return;
3012
+ u.focus({ preventScroll: !0 }), o = u;
3013
+ }
3014
+ if ((r.key === "Enter" || r.key === " ") && o.matches(ni)) {
3015
+ r.preventDefault(), o.click();
2443
3016
  return;
2444
3017
  }
2445
- if (!i.matches(te)) return;
2446
- const o = ir(t), n = o.indexOf(i);
3018
+ if (!o.matches(ne)) return;
3019
+ const n = o, l = ["ArrowDown", "ArrowUp", "Home", "End", "ArrowRight"].includes(r.key) ? ci(e, t, n) : null, c = l ? l.indice : -1;
2447
3020
  if (r.key === "F2") {
2448
3021
  r.preventDefault();
2449
- const c = i.getAttribute("data-layer-row"), f = i.getAttribute("data-feat-row"), u = c ? D(i, "data-layer-name-trigger", c) : f ? D(i, "data-feat-name-trigger", f) : null;
2450
- u && u.dispatchEvent(new MouseEvent("dblclick", { bubbles: !0 }));
3022
+ const u = o.getAttribute("data-layer-row"), h = o.getAttribute("data-feat-row"), m = u ? M(o, "data-layer-name-trigger", u) : h ? M(o, "data-feat-name-trigger", h) : null;
3023
+ m && m.dispatchEvent(new MouseEvent("dblclick", { bubbles: !0 }));
2451
3024
  return;
2452
3025
  }
2453
3026
  if ((r.ctrlKey || r.metaKey) && (r.key === "a" || r.key === "A")) {
2454
3027
  r.preventDefault();
2455
- const c = ya(
2456
- e.camadas,
2457
- e.feicoes,
2458
- e.expandedLayers,
2459
- e.searchQuery,
2460
- void 0,
2461
- e.expandedFeatureLimits,
2462
- e.ordemFilhosPorPai
2463
- );
2464
- c.length > 0 && e.selecionarFeicoes(c, !0);
3028
+ const u = it(e);
3029
+ u.length > 0 && e.selecionarFeicoes(u, !0);
2465
3030
  return;
2466
3031
  }
2467
3032
  if (r.key === "Delete") {
2468
- const c = a.getElementById("btn-footer-del");
2469
- if (c && !c.hasAttribute("disabled") && e.selectedFeatureIds.size > 0) {
2470
- r.preventDefault(), c.click();
3033
+ const u = a.getElementById("btn-footer-del");
3034
+ if (u && !u.hasAttribute("disabled") && e.selectedFeatureIds.size > 0) {
3035
+ r.preventDefault(), u.click();
2471
3036
  return;
2472
3037
  }
2473
3038
  }
2474
3039
  switch (r.key) {
2475
3040
  case "ArrowDown":
2476
- r.preventDefault(), K(t, o[Math.min(o.length - 1, n + 1)]);
3041
+ r.preventDefault(), l && U(t, l.linhaEm(Math.min(l.total - 1, c + 1)));
2477
3042
  break;
2478
3043
  case "ArrowUp":
2479
- r.preventDefault(), K(t, o[Math.max(0, n - 1)]);
3044
+ r.preventDefault(), l && U(t, l.linhaEm(Math.max(0, c - 1)));
2480
3045
  break;
2481
3046
  case "Home":
2482
- r.preventDefault(), K(t, o[0]);
3047
+ r.preventDefault(), l && U(t, l.linhaEm(0));
2483
3048
  break;
2484
3049
  case "End":
2485
- r.preventDefault(), K(t, o[o.length - 1]);
3050
+ r.preventDefault(), l && U(t, l.linhaEm(l.total - 1));
2486
3051
  break;
2487
3052
  case "ArrowRight": {
2488
- const c = i.getAttribute("data-layer-row");
2489
- if (!c) return;
2490
- const f = i.closest(".ui-layer-group");
2491
- (f == null ? void 0 : f.getAttribute("aria-expanded")) === "true" ? n + 1 < o.length && (f != null && f.contains(o[n + 1])) && (r.preventDefault(), K(t, o[n + 1])) : (r.preventDefault(), (s = D(a, "data-layer-expand", c)) == null || s.click());
3053
+ const u = n.getAttribute("data-layer-row");
3054
+ if (!u || !l) return;
3055
+ const h = n.closest(".ui-layer-group");
3056
+ if (!((h == null ? void 0 : h.getAttribute("aria-expanded")) === "true"))
3057
+ r.preventDefault(), (f = M(a, "data-layer-expand", u)) == null || f.click();
3058
+ else if (c + 1 < l.total) {
3059
+ const g = l.linhaEm(c + 1);
3060
+ g && (h != null && h.contains(g)) && (r.preventDefault(), U(t, g));
3061
+ }
2492
3062
  break;
2493
3063
  }
2494
3064
  case "ArrowLeft": {
2495
- const c = i.getAttribute("data-layer-row");
2496
- if (c) {
2497
- const p = i.closest(".ui-layer-group");
2498
- if ((p == null ? void 0 : p.getAttribute("aria-expanded")) === "true")
2499
- r.preventDefault(), (d = D(a, "data-layer-expand", c)) == null || d.click();
3065
+ const u = o.getAttribute("data-layer-row");
3066
+ if (u) {
3067
+ const g = o.closest(".ui-layer-group");
3068
+ if ((g == null ? void 0 : g.getAttribute("aria-expanded")) === "true")
3069
+ r.preventDefault(), (p = M(a, "data-layer-expand", u)) == null || p.click();
2500
3070
  else {
2501
- const g = (l = p == null ? void 0 : p.parentElement) == null ? void 0 : l.closest(".ui-layer-group"), b = g == null ? void 0 : g.getAttribute("data-layer-id"), h = b ? D(t, "data-layer-row", b) : null;
2502
- h && (r.preventDefault(), K(t, h));
3071
+ const v = (d = g == null ? void 0 : g.parentElement) == null ? void 0 : d.closest(".ui-layer-group"), b = v == null ? void 0 : v.getAttribute("data-layer-id"), w = b ? M(t, "data-layer-row", b) : null;
3072
+ w && (r.preventDefault(), U(t, w));
2503
3073
  }
2504
3074
  return;
2505
3075
  }
2506
- const f = i.getAttribute("data-feat-layer"), u = f ? D(t, "data-layer-row", f) : null;
2507
- u && (r.preventDefault(), K(t, u));
3076
+ const h = o.getAttribute("data-feat-layer"), m = h ? M(t, "data-layer-row", h) : null;
3077
+ m && (r.preventDefault(), U(t, m));
2508
3078
  break;
2509
3079
  }
2510
3080
  case "Enter":
2511
3081
  case " ":
2512
- r.preventDefault(), or(i, r);
3082
+ r.preventDefault(), di(o, r);
2513
3083
  break;
2514
3084
  }
2515
3085
  }
2516
- function lr(e, t, a, r, i) {
3086
+ function pi(e, t, a, r, i) {
2517
3087
  i.add(t, "keydown", (o) => {
2518
- o.key === "Escape" && nr(e, a, o);
2519
- }), i.add(r, "keydown", (o) => sr(e, r, a, o)), i.add(r, "focusin", (o) => {
3088
+ o.key === "Escape" && ui(e, a, o);
3089
+ }), i.add(r, "keydown", (o) => fi(e, r, a, o)), i.add(r, "focusin", (o) => {
2520
3090
  const n = o.composedPath()[0];
2521
- n instanceof HTMLElement && n.matches(te) && (r.querySelectorAll(te).forEach((s) => s.setAttribute("tabindex", "-1")), n.setAttribute("tabindex", "0"));
3091
+ n instanceof HTMLElement && n.matches(ne) && (r.querySelectorAll(ne).forEach((s) => s.setAttribute("tabindex", "-1")), n.setAttribute("tabindex", "0"), e.chaveLinhaFocada = Wa(n));
2522
3092
  });
2523
3093
  }
2524
- function dr(e, t, a, r, i) {
2525
- const o = ya(
2526
- e.camadas,
2527
- e.feicoes,
2528
- e.expandedLayers,
2529
- e.searchQuery,
2530
- void 0,
2531
- e.expandedFeatureLimits,
2532
- e.ordemFilhosPorPai
2533
- ), n = !r && !o.includes(t) && e.feicoes.some((d) => d.id === t), s = gt(
2534
- n ? [...o, t] : o,
2535
- e.selectedFeatureIds,
2536
- e.lastClickedFeatureId,
2537
- t,
2538
- a,
2539
- r
2540
- );
2541
- s && (e.selectedFeatureIds = s.selecionados, e.lastClickedFeatureId = s.ultimoClicadoId, e.sincronizarSelecaoDOM(), i && e.notificarMudancaSelecao());
2542
- }
2543
- function cr(e, t, a) {
2544
- const r = t || [];
2545
- r.length === e.selectedFeatureIds.size && r.every((n) => e.selectedFeatureIds.has(n)) || (e.selectedFeatureIds.clear(), r.forEach((n) => e.selectedFeatureIds.add(n)), e.lastClickedFeatureId = r.length > 0 ? r[r.length - 1] : null, e.sincronizarSelecaoDOM(), a && e.notificarMudancaSelecao());
2546
- }
2547
- function ur(e, t) {
2548
- e.selectedFeatureIds.size !== 0 && (e.selectedFeatureIds.clear(), e.lastClickedFeatureId = null, e.sincronizarSelecaoDOM(), t && e.notificarMudancaSelecao());
2549
- }
2550
- function pr(e) {
2551
- const t = e.feicoes.filter((a) => e.selectedFeatureIds.has(a.id));
2552
- e.dispararEvento("ui-feicoes-selecionadas", {
2553
- feicoesIds: Array.from(e.selectedFeatureIds),
2554
- feicoes: t
2555
- }), t.length === 1 ? e.dispararEvento("ui-feicao-selecionada", { feicaoId: t[0].id, feicao: t[0] }) : t.length === 0 && e.dispararEvento("ui-feicao-selecionada", { feicaoId: null, feicao: null });
2556
- }
2557
- class fr {
3094
+ class mi {
2558
3095
  constructor(t) {
2559
3096
  E(this, "origens", /* @__PURE__ */ new Map());
2560
3097
  E(this, "removidas", /* @__PURE__ */ new Set());
2561
- E(this, "salvarComDebounce", ia(() => this.salvar(), 200));
3098
+ E(this, "salvarComDebounce", wa(() => this.salvar(), 200));
2562
3099
  this.instantaneo = t;
2563
3100
  }
2564
3101
  chaveAtual() {
2565
3102
  const t = this.instantaneo();
2566
- return wt(t.storageKey, t.id);
3103
+ return lr(t.storageKey, t.id);
2567
3104
  }
2568
3105
  carregar() {
2569
- return ze(this.chaveAtual());
3106
+ return Te(this.chaveAtual());
2570
3107
  }
2571
3108
  /** Versão com debounce, para interações contínuas (seletor de cor, slider de opacidade). */
2572
3109
  agendar() {
@@ -2575,8 +3112,8 @@ class fr {
2575
3112
  salvar() {
2576
3113
  const t = this.instantaneo();
2577
3114
  if (!t.persistir || !t.conectado) return;
2578
- const a = this.chaveAtual(), r = Ct({
2579
- estadoAnterior: ze(a),
3115
+ const a = this.chaveAtual(), r = pr({
3116
+ estadoAnterior: Te(a),
2580
3117
  origensCamadas: this.origens,
2581
3118
  camadas: t.camadas,
2582
3119
  expandedLayers: t.expandedLayers,
@@ -2588,164 +3125,38 @@ class fr {
2588
3125
  camadasRemovidas: this.removidas,
2589
3126
  ordemFilhosPorPai: t.ordemFilhosPorPai
2590
3127
  });
2591
- this.removidas.clear(), Et(a, r);
3128
+ this.removidas.clear(), dr(a, r);
2592
3129
  }
2593
3130
  limpar() {
2594
- It(this.chaveAtual());
3131
+ ur(this.chaveAtual());
2595
3132
  }
2596
3133
  // --- Origens (como a camada chegou do consumidor) e remoções ---
2597
3134
  limparOrigens() {
2598
3135
  this.origens.clear();
2599
3136
  }
2600
3137
  registrarOrigem(t) {
2601
- this.origens.set(t.id, xa(t));
3138
+ this.origens.set(t.id, Ha(t));
2602
3139
  }
2603
3140
  esquecerCamada(t) {
2604
3141
  this.origens.delete(t), this.removidas.add(t);
2605
3142
  }
2606
3143
  /** Aplica por cima de `camadas` o que foi lembrado (expansão, visibilidade, travas, opacidade, cor, ordem). */
2607
3144
  reidratar(t, a, r, i) {
2608
- if (kt(t, a, r, this.origens), i && (i.clear(), a != null && a.ordemFilhosPorPai))
3145
+ if (fr(t, a, r, this.origens), i && (i.clear(), a != null && a.ordemFilhosPorPai))
2609
3146
  for (const [o, n] of Object.entries(a.ordemFilhosPorPai))
2610
3147
  Array.isArray(n) && n.length > 0 && i.set(o, [...n]);
2611
3148
  }
2612
3149
  }
2613
- function Re(e, t = null, a = /* @__PURE__ */ new Set()) {
2614
- const r = [];
2615
- if (!Array.isArray(e)) return r;
2616
- for (const i of e) {
2617
- if (!i || typeof i != "object" || !i.id) continue;
2618
- const o = String(i.id);
2619
- if (a.has(o)) continue;
2620
- a.add(o);
2621
- const n = { ...i, id: o };
2622
- delete n.children, t && n.parentId === void 0 && (n.parentId = t), r.push(n), Array.isArray(i.children) && i.children.length > 0 && r.push(...Re(i.children, o, a));
2623
- }
2624
- return r;
2625
- }
2626
- function Fa(e) {
2627
- const t = e.lastClickedFeatureId;
2628
- t && !e.feicoes.some((a) => a.id === t) && (e.lastClickedFeatureId = null);
2629
- }
2630
- function $a(e) {
2631
- if (!Array.isArray(e)) return [];
2632
- const t = /* @__PURE__ */ new Set(), a = [];
2633
- for (const r of e) {
2634
- if (!r || typeof r != "object" || !r.id) continue;
2635
- const i = String(r.id);
2636
- t.has(i) || (t.add(i), a.push({ ...r, id: i }));
2637
- }
2638
- return a;
2639
- }
2640
- function mr(e, t, a) {
2641
- if (e.camadas = Array.isArray(t) ? Re(t) : [], e.lembranca.limparOrigens(), e.persistir) {
2642
- const o = e.lembranca.carregar();
2643
- e.lembranca.reidratar(e.camadas, o, e.expandedLayers, e.ordemFilhosPorPai), o != null && o.camadaAtivaId && e.camadas.some((n) => n.id === o.camadaAtivaId) && (e.camadaAtivaId = o.camadaAtivaId);
2644
- } else
2645
- e.camadas.forEach((o) => {
2646
- e.lembranca.registrarOrigem(o), e.expandedLayers.has(o.id) || e.expandedLayers.add(o.id);
2647
- });
2648
- if (Array.isArray(a)) {
2649
- e.feicoes = $a(a);
2650
- const o = new Set(e.camadas.map((s) => s.id)), n = e.feicoes.filter((s) => s.layerId && !o.has(s.layerId));
2651
- n.length > 0 && console.warn(
2652
- `[UI-Camadas] ${n.length} feição(ões) possuem 'layerId' não cadastrado nas camadas:`,
2653
- n.map((s) => ({ id: s.id, nome: s.name, layerId: s.layerId }))
2654
- ), Te(e.selectedFeatureIds, e.feicoes), Fa(e);
2655
- }
2656
- const r = new Set(e.camadas.map((o) => o.id));
2657
- if (e.activeSettingsLayerId && !r.has(e.activeSettingsLayerId) && (e.activeSettingsLayerId = null), e.editingLayerId && !r.has(e.editingLayerId) && (e.editingLayerId = null), e.expandedFeatureLimits)
2658
- for (const o of e.expandedFeatureLimits.keys())
2659
- r.has(o) || e.expandedFeatureLimits.delete(o);
2660
- const i = e.getAttribute("camada-ativa");
2661
- e.camadas.length > 0 && (!i || !r.has(i)) && (e.camadaAtivaId = e.camadas[0].id), e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2662
- }
2663
- function gr(e, t) {
2664
- const a = new Map(e.map((i) => [i.id, i])), r = /* @__PURE__ */ new Set();
2665
- for (const i of t) {
2666
- const o = a.get(i.id);
2667
- (!o || !st(o, i)) && r.add(i.id);
2668
- }
2669
- return r;
2670
- }
2671
- function hr(e, t) {
2672
- const a = e.feicoes;
2673
- e.feicoes = $a(t);
2674
- const r = e.selectedFeatureIds.size;
2675
- Te(e.selectedFeatureIds, e.feicoes), Fa(e), e.editingFeatureId && !e.feicoes.some((i) => i.id === e.editingFeatureId) && (e.editingFeatureId = null), e.solicitarAtualizacaoFeicoes({
2676
- camadas: "todas",
2677
- idsAlterados: gr(a, e.feicoes),
2678
- selecaoAfetada: e.selectedFeatureIds.size !== r
2679
- });
2680
- }
2681
- function vr(e, t) {
2682
- if (!t || !t.id) return;
2683
- if (e.camadas.some((r) => r.id === t.id)) {
2684
- console.warn(`[UI-Camadas] adicionarCamada ignorado: já existe uma camada com id '${t.id}'.`);
2685
- return;
2686
- }
2687
- const a = new Set(e.camadas.map((r) => r.id));
2688
- for (const r of Re([t])) {
2689
- if (a.has(r.id)) {
2690
- console.warn(`[UI-Camadas] adicionarCamada: subcamada '${r.id}' ignorada, o id já existe.`);
2691
- continue;
2692
- }
2693
- a.add(r.id), e.camadas.push(r), e.lembranca.registrarOrigem(r), e.expandedLayers.add(r.id), r.parentId && e.expandedLayers.add(r.parentId);
2694
- }
2695
- e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2696
- }
2697
- function br(e, t) {
2698
- var r, i;
2699
- const a = e.camadas.find((o) => o.id === t);
2700
- e.camadas.forEach((o) => {
2701
- o.parentId === t && (o.parentId = null);
2702
- }), e.camadas = e.camadas.filter((o) => o.id !== t), e.feicoes = e.feicoes.filter((o) => o.layerId !== t), e.ordemFilhosPorPai && (e.ordemFilhosPorPai.delete(t), a != null && a.parentId && G(e.ordemFilhosPorPai, a.parentId, H(t))), e.lembranca.esquecerCamada(t), e.expandedLayers.delete(t), (r = e.expandedFeatureLimits) == null || r.delete(t), e.activeSettingsLayerId === t && (e.activeSettingsLayerId = null), e.editingLayerId === t && (e.editingLayerId = null), e.editingFeatureId && !e.feicoes.some((o) => o.id === e.editingFeatureId) && (e.editingFeatureId = null), Te(e.selectedFeatureIds, e.feicoes), e.selectedFeatureIds.size === 0 && (e.lastClickedFeatureId = null), e.camadaAtivaId === t && (e.camadaAtivaId = ((i = e.camadas[0]) == null ? void 0 : i.id) ?? null), e.salvarLembrancaEstado(), e.solicitarRenderizacao();
2703
- }
2704
- function yr(e, t) {
2705
- if (!(!t || !t.id)) {
2706
- if (e.feicoes.some((a) => a.id === t.id)) {
2707
- console.warn(`[UI-Camadas] adicionarFeicao ignorado: já existe uma feição com id '${t.id}'.`);
2708
- return;
2709
- }
2710
- e.feicoes.push({ ...t }), e.solicitarAtualizacaoFeicoes({
2711
- camadas: /* @__PURE__ */ new Set([t.layerId || ""]),
2712
- idsAlterados: /* @__PURE__ */ new Set(),
2713
- selecaoAfetada: e.selectedFeatureIds.has(t.id)
2714
- });
2715
- }
2716
- }
2717
- function xr(e, t) {
2718
- if (!t || typeof t != "object" || !t.id) return;
2719
- const a = e.feicoes.findIndex((r) => r.id === t.id);
2720
- if (a !== -1) {
2721
- const r = e.feicoes[a].layerId || "";
2722
- e.feicoes[a] = { ...e.feicoes[a], ...t }, e.solicitarAtualizacaoFeicoes({
2723
- camadas: /* @__PURE__ */ new Set([r, e.feicoes[a].layerId || ""]),
2724
- idsAlterados: /* @__PURE__ */ new Set([t.id]),
2725
- selecaoAfetada: !1
2726
- });
2727
- }
2728
- }
2729
- function wr(e, t) {
2730
- const a = e.feicoes.find((i) => i.id === t);
2731
- e.feicoes = e.feicoes.filter((i) => i.id !== t), a != null && a.layerId && e.ordemFilhosPorPai && G(e.ordemFilhosPorPai, a.layerId, O(t));
2732
- const r = e.selectedFeatureIds.delete(t);
2733
- e.lastClickedFeatureId === t && (e.lastClickedFeatureId = null), e.editingFeatureId === t && (e.editingFeatureId = null), e.solicitarAtualizacaoFeicoes({
2734
- camadas: new Set(a ? [a.layerId || ""] : []),
2735
- idsAlterados: /* @__PURE__ */ new Set(),
2736
- selecaoAfetada: r
2737
- });
2738
- }
2739
- function Ar(e) {
3150
+ function hi(e) {
2740
3151
  function r() {
2741
3152
  return e.getMinAltura ? e.getMinAltura() : 140;
2742
3153
  }
2743
3154
  function i() {
2744
3155
  return e.getMaxAltura ? e.getMaxAltura() : 1600;
2745
3156
  }
2746
- function o(l, c = !1) {
2747
- if (l == null || l === "") {
2748
- e.hostElement.style.removeProperty("height"), e.hostElement.style.removeProperty("--ui-camadas-altura"), c && e.hostElement.dispatchEvent(
3157
+ function o(c, f = !1) {
3158
+ if (c == null || c === "") {
3159
+ e.hostElement.style.removeProperty("height"), e.hostElement.style.removeProperty("--ui-camadas-altura"), f && e.hostElement.dispatchEvent(
2749
3160
  new CustomEvent("ui-redimensionar-altura", {
2750
3161
  bubbles: !0,
2751
3162
  composed: !0,
@@ -2754,78 +3165,78 @@ function Ar(e) {
2754
3165
  );
2755
3166
  return;
2756
3167
  }
2757
- const f = typeof l == "number" ? l : parseFloat(String(l));
2758
- if (isNaN(f)) return;
2759
- const u = Math.max(r(), Math.min(i(), Math.round(f)));
2760
- e.hostElement.style.height = `${u}px`, e.hostElement.style.setProperty("--ui-camadas-altura", `${u}px`), c && e.hostElement.dispatchEvent(
3168
+ const p = typeof c == "number" ? c : parseFloat(String(c));
3169
+ if (isNaN(p)) return;
3170
+ const d = Math.max(r(), Math.min(i(), Math.round(p)));
3171
+ e.hostElement.style.height = `${d}px`, e.hostElement.style.setProperty("--ui-camadas-altura", `${d}px`), f && e.hostElement.dispatchEvent(
2761
3172
  new CustomEvent("ui-redimensionar-altura", {
2762
3173
  bubbles: !0,
2763
3174
  composed: !0,
2764
- detail: { altura: u }
3175
+ detail: { altura: d }
2765
3176
  })
2766
3177
  );
2767
3178
  }
2768
3179
  let n = null;
2769
3180
  function s() {
2770
3181
  if (!e.resizerElement) return;
2771
- let l = !1, c = 0, f = 0;
2772
- const u = (m) => {
2773
- if (m.button !== 0) return;
2774
- m.preventDefault(), m.stopPropagation(), l = !0, c = m.clientY, f = e.hostElement.getBoundingClientRect().height, e.resizerElement.classList.add("ui-camadas-resizer--ativo"), e.hostElement.classList.add("ui-camadas--redimensionando");
3182
+ let c = !1, f = 0, p = 0;
3183
+ const d = (h) => {
3184
+ if (h.button !== 0) return;
3185
+ h.preventDefault(), h.stopPropagation(), c = !0, f = h.clientY, p = e.hostElement.getBoundingClientRect().height, e.resizerElement.classList.add("ui-camadas-resizer--ativo"), e.hostElement.classList.add("ui-camadas--redimensionando");
2775
3186
  try {
2776
- e.resizerElement.setPointerCapture(m.pointerId);
3187
+ e.resizerElement.setPointerCapture(h.pointerId);
2777
3188
  } catch {
2778
3189
  }
2779
- const g = (v) => {
2780
- if (!l) return;
3190
+ const m = (v) => {
3191
+ if (!c) return;
2781
3192
  v.preventDefault();
2782
- const A = v.clientY - c, I = Math.max(r(), Math.min(i(), Math.round(f + A)));
2783
- e.hostElement.style.height = `${I}px`, e.hostElement.style.setProperty("--ui-camadas-altura", `${I}px`), e.onRedimensionando && e.onRedimensionando(I), e.hostElement.dispatchEvent(
3193
+ const b = v.clientY - f, w = Math.max(r(), Math.min(i(), Math.round(p + b)));
3194
+ e.hostElement.style.height = `${w}px`, e.hostElement.style.setProperty("--ui-camadas-altura", `${w}px`), e.onRedimensionando && e.onRedimensionando(w), e.hostElement.dispatchEvent(
2784
3195
  new CustomEvent("ui-redimensionando-altura", {
2785
3196
  bubbles: !0,
2786
3197
  composed: !0,
2787
- detail: { altura: I }
3198
+ detail: { altura: w }
2788
3199
  })
2789
3200
  );
2790
- }, b = () => {
3201
+ }, g = () => {
2791
3202
  var v;
2792
- l = !1, n = null, window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", h), (v = e.resizerElement) == null || v.classList.remove("ui-camadas-resizer--ativo"), e.hostElement.classList.remove("ui-camadas--redimensionando");
2793
- }, h = (v) => {
2794
- if (!l) return;
3203
+ c = !1, n = null, window.removeEventListener("pointermove", m), window.removeEventListener("pointerup", y), window.removeEventListener("pointercancel", y), (v = e.resizerElement) == null || v.classList.remove("ui-camadas-resizer--ativo"), e.hostElement.classList.remove("ui-camadas--redimensionando");
3204
+ }, y = (v) => {
3205
+ if (!c) return;
2795
3206
  try {
2796
3207
  e.resizerElement.hasPointerCapture(v.pointerId) && e.resizerElement.releasePointerCapture(v.pointerId);
2797
3208
  } catch {
2798
3209
  }
2799
- b();
2800
- const A = e.hostElement.getBoundingClientRect().height, I = Math.round(A);
2801
- e.onAlturaAlterada && e.onAlturaAlterada(I), e.hostElement.dispatchEvent(
3210
+ g();
3211
+ const b = e.hostElement.getBoundingClientRect().height, w = Math.round(b);
3212
+ e.onAlturaAlterada && e.onAlturaAlterada(w), e.hostElement.dispatchEvent(
2802
3213
  new CustomEvent("ui-redimensionar-altura", {
2803
3214
  bubbles: !0,
2804
3215
  composed: !0,
2805
- detail: { altura: I }
3216
+ detail: { altura: w }
2806
3217
  })
2807
3218
  );
2808
3219
  };
2809
- n = b, window.addEventListener("pointermove", g), window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h);
2810
- }, p = (m) => {
2811
- m.preventDefault(), m.stopPropagation(), o(null, !0), e.onAlturaAlterada && e.onAlturaAlterada(null);
3220
+ n = g, window.addEventListener("pointermove", m), window.addEventListener("pointerup", y), window.addEventListener("pointercancel", y);
3221
+ }, u = (h) => {
3222
+ h.preventDefault(), h.stopPropagation(), o(null, !0), e.onAlturaAlterada && e.onAlturaAlterada(null);
2812
3223
  };
2813
- e.listeners.add(e.resizerElement, "pointerdown", u), e.listeners.add(e.resizerElement, "dblclick", p);
3224
+ e.listeners.add(e.resizerElement, "pointerdown", d), e.listeners.add(e.resizerElement, "dblclick", u);
2814
3225
  }
2815
- function d() {
3226
+ function l() {
2816
3227
  n == null || n(), e.listeners.cleanup();
2817
3228
  }
2818
3229
  return {
2819
3230
  init: s,
2820
3231
  definirAltura: o,
2821
- destruir: d
3232
+ destruir: l
2822
3233
  };
2823
3234
  }
2824
- const W = class W extends Ka {
3235
+ const X = class X extends It {
2825
3236
  constructor() {
2826
3237
  super();
2827
3238
  E(this, "shadow");
2828
- E(this, "listeners", new He());
3239
+ E(this, "listeners", new Xe());
2829
3240
  E(this, "dragDropManager");
2830
3241
  E(this, "resizerController");
2831
3242
  E(this, "bordaResizeObserver", null);
@@ -2835,8 +3246,20 @@ const W = class W extends Ka {
2835
3246
  E(this, "renderPendente", !1);
2836
3247
  /** Mudança de feições à espera do `render()` (consumida nele): permite atualizar só as linhas afetadas. */
2837
3248
  E(this, "mudancaFeicoes", null);
3249
+ /** Dentro de `emLote`: alguma mutação exige o render completo (camadas, expansão, busca…). */
3250
+ E(this, "loteExigeCompleto", !1);
3251
+ /** Dentro de `emLote`: mudanças de feições acumuladas, aplicadas por diferença no fim do lote. */
3252
+ E(this, "loteMudanca", null);
3253
+ /** Última área visível lida da árvore (lida em quadro de animação, nunca no meio das escritas). */
3254
+ E(this, "viewport", null);
3255
+ E(this, "alturaLinhaMedida", null);
3256
+ E(this, "quadroJanela", null);
3257
+ /** @internal Plano da lista virtual em uso no DOM (o que cada container mostra e a janela de cada corrida). */
3258
+ E(this, "planoVirtual", null);
3259
+ /** @internal Linha que recebeu o foco por último (`L:<camada>` / `F:<feição>`), mesmo fora da janela virtual. */
3260
+ E(this, "chaveLinhaFocada", null);
2838
3261
  /** @internal */
2839
- E(this, "lembranca", new fr(() => ({
3262
+ E(this, "lembranca", new mi(() => ({
2840
3263
  persistir: this.persistir,
2841
3264
  conectado: this.conectado,
2842
3265
  storageKey: this.storageKey,
@@ -2853,7 +3276,7 @@ const W = class W extends Ka {
2853
3276
  // Estado interno
2854
3277
  E(this, "camadas", []);
2855
3278
  E(this, "feicoes", []);
2856
- E(this, "mapasBase", [...oa]);
3279
+ E(this, "mapasBase", [...Aa]);
2857
3280
  E(this, "expandedLayers", /* @__PURE__ */ new Set());
2858
3281
  E(this, "expandedFeatureLimits", /* @__PURE__ */ new Map());
2859
3282
  E(this, "ordemFilhosPorPai", /* @__PURE__ */ new Map());
@@ -2866,7 +3289,7 @@ const W = class W extends Ka {
2866
3289
  E(this, "corpoElement");
2867
3290
  E(this, "btnExpandirFlutuante");
2868
3291
  this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = `
2869
- <style>${Lt}</style>
3292
+ <style>${mr}</style>
2870
3293
  <div class="ui-camadas-container" id="panel-container" part="base" role="region" aria-label="Painel de Camadas">
2871
3294
  <div class="ui-camadas-corpo" id="painel-corpo" part="corpo"></div>
2872
3295
  <div class="ui-camadas-resizer-altura" id="resizer-altura" part="resizer" title="Arraste para redimensionar a altura (duplo-clique para resetar)" aria-label="Redimensionar altura">
@@ -2874,14 +3297,14 @@ const W = class W extends Ka {
2874
3297
  </div>
2875
3298
  </div>
2876
3299
  <button type="button" class="ui-camadas-toggle-flutuante" id="btn-expandir-flutuante" part="botao-expandir" title="Expandir Painel de Camadas" aria-label="Expandir Painel de Camadas">
2877
- ${y.camadas}
3300
+ ${A.camadas}
2878
3301
  </button>
2879
- `, this.corpoElement = this.shadow.getElementById("painel-corpo"), this.btnExpandirFlutuante = this.shadow.getElementById("btn-expandir-flutuante"), this.dragDropManager = new yt(this, this.shadow);
3302
+ `, this.corpoElement = this.shadow.getElementById("painel-corpo"), this.btnExpandirFlutuante = this.shadow.getElementById("btn-expandir-flutuante"), this.dragDropManager = new nr(this, this.shadow);
2880
3303
  const a = this.shadow.getElementById("resizer-altura");
2881
- this.resizerController = Ar({
3304
+ this.resizerController = hi({
2882
3305
  hostElement: this,
2883
3306
  resizerElement: a,
2884
- listeners: new He(),
3307
+ listeners: new Xe(),
2885
3308
  getMinAltura: () => {
2886
3309
  const r = this.getAttribute("min-altura");
2887
3310
  return r && parseFloat(r) || 140;
@@ -2916,31 +3339,33 @@ const W = class W extends Ka {
2916
3339
  "min-altura",
2917
3340
  "max-altura",
2918
3341
  "borda-canvas",
2919
- ...Qa
3342
+ ...kt
2920
3343
  ];
2921
3344
  }
2922
3345
  connectedCallback() {
2923
3346
  var a;
2924
3347
  if (this.persistir) {
2925
- const r = ze(this.obterChaveStorageAtual());
3348
+ const r = Te(this.obterChaveStorageAtual());
2926
3349
  r && (r.painelColapsado === !0 && !this.hasAttribute("colapsado") && (this.colapsado = !0), r.camadaAtivaId && !this.getAttribute("camada-ativa") && (this.camadaAtivaId = r.camadaAtivaId), r.mapaBaseAtivo && !this.getAttribute("mapa-base-ativo") && (this.mapaBaseAtivo = r.mapaBaseAtivo), r.densidade && !this.getAttribute("densidade") && (this.densidade = r.densidade), typeof r.altura == "number" && !this.getAttribute("altura") && !this.style.height && (this.resizerController.definirAltura(r.altura, !1), this.alturaCustomizada = r.altura));
2927
3350
  }
2928
- this.hasAttribute("altura") && this.resizerController.definirAltura(this.getAttribute("altura"), !1), this.persistir && !this.storageKey && !this.id && (W.instanciasChavePadrao.size > 0 && console.warn(
3351
+ this.hasAttribute("altura") && this.resizerController.definirAltura(this.getAttribute("altura"), !1), this.persistir && !this.storageKey && !this.id && (X.instanciasChavePadrao.size > 0 && console.warn(
2929
3352
  "[UI-Camadas] Mais de um painel sem 'id' nem 'storage-key' divide a mesma chave de persistência e um sobrescreve o estado do outro. Defina 'storage-key' (ou 'id') em cada um."
2930
- ), W.instanciasChavePadrao.add(this)), this.resizerController.init(), Ge(this, this.shadow.getElementById("panel-container")), this.atualizarBordaCanvas(), typeof window < "u" && this.listeners.add(window, "resize", () => this.atualizarBordaCanvas()), typeof ResizeObserver < "u" && ((a = this.bordaResizeObserver) == null || a.disconnect(), this.bordaResizeObserver = new ResizeObserver(() => this.atualizarBordaCanvas()), this.bordaResizeObserver.observe(this)), this.render(), this.conectarEventosGerais(), lr(this, this, this.shadow, this.corpoElement, this.listeners), this.conectado = !0, this.camadas.length > 0 && this.salvarLembrancaEstado();
3353
+ ), X.instanciasChavePadrao.add(this)), this.resizerController.init(), Ze(this, this.shadow.getElementById("panel-container")), this.atualizarBordaCanvas(), typeof window < "u" && this.listeners.add(window, "resize", () => this.atualizarBordaCanvas()), typeof ResizeObserver < "u" && ((a = this.bordaResizeObserver) == null || a.disconnect(), this.bordaResizeObserver = new ResizeObserver(() => {
3354
+ this.atualizarBordaCanvas(), this.agendarJanelaVirtual();
3355
+ }), this.bordaResizeObserver.observe(this)), this.render(), this.conectarEventosGerais(), this.listeners.add(this.corpoElement, "scroll", () => this.agendarJanelaVirtual(), { capture: !0, passive: !0 }), pi(this, this, this.shadow, this.corpoElement, this.listeners), this.conectado = !0, this.camadas.length > 0 && this.salvarLembrancaEstado();
2931
3356
  }
2932
3357
  disconnectedCallback() {
2933
3358
  var a, r, i;
2934
- this.conectado = !1, W.instanciasChavePadrao.delete(this), (a = this.bordaResizeObserver) == null || a.disconnect(), this.bordaResizeObserver = null, (r = this.resizerController) == null || r.destruir(), (i = this.dragDropManager) == null || i.destruir(), Tt(this), this.listeners.cleanup();
3359
+ this.conectado = !1, X.instanciasChavePadrao.delete(this), this.quadroJanela !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.quadroJanela), this.quadroJanela = null, (a = this.bordaResizeObserver) == null || a.disconnect(), this.bordaResizeObserver = null, (r = this.resizerController) == null || r.destruir(), (i = this.dragDropManager) == null || i.destruir(), Ir(this), this.listeners.cleanup();
2935
3360
  }
2936
3361
  attributeChangedCallback(a, r, i) {
2937
3362
  var o, n;
2938
3363
  if (r !== i) {
2939
- if (Xa(a)) {
2940
- Ge(this, this.shadow.getElementById("panel-container"));
3364
+ if (Lt(a)) {
3365
+ Ze(this, this.shadow.getElementById("panel-container"));
2941
3366
  return;
2942
3367
  }
2943
- a === "colapsado" ? this.salvarLembrancaEstado() : a === "camada-ativa" ? (this.sincronizarCamadaAtivaDOM(), this.salvarLembrancaEstado()) : a === "densidade" ? this.salvarLembrancaEstado() : a === "mapa-base-ativo" ? (i && this.marcarMapaBaseAtivoNoDOM(i), this.salvarLembrancaEstado()) : a === "titulo" || a === "mostrar-mapas-base" || a === "mapas-base-recolhido" || a === "mostrar-rodape" || a === "mostrar-busca" || a === "colapsavel" || a === "flutuante" ? this.solicitarRenderizacao() : a === "altura" ? (o = this.resizerController) == null || o.definirAltura(i, !1) : a === "min-altura" || a === "max-altura" ? this.alturaCustomizada !== null && ((n = this.resizerController) == null || n.definirAltura(this.alturaCustomizada, !1)) : a === "borda-canvas" && this.atualizarBordaCanvas();
3368
+ a === "colapsado" ? this.salvarLembrancaEstado() : a === "camada-ativa" ? (this.sincronizarCamadaAtivaDOM(), this.salvarLembrancaEstado()) : a === "densidade" ? (this.alturaLinhaMedida = null, this.agendarJanelaVirtual(), this.salvarLembrancaEstado()) : a === "mapa-base-ativo" ? (i && this.marcarMapaBaseAtivoNoDOM(i), this.salvarLembrancaEstado()) : a === "titulo" || a === "mostrar-mapas-base" || a === "mapas-base-recolhido" || a === "mostrar-rodape" || a === "mostrar-busca" || a === "colapsavel" || a === "flutuante" ? this.solicitarRenderizacao() : a === "altura" ? (o = this.resizerController) == null || o.definirAltura(i, !1) : a === "min-altura" || a === "max-altura" ? this.alturaCustomizada !== null && ((n = this.resizerController) == null || n.definirAltura(this.alturaCustomizada, !1)) : a === "borda-canvas" && this.atualizarBordaCanvas();
2944
3369
  }
2945
3370
  }
2946
3371
  /**
@@ -2959,8 +3384,8 @@ const W = class W extends Ka {
2959
3384
  if (typeof window < "u" && typeof this.getBoundingClientRect == "function") {
2960
3385
  const o = this.getBoundingClientRect(), n = window.innerWidth || 0;
2961
3386
  if (o.width > 0 && n > 0) {
2962
- const s = o.left <= 2, d = n - o.right <= 2;
2963
- d && !s ? i = "esquerda" : s && !d ? i = "direita" : s && d ? i = "nenhuma" : i = "ambas";
3387
+ const s = o.left <= 2, l = n - o.right <= 2;
3388
+ l && !s ? i = "esquerda" : s && !l ? i = "direita" : s && l ? i = "nenhuma" : i = "ambas";
2964
3389
  }
2965
3390
  }
2966
3391
  a.setAttribute("data-borda-canvas", i);
@@ -2994,7 +3419,7 @@ const W = class W extends Ka {
2994
3419
  i.classList.toggle("active", o), i.setAttribute("aria-pressed", String(o));
2995
3420
  });
2996
3421
  const r = this.shadow.querySelector("[data-basemap-atual]");
2997
- r && (r.textContent = na(this.mapasBase, a));
3422
+ r && (r.textContent = Ea(this.mapasBase, a));
2998
3423
  }
2999
3424
  /** Seção "Mapa Base" recolhida (só o cabeçalho com o mapa ativo). Atributo `mapas-base-recolhido`. */
3000
3425
  get mapasBaseRecolhido() {
@@ -3130,10 +3555,10 @@ const W = class W extends Ka {
3130
3555
  this.definirMapasBase(a);
3131
3556
  }
3132
3557
  definirCamadas(a, r) {
3133
- mr(this, a, r);
3558
+ qr(this, a, r);
3134
3559
  }
3135
3560
  definirFeicoes(a) {
3136
- hr(this, a);
3561
+ Dr(this, a);
3137
3562
  }
3138
3563
  definirMapasBase(a) {
3139
3564
  this.mapasBase = Array.isArray(a) ? [...a] : [], this.solicitarRenderizacao();
@@ -3157,28 +3582,154 @@ const W = class W extends Ka {
3157
3582
  return this.feicoes.filter((a) => this.selectedFeatureIds.has(a.id));
3158
3583
  }
3159
3584
  adicionarCamada(a) {
3160
- vr(this, a);
3585
+ Rr(this, a);
3161
3586
  }
3162
3587
  removerCamada(a) {
3163
- br(this, a);
3588
+ Tr(this, a);
3164
3589
  }
3165
3590
  adicionarFeicao(a) {
3166
- yr(this, a);
3591
+ Or(this, a);
3167
3592
  }
3168
3593
  atualizarFeicao(a) {
3169
- xr(this, a);
3594
+ jr(this, a);
3170
3595
  }
3171
3596
  removerFeicao(a) {
3172
- wr(this, a);
3597
+ Nr(this, a);
3173
3598
  }
3599
+ /** Seleciona uma feição; se a linha dela estiver fora da área visível da árvore, rola até ela. */
3174
3600
  selecionarFeicao(a, r = !1, i = !1, o = !1) {
3175
- dr(this, a, r, i, o);
3601
+ ti(this, a, r, i, o), this.selectedFeatureIds.has(a) && this.revelarSelecao([a]);
3176
3602
  }
3603
+ /**
3604
+ * Substitui a seleção. Se nenhuma das feições estiver na área visível da árvore, rola até a primeira delas
3605
+ * (na ordem da árvore) e a destaca, mesmo que a lista virtual ainda não tenha criado a linha.
3606
+ */
3177
3607
  selecionarFeicoes(a, r = !1) {
3178
- cr(this, a, r);
3608
+ ri(this, a, r), Array.isArray(a) && this.revelarSelecao(a);
3609
+ }
3610
+ /**
3611
+ * Rola a árvore até a linha da feição (centralizada, se estava fora da tela) e garante que ela esteja no DOM.
3612
+ * Com `expandir = true`, expande a camada da feição (e os grupos acima dela) se estiverem recolhidos.
3613
+ * Devolve `false` se a feição não tem linha na tela (não existe, camada recolhida sem `expandir`,
3614
+ * além do "Mostrar mais" quando a árvore não tem altura).
3615
+ */
3616
+ rolarAteFeicao(a, r = !1) {
3617
+ if (!this.planoVirtual || typeof a != "string" || !a) return !1;
3618
+ r && ze(this.planoVirtual, a) === null && this.expandirAteFeicao(a);
3619
+ const i = this.planoVirtual;
3620
+ if (!i) return !1;
3621
+ const o = ze(i, a);
3622
+ if (o === null) return !1;
3623
+ const n = this.shadow.getElementById("ui-layer-tree-mount");
3624
+ if (!n) return !1;
3625
+ const s = this.lerViewport();
3626
+ if (this.viewport = s, s) {
3627
+ const l = la(o, i.alturaLinha, s.topo, s.altura);
3628
+ l !== null && (n.scrollTop = l, this.viewport = { ...s, topo: Number.isFinite(n.scrollTop) ? n.scrollTop : l });
3629
+ }
3630
+ return this.aplicarJanelaVirtual(!1), ie(this.shadow, `F:${a}`) !== null;
3631
+ }
3632
+ /**
3633
+ * Relê a área visível da árvore e cria/remove as linhas da janela virtual na hora (a rolagem e o
3634
+ * redimensionamento já fazem isso sozinhos, no próximo quadro).
3635
+ */
3636
+ atualizarJanelaVirtual() {
3637
+ this.viewport = this.lerViewport(), this.aplicarJanelaVirtual(!1);
3638
+ }
3639
+ /** @internal Expansão/recolhimento feito no lugar: cria ou remove as linhas das camadas afetadas. */
3640
+ atualizarArvoreVirtual(a = !0) {
3641
+ this.aplicarJanelaVirtual(a);
3642
+ }
3643
+ /** @internal Chaves das linhas navegáveis por teclado, na ordem da tela (inclui as fora da janela virtual). */
3644
+ ordemLinhasNavegaveis() {
3645
+ return !this.planoVirtual || this.camadas.length === 0 ? null : tr(this.planoVirtual.estrutura);
3646
+ }
3647
+ /** @internal Devolve a linha da chave, criando-a (rolagem até ela) se estiver fora da janela virtual. */
3648
+ garantirLinhaRenderizada(a) {
3649
+ const r = ie(this.shadow, a);
3650
+ return r || (a.startsWith("F:") && this.rolarAteFeicao(a.slice(2)), ie(this.shadow, a));
3651
+ }
3652
+ revelarSelecao(a) {
3653
+ const r = this.planoVirtual;
3654
+ if (!r || a.length === 0) return;
3655
+ const i = this.viewport ?? this.lerViewport();
3656
+ if (!i) return;
3657
+ this.viewport = i;
3658
+ let o = null, n = 1 / 0;
3659
+ for (const l of a) {
3660
+ const c = ze(r, l);
3661
+ if (c !== null) {
3662
+ if (la(c, r.alturaLinha, i.topo, i.altura) === null) return;
3663
+ c < n && (n = c, o = l);
3664
+ }
3665
+ }
3666
+ if (o !== null) {
3667
+ this.rolarAteFeicao(o);
3668
+ return;
3669
+ }
3670
+ const s = a.find((l) => this.selectedFeatureIds.has(l) && ee(this.feicoes, l) >= 0);
3671
+ s && this.rolarAteFeicao(s, !0);
3672
+ }
3673
+ /** Expande a camada da feição e os grupos acima dela (estado lembrado, sem evento). */
3674
+ expandirAteFeicao(a) {
3675
+ var s;
3676
+ const r = this.feicoes[ee(this.feicoes, a)];
3677
+ if (!(r != null && r.layerId)) return;
3678
+ const i = new Map(this.camadas.map((l) => [l.id, l]));
3679
+ let o = !1;
3680
+ const n = /* @__PURE__ */ new Set();
3681
+ for (let l = r.layerId; l && i.has(l) && !n.has(l); l = (s = i.get(l)) == null ? void 0 : s.parentId)
3682
+ n.add(l), this.expandedLayers.has(l) || (this.expandedLayers.add(l), o = !0);
3683
+ o && (this.salvarLembrancaEstado(), this.solicitarRenderizacao());
3684
+ }
3685
+ /** Lê a área visível da árvore (só leituras de layout). Sem altura não há virtualização. */
3686
+ lerViewport() {
3687
+ var s;
3688
+ const a = this.shadow.getElementById("ui-layer-tree-mount"), r = a ? a.clientHeight : ((s = this.corpoElement) == null ? void 0 : s.clientHeight) ?? 0;
3689
+ if (!(r > 0)) return null;
3690
+ const i = this.shadow.querySelector(".ui-layer-settings-drawer"), o = this.shadow.querySelector(".ui-truncate-notice"), n = o ? o.offsetHeight : 0;
3691
+ return {
3692
+ topo: a ? a.scrollTop : 0,
3693
+ altura: r,
3694
+ alturaLinha: this.medirAlturaLinha(),
3695
+ alturaDrawer: i ? i.offsetHeight : void 0,
3696
+ // Margens do aviso (4px + 6px) não entram no offsetHeight
3697
+ alturaAviso: n > 0 ? n + 10 : void 0
3698
+ };
3699
+ }
3700
+ /** Altura real de uma linha (medida uma vez por densidade); antes da primeira medida, a do CSS. */
3701
+ medirAlturaLinha() {
3702
+ if (this.alturaLinhaMedida !== null) return this.alturaLinhaMedida;
3703
+ const a = this.shadow.querySelector(".ui-feat-row, .ui-layer-row"), r = a ? a.offsetHeight : 0;
3704
+ return r > 0 ? (this.alturaLinhaMedida = r, r) : this.densidade === "compacto" ? Ae.compacto : Ae.normal;
3705
+ }
3706
+ /** Rolagem e redimensionamento: relê a área visível e ajusta a janela no próximo quadro (uma vez por quadro). */
3707
+ agendarJanelaVirtual() {
3708
+ this.quadroJanela !== null || !this.conectado || typeof requestAnimationFrame == "function" && (this.quadroJanela = requestAnimationFrame(() => {
3709
+ this.quadroJanela = null, this.conectado && this.atualizarJanelaVirtual();
3710
+ }));
3711
+ }
3712
+ aplicarJanelaVirtual(a) {
3713
+ if (!this.planoVirtual) return;
3714
+ if (this.profundidadeLote > 0) {
3715
+ a && (this.loteExigeCompleto = !0, this.renderPendente = !0);
3716
+ return;
3717
+ }
3718
+ const r = ai(this, this.shadow, this.dragDropManager, this.viewport, a);
3719
+ if (!r.ok) {
3720
+ this.render();
3721
+ return;
3722
+ }
3723
+ this.depoisDeAtualizacaoParcial(r);
3724
+ }
3725
+ /** Linha com foco que saiu da janela: o foco fica na árvore (as setas continuam da linha lembrada). */
3726
+ depoisDeAtualizacaoParcial(a) {
3727
+ if (!a.focoPerdido && !a.tabulavelRemovida) return;
3728
+ const r = this.shadow.getElementById("ui-layer-tree-mount");
3729
+ r && (ga(r, this.chaveLinhaFocada), a.focoPerdido && (r.hasAttribute("tabindex") || r.setAttribute("tabindex", "-1"), r.focus({ preventScroll: !0 })));
3179
3730
  }
3180
3731
  limparSelecao(a = !1) {
3181
- ur(this, a);
3732
+ ii(this, a);
3182
3733
  }
3183
3734
  expandirTodas() {
3184
3735
  this.expandedLayers = new Set(this.camadas.map((a) => a.id)), this.salvarLembrancaEstado(), this.solicitarRenderizacao();
@@ -3215,7 +3766,7 @@ const W = class W extends Ka {
3215
3766
  // --- Renderização e Ciclo de Vida ---
3216
3767
  solicitarRenderizacao() {
3217
3768
  if (this.profundidadeLote > 0) {
3218
- this.renderPendente = !0;
3769
+ this.renderPendente = !0, this.loteExigeCompleto = !0;
3219
3770
  return;
3220
3771
  }
3221
3772
  this.render();
@@ -3228,21 +3779,25 @@ const W = class W extends Ka {
3228
3779
  */
3229
3780
  solicitarAtualizacaoFeicoes(a) {
3230
3781
  if (this.profundidadeLote > 0) {
3231
- this.renderPendente = !0;
3782
+ this.renderPendente = !0, this.loteMudanca = $r(this.loteMudanca, a);
3232
3783
  return;
3233
3784
  }
3234
3785
  this.mudancaFeicoes = a, this.render();
3235
3786
  }
3236
3787
  /**
3237
- * Agrupa várias mutações (`adicionarFeicao` em laço, por exemplo) em uma só renderização, ao fim de `fn`.
3238
- * Mesmo com a atualização incremental, é a forma ideal para cargas grandes: o DOM é refeito uma só vez.
3788
+ * Agrupa várias mutações (`adicionarFeicao` em laço, por exemplo) em uma só atualização, ao fim de `fn`.
3789
+ * Se o lote só mexeu em feições, o DOM é atualizado por diferença (só as linhas que mudaram, dentro da janela
3790
+ * virtual); mudanças de camadas, expansão ou busca levam a um render completo.
3239
3791
  */
3240
3792
  emLote(a) {
3241
3793
  this.profundidadeLote++;
3242
3794
  try {
3243
3795
  a();
3244
3796
  } finally {
3245
- this.profundidadeLote--, this.profundidadeLote === 0 && this.renderPendente && (this.renderPendente = !1, this.render());
3797
+ if (this.profundidadeLote--, this.profundidadeLote === 0) {
3798
+ const r = this.renderPendente, i = this.loteExigeCompleto, o = this.loteMudanca;
3799
+ this.renderPendente = !1, this.loteExigeCompleto = !1, this.loteMudanca = null, r && (this.mudancaFeicoes = i ? null : o, this.render());
3800
+ }
3246
3801
  }
3247
3802
  }
3248
3803
  dispararEvento(a, r) {
@@ -3256,7 +3811,19 @@ const W = class W extends Ka {
3256
3811
  }
3257
3812
  render() {
3258
3813
  const a = this.mudancaFeicoes;
3259
- this.mudancaFeicoes = null, this.corpoElement && (a && ar(this, this.shadow, this.dragDropManager, a) || er(this, this.shadow, this.corpoElement, this.dragDropManager));
3814
+ if (this.mudancaFeicoes = null, !!this.corpoElement) {
3815
+ if (this.viewport || (this.viewport = this.lerViewport()), a) {
3816
+ const r = ei(this, this.shadow, this.dragDropManager, a, this.viewport);
3817
+ if (r.ok) {
3818
+ this.depoisDeAtualizacaoParcial(r);
3819
+ return;
3820
+ }
3821
+ }
3822
+ if (Zr(this, this.shadow, this.corpoElement, this.dragDropManager, this.viewport), this.chaveLinhaFocada) {
3823
+ const r = this.shadow.getElementById("ui-layer-tree-mount");
3824
+ r && ie(r, this.chaveLinhaFocada) && ga(r, this.chaveLinhaFocada);
3825
+ }
3826
+ }
3260
3827
  }
3261
3828
  // --- Conexão de Eventos ---
3262
3829
  conectarEventosGerais() {
@@ -3264,27 +3831,27 @@ const W = class W extends Ka {
3264
3831
  }
3265
3832
  // --- Sincronização de DOM (delegada) ---
3266
3833
  sincronizarCamadaAtivaDOM() {
3267
- St(this, this.shadow);
3834
+ hr(this, this.shadow);
3268
3835
  }
3269
3836
  sincronizarSelecaoDOM() {
3270
- Ft(this, this.shadow);
3837
+ gr(this, this.shadow);
3271
3838
  }
3272
3839
  // --- Auxiliares Internos ---
3273
3840
  notificarMudancaSelecao() {
3274
- pr(this);
3841
+ oi(this);
3275
3842
  }
3276
3843
  };
3277
3844
  /** Painéis conectados sem `id` nem `storage-key`: dividem a mesma chave de persistência. */
3278
- E(W, "instanciasChavePadrao", /* @__PURE__ */ new Set());
3279
- let re = W;
3280
- class Er extends re {
3845
+ E(X, "instanciasChavePadrao", /* @__PURE__ */ new Set());
3846
+ let se = X;
3847
+ class gi extends se {
3281
3848
  }
3282
- class Ir extends re {
3849
+ class vi extends se {
3283
3850
  }
3284
- Pe("ui-camadas", re);
3285
- Pe("ui-painel-camadas", Er);
3286
- Pe("ui-layer-panel", Ir);
3287
- function Pr(e) {
3851
+ Ne("ui-camadas", se);
3852
+ Ne("ui-painel-camadas", gi);
3853
+ Ne("ui-layer-panel", vi);
3854
+ function Ci(e) {
3288
3855
  var t;
3289
3856
  return {
3290
3857
  id: e.id,
@@ -3301,7 +3868,7 @@ function Pr(e) {
3301
3868
  dados: e.dados
3302
3869
  };
3303
3870
  }
3304
- function Br(e, t = "levantamento", a = "feicoes") {
3871
+ function Fi(e, t = "levantamento", a = "feicoes") {
3305
3872
  return {
3306
3873
  id: e.id,
3307
3874
  nome: e.name,
@@ -3320,9 +3887,9 @@ function Br(e, t = "levantamento", a = "feicoes") {
3320
3887
  dados: typeof e.dados == "object" && e.dados !== null ? e.dados : void 0
3321
3888
  };
3322
3889
  }
3323
- function qr(e, t = "") {
3324
- var o, n, s, d;
3325
- const a = ((o = e.geometria) == null ? void 0 : o.tipo) || ((n = e.geometria) == null ? void 0 : n.type) || e.tipo || e.type || "Polygon", r = ((s = e.geometria) == null ? void 0 : s.coordenadas) || ((d = e.geometria) == null ? void 0 : d.coordinates) || e.coordinates, i = e.cor || e.color;
3890
+ function Si(e, t = "") {
3891
+ var o, n, s, l;
3892
+ const a = ((o = e.geometria) == null ? void 0 : o.tipo) || ((n = e.geometria) == null ? void 0 : n.type) || e.tipo || e.type || "Polygon", r = ((s = e.geometria) == null ? void 0 : s.coordenadas) || ((l = e.geometria) == null ? void 0 : l.coordinates) || e.coordinates, i = e.cor || e.color;
3326
3893
  return {
3327
3894
  id: String(e.id),
3328
3895
  name: e.nome || e.name || `Feição ${e.id}`,
@@ -3339,45 +3906,47 @@ function qr(e, t = "") {
3339
3906
  };
3340
3907
  }
3341
3908
  export {
3342
- yt as CamadasDragDropManager,
3343
- y as ICONES,
3344
- De as LIMITE_FEICOES_POR_CAMADA,
3345
- oa as MAPAS_BASE_PADRAO,
3346
- re as UICamadas,
3347
- Ir as UILayerPanel,
3348
- Rr as UIMapaBase,
3349
- Er as UIPainelCamadas,
3350
- Or as UISeletorMapaBase,
3351
- we as calcularAreaAnelSimples,
3352
- ra as calcularAreaPoligono,
3353
- ta as calcularComprimentoLinha,
3354
- zr as calcularDistanciaPontos,
3355
- gt as calcularSelecaoFeicao,
3356
- ze as carregarEstadoPersistido,
3357
- ie as construirHierarquiaCamadas,
3358
- Br as converterCamadaItemParaCanvasLayer,
3359
- Pr as converterCanvasLayerParaCamadaItem,
3360
- qr as converterFeicaoParaItem,
3361
- z as escapeHtml,
3362
- be as filtrarCamadasPorBusca,
3363
- $e as filtrarFeicoesPorBusca,
3364
- Mr as formatarMetricaFeicoes,
3365
- sa as formatarOpcoesCamadasHierarquicas,
3366
- wt as gerarChaveStorage,
3367
- ba as indexarMetricasEscopo,
3368
- It as limparEstadoPersistido,
3369
- Ct as montarEstadoPersistido,
3370
- na as nomeDoMapaBase,
3371
- At as normalizarEstadoPersistido,
3372
- mt as obterFeicoesVisiveisNoEscopo,
3373
- ya as obterIdsVisiveisFeicoes,
3374
- kt as reidratarCamadasComOverrides,
3375
- Te as removerSelecoesInvalidas,
3376
- ht as renderizarArvoreCamadas,
3377
- tt as renderizarGridMapasBase,
3378
- it as renderizarRodapeAcoes,
3379
- ca as renderizarThumbGeometria,
3380
- la as rotuloRodape,
3381
- Et as salvarEstadoPersistido,
3382
- xa as snapshotCamada
3909
+ nr as CamadasDragDropManager,
3910
+ A as ICONES,
3911
+ _e as LIMITE_FEICOES_POR_CAMADA,
3912
+ Aa as MAPAS_BASE_PADRAO,
3913
+ se as UICamadas,
3914
+ vi as UILayerPanel,
3915
+ zi as UIMapaBase,
3916
+ gi as UIPainelCamadas,
3917
+ Pi as UISeletorMapaBase,
3918
+ Ce as calcularAreaAnelSimples,
3919
+ xa as calcularAreaPoligono,
3920
+ ya as calcularComprimentoLinha,
3921
+ Ii as calcularDistanciaPontos,
3922
+ Gt as calcularSelecaoFeicao,
3923
+ Te as carregarEstadoPersistido,
3924
+ te as construirHierarquiaCamadas,
3925
+ Fi as converterCamadaItemParaCanvasLayer,
3926
+ Ci as converterCanvasLayerParaCamadaItem,
3927
+ Si as converterFeicaoParaItem,
3928
+ S as escapeHtml,
3929
+ ke as filtrarCamadasPorBusca,
3930
+ Re as filtrarFeicoesPorBusca,
3931
+ ki as formatarMetricaFeicoes,
3932
+ Ia as formatarOpcoesCamadasHierarquicas,
3933
+ lr as gerarChaveStorage,
3934
+ Da as indexarMetricasEscopo,
3935
+ ur as limparEstadoPersistido,
3936
+ pr as montarEstadoPersistido,
3937
+ Ea as nomeDoMapaBase,
3938
+ cr as normalizarEstadoPersistido,
3939
+ Vt as obterFeicoesVisiveisNoEscopo,
3940
+ _t as obterIdsVisiveisFeicoes,
3941
+ fr as reidratarCamadasComOverrides,
3942
+ Ra as removerSelecoesInvalidas,
3943
+ Li as renderizarArvoreCamadas,
3944
+ Na as renderizarArvoreComPlano,
3945
+ rr as renderizarCorridaFeicoes,
3946
+ zt as renderizarGridMapasBase,
3947
+ qt as renderizarRodapeAcoes,
3948
+ Ca as renderizarThumbGeometria,
3949
+ ka as rotuloRodape,
3950
+ dr as salvarEstadoPersistido,
3951
+ Ha as snapshotCamada
3383
3952
  };