@thibezer/ui-components-kit 2.8.1 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +22 -103
  2. package/README.md +8 -32
  3. package/dist/botao.cjs +1 -1
  4. package/dist/botao.js +1 -1
  5. package/dist/camadas.cjs +110 -114
  6. package/dist/camadas.js +1177 -1343
  7. package/dist/campo-texto.cjs +1 -1
  8. package/dist/campo-texto.js +1 -1
  9. package/dist/canvas.cjs +63 -64
  10. package/dist/canvas.js +3544 -4025
  11. package/dist/card.cjs +1 -1
  12. package/dist/card.js +1 -1
  13. package/dist/components/ui-avatar/ui-avatar.d.ts +0 -11
  14. package/dist/components/ui-badge/ui-badge.d.ts +0 -2
  15. package/dist/components/ui-barra-ferramentas/ferramentas-comum.d.ts +22 -1
  16. package/dist/components/ui-barra-ferramentas/tipos.d.ts +31 -0
  17. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +17 -1
  18. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +17 -0
  19. package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +0 -2
  20. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -4
  21. package/dist/components/ui-camadas/camadas-drag-drop.d.ts +1 -13
  22. package/dist/components/ui-camadas/camadas-host.d.ts +0 -1
  23. package/dist/components/ui-camadas/camadas-mapas-base.d.ts +1 -3
  24. package/dist/components/ui-camadas/camadas-selecao.d.ts +0 -12
  25. package/dist/components/ui-camadas/ui-camadas.d.ts +5 -8
  26. package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +1 -2
  27. package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
  28. package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +8 -3
  29. package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +106 -39
  30. package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +1 -3
  31. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +1 -15
  32. package/dist/components/ui-checkbox/ui-checkbox.d.ts +1 -4
  33. package/dist/components/ui-cores/tipos.d.ts +0 -2
  34. package/dist/components/ui-cores/ui-controle-cores.d.ts +3 -8
  35. package/dist/components/ui-cores/ui-seletor-cor.d.ts +1 -3
  36. package/dist/components/ui-mapa/ui-mapa-linha.d.ts +5 -12
  37. package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +6 -15
  38. package/dist/components/ui-mapa/ui-mapa.d.ts +1 -14
  39. package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
  40. package/dist/components/ui-modal/ui-modal.d.ts +11 -1
  41. package/dist/components/ui-radio/radio-grupo-registry.d.ts +0 -10
  42. package/dist/components/ui-radio/ui-radio.d.ts +2 -9
  43. package/dist/components/ui-skeleton/ui-skeleton.d.ts +0 -9
  44. package/dist/components/ui-switch/ui-switch.d.ts +1 -3
  45. package/dist/components/ui-tabela/ui-tabela.d.ts +19 -1
  46. package/dist/components/ui-tooltip/ui-tooltip.d.ts +1 -24
  47. package/dist/core/index.d.ts +0 -1
  48. package/dist/core.cjs +1 -1
  49. package/dist/core.js +18 -28
  50. package/dist/cores.cjs +1 -1
  51. package/dist/cores.js +1 -1
  52. package/dist/custom-elements.json +13585 -18764
  53. package/dist/data.cjs +1 -1
  54. package/dist/data.js +2 -2
  55. package/dist/feedback.cjs +1 -1
  56. package/dist/feedback.js +2 -2
  57. package/dist/form-validacao-BIOXxt-1.js +140 -0
  58. package/dist/form-validacao-ytRYSF3E.cjs +1 -0
  59. package/dist/forms.cjs +1 -1
  60. package/dist/forms.js +2 -2
  61. package/dist/gerencigeo-canvas/canvas_interacao.d.ts +1 -0
  62. package/dist/gerencigeo-canvas/feature_metricas.d.ts +9 -0
  63. package/dist/gerencigeo-canvas/feature_popup.d.ts +0 -2
  64. package/dist/gerencigeo-canvas/mapa_core.d.ts +0 -6
  65. package/dist/index.cjs +1 -1
  66. package/dist/index.d.ts +0 -3
  67. package/dist/index.js +176 -179
  68. package/dist/mapa.cjs +16 -11
  69. package/dist/mapa.js +170 -242
  70. package/dist/modal.cjs +1 -1
  71. package/dist/modal.js +1 -1
  72. package/dist/register.cjs +1 -1
  73. package/dist/register.js +11 -11
  74. package/dist/svg-seguro-ChVJ2L2z.js +74 -0
  75. package/dist/svg-seguro-J2RM1Ssf.cjs +1 -0
  76. package/dist/tabela.cjs +1 -1
  77. package/dist/tabela.js +1 -1
  78. package/dist/tipos-elementos.d.ts +20 -48
  79. package/dist/tipos-react.d.ts +0 -2
  80. package/dist/tipos-vue.d.ts +15 -44
  81. package/dist/tools.cjs +1 -1
  82. package/dist/tools.js +1 -1
  83. package/dist/ui-badge-BxT-sDmV.cjs +28 -0
  84. package/dist/ui-badge-C0eKBI8E.js +183 -0
  85. package/dist/ui-botao-BOOnP8ds.cjs +12 -0
  86. package/dist/ui-botao-DfqSivHl.js +165 -0
  87. package/dist/ui-botao-OGJV6Vfk.js +165 -0
  88. package/dist/ui-botao-psS1juof.cjs +12 -0
  89. package/dist/ui-campo-texto-Cnn2UAkS.cjs +16 -0
  90. package/dist/{ui-campo-texto-B_OHVGiN.js → ui-campo-texto-Uu2dJE_0.js} +51 -51
  91. package/dist/ui-card-B86lJXTP.cjs +20 -0
  92. package/dist/{ui-card-BNYCQ7g-.js → ui-card-C_o5_0cB.js} +42 -50
  93. package/dist/ui-controle-cores-BS0WYPdi.js +572 -0
  94. package/dist/ui-controle-cores-Er6ZcQ7U.cjs +111 -0
  95. package/dist/ui-kit.css +1 -1
  96. package/dist/ui-modal-CvGFGh1h.cjs +18 -0
  97. package/dist/{ui-modal-BkYvNP0G.js → ui-modal-DBOtSTbR.js} +140 -116
  98. package/dist/ui-paleta-ferramentas-CEZYcN4J.js +624 -0
  99. package/dist/ui-paleta-ferramentas-CU4icLl0.js +1171 -0
  100. package/dist/{ui-paleta-ferramentas-bDLPbiGA.cjs → ui-paleta-ferramentas-Ccmo-rB5.cjs} +7 -7
  101. package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +21 -0
  102. package/dist/{ui-paleta-ferramentas-Ksh6gMW3.js → ui-paleta-ferramentas-DNN5i6nL.js} +329 -359
  103. package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +18 -0
  104. package/dist/ui-paleta-ferramentas-DbwdWVtT.js +1173 -0
  105. package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +21 -0
  106. package/dist/ui-segmented-D6b6zxVs.cjs +19 -0
  107. package/dist/ui-segmented-DyF5YLsV.js +418 -0
  108. package/dist/ui-segmented-rn9RxRGM.cjs +19 -0
  109. package/dist/{ui-linha-nCDh2wPm.js → ui-segmented-wUraId2e.js} +105 -200
  110. package/dist/ui-skeleton-DI4_9WOX.js +428 -0
  111. package/dist/{ui-skeleton-DiOxTBZK.cjs → ui-skeleton-SPYqku8P.cjs} +10 -10
  112. package/dist/{ui-skeleton-B2Rgrv8o.js → ui-skeleton-W9uwIceA.js} +191 -254
  113. package/dist/ui-skeleton-elhKIh2B.cjs +33 -0
  114. package/dist/{ui-switch-DO1R0Ce7.js → ui-switch-BcOqOkiV.js} +128 -187
  115. package/dist/ui-switch-D7iPKDj-.cjs +53 -0
  116. package/dist/ui-tabela-propriedades-BBr5sqki.cjs +145 -0
  117. package/dist/{ui-tabela-propriedades-DzZlyNZ_.cjs → ui-tabela-propriedades-BecPqC-e.cjs} +10 -10
  118. package/dist/{ui-tabela-propriedades-D9Echt2X.js → ui-tabela-propriedades-BokvDD3b.js} +826 -845
  119. package/dist/ui-tabela-propriedades-Boy7I5yW.js +2412 -0
  120. package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +141 -0
  121. package/dist/ui-tabela-propriedades-Df9ajC6M.js +2648 -0
  122. package/dist/ui-toast-Bp_NlM5G.js +156 -0
  123. package/dist/ui-toast-DGTZKne5.cjs +20 -0
  124. package/dist/zero-js-triggers-C_KrvFOQ.js +244 -0
  125. package/dist/zero-js-triggers-C_gtaojZ.cjs +1 -0
  126. package/package.json +3 -3
  127. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  128. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  129. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  130. package/dist/altura-controle-vxQiXG4q.js +0 -62
  131. package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +0 -16
  132. package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +0 -24
  133. package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +0 -14
  134. package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +0 -17
  135. package/dist/components/ui-camadas/camadas-colecao.d.ts +0 -27
  136. package/dist/components/ui-camadas/camadas-drop-ops.d.ts +0 -31
  137. package/dist/components/ui-camadas/camadas-hierarquia.d.ts +0 -10
  138. package/dist/components/ui-camadas/camadas-lembranca.d.ts +0 -34
  139. package/dist/components/ui-camadas/camadas-render.d.ts +0 -15
  140. package/dist/components/ui-camadas/camadas-renomear.d.ts +0 -12
  141. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +0 -17
  142. package/dist/components/ui-camadas/camadas-thumb.d.ts +0 -1
  143. package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +0 -15
  144. package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +0 -22
  145. package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +0 -26
  146. package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +0 -21
  147. package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +0 -39
  148. package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +0 -68
  149. package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +0 -37
  150. package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +0 -48
  151. package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +0 -28
  152. package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +0 -22
  153. package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +0 -53
  154. package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +0 -33
  155. package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +0 -5
  156. package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +0 -5
  157. package/dist/components/ui-canvas-cad/tipos.d.ts +0 -37
  158. package/dist/components/ui-linha/index.d.ts +0 -1
  159. package/dist/components/ui-linha/ui-linha.d.ts +0 -48
  160. package/dist/components/ui-mapa/mapa-atributos.d.ts +0 -14
  161. package/dist/components/ui-mapa/mapa-basemaps.d.ts +0 -7
  162. package/dist/components/ui-mapa/mapa-icones.d.ts +0 -4
  163. package/dist/components/ui-mapa/mapa-leaflet.d.ts +0 -5
  164. package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +0 -22
  165. package/dist/components/ui-mapa/tipos.d.ts +0 -13
  166. package/dist/components/ui-modal/modal-foco.d.ts +0 -28
  167. package/dist/components/ui-tabela/tabela-estados.d.ts +0 -16
  168. package/dist/components/ui-tabela/tabela-rolagem.d.ts +0 -44
  169. package/dist/components/ui-tabela/tabela-teclado.d.ts +0 -16
  170. package/dist/components/ui-tooltip/tooltip-popover.d.ts +0 -7
  171. package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +0 -29
  172. package/dist/core/altura-controle.d.ts +0 -34
  173. package/dist/core/opcoes.d.ts +0 -9
  174. package/dist/core/rotulo-controle.d.ts +0 -13
  175. package/dist/form-validacao-BlQFxUVj.js +0 -104
  176. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  177. package/dist/gerencigeo-canvas/popup_gate.d.ts +0 -30
  178. package/dist/gerencigeo-canvas/zoom_opcoes.d.ts +0 -10
  179. package/dist/opcoes-CJYLi6kd.js +0 -12
  180. package/dist/opcoes-CkyDxBuQ.cjs +0 -1
  181. package/dist/ui-badge-BWhoGgo9.js +0 -197
  182. package/dist/ui-badge-SIR81R9l.cjs +0 -28
  183. package/dist/ui-botao-D24oXySA.cjs +0 -12
  184. package/dist/ui-botao-Dsj08jjw.js +0 -165
  185. package/dist/ui-campo-texto-DauJCde3.cjs +0 -16
  186. package/dist/ui-card-BrjBL-yo.cjs +0 -20
  187. package/dist/ui-controle-cores-DgEza3wF.js +0 -612
  188. package/dist/ui-controle-cores-uY__TgwW.cjs +0 -117
  189. package/dist/ui-linha-C6HBnsaw.cjs +0 -19
  190. package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
  191. package/dist/ui-switch-D9a8XlVX.cjs +0 -53
@@ -0,0 +1,2648 @@
1
+ var ue = Object.defineProperty;
2
+ var pe = (t, r, e) => r in t ? ue(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
+ var b = (t, r, e) => pe(t, typeof r != "symbol" ? r + "" : r, e);
4
+ import { L as O } from "./listener-bag-DQgv7OON.js";
5
+ import { a as he } from "./parts-CaoQiCfI.js";
6
+ import { d as te, S as re } from "./ssr-safe-5cWfJP-s.js";
7
+ import { h as me } from "./svg-seguro-ChVJ2L2z.js";
8
+ class be {
9
+ constructor(r) {
10
+ b(this, "autoFetchController", null);
11
+ b(this, "emVoo", null);
12
+ this.ctx = r;
13
+ }
14
+ /**
15
+ * Busca os dados. Resolve `true` em sucesso e `false` em falha, cancelamento ou requisição
16
+ * substituída (nunca rejeita; o motivo da falha vai no evento `ui-fetch-erro`).
17
+ * Uma chamada com a mesma URL de uma requisição em andamento reaproveita essa requisição.
18
+ */
19
+ carregar(r) {
20
+ if (!r) return Promise.resolve(!1);
21
+ if (this.emVoo && this.emVoo.url === r && this.autoFetchController) return this.emVoo.promessa;
22
+ this.cancelarEmVoo();
23
+ const e = new AbortController();
24
+ this.autoFetchController = e;
25
+ const i = this.executar(r, e);
26
+ return this.emVoo = { url: r, promessa: i }, i;
27
+ }
28
+ emitir(r, e) {
29
+ this.ctx.host.dispatchEvent(new CustomEvent(r, { bubbles: !0, composed: !0, detail: e }));
30
+ }
31
+ erro(r, e, i, o) {
32
+ const a = e instanceof Error ? e.message : String(e);
33
+ console.error("[ui-tabela] Erro ao carregar dados remotos:", e);
34
+ const n = { url: r, erro: a, origem: i };
35
+ o !== void 0 && (n.status = o), this.emitir("ui-fetch-erro", n);
36
+ }
37
+ async executar(r, e) {
38
+ var s, d, c, l;
39
+ const i = () => this.autoFetchController === e, o = () => {
40
+ this.autoFetchController === e && (this.autoFetchController = null, this.emVoo = null);
41
+ };
42
+ this.ctx.onCarregandoAlterado(!0), this.emitir("ui-fetch-start", { url: r });
43
+ let a = "rede", n;
44
+ try {
45
+ const u = { ...((d = (s = this.ctx).getOpcoes) == null ? void 0 : d.call(s)) ?? {}, signal: e.signal }, h = await (((l = (c = this.ctx).getFetcher) == null ? void 0 : l.call(c)) ?? ((f, _) => fetch(f, _)))(r, u);
46
+ if (!h.ok)
47
+ throw a = "http", n = h.status, new Error(`HTTP ${h.status}: ${h.statusText}`);
48
+ a = "json";
49
+ const m = await h.json(), x = Array.isArray(m) ? m : (m == null ? void 0 : m.dados) || (m == null ? void 0 : m.items) || (m == null ? void 0 : m.data) || (m == null ? void 0 : m.rows) || [], g = Array.isArray(x) ? x : [];
50
+ return i() ? (a = "render", this.ctx.onDadosRecebidos(g), o(), this.ctx.onCarregandoAlterado(!1), this.emitir("ui-fetch-sucesso", { url: r, total: g.length, dados: g }), !0) : !1;
51
+ } catch (u) {
52
+ return (u == null ? void 0 : u.name) === "AbortError" ? (i() && (o(), this.ctx.onCarregandoAlterado(!1)), this.emitir("ui-fetch-cancelado", { url: r }), !1) : (i() && (o(), this.ctx.onCarregandoAlterado(!1), this.erro(r, u, a, n)), !1);
53
+ }
54
+ }
55
+ /** Cancela a requisição em andamento (se houver) e libera o indicador de carregamento. */
56
+ abortar() {
57
+ this.autoFetchController && (this.cancelarEmVoo(), this.ctx.onCarregandoAlterado(!1));
58
+ }
59
+ cancelarEmVoo() {
60
+ if (this.autoFetchController) {
61
+ const r = this.autoFetchController;
62
+ this.autoFetchController = null, this.emVoo = null, r.abort();
63
+ }
64
+ }
65
+ }
66
+ const ge = ["id", "_id", "codigo", "key"];
67
+ function fe(t, r) {
68
+ return t != null && (t === r || String(t) === String(r));
69
+ }
70
+ function Y(t, r) {
71
+ let e = -1;
72
+ return typeof t == "number" && Number.isInteger(t) ? e = t : typeof t == "string" && /^\d+$/.test(t.trim()) && (e = parseInt(t.trim(), 10)), e >= 0 && e < r ? e : -1;
73
+ }
74
+ function xe(t, r, e = "id", i = !1) {
75
+ if (!t || t.length === 0) return -1;
76
+ if (typeof r == "function")
77
+ return t.findIndex(r);
78
+ if (i) return Y(r, t.length);
79
+ const o = [e, ...ge.filter((a) => a !== e)];
80
+ for (const a of o) {
81
+ const n = t.findIndex((s) => !!s && typeof s == "object" && fe(s[a], r));
82
+ if (n !== -1) return n;
83
+ }
84
+ return Y(r, t.length);
85
+ }
86
+ class ve {
87
+ constructor(r) {
88
+ b(this, "itemSelecionado", null);
89
+ b(this, "indiceSelecionado", null);
90
+ this.ctx = r;
91
+ }
92
+ /** Mesmo objeto ou mesmo valor na chave configurada. */
93
+ indiceDoItem(r, e) {
94
+ const i = this.ctx.getChaveId(), o = r.indexOf(e);
95
+ return o >= 0 ? o : e[i] == null ? -1 : r.findIndex((a) => (a == null ? void 0 : a[i]) != null && String(a[i]) === String(e[i]));
96
+ }
97
+ getItemSelecionado() {
98
+ return this.itemSelecionado;
99
+ }
100
+ setItemSelecionado(r) {
101
+ this.itemSelecionado = r;
102
+ const e = r ? this.indiceDoItem(this.ctx.getDadosExibicao(), r) : -1;
103
+ this.indiceSelecionado = e >= 0 ? e : null, this.atualizarLinhasSelecionadas();
104
+ }
105
+ getIndiceSelecionado() {
106
+ return this.indiceSelecionado;
107
+ }
108
+ setIndiceSelecionado(r) {
109
+ const e = this.ctx.getDadosExibicao(), i = r !== null && r >= 0 && r < e.length;
110
+ this.indiceSelecionado = i ? r : null, this.itemSelecionado = i ? e[r] : null, this.atualizarLinhasSelecionadas();
111
+ }
112
+ /**
113
+ * Reaplica a seleção após ordenar, filtrar ou trocar os dados.
114
+ * - Item ainda exibido: atualiza o índice (e a referência, se veio um objeto novo com a mesma chave).
115
+ * - Item só escondido pelo filtro: mantém a seleção (sem índice) para reaparecer ao limpar o filtro.
116
+ * - Item removido dos dados: limpa a seleção e emite `ui-selecao-removida`.
117
+ */
118
+ reconciliar() {
119
+ const r = this.itemSelecionado;
120
+ if (!r) {
121
+ this.indiceSelecionado = null;
122
+ return;
123
+ }
124
+ const e = this.ctx.getDadosExibicao(), i = this.indiceDoItem(e, r);
125
+ if (i >= 0) {
126
+ this.indiceSelecionado = i, this.substituirReferencia(r, e[i]);
127
+ return;
128
+ }
129
+ this.indiceSelecionado = null;
130
+ const o = this.ctx.getDadosOriginais(), a = this.indiceDoItem(o, r);
131
+ if (a >= 0) {
132
+ this.substituirReferencia(r, o[a]);
133
+ return;
134
+ }
135
+ this.itemSelecionado = null, this.ctx.host.dispatchEvent(
136
+ new CustomEvent("ui-selecao-removida", { bubbles: !0, composed: !0, detail: { item: r } })
137
+ );
138
+ }
139
+ /** Mesmo registro com outro objeto (dados recarregados): atualiza a referência e avisa. */
140
+ substituirReferencia(r, e) {
141
+ this.itemSelecionado = e, r !== e && this.ctx.host.dispatchEvent(
142
+ new CustomEvent("ui-selecao-atualizada", { bubbles: !0, composed: !0, detail: { item: e, anterior: r } })
143
+ );
144
+ }
145
+ limparSelecao() {
146
+ this.itemSelecionado = null, this.indiceSelecionado = null, this.atualizarLinhasSelecionadas();
147
+ }
148
+ isItemSelecionado(r, e) {
149
+ if (this.itemSelecionado) {
150
+ if (this.itemSelecionado === r) return !0;
151
+ const i = this.ctx.getChaveId();
152
+ if (r[i] != null && this.itemSelecionado[i] != null)
153
+ return String(r[i]) === String(this.itemSelecionado[i]);
154
+ if (r.id != null && this.itemSelecionado.id != null)
155
+ return String(r.id) === String(this.itemSelecionado.id);
156
+ }
157
+ return this.indiceSelecionado !== null && this.indiceSelecionado === e;
158
+ }
159
+ atualizarLinhasSelecionadas() {
160
+ const r = this.ctx.getTbody();
161
+ if (!r) return;
162
+ const e = this.ctx.getDadosExibicao();
163
+ r.querySelectorAll("tr:not(.ui-tabela__virtual-spacer)").forEach((o) => {
164
+ const a = o.getAttribute("data-index"), n = a !== null ? parseInt(a, 10) : -1, s = n >= 0 ? e[n] : null, d = s ? this.isItemSelecionado(s, n) : !1;
165
+ o.classList.toggle("ui-tabela__tr--selecionada", d), he(o, "linha-selecionada", d), d ? (o.setAttribute("data-selecionada", "true"), o.setAttribute("aria-current", "true"), o.setAttribute("aria-selected", "true")) : (o.removeAttribute("data-selecionada"), o.removeAttribute("aria-current"), o.setAttribute("aria-selected", "false"));
166
+ });
167
+ }
168
+ rolarPara(r, e) {
169
+ const i = this.ctx.getDadosExibicao(), o = xe(i, r, this.ctx.getChaveId(), (e == null ? void 0 : e.porIndice) === !0);
170
+ if (o === -1)
171
+ return !1;
172
+ if (e != null && e.selecionar) {
173
+ const a = i[o];
174
+ this.itemSelecionado = a, this.indiceSelecionado = o, this.atualizarLinhasSelecionadas(), this.ctx.onLinhaAtiva(o), this.ctx.host.dispatchEvent(
175
+ new CustomEvent("ui-linha-selecionada", {
176
+ bubbles: !0,
177
+ composed: !0,
178
+ detail: { item: a, indice: o }
179
+ })
180
+ );
181
+ }
182
+ return this.ctx.onRolarParaIndice(o, (e == null ? void 0 : e.comportamento) || "smooth");
183
+ }
184
+ }
185
+ function _e(t, r, e) {
186
+ return t !== e ? {
187
+ idColuna: e,
188
+ direcao: "asc"
189
+ } : r === "asc" ? {
190
+ idColuna: e,
191
+ direcao: "desc"
192
+ } : r === "desc" ? {
193
+ idColuna: null,
194
+ direcao: "original"
195
+ } : {
196
+ idColuna: e,
197
+ direcao: "asc"
198
+ };
199
+ }
200
+ const Ee = new Intl.Collator("pt-BR", { numeric: !0, sensitivity: "base" });
201
+ function G(t) {
202
+ if (t instanceof Date) return t.getTime();
203
+ if (typeof t == "number") return t;
204
+ const r = String(t).trim(), e = /^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T](\d{1,2}):(\d{2}))?$/.exec(r);
205
+ return e ? new Date(+e[3], +e[2] - 1, +e[1], +(e[4] ?? 0), +(e[5] ?? 0)).getTime() : Date.parse(r);
206
+ }
207
+ function ye(t, r, e) {
208
+ if (e === "data" || !e && (t instanceof Date || r instanceof Date)) {
209
+ const i = G(t), o = G(r);
210
+ if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
211
+ } else if (e === "numero" || !e && typeof t == "number" && typeof r == "number") {
212
+ const i = Number(t), o = Number(r);
213
+ if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
214
+ } else if (e === "booleano" || !e && typeof t == "boolean" && typeof r == "boolean")
215
+ return +!!t - +!!r;
216
+ return Ee.compare(String(t), String(r));
217
+ }
218
+ function we(t, r, e, i) {
219
+ if (!r || e === "original")
220
+ return [...t];
221
+ const o = e === "desc" ? -1 : 1;
222
+ return [...t].sort((a, n) => {
223
+ const s = a[r], d = n[r], c = s == null, l = d == null;
224
+ return c || l ? c === l ? 0 : c ? 1 : -1 : i != null && i.comparador ? i.comparador(s, d, a, n) * o : s === d ? 0 : ye(s, d, i == null ? void 0 : i.tipo) * o;
225
+ });
226
+ }
227
+ function V(t) {
228
+ return t.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
229
+ }
230
+ class Ce {
231
+ constructor() {
232
+ b(this, "dadosOriginais", []);
233
+ b(this, "dadosExibicao", []);
234
+ b(this, "colunaOrdenada", null);
235
+ b(this, "direcaoOrdenacao", "original");
236
+ b(this, "ultimoFiltro", "");
237
+ /** Colunas declaradas: o filtro olha só elas (vazio = todos os campos do registro). */
238
+ b(this, "colunasFiltro", []);
239
+ b(this, "colunas", []);
240
+ /** Ordenação feita pelo servidor: a tabela guarda coluna/direção (indicador) mas não reordena os dados. */
241
+ b(this, "ordenacaoRemota", !1);
242
+ }
243
+ setColunas(r) {
244
+ this.colunas = r, this.colunaOrdenada && this.aplicarOrdenacao();
245
+ }
246
+ setOrdenacaoRemota(r) {
247
+ this.ordenacaoRemota !== r && (this.ordenacaoRemota = r, this.aplicarOrdenacao());
248
+ }
249
+ /** Restaura coluna/direção (ex.: `ui-sort` cancelado) e recalcula. */
250
+ restaurarOrdenacao(r, e) {
251
+ this.colunaOrdenada = r, this.direcaoOrdenacao = e, this.aplicarOrdenacao();
252
+ }
253
+ setColunasFiltro(r) {
254
+ this.colunasFiltro = r, this.ultimoFiltro && this.aplicarOrdenacao();
255
+ }
256
+ getDadosOriginais() {
257
+ return this.dadosOriginais;
258
+ }
259
+ setDadosOriginais(r) {
260
+ this.dadosOriginais = Array.isArray(r) ? r.filter((e) => e != null) : [], this.aplicarOrdenacao();
261
+ }
262
+ getDadosExibicao() {
263
+ return this.dadosExibicao;
264
+ }
265
+ getColunaOrdenada() {
266
+ return this.colunaOrdenada;
267
+ }
268
+ setColunaOrdenada(r) {
269
+ this.colunaOrdenada = r, r ? this.direcaoOrdenacao === "original" && (this.direcaoOrdenacao = "asc") : this.direcaoOrdenacao = "original", this.aplicarOrdenacao();
270
+ }
271
+ getDirecaoOrdenacao() {
272
+ return this.direcaoOrdenacao;
273
+ }
274
+ setDirecaoOrdenacao(r) {
275
+ this.direcaoOrdenacao = r || "original", this.direcaoOrdenacao === "original" && (this.colunaOrdenada = null), this.aplicarOrdenacao();
276
+ }
277
+ alternarOrdenacaoColuna(r) {
278
+ if (!r.ordenavel) return null;
279
+ const e = _e(this.colunaOrdenada, this.direcaoOrdenacao, r.id);
280
+ return this.colunaOrdenada = e.idColuna, this.direcaoOrdenacao = e.direcao, this.aplicarOrdenacao(), e;
281
+ }
282
+ /** Recalcula a lista exibida: filtro vigente e, sobre o resultado, a ordenação da coluna (valem juntos). */
283
+ aplicarOrdenacao() {
284
+ const r = this.ultimoFiltro, e = r ? this.dadosOriginais.filter((o) => this.casaFiltro(o, r)) : this.dadosOriginais, i = this.colunaOrdenada ? this.colunas.find((o) => o.id === this.colunaOrdenada) : null;
285
+ this.dadosExibicao = this.ordenacaoRemota ? [...e] : we(e, this.colunaOrdenada, this.direcaoOrdenacao, i);
286
+ }
287
+ casaFiltro(r, e) {
288
+ return (this.colunasFiltro.length > 0 ? this.colunasFiltro : Object.keys(r)).some((o) => {
289
+ const a = r[o], n = this.colunas.find((d) => d.id === o);
290
+ if (n != null && n.textoFiltro)
291
+ try {
292
+ if (V(String(n.textoFiltro(a, r) ?? "")).includes(e)) return !0;
293
+ } catch {
294
+ }
295
+ if (a == null || typeof a == "object" && !(a instanceof Date)) return !1;
296
+ const s = a instanceof Date ? `${a.toISOString()} ${a.toLocaleDateString("pt-BR")}` : String(a);
297
+ return V(s).includes(e);
298
+ });
299
+ }
300
+ /** Há um filtro de texto aplicado (o vazio vira "sem resultados"). */
301
+ temFiltro() {
302
+ return this.ultimoFiltro !== "";
303
+ }
304
+ filtrar(r) {
305
+ this.ultimoFiltro = V((r || "").trim()), this.aplicarOrdenacao();
306
+ }
307
+ }
308
+ const Ae = ':host{display:block;width:100%;box-sizing:border-box;font-family:inherit;color:var(--ui-cor-texto, #e1e1e6);position:relative}.ui-tabela-container{width:100%;max-width:100%;max-height:var(--ui-tabela-max-height, 500px);overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);background-color:var(--ui-cor-superficie, #141417);box-sizing:border-box;position:relative}.ui-tabela{width:100%;border-collapse:separate;border-spacing:0;text-align:left;font-size:14px;font-family:var(--ui-fonte-base, inherit);font-variant-numeric:tabular-nums}.ui-tabela thead{background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}.ui-tabela th{position:sticky;top:0;z-index:10;padding:10px 16px;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto-secundario, #9696a6);font-size:13px;font-weight:600;letter-spacing:.02em;border-bottom:2px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box}.ui-tabela th[aria-sort=ascending],.ui-tabela th[aria-sort=descending]{color:var(--ui-cor-texto, #e1e1e6)}.ui-tabela__resizer{position:absolute;top:0;right:0;width:8px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;touch-action:none;z-index:20;background:linear-gradient(var(--ui-cor-borda, rgba(255, 255, 255, .12)),var(--ui-cor-borda, rgba(255, 255, 255, .12))) center / 1px 60% no-repeat;transition:background-color .15s ease}.ui-tabela__resizer:hover,.ui-tabela__resizer:focus-visible,.ui-tabela__resizer--ativo{background:var(--ui-cor-primaria, #00E08A);outline:none}:host([densidade="compacta"]) th,:host([densidade="compacta"]) td,:host([density="compact"]) th,:host([density="compact"]) td{padding:4px 8px}:host([densidade="normal"]) th,:host([densidade="normal"]) td,:host([density="normal"]) th,:host([density="normal"]) td{padding:10px 16px}:host([densidade="relaxada"]) th,:host([densidade="relaxada"]) td,:host([density="relaxed"]) th,:host([density="relaxed"]) td{padding:16px 20px}:host([altura-linha]) td,:host([row-height]) td{height:var(--ui-tabela-altura-linha);box-sizing:border-box;padding-top:0;padding-bottom:0;overflow:hidden;white-space:nowrap}.ui-tabela__header-content{display:inline-flex;align-items:center;vertical-align:middle;width:100%;box-sizing:border-box}.ui-tabela__header-text{margin-right:var(--ui-tabela-th-gap, 6px);display:inline-block;min-width:0;overflow:hidden;text-overflow:ellipsis}.ui-tabela__sort-icon{width:var(--ui-tabela-th-icone, 16px);min-width:var(--ui-tabela-th-icone, 16px);flex:none;display:inline-flex;justify-content:center;align-items:center}.ui-tabela th.ui-tabela__th--ordenavel{cursor:pointer}@media (hover: hover){.ui-tabela th.ui-tabela__th--ordenavel:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,var(--ui-cor-fundo-elevado, #1a1a1e));color:var(--ui-cor-texto, #e1e1e6)}}.ui-tabela__ordenar{all:unset;display:flex;width:100%;box-sizing:border-box;cursor:pointer;font:inherit;color:inherit;text-align:inherit}.ui-tabela__ordenar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-radius:var(--ui-raio-sm, 4px)}.ui-tabela tbody tr:focus{outline:none}.ui-tabela tbody tr:focus-visible{outline:2px solid var(--ui-tabela-cor-foco, var(--ui-cor-texto, #e1e1e6));outline-offset:-2px;background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}.ui-tabela__sort-arrow{display:inline-block;width:14px;height:14px;vertical-align:middle;shape-rendering:geometricPrecision;fill:var(--ui-cor-primaria, #00E08A)}.ui-tabela__sort-arrow path{transition:opacity .15s ease;opacity:.35}.ui-tabela__sort-arrow--asc .seta-cima,.ui-tabela__sort-arrow--desc .seta-baixo{opacity:1}.ui-tabela__sort-arrow--inativo{fill:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__sort-arrow--inativo path{opacity:.6}.ui-tabela td{padding:10px 16px;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-borda, rgba(255, 255, 255, .12)) 60%,transparent);white-space:nowrap;vertical-align:middle;color:var(--ui-cor-texto, #e1e1e6);box-sizing:border-box}.ui-tabela__cell-content{display:inline-flex;align-items:center;vertical-align:middle}.ui-tabela__cell-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.ui-tabela--alinhar-esquerda{text-align:left}.ui-tabela--alinhar-esquerda .ui-tabela__header-content,.ui-tabela--alinhar-esquerda .ui-tabela__cell-content{justify-content:flex-start}.ui-tabela--alinhar-centro{text-align:center}.ui-tabela--alinhar-centro .ui-tabela__header-content,.ui-tabela--alinhar-centro .ui-tabela__cell-content{justify-content:center}.ui-tabela--alinhar-direita{text-align:right}.ui-tabela--alinhar-direita .ui-tabela__header-content,.ui-tabela--alinhar-direita .ui-tabela__cell-content{justify-content:flex-end}.ui-tabela tbody tr[data-index]{cursor:pointer}.ui-tabela tbody tr.ui-tabela__tr--par{background-color:var(--ui-tabela-zebra, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 4%, transparent))}@media (hover: hover){.ui-tabela tbody tr[data-index]:hover{background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}}.ui-tabela tbody tr[data-index]:active{background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 12%, transparent))}:host(:not([selecionar-texto])) .ui-tabela tbody td{-webkit-user-select:none;user-select:none}.ui-tabela tbody tr.ui-tabela__tr--selecionada,.ui-tabela tbody tr[data-selecionada=true]{background-color:var(--ui-tabela-selecionada, var(--ui-cor-linha-selecionada, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 14%, transparent)))}.ui-tabela tbody tr.ui-tabela__tr--selecionada td:first-child,.ui-tabela tbody tr[data-selecionada=true] td:first-child{box-shadow:inset 3px 0 0 var(--ui-cor-primaria, #00E08A)}@media (hover: hover){.ui-tabela tbody tr.ui-tabela__tr--selecionada:hover,.ui-tabela tbody tr[data-selecionada=true]:hover{background-color:var(--ui-tabela-selecionada-hover, var(--ui-cor-linha-selecionada-hover, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 22%, transparent)))}}.ui-tabela__virtual-spacer td{padding:0!important;border:none!important;height:inherit;background:transparent!important}.ui-tabela__empty{padding:40px 24px;text-align:center;color:var(--ui-cor-texto-secundario, #9696a6);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;box-sizing:border-box}.ui-tabela__empty-icon{width:32px;height:32px;opacity:.5;fill:currentColor}.ui-tabela__empty-text{font-size:14px;font-weight:500;color:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__erro{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px;padding:10px 14px;border:1px solid var(--ui-cor-texto-erro, #ff5555);border-left-width:4px;border-radius:var(--ui-raio-borda, 6px);background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 10%,transparent);color:var(--ui-cor-texto, #e1e1e6);font-size:14px;box-sizing:border-box}.ui-tabela__erro-texto{flex:1 1 200px;min-width:0}.ui-tabela__erro-detalhe{display:block;margin-top:2px;font-size:12px;color:var(--ui-cor-texto-secundario, #9696a6);overflow-wrap:anywhere}.ui-tabela__erro-acao,.ui-tabela__prompt-actions button{background:var(--ui-cor-botao-secundario-fundo, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));padding:6px 12px;border-radius:var(--ui-raio-sm, 4px);font:inherit;cursor:pointer}.ui-tabela__erro-acao:hover,.ui-tabela__prompt-actions button:hover{background:var(--ui-cor-botao-secundario-hover, rgba(255, 255, 255, .2))}.ui-tabela__erro-acao:focus-visible,.ui-tabela__prompt-actions button:focus-visible,.ui-tabela__prompt-dialog input:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px}.ui-tabela__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-tabela__loading{position:absolute;top:0;left:0;right:0;bottom:0;background-color:color-mix(in srgb,var(--ui-cor-superficie, #141417) 72%,transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:50;color:var(--ui-cor-texto, #e1e1e6);font-size:14px}.ui-tabela__spinner{width:32px;height:32px;border:3px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent);border-top-color:var(--ui-cor-primaria, #00E08A);border-radius:50%;animation:ui-tabela-spin .8s linear infinite}@keyframes ui-tabela-spin{to{transform:rotate(360deg)}}.ui-tabela__prompt-dialog{margin:0;max-width:calc(100vw - 16px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));border-radius:var(--ui-raio-borda, 6px);background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto, #e1e1e6);padding:12px;box-shadow:var(--ui-sombra-lg, 0 8px 32px rgba(0, 0, 0, .8));font-family:inherit;font-size:14px}.ui-tabela__prompt-dialog::backdrop{background:#0000004d}.ui-tabela__prompt-title{display:block;margin-bottom:8px;font-weight:500}.ui-tabela__prompt-dialog input{width:100%;padding:6px 8px;border-radius:var(--ui-raio-sm, 4px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));background:var(--ui-cor-superficie, #141417);color:var(--ui-cor-texto, #e1e1e6);margin-bottom:8px;box-sizing:border-box;font:inherit}.ui-tabela__prompt-dialog input[aria-invalid=true]{border-color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-erro{min-height:1.2em;margin-bottom:8px;font-size:12px;color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-actions{display:flex;justify-content:flex-end;gap:8px}.ui-tabela__prompt-actions button:last-child{background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000);font-weight:600}.ui-tabela__prompt-actions button:last-child:hover{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 85%,var(--ui-cor-texto, #e1e1e6))}@media (pointer: coarse){.ui-tabela__resizer{width:16px}:host(:not([altura-linha]):not([row-height])) .ui-tabela tbody tr[data-index]{height:44px}}@media (max-width: 640px){.ui-tabela th{padding:8px 10px;font-size:12px}.ui-tabela td{padding:8px 10px;font-size:13px}}@media (prefers-reduced-motion: reduce){.ui-tabela__resizer,.ui-tabela__sort-arrow path{transition:none}.ui-tabela__spinner{animation-duration:2.4s}}';
309
+ function oe(t) {
310
+ return t == null || t === "" ? "" : typeof t == "number" ? `${t}px` : t;
311
+ }
312
+ function ie(t) {
313
+ return t === "centro" || t === "center" ? "ui-tabela--alinhar-centro" : t === "direita" || t === "right" ? "ui-tabela--alinhar-direita" : "ui-tabela--alinhar-esquerda";
314
+ }
315
+ function ae(t) {
316
+ return t === "centro" || t === "center" ? "center" : t === "direita" || t === "right" ? "right" : "left";
317
+ }
318
+ function K(t) {
319
+ return t === "compacta" ? 30 : t === "relaxada" ? 56 : 42;
320
+ }
321
+ function ke(t, r, e, i) {
322
+ t.innerHTML = `<style>${Ae}</style>`;
323
+ const o = document.createElement("div");
324
+ o.className = "ui-tabela-container", o.setAttribute("part", "base"), e && (o.style.maxHeight = e);
325
+ const a = document.createElement("div");
326
+ a.className = "ui-tabela__empty", a.setAttribute("part", "vazio"), a.style.display = "none", a.setAttribute("role", "status");
327
+ const n = document.createElement("div");
328
+ n.innerHTML = `
329
+ <svg class="ui-tabela__empty-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
330
+ <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"/>
331
+ </svg>`;
332
+ const s = document.createElement("span");
333
+ s.className = "ui-tabela__empty-text", s.textContent = r, a.appendChild(n), a.appendChild(s);
334
+ const d = document.createElement("table");
335
+ d.className = "ui-tabela", d.setAttribute("part", "tabela"), d.setAttribute("role", "grid");
336
+ const c = document.createElement("colgroup"), l = document.createElement("thead"), u = document.createElement("tbody");
337
+ d.appendChild(c), d.appendChild(l), d.appendChild(u);
338
+ const p = document.createElement("div");
339
+ p.className = "ui-tabela__erro", p.setAttribute("part", "erro"), p.setAttribute("role", "alert"), p.style.display = "none";
340
+ const h = document.createElement("div");
341
+ h.className = "ui-tabela__erro-texto";
342
+ const m = document.createElement("span");
343
+ m.className = "ui-tabela__erro-mensagem";
344
+ const x = document.createElement("span");
345
+ x.className = "ui-tabela__erro-detalhe", h.appendChild(m), h.appendChild(x);
346
+ const g = document.createElement("button");
347
+ g.type = "button", g.className = "ui-tabela__erro-acao", g.setAttribute("part", "erro-acao"), g.textContent = "Tentar novamente", p.appendChild(h), p.appendChild(g);
348
+ const f = document.createElement("div");
349
+ f.className = "ui-tabela__sr", f.setAttribute("role", "status"), f.setAttribute("aria-live", "polite"), o.appendChild(p), o.appendChild(d), o.appendChild(a), o.appendChild(f);
350
+ const _ = document.createElement("div");
351
+ return _.className = "ui-tabela__loading", _.setAttribute("part", "carregando"), _.setAttribute("role", "status"), _.setAttribute("aria-live", "polite"), _.style.display = i ? "flex" : "none", _.innerHTML = `
352
+ <div class="ui-tabela__spinner" aria-hidden="true"></div>
353
+ <span class="ui-tabela__loading-texto">Carregando dados...</span>
354
+ `, o.appendChild(_), t.appendChild(o), {
355
+ containerElement: o,
356
+ tableElement: d,
357
+ theadElement: l,
358
+ tbodyElement: u,
359
+ colgroupElement: c,
360
+ emptyElement: a,
361
+ loadingElement: _,
362
+ erroElement: p,
363
+ anuncioElement: f
364
+ };
365
+ }
366
+ function ze(t) {
367
+ var a, n;
368
+ if (!t.theadElement || !t.colgroupElement) return;
369
+ t.headerListeners.cleanup();
370
+ const e = t.theadElement.getRootNode().activeElement, i = e && t.theadElement.contains(e) ? ((a = e.closest("th")) == null ? void 0 : a.getAttribute("data-coluna")) ?? null : null;
371
+ t.theadElement.innerHTML = "", t.colgroupElement.innerHTML = "";
372
+ const o = document.createElement("tr");
373
+ if (o.setAttribute("aria-rowindex", "1"), t.colunas.forEach((s, d) => {
374
+ const c = document.createElement("col");
375
+ s.largura !== void 0 && (c.style.width = t.formatWidth(s.largura)), t.colgroupElement.appendChild(c);
376
+ const l = document.createElement("th"), u = t.getAlignmentClass(s.alinhamento);
377
+ if (l.className = u, l.setAttribute("part", "celula-cabecalho"), l.scope = "col", l.setAttribute("data-coluna", s.id), l.style.textAlign = t.getTextAlign(s.alinhamento), s.largura !== void 0 && (l.style.width = t.formatWidth(s.largura)), s.larguraMinima !== void 0 && (l.style.minWidth = t.formatWidth(s.larguraMinima)), s.larguraMaxima !== void 0) {
378
+ const v = t.formatWidth(s.larguraMaxima);
379
+ l.style.maxWidth = v, l.style.overflow = "hidden", l.style.textOverflow = "ellipsis", l.style.whiteSpace = "nowrap";
380
+ }
381
+ s.tooltip && (l.title = s.tooltip);
382
+ const p = !!s.ordenavel && t.colunaOrdenada === s.id && t.direcaoOrdenacao !== "original", h = p && t.direcaoOrdenacao === "desc";
383
+ if (s.ordenavel) {
384
+ l.classList.add("ui-tabela__th--ordenavel");
385
+ const v = () => t.onHeaderClick(s);
386
+ t.headerListeners.add(l, "click", v), l.setAttribute("aria-sort", p ? h ? "descending" : "ascending" : "none");
387
+ }
388
+ const m = (v) => t.onHeaderContextMenu(v, s, d, l);
389
+ t.headerListeners.add(l, "contextmenu", m);
390
+ const x = document.createElement("div");
391
+ x.className = "ui-tabela__header-content";
392
+ const g = document.createElement("span");
393
+ if (g.className = "ui-tabela__header-text", g.textContent = s.rotulo, x.appendChild(g), s.ordenavel) {
394
+ const v = document.createElement("span");
395
+ v.className = "ui-tabela__sort-icon";
396
+ const E = p ? h ? "ui-tabela__sort-arrow--desc" : "ui-tabela__sort-arrow--asc" : "ui-tabela__sort-arrow--inativo";
397
+ v.setAttribute("aria-hidden", "true"), v.innerHTML = `<svg class="ui-tabela__sort-arrow ${E}" viewBox="0 0 24 24" focusable="false"><path class="seta-cima" d="M7 11l5-5 5 5H7z"/><path class="seta-baixo" d="M7 13l5 5 5-5H7z"/></svg>`, x.appendChild(v);
398
+ }
399
+ if (s.ordenavel) {
400
+ const v = document.createElement("button");
401
+ v.type = "button", v.className = "ui-tabela__ordenar", v.setAttribute("part", "ordenar"), v.appendChild(x), l.appendChild(v);
402
+ } else
403
+ l.appendChild(x);
404
+ const f = document.createElement("div");
405
+ f.className = "ui-tabela__resizer", f.setAttribute("part", "redimensionador"), f.title = "Arrastar para redimensionar largura (duplo-clique para auto-ajuste)", f.tabIndex = 0, f.setAttribute("role", "separator"), f.setAttribute("aria-orientation", "vertical"), f.setAttribute("aria-label", `Redimensionar coluna ${s.rotulo}`);
406
+ const _ = (v) => t.onInitColumnResize(v, s, d, l, f);
407
+ t.headerListeners.add(f, "mousedown", _);
408
+ const y = (v) => {
409
+ const E = v;
410
+ E.pointerType === "mouse" || !E.pointerType || t.onInitColumnResize(E, s, d, l, f);
411
+ };
412
+ t.headerListeners.add(f, "pointerdown", y);
413
+ const A = (v) => {
414
+ var N, D;
415
+ const E = v, R = E.shiftKey ? 50 : 10;
416
+ if (E.key === "ArrowRight")
417
+ E.preventDefault(), (N = t.onResizeTeclado) == null || N.call(t, R, s, d, l, c);
418
+ else if (E.key === "ArrowLeft")
419
+ E.preventDefault(), (D = t.onResizeTeclado) == null || D.call(t, -R, s, d, l, c);
420
+ else if (E.key === "Enter" || E.key === "F2") {
421
+ E.preventDefault();
422
+ const C = l.getBoundingClientRect();
423
+ t.onHeaderContextMenu(new MouseEvent("contextmenu", { clientX: C.left, clientY: C.bottom }), s, d, l);
424
+ }
425
+ };
426
+ t.headerListeners.add(f, "keydown", A);
427
+ const w = (v) => {
428
+ v.stopPropagation(), t.onColumnAutoFit(s, l, c);
429
+ };
430
+ t.headerListeners.add(f, "dblclick", w), t.headerListeners.add(f, "click", (v) => v.stopPropagation()), l.appendChild(f), o.appendChild(l);
431
+ }), t.theadElement.appendChild(o), i !== null) {
432
+ const s = Array.from(o.children).find((d) => d.getAttribute("data-coluna") === i);
433
+ (n = s == null ? void 0 : s.querySelector(".ui-tabela__ordenar")) == null || n.focus();
434
+ }
435
+ }
436
+ const Se = 'button, input, select, textarea, a, summary, [role="button"], [data-prevent-select]';
437
+ function Le(t, r) {
438
+ for (const e of t.composedPath()) {
439
+ if (e === r) return !1;
440
+ if (e instanceof Element && e.matches(Se)) return !0;
441
+ }
442
+ return !1;
443
+ }
444
+ function Me(t) {
445
+ if (!t.tbodyElement || !t.tableElement || !t.emptyElement || !t.containerElement) return;
446
+ if (t.tableElement.setAttribute("aria-colcount", String(t.colunas.length)), !t.dadosExibicao || t.dadosExibicao.length === 0) {
447
+ t.tbodyElement.innerHTML = "", t.tableElement.setAttribute("aria-rowcount", "1"), t.tableElement.style.display = t.colunas.length > 0 ? "table" : "none", t.emptyElement.style.display = "flex";
448
+ const p = t.emptyElement.querySelector(".ui-tabela__empty-text"), h = t.filtroAtivo ? t.textoSemResultados : t.textoVazio;
449
+ p && h !== void 0 && (p.textContent = h);
450
+ return;
451
+ }
452
+ t.emptyElement.style.display = "none", t.tableElement.style.display = "table", t.tableElement.setAttribute("aria-rowcount", String(t.dadosExibicao.length + 1));
453
+ const r = t.dadosExibicao.length, e = t.rowHeight, i = t.virtualizar && r > 30;
454
+ let o = 0, a = r;
455
+ if (i) {
456
+ const p = t.containerElement.scrollTop, h = t.containerElement.clientHeight || 400, m = 5;
457
+ o = Math.max(0, Math.floor(p / e) - m), a = Math.min(r, Math.ceil((p + h) / e) + m);
458
+ }
459
+ const s = t.tbodyElement.getRootNode().activeElement, d = s && s.parentElement === t.tbodyElement ? s.getAttribute("data-index") : null, c = t.indiceAtivo ?? null, l = c !== null && c >= o && c < a ? c : o;
460
+ t.tbodyElement.innerHTML = "";
461
+ const u = document.createDocumentFragment();
462
+ if (i && o > 0) {
463
+ const p = document.createElement("tr");
464
+ p.className = "ui-tabela__virtual-spacer", p.setAttribute("aria-hidden", "true"), p.style.height = `${o * e}px`;
465
+ const h = document.createElement("td");
466
+ h.colSpan = t.colunas.length || 1, p.appendChild(h), u.appendChild(p);
467
+ }
468
+ for (let p = o; p < a; p++) {
469
+ const h = t.dadosExibicao[p], m = document.createElement("tr");
470
+ m.setAttribute("data-index", String(p)), m.setAttribute("part", "linha"), m.setAttribute("aria-rowindex", String(p + 2)), m.setAttribute("aria-selected", "false"), m.tabIndex = p === l ? 0 : -1, p % 2 === 1 && m.classList.add("ui-tabela__tr--par");
471
+ const x = t.chaveId;
472
+ h[x] !== void 0 ? m.setAttribute("data-id", String(h[x])) : h.id !== void 0 ? m.setAttribute("data-id", String(h.id)) : h._id !== void 0 && m.setAttribute("data-id", String(h._id)), t.isItemSelecionado(h, p) && (m.classList.add("ui-tabela__tr--selecionada"), m.setAttribute("part", "linha linha-selecionada"), m.setAttribute("aria-current", "true"), m.setAttribute("aria-selected", "true"), m.setAttribute("data-selecionada", "true")), m.addEventListener("click", (g) => {
473
+ Le(g, m) || t.onLinhaClique(h, p);
474
+ }), t.colunas.forEach((g) => {
475
+ const f = document.createElement("td"), _ = t.getAlignmentClass(g.alinhamento);
476
+ if (f.className = _, f.setAttribute("part", "celula"), f.style.textAlign = t.getTextAlign(g.alinhamento), g.larguraMaxima !== void 0) {
477
+ const w = t.formatWidth(g.larguraMaxima);
478
+ f.style.maxWidth = w, f.style.overflow = "hidden", f.style.textOverflow = "ellipsis", f.style.whiteSpace = "nowrap";
479
+ }
480
+ const y = document.createElement("div");
481
+ y.className = "ui-tabela__cell-content", g.larguraMaxima !== void 0 && y.classList.add("ui-tabela__cell-truncate");
482
+ const A = h[g.id];
483
+ if (typeof g.render == "function")
484
+ try {
485
+ const w = g.render(A, h, p);
486
+ w instanceof Node ? y.appendChild(w) : y.textContent = String(w ?? "");
487
+ } catch (w) {
488
+ console.error(`[ui-tabela] Erro no render da coluna "${g.id}" (linha ${p}):`, w), y.textContent = "";
489
+ }
490
+ else if (A instanceof Node)
491
+ y.appendChild(A);
492
+ else {
493
+ const w = A != null ? String(A) : "";
494
+ y.textContent = w, g.larguraMaxima !== void 0 && !g.tooltip && (f.title = w);
495
+ }
496
+ f.appendChild(y), m.appendChild(f);
497
+ }), u.appendChild(m);
498
+ }
499
+ if (i && a < r) {
500
+ const p = document.createElement("tr");
501
+ p.className = "ui-tabela__virtual-spacer", p.setAttribute("aria-hidden", "true"), p.style.height = `${(r - a) * e}px`;
502
+ const h = document.createElement("td");
503
+ h.colSpan = t.colunas.length || 1, p.appendChild(h), u.appendChild(p);
504
+ }
505
+ if (t.tbodyElement.appendChild(u), d !== null) {
506
+ const p = t.tbodyElement.querySelector(`tr[data-index="${d}"]`);
507
+ p == null || p.focus({ preventScroll: !0 });
508
+ }
509
+ }
510
+ function Q(t) {
511
+ if (t === void 0) return null;
512
+ const r = typeof t == "number" ? t : parseInt(t, 10);
513
+ return isNaN(r) ? null : r;
514
+ }
515
+ function $(t, r) {
516
+ const e = Q(t.larguraMinima);
517
+ let i = Math.max(e ?? 60, r);
518
+ const o = Q(t.larguraMaxima);
519
+ return o !== null && (i = Math.min(o, i)), i;
520
+ }
521
+ function Ne(t, r, e, i) {
522
+ const o = $(t, r.offsetWidth + i);
523
+ return t.largura = `${o}px`, r.style.width = `${o}px`, e && (e.style.width = `${o}px`), `${o}px`;
524
+ }
525
+ function De(t) {
526
+ const {
527
+ evento: r,
528
+ coluna: e,
529
+ colIndex: i,
530
+ thElement: o,
531
+ resizer: a,
532
+ colgroupElement: n,
533
+ onResizeStart: s,
534
+ onResizeEnd: d,
535
+ onResizeCancel: c
536
+ } = t;
537
+ r.stopPropagation(), r.preventDefault(), s(), a.classList.add("ui-tabela__resizer--ativo");
538
+ const l = r.pageX, u = o.offsetWidth, p = n == null ? void 0 : n.children[i], h = r.type === "pointerdown", m = h ? r.pointerId : null, x = h ? "pointermove" : "mousemove", g = h ? "pointerup" : "mouseup";
539
+ let f = !1;
540
+ const _ = (w) => {
541
+ const v = w;
542
+ if (m !== null && v.pointerId !== m) return;
543
+ f = !0;
544
+ const E = $(e, u + (v.pageX - l));
545
+ e.largura = `${E}px`, o.style.width = `${E}px`, p && (p.style.width = `${E}px`);
546
+ }, y = () => {
547
+ A(), f ? d(String(e.largura)) : c == null || c();
548
+ }, A = () => {
549
+ a.classList.remove("ui-tabela__resizer--ativo"), window.removeEventListener(x, _), window.removeEventListener(g, y), h && window.removeEventListener("pointercancel", y);
550
+ };
551
+ return window.addEventListener(x, _), window.addEventListener(g, y), h && window.addEventListener("pointercancel", y), A;
552
+ }
553
+ const B = 20;
554
+ let Re = 0;
555
+ function Be(t) {
556
+ var D;
557
+ const {
558
+ evento: r,
559
+ coluna: e,
560
+ colIndex: i,
561
+ thElement: o,
562
+ colgroupElement: a,
563
+ shadow: n,
564
+ onResizeEnd: s
565
+ } = t, d = `ui-tabela-dlg-${++Re}`, c = document.createElement("dialog");
566
+ c.className = "ui-tabela__prompt-dialog", c.setAttribute("part", "dialogo"), c.setAttribute("aria-labelledby", `${d}-titulo`);
567
+ const l = document.createElement("label");
568
+ l.className = "ui-tabela__prompt-title", l.id = `${d}-titulo`, l.htmlFor = `${d}-campo`, l.textContent = `Largura de "${e.rotulo}" (px; vazio = automática)`;
569
+ const u = document.createElement("input");
570
+ u.id = `${d}-campo`, u.type = "number", u.min = String(B), u.step = "1", u.setAttribute("inputmode", "numeric"), u.placeholder = "auto";
571
+ const p = e.largura ? parseInt(String(e.largura), 10) : NaN;
572
+ u.value = Number.isFinite(p) ? String(p) : "";
573
+ const h = document.createElement("div");
574
+ h.className = "ui-tabela__prompt-erro", h.id = `${d}-erro`, h.setAttribute("role", "alert");
575
+ const m = document.createElement("div");
576
+ m.className = "ui-tabela__prompt-actions";
577
+ const x = document.createElement("button");
578
+ x.type = "button", x.textContent = "Aplicar";
579
+ const g = document.createElement("button");
580
+ g.type = "button", g.textContent = "Cancelar", m.appendChild(g), m.appendChild(x), c.appendChild(l), c.appendChild(u), c.appendChild(h), c.appendChild(m), n.appendChild(c), typeof c.showModal == "function" ? c.showModal() : c.setAttribute("open", ""), c.style.position = "fixed";
581
+ const f = c.getBoundingClientRect(), _ = f.width || 240, y = f.height || 140, A = Math.max(8, Math.min(r.clientX || 0, window.innerWidth - _ - 8)), w = Math.max(8, Math.min(r.clientY || 0, window.innerHeight - y - 8));
582
+ c.style.left = `${A}px`, c.style.top = `${w}px`;
583
+ let v = !1;
584
+ const E = () => {
585
+ var C;
586
+ v || (v = !0, c.open && typeof c.close == "function" && c.close(), c.remove(), (C = o.querySelector(".ui-tabela__ordenar, .ui-tabela__resizer")) == null || C.focus());
587
+ }, R = (C) => {
588
+ h.textContent = C, u.setAttribute("aria-invalid", "true"), u.setAttribute("aria-describedby", h.id), u.focus();
589
+ }, N = () => {
590
+ const C = e.largura, X = u.value.trim();
591
+ if (X === "")
592
+ e.largura = void 0, o.style.width = "", a != null && a.children[i] && (a.children[i].style.width = "");
593
+ else {
594
+ const F = Number(X);
595
+ if (!Number.isFinite(F) || F < B) {
596
+ R(`Informe um valor de pelo menos ${B} px, ou deixe vazio para automática.`);
597
+ return;
598
+ }
599
+ const H = Math.round($({ ...e, larguraMinima: e.larguraMinima ?? B }, F));
600
+ e.largura = `${H}px`, o.style.width = `${H}px`, a != null && a.children[i] && (a.children[i].style.width = `${H}px`);
601
+ }
602
+ E(), e.largura !== C && s(e.largura ? String(e.largura) : "auto");
603
+ };
604
+ x.addEventListener("click", (C) => {
605
+ C.stopPropagation(), N();
606
+ }), g.addEventListener("click", (C) => {
607
+ C.stopPropagation(), E();
608
+ }), c.addEventListener("close", E), u.addEventListener("input", () => {
609
+ h.textContent = "", u.removeAttribute("aria-invalid"), u.removeAttribute("aria-describedby");
610
+ }), u.addEventListener("keydown", (C) => {
611
+ C.key === "Enter" ? (C.preventDefault(), N()) : C.key === "Escape" && (C.preventDefault(), E());
612
+ }), u.focus(), (D = u.select) == null || D.call(u);
613
+ }
614
+ function Te(t, r, e, i, o, a) {
615
+ return De({
616
+ evento: t,
617
+ coluna: r,
618
+ colIndex: e,
619
+ thElement: i,
620
+ resizer: o,
621
+ colgroupElement: a.colgroupElement,
622
+ onResizeStart: () => a.onSetIsResizing(!0),
623
+ onResizeCancel: () => {
624
+ setTimeout(() => a.onSetIsResizing(!1), 50);
625
+ },
626
+ onResizeEnd: (n) => {
627
+ setTimeout(() => a.onSetIsResizing(!1), 50), a.host.dispatchEvent(
628
+ new CustomEvent("ui-column-resize", {
629
+ detail: { idColuna: r.id, largura: n },
630
+ bubbles: !0,
631
+ composed: !0
632
+ })
633
+ );
634
+ }
635
+ });
636
+ }
637
+ function Ie(t, r, e, i, o) {
638
+ t.preventDefault(), t.stopPropagation(), Be({
639
+ evento: t,
640
+ coluna: r,
641
+ colIndex: e,
642
+ thElement: i,
643
+ colgroupElement: o.colgroupElement,
644
+ shadow: o.shadow,
645
+ onResizeEnd: (a) => {
646
+ o.host.dispatchEvent(
647
+ new CustomEvent("ui-column-resize", {
648
+ detail: { idColuna: r.id, largura: a },
649
+ bubbles: !0,
650
+ composed: !0
651
+ })
652
+ );
653
+ }
654
+ });
655
+ }
656
+ function Oe(t, r, e, i, o) {
657
+ const a = Ne(r, e, i, t);
658
+ o.host.dispatchEvent(
659
+ new CustomEvent("ui-column-resize", {
660
+ detail: { idColuna: r.id, largura: a },
661
+ bubbles: !0,
662
+ composed: !0
663
+ })
664
+ );
665
+ }
666
+ function Pe(t) {
667
+ ze({
668
+ theadElement: t.theadElement,
669
+ colgroupElement: t.colgroupElement,
670
+ colunas: t.colunas,
671
+ colunaOrdenada: t.dadosController.getColunaOrdenada(),
672
+ direcaoOrdenacao: t.dadosController.getDirecaoOrdenacao(),
673
+ headerListeners: t.headerListeners,
674
+ formatWidth: oe,
675
+ getAlignmentClass: ie,
676
+ getTextAlign: ae,
677
+ onHeaderClick: (r) => t.onHeaderClick(r),
678
+ onHeaderContextMenu: (r, e, i, o) => {
679
+ Ie(r, e, i, o, {
680
+ host: t.host,
681
+ colgroupElement: t.colgroupElement,
682
+ shadow: t.shadow,
683
+ onSetIsResizing: t.onSetIsResizing
684
+ });
685
+ },
686
+ onInitColumnResize: (r, e, i, o, a) => {
687
+ const n = Te(r, e, i, o, a, {
688
+ host: t.host,
689
+ colgroupElement: t.colgroupElement,
690
+ shadow: t.shadow,
691
+ onSetIsResizing: t.onSetIsResizing
692
+ });
693
+ t.onActiveResizeCleanup(n);
694
+ },
695
+ onResizeTeclado: (r, e, i, o, a) => {
696
+ Oe(r, e, o, a, {
697
+ host: t.host,
698
+ colgroupElement: t.colgroupElement,
699
+ shadow: t.shadow,
700
+ onSetIsResizing: t.onSetIsResizing
701
+ });
702
+ },
703
+ onColumnAutoFit: (r, e, i) => {
704
+ r.largura = void 0, e.style.width = "", i.style.width = "", t.host.dispatchEvent(
705
+ new CustomEvent("ui-column-resize", {
706
+ bubbles: !0,
707
+ composed: !0,
708
+ detail: { idColuna: r.id, largura: "auto" }
709
+ })
710
+ );
711
+ }
712
+ });
713
+ }
714
+ function Fe(t) {
715
+ Me({
716
+ tbodyElement: t.tbodyElement,
717
+ tableElement: t.tableElement,
718
+ emptyElement: t.emptyElement,
719
+ containerElement: t.containerElement,
720
+ dadosExibicao: t.dadosController.getDadosExibicao(),
721
+ colunas: t.colunas,
722
+ chaveId: t.chaveId,
723
+ virtualizar: t.virtualizar,
724
+ rowHeight: t.rowHeight,
725
+ indiceAtivo: t.indiceAtivo,
726
+ filtroAtivo: t.dadosController.temFiltro(),
727
+ textoVazio: t.textoVazio,
728
+ textoSemResultados: t.textoSemResultados,
729
+ isItemSelecionado: (r, e) => t.selecaoController.isItemSelecionado(r, e),
730
+ onLinhaClique: (r, e) => {
731
+ t.selecaoController.setItemSelecionado(r), t.host.dispatchEvent(
732
+ new CustomEvent("ui-linha-clique", {
733
+ bubbles: !0,
734
+ composed: !0,
735
+ detail: { item: r, indice: e }
736
+ })
737
+ );
738
+ },
739
+ formatWidth: oe,
740
+ getAlignmentClass: ie,
741
+ getTextAlign: ae
742
+ });
743
+ }
744
+ function He(t, r) {
745
+ let e = !1;
746
+ const i = () => {
747
+ e || (window.requestAnimationFrame(() => {
748
+ try {
749
+ r();
750
+ } finally {
751
+ e = !1;
752
+ }
753
+ }), e = !0);
754
+ };
755
+ return t.addEventListener("scroll", i), i;
756
+ }
757
+ function Ve(t, r, e, i) {
758
+ return ke(t, r, e, i);
759
+ }
760
+ function ne(t) {
761
+ const r = t.host.getAttribute("texto-vazio") || t.host.getAttribute("empty-text");
762
+ r && t.onTextoVazioAlterado(r);
763
+ const e = t.host.getAttribute("virtualizar") || t.host.getAttribute("virtualize");
764
+ e !== null && t.onVirtualizarAlterado(e !== "false"), t.onSrcLido(t.host.getAttribute("src"));
765
+ const i = t.host.hasAttribute("carregando") || t.host.hasAttribute("loading");
766
+ t.onCarregandoAlterado(i), t.loadingElement && (t.loadingElement.style.display = i ? "flex" : "none");
767
+ }
768
+ function qe(t, r, e) {
769
+ if (ne(e), t === "src") {
770
+ r && e.host.isConnected && e.onCarregarSrc(r);
771
+ return;
772
+ }
773
+ if (t === "max-height" && e.containerElement) {
774
+ e.containerElement.style.maxHeight = r || "";
775
+ return;
776
+ }
777
+ if ((t === "texto-vazio" || t === "empty-text") && e.emptyElement) {
778
+ const i = e.emptyElement.querySelector(".ui-tabela__empty-text");
779
+ i && r && (i.textContent = r), e.onRenderBody();
780
+ return;
781
+ }
782
+ if (t === "carregando" || t === "loading") {
783
+ e.loadingElement && (e.loadingElement.style.display = r !== null ? "flex" : "none");
784
+ return;
785
+ }
786
+ if (t === "densidade" || t === "density") {
787
+ e.onRenderBody();
788
+ return;
789
+ }
790
+ e.onRenderTotal();
791
+ }
792
+ class $e extends re {
793
+ constructor() {
794
+ super();
795
+ b(this, "shadow");
796
+ b(this, "_colunas", []);
797
+ b(this, "_textoVazio", "Nenhum registro encontrado");
798
+ b(this, "_virtualizar", !0);
799
+ b(this, "_isResizing", !1);
800
+ b(this, "_carregando", !1);
801
+ b(this, "_src", null);
802
+ b(this, "_fetchOpcoes", null);
803
+ b(this, "_fetcher", null);
804
+ b(this, "_containerElement", null);
805
+ b(this, "_tableElement", null);
806
+ b(this, "_theadElement", null);
807
+ b(this, "_tbodyElement", null);
808
+ b(this, "_colgroupElement", null);
809
+ b(this, "_emptyElement", null);
810
+ b(this, "_loadingElement", null);
811
+ b(this, "_erroElement", null);
812
+ b(this, "_anuncioElement", null);
813
+ /** Último erro de carregamento remoto (null = sem erro). */
814
+ b(this, "_erro", null);
815
+ b(this, "_scrollHandler", null);
816
+ b(this, "_activeResizeCleanup", null);
817
+ b(this, "_headerListeners", new O());
818
+ b(this, "_corpoListeners", new O());
819
+ /** Linha com o foco móvel (navegação por teclado); null = primeira linha visível. */
820
+ b(this, "_indiceAtivo", null);
821
+ /** Altura real das linhas medida no DOM; null = usa a estimativa da densidade. */
822
+ b(this, "_alturaLinhaMedida", null);
823
+ /** Cancela a correção pendente de uma rolagem suave anterior. */
824
+ b(this, "_cancelarCorrecaoRolagem", null);
825
+ b(this, "remotaController");
826
+ b(this, "selecaoController");
827
+ b(this, "dadosController", new Ce());
828
+ /** Mantém um único tabindex=0 (foco móvel): Tab entra na tabela pela última linha ativa. */
829
+ b(this, "handleFocoLinha", (e) => {
830
+ const i = e.target;
831
+ i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index") || this.definirLinhaAtiva(Number(i.getAttribute("data-index")));
832
+ });
833
+ /**
834
+ * Teclado nas linhas: setas, Home/End e PageUp/PageDown movem o foco;
835
+ * Enter/Espaço selecionam a linha (mesmo caminho do clique, emite `ui-linha-clique`).
836
+ */
837
+ b(this, "handleTecladoCorpo", (e) => {
838
+ const i = e.target;
839
+ if (i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index")) return;
840
+ const o = Number(i.getAttribute("data-index")), a = this.dadosController.getDadosExibicao().length - 1;
841
+ let n;
842
+ switch (e.key) {
843
+ case "ArrowDown":
844
+ n = Math.min(a, o + 1);
845
+ break;
846
+ case "ArrowUp":
847
+ n = Math.max(0, o - 1);
848
+ break;
849
+ case "Home":
850
+ n = 0;
851
+ break;
852
+ case "End":
853
+ n = a;
854
+ break;
855
+ case "PageDown":
856
+ n = Math.min(a, o + this.linhasPorPagina());
857
+ break;
858
+ case "PageUp":
859
+ n = Math.max(0, o - this.linhasPorPagina());
860
+ break;
861
+ case "Enter":
862
+ case " ":
863
+ e.preventDefault(), i.click();
864
+ return;
865
+ default:
866
+ return;
867
+ }
868
+ e.preventDefault(), this.focarLinha(n);
869
+ });
870
+ this.shadow = this.attachShadow({ mode: "open" }), this.remotaController = new be({
871
+ host: this,
872
+ onCarregandoAlterado: (e) => {
873
+ this.carregando = e;
874
+ },
875
+ onDadosRecebidos: (e) => {
876
+ this.dados = e;
877
+ },
878
+ getOpcoes: () => this._fetchOpcoes,
879
+ getFetcher: () => this._fetcher
880
+ }), this.selecaoController = new ve({
881
+ host: this,
882
+ getTbody: () => this._tbodyElement,
883
+ getDadosExibicao: () => this.dadosController.getDadosExibicao(),
884
+ getDadosOriginais: () => this.dadosController.getDadosOriginais(),
885
+ getChaveId: () => this.chaveId,
886
+ onRolarParaIndice: (e, i) => this.posicionarLinha(e, i),
887
+ onLinhaAtiva: (e) => this.definirLinhaAtiva(e)
888
+ }), this.addEventListener("ui-fetch-erro", (e) => this.mostrarErro(e.detail)), this.addEventListener("ui-fetch-start", () => this.mostrarErro(null)), this.addEventListener("ui-fetch-sucesso", () => this.mostrarErro(null));
889
+ }
890
+ static get observedAttributes() {
891
+ return ["texto-vazio", "empty-text", "max-height", "densidade", "density", "altura-linha", "row-height", "virtualizar", "virtualize", "src", "carregando", "loading", "chave-id", "id-key", "aria-label", "ordenacao-remota", "texto-erro", "texto-sem-resultados", "texto-carregando"];
892
+ }
893
+ connectedCallback() {
894
+ this.syncAttributes(), this.alturaLinha && this.style.setProperty("--ui-tabela-altura-linha", `${this.alturaLinha}px`), !this.hasAttribute("densidade") && !this.hasAttribute("density") && this.setAttribute("densidade", "normal"), this.renderTotal(), this._src && this.remotaController.carregar(this._src);
895
+ }
896
+ disconnectedCallback() {
897
+ this.cleanupEventListeners();
898
+ }
899
+ attributeChangedCallback(e, i, o) {
900
+ e === "ordenacao-remota" && (this.dadosController.setOrdenacaoRemota(o !== null), this.atualizarContextoSelecao()), (e === "densidade" || e === "density" || e === "altura-linha" || e === "row-height") && (this._alturaLinhaMedida = null), (e === "altura-linha" || e === "row-height") && this.aplicarAlturaLinha(), (e === "chave-id" || e === "id-key") && this.atualizarContextoSelecao(), qe(e, o, this.obterContextoAtributos()), this.sincronizarAria();
901
+ }
902
+ /** Nome acessível vem do host (`aria-label`); `aria-busy` acompanha o carregamento remoto. */
903
+ sincronizarAria() {
904
+ if (!this._tableElement) return;
905
+ const e = this.getAttribute("aria-label");
906
+ e ? this._tableElement.setAttribute("aria-label", e) : this._tableElement.removeAttribute("aria-label"), this._tableElement.setAttribute("aria-busy", String(this._carregando)), this._containerElement && (e ? (this._containerElement.setAttribute("role", "region"), this._containerElement.setAttribute("aria-label", e)) : (this._containerElement.removeAttribute("role"), this._containerElement.removeAttribute("aria-label"))), this.atualizarTextosEstado();
907
+ }
908
+ /** Textos de estado configuráveis por atributo (carregando, sem resultados, erro). */
909
+ atualizarTextosEstado() {
910
+ var i;
911
+ const e = (i = this._loadingElement) == null ? void 0 : i.querySelector(".ui-tabela__loading-texto");
912
+ e && (e.textContent = this.getAttribute("texto-carregando") || "Carregando dados..."), this.renderizarErro();
913
+ }
914
+ /** Mostra (ou oculta, com null) o aviso de erro de carregamento com a ação "Tentar novamente". */
915
+ mostrarErro(e) {
916
+ this._erro = e, this.renderizarErro();
917
+ }
918
+ renderizarErro() {
919
+ const e = this._erroElement;
920
+ if (!e) return;
921
+ if (!this._erro) {
922
+ e.style.display = "none";
923
+ return;
924
+ }
925
+ const i = this.getAttribute("texto-erro") || "Não foi possível carregar os dados.", o = e.querySelector(".ui-tabela__erro-mensagem"), a = e.querySelector(".ui-tabela__erro-detalhe");
926
+ o && (o.textContent = i), a && (a.textContent = this._erro.erro || "");
927
+ const n = e.querySelector(".ui-tabela__erro-acao");
928
+ n && (n.style.display = this._src ? "" : "none"), e.style.display = "flex";
929
+ }
930
+ /** Anuncia ao leitor de tela o resultado do filtro (a região é limpa sem filtro ativo). */
931
+ anunciarResultado() {
932
+ if (!this._anuncioElement) return;
933
+ const e = this.dadosController.getDadosExibicao().length;
934
+ this._anuncioElement.textContent = this.dadosController.temFiltro() ? e === 0 ? this._textoSemResultados() : `${e} ${e === 1 ? "registro encontrado" : "registros encontrados"}` : "";
935
+ }
936
+ _textoSemResultados() {
937
+ return this.getAttribute("texto-sem-resultados") || "Nenhum resultado para o filtro";
938
+ }
939
+ syncAttributes() {
940
+ ne(this.obterContextoAtributos());
941
+ }
942
+ obterContextoAtributos() {
943
+ return {
944
+ host: this,
945
+ containerElement: this._containerElement,
946
+ emptyElement: this._emptyElement,
947
+ loadingElement: this._loadingElement,
948
+ onTextoVazioAlterado: (e) => {
949
+ this._textoVazio = e;
950
+ },
951
+ onVirtualizarAlterado: (e) => {
952
+ this._virtualizar = e;
953
+ },
954
+ onSrcLido: (e) => {
955
+ this._src = e;
956
+ },
957
+ onCarregarSrc: (e) => {
958
+ this.remotaController.carregar(e);
959
+ },
960
+ onCarregandoAlterado: (e) => {
961
+ this._carregando = e;
962
+ },
963
+ onRenderBody: () => this.renderBody(),
964
+ onRenderTotal: () => this.renderTotal()
965
+ };
966
+ }
967
+ get src() {
968
+ return this._src;
969
+ }
970
+ set src(e) {
971
+ this._src = e, e ? this.setAttribute("src", e) : this.removeAttribute("src");
972
+ }
973
+ get carregando() {
974
+ return this._carregando;
975
+ }
976
+ set carregando(e) {
977
+ this._carregando = !!e, this._carregando ? this.setAttribute("carregando", "") : (this.removeAttribute("carregando"), this.removeAttribute("loading")), this._loadingElement && (this._loadingElement.style.display = this._carregando ? "flex" : "none"), this.sincronizarAria();
978
+ }
979
+ /** Opções do `fetch` do modo remoto (headers, credentials, method, body...); o `signal` é da tabela. */
980
+ get fetchOpcoes() {
981
+ return this._fetchOpcoes;
982
+ }
983
+ set fetchOpcoes(e) {
984
+ this._fetchOpcoes = e ?? null;
985
+ }
986
+ /** Função de busca alternativa ao `fetch` (autenticação, renovação de token, mocks). */
987
+ get fetcher() {
988
+ return this._fetcher;
989
+ }
990
+ set fetcher(e) {
991
+ this._fetcher = typeof e == "function" ? e : null;
992
+ }
993
+ /** Ordenação feita pelo servidor: o clique no cabeçalho atualiza o indicador e emite `ui-sort`, mas não reordena. */
994
+ get ordenacaoRemota() {
995
+ return this.hasAttribute("ordenacao-remota");
996
+ }
997
+ set ordenacaoRemota(e) {
998
+ this.toggleAttribute("ordenacao-remota", !!e);
999
+ }
1000
+ /** Busca a URL (guardada como `src`, para `recarregar()`). Resolve `true` em sucesso; falhas vão em `ui-fetch-erro`. */
1001
+ async carregarDoEndpoint(e) {
1002
+ return e && e !== this._src && (this.src = e), this.remotaController.carregar(e || this._src || "");
1003
+ }
1004
+ async recarregar() {
1005
+ return this._src ? this.remotaController.carregar(this._src) : (this.dadosController.aplicarOrdenacao(), this.atualizarContextoSelecao(), this.renderBody(), !0);
1006
+ }
1007
+ filtrar(e) {
1008
+ this.dadosController.filtrar(e), this.atualizarContextoSelecao(), this.renderBody();
1009
+ }
1010
+ cleanupEventListeners() {
1011
+ var e;
1012
+ this._containerElement && this._scrollHandler && (this._containerElement.removeEventListener("scroll", this._scrollHandler), this._scrollHandler = null), this._activeResizeCleanup && (this._activeResizeCleanup(), this._activeResizeCleanup = null, this._isResizing = !1), (e = this._cancelarCorrecaoRolagem) == null || e.call(this), this.remotaController.abortar(), this._headerListeners.cleanup(), this._corpoListeners.cleanup();
1013
+ }
1014
+ get colunas() {
1015
+ return this._colunas;
1016
+ }
1017
+ set colunas(e) {
1018
+ this._colunas = Array.isArray(e) ? e.filter((i) => i != null).map((i) => ({ ...i })) : [], this.dadosController.setColunas(this._colunas), this.dadosController.setColunasFiltro(this._colunas.map((i) => i.id)), this._alturaLinhaMedida = null, this.renderTotal();
1019
+ }
1020
+ get dados() {
1021
+ return this.dadosController.getDadosOriginais();
1022
+ }
1023
+ set dados(e) {
1024
+ this.dadosController.setDadosOriginais(e), this.atualizarContextoSelecao(), this.renderBody();
1025
+ }
1026
+ get itens() {
1027
+ return this.dados;
1028
+ }
1029
+ set itens(e) {
1030
+ this.dados = e;
1031
+ }
1032
+ get chaveId() {
1033
+ return this.getAttribute("chave-id") || this.getAttribute("id-key") || "id";
1034
+ }
1035
+ set chaveId(e) {
1036
+ e ? this.setAttribute("chave-id", e) : (this.removeAttribute("chave-id"), this.removeAttribute("id-key")), this.atualizarContextoSelecao();
1037
+ }
1038
+ get itemSelecionado() {
1039
+ return this.selecaoController.getItemSelecionado();
1040
+ }
1041
+ set itemSelecionado(e) {
1042
+ this.selecaoController.setItemSelecionado(e);
1043
+ }
1044
+ get indiceSelecionado() {
1045
+ return this.selecaoController.getIndiceSelecionado();
1046
+ }
1047
+ set indiceSelecionado(e) {
1048
+ this.selecaoController.setIndiceSelecionado(e);
1049
+ }
1050
+ limparSelecao() {
1051
+ this.selecaoController.limparSelecao();
1052
+ }
1053
+ get densidade() {
1054
+ const e = this.getAttribute("densidade") || this.getAttribute("density");
1055
+ return e === "compacta" || e === "compact" ? "compacta" : e === "relaxada" || e === "relaxed" ? "relaxada" : "normal";
1056
+ }
1057
+ set densidade(e) {
1058
+ e ? this.setAttribute("densidade", e) : (this.removeAttribute("densidade"), this.removeAttribute("density")), this.renderBody();
1059
+ }
1060
+ get virtualizar() {
1061
+ return this._virtualizar;
1062
+ }
1063
+ set virtualizar(e) {
1064
+ this._virtualizar = !!e, e ? this.setAttribute("virtualizar", "true") : this.removeAttribute("virtualizar"), this.renderTotal();
1065
+ }
1066
+ get colunaOrdenada() {
1067
+ return this.dadosController.getColunaOrdenada();
1068
+ }
1069
+ set colunaOrdenada(e) {
1070
+ this.dadosController.setColunaOrdenada(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1071
+ }
1072
+ get direcaoOrdenacao() {
1073
+ return this.dadosController.getDirecaoOrdenacao();
1074
+ }
1075
+ set direcaoOrdenacao(e) {
1076
+ this.dadosController.setDirecaoOrdenacao(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1077
+ }
1078
+ get textoVazio() {
1079
+ return this._textoVazio;
1080
+ }
1081
+ set textoVazio(e) {
1082
+ this._textoVazio = e || "Nenhum registro encontrado", this.renderTotal();
1083
+ }
1084
+ handleHeaderClick(e) {
1085
+ if (!e.ordenavel || this._isResizing) return;
1086
+ const i = this.dadosController.getColunaOrdenada(), o = this.dadosController.getDirecaoOrdenacao(), a = this.dadosController.alternarOrdenacaoColuna(e);
1087
+ if (!a) return;
1088
+ this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1089
+ const n = new CustomEvent("ui-sort", { detail: a, bubbles: !0, composed: !0, cancelable: !0 });
1090
+ this.dispatchEvent(n), n.defaultPrevented && (this.dadosController.restaurarOrdenacao(i, o), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody());
1091
+ }
1092
+ /** Altura fixa das linhas em px (`altura-linha`), sobrepõe a densidade; null = vale a densidade. */
1093
+ get alturaLinha() {
1094
+ const e = this.getAttribute("altura-linha") ?? this.getAttribute("row-height"), i = e === null ? NaN : parseFloat(e);
1095
+ return Number.isFinite(i) && i > 0 ? i : null;
1096
+ }
1097
+ set alturaLinha(e) {
1098
+ e && e > 0 ? this.setAttribute("altura-linha", String(e)) : (this.removeAttribute("altura-linha"), this.removeAttribute("row-height"));
1099
+ }
1100
+ /** Publica a altura fixa como variável CSS (usada pelo estilo `:host([altura-linha])`). */
1101
+ aplicarAlturaLinha() {
1102
+ const e = this.alturaLinha;
1103
+ e ? this.style.setProperty("--ui-tabela-altura-linha", `${e}px`) : this.style.removeProperty("--ui-tabela-altura-linha"), this.renderBody();
1104
+ }
1105
+ /** Altura usada na virtualização: a fixa (`altura-linha`), a medida no DOM ou a estimativa da densidade. */
1106
+ getRowHeight() {
1107
+ return this.alturaLinha ?? this._alturaLinhaMedida ?? K(this.densidade);
1108
+ }
1109
+ /**
1110
+ * Mede a altura real das linhas uma vez por configuração (densidade/colunas): padding, fonte e
1111
+ * renderizadores customizados mudam a altura, e a estimativa fixa desalinharia a janela virtual.
1112
+ * Não remede a cada rolagem para os espaçadores não "pularem" com linhas de alturas diferentes.
1113
+ */
1114
+ medirAlturaLinha() {
1115
+ if (this._alturaLinhaMedida !== null || !this._tbodyElement) return;
1116
+ const e = this._tbodyElement.querySelectorAll("tr[data-index]");
1117
+ if (e.length === 0) return;
1118
+ let i = 0;
1119
+ e.forEach((a) => {
1120
+ i += a.getBoundingClientRect().height;
1121
+ });
1122
+ const o = i / e.length;
1123
+ o <= 0 || (this._alturaLinhaMedida = o, Math.abs(o - K(this.densidade)) > 0.5 && this.renderBody());
1124
+ }
1125
+ /** Ordenar, filtrar, trocar os dados ou a chave mantém a linha selecionada (se ainda existir). */
1126
+ atualizarContextoSelecao() {
1127
+ this.selecaoController.reconciliar(), this._indiceAtivo = this.selecaoController.getIndiceSelecionado();
1128
+ }
1129
+ renderTotal() {
1130
+ var e;
1131
+ if (this.shadow) {
1132
+ if (this._containerElement) {
1133
+ if (this._containerElement.style.maxHeight = this.getAttribute("max-height") || "", this._emptyElement) {
1134
+ const i = this._emptyElement.querySelector(".ui-tabela__empty-text");
1135
+ i && (i.textContent = this._textoVazio);
1136
+ }
1137
+ } else {
1138
+ this.cleanupEventListeners();
1139
+ const i = Ve(this.shadow, this._textoVazio, this.getAttribute("max-height"), this._carregando);
1140
+ this._containerElement = i.containerElement, this._tableElement = i.tableElement, this._colgroupElement = i.colgroupElement, this._theadElement = i.theadElement, this._tbodyElement = i.tbodyElement, this._emptyElement = i.emptyElement, this._loadingElement = i.loadingElement, this._erroElement = i.erroElement, this._anuncioElement = i.anuncioElement, (e = i.erroElement.querySelector(".ui-tabela__erro-acao")) == null || e.addEventListener("click", () => {
1141
+ this.recarregar();
1142
+ });
1143
+ }
1144
+ this.renderHeader(), this.renderBody(), this._virtualizar && this._containerElement && !this._scrollHandler && (this._scrollHandler = He(this._containerElement, () => this.renderBody())), this._tbodyElement && this._corpoListeners.size === 0 && (this._corpoListeners.add(this._tbodyElement, "keydown", this.handleTecladoCorpo), this._corpoListeners.add(this._tbodyElement, "focusin", this.handleFocoLinha)), this.sincronizarAria();
1145
+ }
1146
+ }
1147
+ definirLinhaAtiva(e) {
1148
+ this._indiceAtivo = e;
1149
+ const i = this._tbodyElement, o = i == null ? void 0 : i.querySelector(`tr[data-index="${e}"]`);
1150
+ !i || !o || (i.querySelectorAll('tr[tabindex="0"]').forEach((a) => {
1151
+ a !== o && (a.tabIndex = -1);
1152
+ }), o.tabIndex = 0);
1153
+ }
1154
+ linhasPorPagina() {
1155
+ var i, o;
1156
+ const e = (((i = this._containerElement) == null ? void 0 : i.clientHeight) ?? 0) - (((o = this._theadElement) == null ? void 0 : o.offsetHeight) ?? 0);
1157
+ return Math.max(1, Math.floor(e / this.getRowHeight()));
1158
+ }
1159
+ /** Foca a linha, renderizando a janela virtual se necessário, e a mantém visível abaixo do cabeçalho fixo. */
1160
+ focarLinha(e) {
1161
+ const i = this._containerElement, o = this._tbodyElement;
1162
+ if (!i || !o) return;
1163
+ this._indiceAtivo = e;
1164
+ const a = `tr[data-index="${e}"]`;
1165
+ let n = o.querySelector(a);
1166
+ if (n || (i.scrollTop = Math.max(0, e * this.getRowHeight() - i.clientHeight / 2), this.renderBody(), n = o.querySelector(a)), !n) return;
1167
+ n.focus({ preventScroll: !0 });
1168
+ const s = this.deslocamentoAteLinha(n);
1169
+ s && (i.scrollTop += s);
1170
+ }
1171
+ /**
1172
+ * Quanto o container precisa rolar para a linha ficar inteira na área útil: abaixo do cabeçalho
1173
+ * fixo e acima da barra de rolagem horizontal. 0 = já visível. Linha maior que a área alinha pelo topo.
1174
+ */
1175
+ deslocamentoAteLinha(e) {
1176
+ var d;
1177
+ const i = this._containerElement, o = i.getBoundingClientRect(), a = e.getBoundingClientRect(), n = o.top + i.clientTop + (((d = this._theadElement) == null ? void 0 : d.offsetHeight) ?? 0), s = o.top + i.clientTop + i.clientHeight;
1178
+ return a.top < n ? a.top - n : a.bottom > s ? Math.min(a.bottom - s, a.top - n) : 0;
1179
+ }
1180
+ /** Rola só o container da tabela (nunca a página, ao contrário de `scrollIntoView`). */
1181
+ rolarContainer(e, i) {
1182
+ const o = this._containerElement;
1183
+ i === "smooth" && typeof o.scrollTo == "function" ? o.scrollTo({ top: e, behavior: "smooth" }) : o.scrollTop = e;
1184
+ }
1185
+ /**
1186
+ * Posiciona a linha exibida `indice` na área visível.
1187
+ * Fora da janela virtual, rola até a posição estimada, renderiza a janela e corrige pela posição
1188
+ * real da linha. No modo suave a correção ocorre ao fim da animação (`scrollend`, com timeout de
1189
+ * segurança para navegadores sem o evento ou quando não há rolagem a fazer).
1190
+ */
1191
+ posicionarLinha(e, i) {
1192
+ var p;
1193
+ const o = this._containerElement, a = this._tbodyElement;
1194
+ if (!o || !a) return !1;
1195
+ (p = this._cancelarCorrecaoRolagem) == null || p.call(this);
1196
+ const n = () => a.querySelector(`tr[data-index="${e}"]`), s = (h) => {
1197
+ const m = n();
1198
+ if (!m) return;
1199
+ const x = this.deslocamentoAteLinha(m);
1200
+ x && this.rolarContainer(o.scrollTop + x, h);
1201
+ };
1202
+ if (n())
1203
+ return s(i), !0;
1204
+ const d = () => {
1205
+ o.scrollTop = Math.max(0, e * this.getRowHeight()), this.renderBody(), s("auto"), this.renderBody();
1206
+ };
1207
+ if (i === "auto")
1208
+ return d(), !0;
1209
+ this.rolarContainer(Math.max(0, e * this.getRowHeight()), "smooth");
1210
+ let c = !0;
1211
+ const l = () => {
1212
+ var h;
1213
+ c && ((h = this._cancelarCorrecaoRolagem) == null || h.call(this), this.renderBody(), n() ? s("smooth") : d());
1214
+ }, u = window.setTimeout(l, 800);
1215
+ return o.addEventListener("scrollend", l, { once: !0 }), this._cancelarCorrecaoRolagem = () => {
1216
+ c = !1, window.clearTimeout(u), o.removeEventListener("scrollend", l), this._cancelarCorrecaoRolagem = null;
1217
+ }, !0;
1218
+ }
1219
+ obterContextoRenderizador() {
1220
+ return {
1221
+ host: this,
1222
+ shadow: this.shadow,
1223
+ theadElement: this._theadElement,
1224
+ colgroupElement: this._colgroupElement,
1225
+ tbodyElement: this._tbodyElement,
1226
+ tableElement: this._tableElement,
1227
+ emptyElement: this._emptyElement,
1228
+ containerElement: this._containerElement,
1229
+ colunas: this._colunas,
1230
+ dadosController: this.dadosController,
1231
+ selecaoController: this.selecaoController,
1232
+ chaveId: this.chaveId,
1233
+ virtualizar: this._virtualizar,
1234
+ rowHeight: this.getRowHeight(),
1235
+ indiceAtivo: this._indiceAtivo,
1236
+ textoVazio: this._textoVazio,
1237
+ textoSemResultados: this._textoSemResultados(),
1238
+ headerListeners: this._headerListeners,
1239
+ onSetIsResizing: (e) => {
1240
+ this._isResizing = e;
1241
+ },
1242
+ onActiveResizeCleanup: (e) => {
1243
+ this._activeResizeCleanup = e;
1244
+ },
1245
+ onHeaderClick: (e) => this.handleHeaderClick(e)
1246
+ };
1247
+ }
1248
+ renderHeader() {
1249
+ Pe(this.obterContextoRenderizador());
1250
+ }
1251
+ renderBody() {
1252
+ Fe(this.obterContextoRenderizador()), this.anunciarResultado(), this.medirAlturaLinha();
1253
+ }
1254
+ /**
1255
+ * Rola até um item e opcionalmente o seleciona. Aceita ID (pela `chave-id`, depois `id`, `_id`,
1256
+ * `codigo`, `key`), predicado ou índice. Um número é procurado primeiro como ID; use
1257
+ * `{ porIndice: true }` ou `rolarParaIndice()` para tratá-lo só como índice da linha exibida.
1258
+ */
1259
+ rolarPara(e, i) {
1260
+ return this.selecaoController.rolarPara(e, i);
1261
+ }
1262
+ /** Rola até a linha exibida de índice `indice` (posição após ordenação/filtro, base 0). */
1263
+ rolarParaIndice(e, i) {
1264
+ return this.selecaoController.rolarPara(e, { ...i, porIndice: !0 });
1265
+ }
1266
+ }
1267
+ te("ui-tabela", $e);
1268
+ const S = Math.PI / 180;
1269
+ function L(t) {
1270
+ return Math.abs(t) < 1e-12 ? 0 : Number(t.toPrecision(15));
1271
+ }
1272
+ const je = {
1273
+ sqrt: Math.sqrt,
1274
+ abs: Math.abs,
1275
+ round: Math.round,
1276
+ floor: Math.floor,
1277
+ ceil: Math.ceil,
1278
+ sin: (t) => L(Math.sin(t * S)),
1279
+ cos: (t) => L(Math.cos(t * S)),
1280
+ tan: (t) => L(Math.tan(t * S)),
1281
+ asin: (t) => L(Math.asin(t) / S),
1282
+ acos: (t) => L(Math.acos(t) / S),
1283
+ atan: (t) => L(Math.atan(t) / S)
1284
+ };
1285
+ function Z(t) {
1286
+ if (!t || typeof t != "string") return null;
1287
+ let r = t.trim();
1288
+ if (!r) return null;
1289
+ r = r.replace(/(\d),(\d)/g, "$1.$2").replace(/,/g, "."), r = r.replace(/\bpi\b/gi, String(Math.PI)), r = r.replace(/\be\b/gi, String(Math.E));
1290
+ let e = 0;
1291
+ function i() {
1292
+ return r[e] || "";
1293
+ }
1294
+ function o() {
1295
+ return r[e++] || "";
1296
+ }
1297
+ function a() {
1298
+ for (; e < r.length && /\s/.test(r[e]); )
1299
+ e++;
1300
+ }
1301
+ function n() {
1302
+ a();
1303
+ let l = s();
1304
+ for (a(); e < r.length; ) {
1305
+ const u = i();
1306
+ if (u === "+" || u === "-") {
1307
+ o(), a();
1308
+ const p = e, h = s();
1309
+ a(), r.slice(p, e).includes("%") ? l = u === "+" ? l + l * h : l - l * h : l = u === "+" ? l + h : l - h;
1310
+ } else
1311
+ break;
1312
+ }
1313
+ return l;
1314
+ }
1315
+ function s() {
1316
+ a();
1317
+ let l = d();
1318
+ for (a(); e < r.length; ) {
1319
+ const u = i();
1320
+ if (u === "*" || u === "/" || u === "x" || u === "X") {
1321
+ o(), a();
1322
+ const p = d();
1323
+ if (u === "/" && p === 0)
1324
+ throw new Error("Divisão por zero");
1325
+ l = u === "/" ? l / p : l * p, a();
1326
+ } else
1327
+ break;
1328
+ }
1329
+ return l;
1330
+ }
1331
+ function d() {
1332
+ a();
1333
+ const l = i();
1334
+ if (l === "+" || l === "-") {
1335
+ o();
1336
+ const p = d();
1337
+ return l === "-" ? -p : p;
1338
+ }
1339
+ let u = c();
1340
+ if (a(), i() === "^") {
1341
+ o();
1342
+ const p = d();
1343
+ u = Math.pow(u, p);
1344
+ } else if (r.slice(e, e + 2) === "**") {
1345
+ e += 2;
1346
+ const p = d();
1347
+ u = Math.pow(u, p);
1348
+ }
1349
+ return u;
1350
+ }
1351
+ function c() {
1352
+ a();
1353
+ const l = i();
1354
+ if (l === "+" || l === "-") {
1355
+ o();
1356
+ const h = c();
1357
+ return l === "-" ? -h : h;
1358
+ }
1359
+ if (l === "(") {
1360
+ o();
1361
+ const h = n();
1362
+ if (a(), o() !== ")") throw new Error("Parêntese sem fechamento");
1363
+ return a(), i() === "%" ? (o(), h / 100) : h;
1364
+ }
1365
+ const u = r.slice(e).match(/^([a-zA-Z_]\w*)\s*\(/);
1366
+ if (u) {
1367
+ const h = je[u[1].toLowerCase()];
1368
+ if (!h) throw new Error("Função desconhecida: " + u[1]);
1369
+ e += u[0].length;
1370
+ const m = n();
1371
+ if (a(), o() !== ")") throw new Error("Parêntese sem fechamento");
1372
+ const x = h(m);
1373
+ return a(), i() === "%" ? (o(), x / 100) : x;
1374
+ }
1375
+ const p = r.slice(e).match(/^([0-9]+(?:\.[0-9]+)?|\.[0-9]+)/);
1376
+ if (p) {
1377
+ e += p[0].length;
1378
+ let h = parseFloat(p[0]);
1379
+ return a(), i() === "%" && (o(), h = h / 100), h;
1380
+ }
1381
+ throw new Error("Caractere inválido: " + l);
1382
+ }
1383
+ try {
1384
+ const l = n();
1385
+ return a(), e < r.length ? null : isFinite(l) ? l : null;
1386
+ } catch {
1387
+ return null;
1388
+ }
1389
+ }
1390
+ const Ue = '.ui-prop__linha input:not([disabled]):not([type="color"]):not(.ui-prop__cor-picker-oculto), .ui-prop__linha select:not([disabled]), .ui-prop__linha .ui-prop__btn-acao-inline:not([disabled]), .ui-prop__linha .ui-prop__editor-booleano, .ui-prop__linha .ui-prop__editor-cor-container';
1391
+ function se(t, r) {
1392
+ if (!t) return null;
1393
+ const e = String(r);
1394
+ return Array.from(t.querySelectorAll("[data-prop-id]")).find((i) => i.getAttribute("data-prop-id") === e) ?? null;
1395
+ }
1396
+ const le = /* @__PURE__ */ new WeakMap();
1397
+ function k(t, r) {
1398
+ le.set(t, r);
1399
+ }
1400
+ function J(t, r, e) {
1401
+ var a, n;
1402
+ const i = se(t, r), o = (a = i == null ? void 0 : i.querySelector(".ui-prop__col-valor")) == null ? void 0 : a.firstElementChild;
1403
+ o && ((n = le.get(o)) == null || n(e));
1404
+ }
1405
+ function z(t, r, e = (o, a) => o === String(a), i = (o) => o == null || o === "" ? "—" : String(o)) {
1406
+ var n;
1407
+ (n = t.querySelector("option[data-externa]")) == null || n.remove();
1408
+ const o = Array.from(t.options).find((s) => !s.hasAttribute("data-acao") && e(s.value, r));
1409
+ if (o) {
1410
+ o.selected = !0;
1411
+ return;
1412
+ }
1413
+ const a = document.createElement("option");
1414
+ a.value = r == null ? "" : String(r), a.textContent = i(r), a.setAttribute("data-externa", ""), a.hidden = !0, t.insertBefore(a, t.firstChild), a.selected = !0;
1415
+ }
1416
+ function We(t, r) {
1417
+ const e = Array.from(t.querySelectorAll(Ue)), i = e.indexOf(r);
1418
+ if (i !== -1 && i + 1 < e.length) {
1419
+ const o = e[i + 1];
1420
+ o.focus(), o instanceof HTMLInputElement && o.select();
1421
+ }
1422
+ }
1423
+ function j(t, r) {
1424
+ var e;
1425
+ t.classList.toggle("ui-prop__categoria--aberta", r), (e = t.querySelector(".ui-prop__categoria-header")) == null || e.setAttribute("aria-expanded", String(r));
1426
+ }
1427
+ function Xe(t, r) {
1428
+ r.forEach((e) => e.aberto = !0), t.querySelectorAll(".ui-prop__categoria").forEach((e) => j(e, !0));
1429
+ }
1430
+ function Ye(t, r) {
1431
+ r.forEach((e) => e.aberto = !1), t.querySelectorAll(".ui-prop__categoria").forEach((e) => j(e, !1));
1432
+ }
1433
+ function Ge(t, r, e, i) {
1434
+ const o = e.find((a) => a.id === i);
1435
+ if (o) {
1436
+ o.aberto = o.aberto === !1;
1437
+ const a = Array.from(t.querySelectorAll("[data-cat-id]")).find((n) => n.getAttribute("data-cat-id") === i);
1438
+ a && j(a, !!o.aberto), r.dispatchEvent(
1439
+ new CustomEvent("ui-categoria-toggle", {
1440
+ bubbles: !0,
1441
+ composed: !0,
1442
+ detail: { id: i, aberto: o.aberto }
1443
+ })
1444
+ );
1445
+ }
1446
+ }
1447
+ function Ke(t) {
1448
+ const r = document.createElement("span"), e = (i) => {
1449
+ const o = typeof i == "number" || typeof i == "string" && /^-?\d+(\.\d+)?$/.test(i.trim());
1450
+ r.className = `ui-prop__valor-readonly ${o ? "ui-prop__valor-readonly--numero" : ""}`.trim(), r.textContent = i != null ? String(i) : "—";
1451
+ };
1452
+ return e(t), k(r, e), r;
1453
+ }
1454
+ function Qe(t, r, e, i) {
1455
+ const o = document.createElement("label");
1456
+ o.className = "ui-prop__editor-booleano", o.setAttribute("role", "checkbox"), o.tabIndex = 0, o.setAttribute("aria-label", r.rotulo);
1457
+ const a = document.createElement("div");
1458
+ a.className = "ui-prop__checkbox-custom";
1459
+ const n = document.createElement("span");
1460
+ n.className = "ui-prop__booleano-rotulo";
1461
+ const s = (c) => {
1462
+ const l = !!c;
1463
+ a.classList.toggle("ui-prop__checkbox-custom--marcado", l), a.textContent = l ? "✓" : "", n.textContent = l ? "Sim" : "Não", o.setAttribute("aria-checked", String(l));
1464
+ };
1465
+ s(e), k(o, s), o.appendChild(a), o.appendChild(n);
1466
+ const d = () => {
1467
+ const c = !i.obterValorAtual(r.id);
1468
+ i.registrarAlteracao(t, r.id, c), s(c);
1469
+ };
1470
+ return o.addEventListener("click", (c) => {
1471
+ c.preventDefault(), d();
1472
+ }), o.addEventListener("keydown", (c) => {
1473
+ c.key === " " ? (c.preventDefault(), d()) : c.key === "Enter" && (c.preventDefault(), i.focarProximoEditor(o));
1474
+ }), o;
1475
+ }
1476
+ function Ze(t, r, e, i) {
1477
+ const o = document.createElement("select");
1478
+ return o.className = "ui-prop__editor-select", o.setAttribute("aria-label", r.rotulo), (r.opcoes || []).forEach((a) => {
1479
+ const n = document.createElement("option");
1480
+ n.value = String(a.id), n.textContent = a.rotulo, o.appendChild(n);
1481
+ }), z(o, e), k(o, (a) => z(o, a)), o.addEventListener("change", () => {
1482
+ const a = (r.opcoes || []).find((n) => String(n.id) === o.value);
1483
+ i.registrarAlteracao(t, r.id, a ? a.id : o.value), z(o, i.obterValorAtual(r.id));
1484
+ }), o.addEventListener("keydown", (a) => {
1485
+ a.key === "Enter" && i.focarProximoEditor(o);
1486
+ }), o;
1487
+ }
1488
+ function Je(t, r, e) {
1489
+ const i = document.createElement("button");
1490
+ return i.type = "button", i.className = "ui-prop__btn-acao-inline", i.textContent = r.rotuloAcao || "Editar...", i.addEventListener("click", () => {
1491
+ typeof r.onClickAcao == "function" && r.onClickAcao(r), e.despacharEventoAcao(r, t);
1492
+ }), i;
1493
+ }
1494
+ function et(t, r, e, i) {
1495
+ const o = document.createElement("input");
1496
+ o.type = "text", o.inputMode = "decimal", o.autocomplete = "off", o.spellcheck = !1, o.className = "ui-prop__editor-input ui-prop__editor-input--numero", o.setAttribute("aria-label", r.rotulo), r.placeholder && (o.placeholder = r.placeholder);
1497
+ const a = (s) => {
1498
+ if (s == null || s === "") return "";
1499
+ const d = Number(s);
1500
+ return isNaN(d) ? String(s) : r.casasDecimais !== void 0 ? d.toFixed(r.casasDecimais) : String(d);
1501
+ };
1502
+ o.value = a(e), k(o, (s) => {
1503
+ o.value = a(s);
1504
+ }), o.addEventListener("focus", () => {
1505
+ o.select();
1506
+ }), o.addEventListener("input", () => {
1507
+ const s = o.value, d = /[\+\-\*\/\^\%\(\)]/.test(s) && !/^[+-]?[0-9]*\.?[0-9]*$/.test(s.trim());
1508
+ o.classList.toggle("ui-prop__editor-input--calculando", d);
1509
+ });
1510
+ const n = () => {
1511
+ o.classList.remove("ui-prop__editor-input--calculando");
1512
+ const s = o.value.trim();
1513
+ if (s === "") {
1514
+ i.registrarAlteracao(t, r.id, null);
1515
+ return;
1516
+ }
1517
+ const d = Z(s);
1518
+ if (d !== null && !isNaN(d)) {
1519
+ let c = d;
1520
+ r.casasDecimais !== void 0 && (c = Number(d.toFixed(r.casasDecimais))), o.value = a(c), i.registrarAlteracao(t, r.id, c);
1521
+ } else
1522
+ o.value = a(i.obterValorAtual(r.id));
1523
+ };
1524
+ return o.addEventListener("change", n), o.addEventListener("blur", n), o.addEventListener("keydown", (s) => {
1525
+ if (s.key === "Enter")
1526
+ n(), i.focarProximoEditor(o);
1527
+ else if (s.key === "Escape")
1528
+ o.classList.remove("ui-prop__editor-input--calculando"), o.value = a(i.obterValorAtual(r.id)), o.blur();
1529
+ else if (s.key === "ArrowUp" || s.key === "ArrowDown") {
1530
+ s.preventDefault();
1531
+ const c = Z(o.value) ?? (Number(i.obterValorAtual(r.id)) || 0);
1532
+ let l = r.casasDecimais !== void 0 ? Math.pow(10, -r.casasDecimais) : 1;
1533
+ s.shiftKey ? l *= 10 : s.altKey && r.casasDecimais === void 0 && (l *= 0.1);
1534
+ let u = s.key === "ArrowUp" ? c + l : c - l;
1535
+ r.casasDecimais !== void 0 ? u = Number(u.toFixed(r.casasDecimais)) : u = Math.round(u * 100) / 100, o.value = a(u), i.registrarAlteracao(t, r.id, u);
1536
+ }
1537
+ }), o;
1538
+ }
1539
+ function tt(t, r, e, i) {
1540
+ const o = document.createElement("input");
1541
+ o.type = "text", o.className = "ui-prop__editor-input", o.setAttribute("aria-label", r.rotulo), r.placeholder && (o.placeholder = r.placeholder), o.value = e != null ? String(e) : "", k(o, (n) => {
1542
+ o.value = n != null ? String(n) : "";
1543
+ }), o.addEventListener("focus", () => {
1544
+ o.select();
1545
+ });
1546
+ const a = () => {
1547
+ i.registrarAlteracao(t, r.id, o.value);
1548
+ };
1549
+ return o.addEventListener("change", a), o.addEventListener("keydown", (n) => {
1550
+ n.key === "Enter" ? (a(), i.focarProximoEditor(o)) : n.key === "Escape" && (o.value = String(i.obterValorAtual(r.id) ?? ""), o.blur());
1551
+ }), o;
1552
+ }
1553
+ const P = (t, r) => t.toLowerCase() === String(r ?? "").toLowerCase();
1554
+ function U(t, r) {
1555
+ r.forEach((e) => {
1556
+ const i = document.createElement("option");
1557
+ i.value = String(e.id), i.textContent = e.rotulo, t.appendChild(i);
1558
+ });
1559
+ }
1560
+ function rt(t, r, e, i) {
1561
+ const o = document.createElement("div");
1562
+ o.className = "ui-prop__editor-linha-container";
1563
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1564
+ a.setAttribute("class", "ui-prop__linha-amostra-svg"), a.setAttribute("viewBox", "0 0 44 12");
1565
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
1566
+ n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "44"), n.setAttribute("y2", "6");
1567
+ const s = (l) => {
1568
+ const u = String(l || "").toLowerCase();
1569
+ u.includes("center") || u.includes("eixo") || u.includes("dashdot") || u.includes("traço-ponto") ? n.setAttribute("stroke-dasharray", "8,3,2,3") : u.includes("dash") || u.includes("tracej") || u.includes("hidden") ? n.setAttribute("stroke-dasharray", "6,3") : u.includes("dot") || u.includes("ponto") || u.includes("pontilh") ? n.setAttribute("stroke-dasharray", "2,3") : n.setAttribute("stroke-dasharray", "none");
1570
+ };
1571
+ a.appendChild(n);
1572
+ const d = document.createElement("select");
1573
+ d.className = "ui-prop__linha-select", d.setAttribute("aria-label", r.rotulo), U(d, r.opcoes && r.opcoes.length > 0 ? r.opcoes : [
1574
+ { id: "ByLayer", rotulo: "ByLayer" },
1575
+ { id: "ByBlock", rotulo: "ByBlock" },
1576
+ { id: "Continuous", rotulo: "Continuous" },
1577
+ { id: "Dashed", rotulo: "Dashed" },
1578
+ { id: "Hidden", rotulo: "Hidden" },
1579
+ { id: "Center", rotulo: "Center" },
1580
+ { id: "Dotted", rotulo: "Dotted" }
1581
+ ]);
1582
+ const c = (l) => {
1583
+ s(l), z(d, l, P);
1584
+ };
1585
+ return c(e), k(o, c), d.addEventListener("change", () => {
1586
+ s(d.value), i.registrarAlteracao(t, r.id, d.value), z(d, d.value, P);
1587
+ }), d.addEventListener("keydown", (l) => {
1588
+ l.key === "Enter" && i.focarProximoEditor(d);
1589
+ }), o.appendChild(a), o.appendChild(d), o;
1590
+ }
1591
+ function ot(t, r, e, i) {
1592
+ const o = document.createElement("div");
1593
+ o.className = "ui-prop__editor-espessura-container";
1594
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1595
+ a.setAttribute("class", "ui-prop__espessura-amostra-svg"), a.setAttribute("viewBox", "0 0 38 12");
1596
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
1597
+ n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "38"), n.setAttribute("y2", "6");
1598
+ const s = (l) => {
1599
+ const u = parseFloat(String(l).replace(/[^0-9.]/g, ""));
1600
+ return isNaN(u) || u <= 0 ? 1.5 : Math.min(8, Math.max(1, u * 8));
1601
+ };
1602
+ a.appendChild(n);
1603
+ const d = document.createElement("select");
1604
+ d.className = "ui-prop__espessura-select", d.setAttribute("aria-label", r.rotulo), U(d, r.opcoes && r.opcoes.length > 0 ? r.opcoes : [
1605
+ { id: "ByLayer", rotulo: "ByLayer" },
1606
+ { id: "ByBlock", rotulo: "ByBlock" },
1607
+ { id: "0.00 mm", rotulo: "0.00 mm" },
1608
+ { id: "0.05 mm", rotulo: "0.05 mm" },
1609
+ { id: "0.09 mm", rotulo: "0.09 mm" },
1610
+ { id: "0.13 mm", rotulo: "0.13 mm" },
1611
+ { id: "0.15 mm", rotulo: "0.15 mm" },
1612
+ { id: "0.18 mm", rotulo: "0.18 mm" },
1613
+ { id: "0.20 mm", rotulo: "0.20 mm" },
1614
+ { id: "0.25 mm", rotulo: "0.25 mm" },
1615
+ { id: "0.30 mm", rotulo: "0.30 mm" },
1616
+ { id: "0.35 mm", rotulo: "0.35 mm" },
1617
+ { id: "0.40 mm", rotulo: "0.40 mm" },
1618
+ { id: "0.50 mm", rotulo: "0.50 mm" },
1619
+ { id: "0.60 mm", rotulo: "0.60 mm" },
1620
+ { id: "0.70 mm", rotulo: "0.70 mm" },
1621
+ { id: "1.00 mm", rotulo: "1.00 mm" },
1622
+ { id: "1.40 mm", rotulo: "1.40 mm" },
1623
+ { id: "2.00 mm", rotulo: "2.00 mm" }
1624
+ ]);
1625
+ const c = (l) => {
1626
+ n.setAttribute("stroke-width", String(s(l))), z(d, l, P);
1627
+ };
1628
+ return c(e), k(o, c), d.addEventListener("change", () => {
1629
+ n.setAttribute("stroke-width", String(s(d.value))), i.registrarAlteracao(t, r.id, d.value), z(d, d.value, P);
1630
+ }), d.addEventListener("keydown", (l) => {
1631
+ l.key === "Enter" && i.focarProximoEditor(d);
1632
+ }), o.appendChild(a), o.appendChild(d), o;
1633
+ }
1634
+ const W = [
1635
+ { nome: "Red", indice: 1, hex: "#ff0000" },
1636
+ { nome: "Yellow", indice: 2, hex: "#ffff00" },
1637
+ { nome: "Green", indice: 3, hex: "#00ff00" },
1638
+ { nome: "Cyan", indice: 4, hex: "#00ffff" },
1639
+ { nome: "Blue", indice: 5, hex: "#0000ff" },
1640
+ { nome: "Magenta", indice: 6, hex: "#ff00ff" },
1641
+ { nome: "White", indice: 7, hex: "#ffffff" }
1642
+ ], de = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
1643
+ function q(t) {
1644
+ const r = String(t ?? "").trim().toLowerCase(), e = W.find((i) => String(i.indice) === r || i.nome.toLowerCase() === r);
1645
+ return e ? e.nome.toLowerCase() : r;
1646
+ }
1647
+ function it(t) {
1648
+ const r = q(t), e = W.find((i) => i.nome.toLowerCase() === r);
1649
+ return e ? e.hex : de.test(r) ? r : "#ffffff";
1650
+ }
1651
+ function ce(t) {
1652
+ return t.length === 4 ? "#" + t.slice(1).split("").map((r) => r + r).join("") : t;
1653
+ }
1654
+ function at(t, r, e, i) {
1655
+ const o = document.createElement("div");
1656
+ o.className = "ui-prop__editor-cor-cad-container";
1657
+ const a = document.createElement("div");
1658
+ a.className = "ui-prop__cor-amostra";
1659
+ const n = document.createElement("select");
1660
+ n.className = "ui-prop__cor-cad-select", n.setAttribute("aria-label", r.rotulo), U(n, [
1661
+ { id: "ByLayer", rotulo: "ByLayer" },
1662
+ { id: "ByBlock", rotulo: "ByBlock" },
1663
+ ...W.map((l) => ({ id: l.nome, rotulo: `${l.nome} (${l.indice})` }))
1664
+ ]);
1665
+ const s = document.createElement("option");
1666
+ s.value = "__escolher", s.textContent = "Selecionar cor...", s.setAttribute("data-acao", ""), n.appendChild(s);
1667
+ const d = document.createElement("input");
1668
+ d.type = "color", d.className = "ui-prop__cor-picker-oculto", d.tabIndex = -1;
1669
+ const c = (l) => {
1670
+ const u = it(l);
1671
+ a.style.backgroundColor = u, d.value = ce(u), z(
1672
+ n,
1673
+ l,
1674
+ (p, h) => q(p) === q(h),
1675
+ (p) => p == null || p === "" ? "—" : String(p)
1676
+ );
1677
+ };
1678
+ return c(e), k(o, c), d.addEventListener("input", () => {
1679
+ a.style.backgroundColor = d.value;
1680
+ }), d.addEventListener("change", () => {
1681
+ i.registrarAlteracao(t, r.id, d.value), c(i.obterValorAtual(r.id));
1682
+ }), n.addEventListener("change", () => {
1683
+ if (n.value === "__escolher") {
1684
+ c(i.obterValorAtual(r.id)), d.click();
1685
+ return;
1686
+ }
1687
+ i.registrarAlteracao(t, r.id, n.value), c(i.obterValorAtual(r.id));
1688
+ }), n.addEventListener("keydown", (l) => {
1689
+ l.key === "Enter" && i.focarProximoEditor(n);
1690
+ }), o.appendChild(a), o.appendChild(n), o.appendChild(d), o;
1691
+ }
1692
+ function nt(t, r, e, i) {
1693
+ const o = document.createElement("div");
1694
+ o.className = "ui-prop__editor-cor-container", o.setAttribute("role", "button"), o.tabIndex = 0;
1695
+ const a = document.createElement("div");
1696
+ a.className = "ui-prop__cor-amostra";
1697
+ const n = document.createElement("span");
1698
+ n.className = "ui-prop__cor-texto";
1699
+ const s = document.createElement("input");
1700
+ s.type = "color", s.className = "ui-prop__cor-picker-oculto", s.tabIndex = -1;
1701
+ const d = (c) => {
1702
+ const l = typeof c == "string" && de.test(c) ? ce(c) : null;
1703
+ a.style.backgroundColor = c || "#ffffff", n.textContent = r.textoAmostra || String(c || "ByLayer"), s.value = l ?? "#ffffff", o.setAttribute("aria-label", `${r.rotulo}: ${c || "ByLayer"}`);
1704
+ };
1705
+ return d(e), k(o, d), s.addEventListener("input", () => {
1706
+ a.style.backgroundColor = s.value, n.textContent = r.textoAmostra || s.value;
1707
+ }), s.addEventListener("change", () => {
1708
+ i.registrarAlteracao(t, r.id, s.value), d(i.obterValorAtual(r.id));
1709
+ }), o.addEventListener("click", (c) => {
1710
+ c.target !== s && s.click();
1711
+ }), o.addEventListener("keydown", (c) => {
1712
+ (c.key === " " || c.key === "Enter") && (c.preventDefault(), s.click());
1713
+ }), o.appendChild(a), o.appendChild(n), o.appendChild(s), o;
1714
+ }
1715
+ function st(t, r, e, i) {
1716
+ return r.somenteLeitura || r.tipo === "readonly" ? Ke(e) : r.tipo === "booleano" ? Qe(t, r, e, i) : r.tipo === "linha" || r.tipo === "linetype" ? rt(t, r, e, i) : r.tipo === "espessura" || r.tipo === "lineweight" ? ot(t, r, e, i) : r.tipo === "cor-cad" ? at(t, r, e, i) : r.tipo === "selecao" ? Ze(t, r, e, i) : r.tipo === "cor" ? nt(t, r, e, i) : r.tipo === "acao" ? Je(t, r, i) : r.tipo === "numero" ? et(t, r, e, i) : tt(t, r, e, i);
1717
+ }
1718
+ function lt(t) {
1719
+ if (!t.tipoContainerElement) return;
1720
+ if (!t.tipos || t.tipos.length === 0) {
1721
+ t.tipoContainerElement.style.display = "none";
1722
+ return;
1723
+ }
1724
+ t.tipoContainerElement.style.display = "flex", t.tipoContainerElement.innerHTML = "";
1725
+ const r = t.tipos.find((e) => String(e.id) === String(t.tipoSelecionadoId)) || t.tipos[0];
1726
+ if (t.estiloVisual === "revit") {
1727
+ const e = document.createElement("div");
1728
+ e.className = "ui-prop__tipo-revit-card";
1729
+ const i = document.createElement("div");
1730
+ i.className = "ui-prop__tipo-miniatura";
1731
+ const o = r.iconeSvg ? me(r.iconeSvg) : null;
1732
+ o ? i.appendChild(o) : i.innerHTML = `
1733
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1734
+ <rect x="3" y="3" width="18" height="18" rx="2"></rect>
1735
+ <path d="M3 9h18M9 21V9"></path>
1736
+ </svg>
1737
+ `;
1738
+ const a = document.createElement("div");
1739
+ a.className = "ui-prop__tipo-info";
1740
+ const n = document.createElement("div");
1741
+ n.className = "ui-prop__tipo-nome", n.textContent = r.rotulo;
1742
+ const s = document.createElement("div");
1743
+ s.className = "ui-prop__tipo-subtexto", s.textContent = r.subtipo || "Tipo de Família", a.appendChild(n), a.appendChild(s), e.appendChild(i), e.appendChild(a);
1744
+ const d = document.createElement("div");
1745
+ d.className = "ui-prop__tipo-revit-subbarra";
1746
+ const c = document.createElement("select");
1747
+ c.className = "ui-prop__tipo-select", t.tipos.forEach((u) => {
1748
+ const p = document.createElement("option");
1749
+ p.value = u.id, p.textContent = `${u.rotulo}${u.subtipo ? ` : ${u.subtipo}` : ""}`, String(u.id) === String(t.tipoSelecionadoId) && (p.selected = !0), c.appendChild(p);
1750
+ }), c.addEventListener("change", () => {
1751
+ t.onSelecionarTipo(c.value);
1752
+ });
1753
+ const l = document.createElement("button");
1754
+ l.type = "button", l.className = "ui-prop__btn-editar-tipo", l.innerHTML = `
1755
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 4px; vertical-align: -1px;">
1756
+ <rect x="3" y="3" width="12" height="12" rx="1"></rect>
1757
+ <rect x="9" y="9" width="12" height="12" rx="1"></rect>
1758
+ </svg>
1759
+ <span>Editar tipo</span>
1760
+ `, l.addEventListener("click", () => {
1761
+ t.onEditarTipo(r);
1762
+ }), d.appendChild(c), d.appendChild(l), t.tipoContainerElement.appendChild(e), t.tipoContainerElement.appendChild(d);
1763
+ } else {
1764
+ const e = document.createElement("div");
1765
+ e.className = "ui-prop__tipo-autocad-bar";
1766
+ const i = document.createElement("select");
1767
+ i.className = "ui-prop__tipo-select", t.tipos.forEach((d) => {
1768
+ const c = document.createElement("option");
1769
+ c.value = d.id, c.textContent = d.rotulo, String(d.id) === String(t.tipoSelecionadoId) && (c.selected = !0), i.appendChild(c);
1770
+ }), i.addEventListener("change", () => {
1771
+ t.onSelecionarTipo(i.value);
1772
+ });
1773
+ const o = document.createElement("div");
1774
+ o.className = "ui-prop__tipo-autocad-acoes";
1775
+ const a = document.createElement("button");
1776
+ a.type = "button", a.className = "ui-prop__btn-autocad", a.title = "Seleção rápida", a.setAttribute("aria-label", "Seleção rápida"), a.innerHTML = `
1777
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1778
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
1779
+ </svg>
1780
+ `, a.addEventListener("click", () => {
1781
+ t.onQuickSelect(r);
1782
+ });
1783
+ const n = document.createElement("button");
1784
+ n.type = "button", n.className = "ui-prop__btn-autocad", n.title = "Selecionar objetos", n.setAttribute("aria-label", "Selecionar objetos"), n.innerHTML = `
1785
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1786
+ <circle cx="12" cy="12" r="7"></circle>
1787
+ <line x1="12" y1="2" x2="12" y2="7"></line>
1788
+ <line x1="12" y1="17" x2="12" y2="22"></line>
1789
+ <line x1="2" y1="12" x2="7" y2="12"></line>
1790
+ <line x1="17" y1="12" x2="22" y2="12"></line>
1791
+ <line x1="12" y1="9" x2="12" y2="15" stroke-width="2.5"></line>
1792
+ <line x1="9" y1="12" x2="15" y2="12" stroke-width="2.5"></line>
1793
+ </svg>
1794
+ `, n.addEventListener("click", () => {
1795
+ t.onSelectObjects(r);
1796
+ });
1797
+ const s = document.createElement("button");
1798
+ s.type = "button", s.className = "ui-prop__btn-autocad", s.title = "Calculadora rápida", s.setAttribute("aria-label", "Calculadora rápida"), s.innerHTML = `
1799
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1800
+ <rect x="4" y="2" width="16" height="20" rx="2"></rect>
1801
+ <line x1="8" y1="6" x2="16" y2="6"></line>
1802
+ <circle cx="8" cy="11" r="1" fill="currentColor"></circle>
1803
+ <circle cx="12" cy="11" r="1" fill="currentColor"></circle>
1804
+ <circle cx="16" cy="11" r="1" fill="currentColor"></circle>
1805
+ <circle cx="8" cy="15" r="1" fill="currentColor"></circle>
1806
+ <circle cx="12" cy="15" r="1" fill="currentColor"></circle>
1807
+ <circle cx="16" cy="15" r="1" fill="currentColor"></circle>
1808
+ </svg>
1809
+ `, s.addEventListener("click", () => {
1810
+ t.onCalculadora(r);
1811
+ }), o.appendChild(a), o.appendChild(n), o.appendChild(s), e.appendChild(i), e.appendChild(o), t.tipoContainerElement.appendChild(e);
1812
+ }
1813
+ }
1814
+ function dt(t) {
1815
+ let r = 45;
1816
+ function e(o) {
1817
+ const a = Math.max(20, Math.min(65, o));
1818
+ return r = a, t.hostElement.style.setProperty("--ui-prop-rotulo-largura", `${a}%`), t.splitterElement && (t.splitterElement.style.left = `calc(${a}% - 4px)`), a;
1819
+ }
1820
+ function i() {
1821
+ if (!t.splitterElement || !t.corpoElement) return;
1822
+ t.splitterListeners.cleanup();
1823
+ let o = !1;
1824
+ const a = (n) => {
1825
+ if (n.button !== 0) return;
1826
+ n.preventDefault(), n.stopPropagation(), o = !0, t.splitterElement.classList.add("ui-prop__splitter--ativo");
1827
+ try {
1828
+ t.splitterElement.setPointerCapture(n.pointerId);
1829
+ } catch {
1830
+ }
1831
+ const s = t.corpoElement.getBoundingClientRect(), d = (l) => {
1832
+ if (!o) return;
1833
+ const u = s.width;
1834
+ if (u <= 0) return;
1835
+ const p = l.clientX - s.left;
1836
+ let g = Math.max(80, Math.min(u - 130, p)) / u * 100;
1837
+ g = Math.max(20, Math.min(65, g)), e(g);
1838
+ }, c = (l) => {
1839
+ if (o) {
1840
+ o = !1, t.splitterElement.classList.remove("ui-prop__splitter--ativo");
1841
+ try {
1842
+ t.splitterElement.hasPointerCapture(l.pointerId) && t.splitterElement.releasePointerCapture(l.pointerId);
1843
+ } catch {
1844
+ }
1845
+ t.splitterElement.removeEventListener("pointermove", d), t.splitterElement.removeEventListener("pointerup", c), t.splitterElement.removeEventListener("pointercancel", c), t.onLarguraAlterada(r), t.hostElement.dispatchEvent(
1846
+ new CustomEvent("ui-splitter-resize", {
1847
+ bubbles: !0,
1848
+ composed: !0,
1849
+ detail: { larguraPorcentagem: r }
1850
+ })
1851
+ );
1852
+ }
1853
+ };
1854
+ t.splitterElement.addEventListener("pointermove", d), t.splitterElement.addEventListener("pointerup", c), t.splitterElement.addEventListener("pointercancel", c);
1855
+ };
1856
+ t.splitterListeners.add(t.splitterElement, "pointerdown", a), t.splitterListeners.add(t.splitterElement, "dblclick", () => {
1857
+ e(45), t.onLarguraAlterada(45), t.hostElement.dispatchEvent(
1858
+ new CustomEvent("ui-splitter-resize", {
1859
+ bubbles: !0,
1860
+ composed: !0,
1861
+ detail: { larguraPorcentagem: 45 }
1862
+ })
1863
+ );
1864
+ });
1865
+ }
1866
+ return {
1867
+ init: i,
1868
+ definirLarguraRotulo: e
1869
+ };
1870
+ }
1871
+ const ct = `:host{display:flex;flex-direction:column;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:var(--ui-tamanho-corpo-sm, 12px);color:var(--ui-cor-texto, #e1e1e6);background-color:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 4px);overflow:hidden;width:100%;max-width:100%;height:100%;min-height:200px;-webkit-user-select:none;user-select:none;--ui-prop-altura-linha: 22px;--ui-prop-rotulo-largura: 45%}:host([densidade="compacta"]){--ui-prop-altura-linha: 19px;font-size:10.5px}:host([densidade="ultracompacta"]){--ui-prop-altura-linha: 17px;font-size:10px}:host([densidade="relaxada"]){--ui-prop-altura-linha: 28px;font-size:12px}:host([colapsado]){width:32px!important;min-width:32px!important;max-width:32px!important;height:100%!important;cursor:pointer;transition:width .2s cubic-bezier(.4,0,.2,1)}:host([colapsado]) .ui-prop__header,:host([colapsado]) .ui-prop__tipo-seletor-container,:host([colapsado]) .ui-prop__filtro-container,:host([colapsado]) .ui-prop__corpo-wrapper,:host([colapsado]) .ui-prop__footer,:host([colapsado]) .ui-prop__resizer-canto{display:none!important}:host([colapsado]) .ui-prop__faixa-estreita{display:flex!important;flex-direction:column;align-items:center;width:100%;height:100%;padding:8px 0;gap:10px;box-sizing:border-box;background-color:var(--ui-cor-fundo-elevado, #18181d);-webkit-user-select:none;user-select:none;cursor:pointer}.ui-prop__faixa-estreita{display:none}.ui-prop__faixa-icone{display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__faixa-btn-expandir{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;color:var(--ui-cor-texto, #e1e1e6);cursor:pointer;padding:0;transition:all .15s ease;flex-shrink:0}.ui-prop__faixa-btn-expandir:hover{background-color:var(--ui-cor-destaque, #00E08A);color:#000;border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__faixa-texto{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:2px;color:var(--ui-cor-texto-secundario, #888899);margin-top:8px;flex:1;pointer-events:none}:host([colapsado]):hover .ui-prop__faixa-texto{color:var(--ui-cor-texto, #ffffff)}:host([flutuante]){position:fixed!important;z-index:var(--ui-z-docked-bar, 600)!important;box-shadow:var(--ui-sombra-lg, 0 16px 48px rgba(0, 0, 0, .75)),0 0 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 14%,transparent),0 6px 14px #00000080!important;border-radius:6px!important;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);resize:both;overflow:hidden;max-width:95vw;max-height:95vh;min-width:220px;min-height:200px}:host([flutuante]) .ui-prop__header{cursor:grab;-webkit-user-select:none;user-select:none}:host([flutuante].arrastando) .ui-prop__header{cursor:grabbing!important}.ui-prop__resizer-canto{display:none}:host([flutuante]) .ui-prop__resizer-canto{display:block;position:absolute;bottom:0;right:0;width:14px;height:14px;cursor:nwse-resize;z-index:50;background:linear-gradient(135deg,transparent 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 65%,transparent 65%,transparent 80%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 80%);pointer-events:auto}.ui-prop__btn-icone--ativo{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)!important;color:var(--ui-cor-destaque, #00E08A)!important}.ui-prop__container{display:flex;flex-direction:column;width:100%;height:100%;min-height:0;flex:1;overflow:hidden;box-sizing:border-box}.ui-prop__header{display:flex;align-items:center;justify-content:space-between;height:22px;min-height:22px;padding:0 8px;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__header{height:20px;min-height:20px;padding:0 6px}:host([densidade="ultracompacta"]) .ui-prop__header{height:18px;min-height:18px;padding:0 5px}.ui-prop__header-titulo{display:flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;color:var(--ui-cor-texto, #ffffff);text-transform:uppercase;letter-spacing:.4px}:host([densidade="compacta"]) .ui-prop__header-titulo{font-size:10px;gap:4px}:host([densidade="ultracompacta"]) .ui-prop__header-titulo{font-size:9.5px;gap:3px}.ui-prop__header-icone{display:flex;align-items:center;color:var(--ui-cor-destaque, #00E08A)}.ui-prop__header-icone svg{width:12px;height:12px}:host([densidade="ultracompacta"]) .ui-prop__header-icone svg{width:10px;height:10px}.ui-prop__header-acoes{display:flex;align-items:center;gap:2px}.ui-prop__btn-icone{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;transition:all .15s ease;padding:0}.ui-prop__btn-icone:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}:host([densidade="compacta"]) .ui-prop__btn-icone{width:17px;height:17px}:host([densidade="ultracompacta"]) .ui-prop__btn-icone{width:16px;height:16px}.ui-prop__tipo-seletor-container{padding:3px 6px;background-color:var(--ui-cor-superficie, #141417);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));display:flex;flex-direction:column;gap:3px;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__tipo-seletor-container{padding:2px 5px;gap:2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-seletor-container{padding:1px 4px;gap:1px}.ui-prop__tipo-revit-card{display:flex;align-items:center;gap:10px;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-sm, 4px);padding:6px 8px;cursor:pointer;transition:border-color .15s ease}.ui-prop__tipo-revit-card:hover{border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-miniatura{width:32px;height:32px;border-radius:3px;background-color:var(--ui-cor-fundo-elevado, #24242a);display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__tipo-info{display:flex;flex-direction:column;flex:1;min-width:0}.ui-prop__tipo-nome{font-weight:600;font-size:12px;color:var(--ui-cor-texto, #ffffff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-subtexto{font-size:11px;color:var(--ui-cor-texto-secundario, #888899);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-revit-subbarra{display:flex;align-items:center;gap:6px}.ui-prop__tipo-select{flex:1;min-width:0;width:0;height:20px;background-color:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:2px;padding:0 16px 0 2px;font-size:10.5px;font-weight:500;cursor:pointer;outline:none;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 4px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,color .15s ease}.ui-prop__tipo-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);color:#fff}.ui-prop__tipo-select:focus{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent);color:var(--ui-cor-destaque, #00E08A)}:host([densidade="compacta"]) .ui-prop__tipo-select{height:18px;font-size:10px;padding:0 14px 0 2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-select{height:16px;font-size:9.5px;padding:0 12px 0 2px}.ui-prop__btn-editar-tipo{height:20px;padding:0 6px;background-color:transparent;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:2px;color:var(--ui-cor-texto, #ffffff);font-size:10.5px;font-weight:500;cursor:pointer;white-space:nowrap;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-editar-tipo{height:18px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__btn-editar-tipo{height:16px;font-size:9.5px}.ui-prop__btn-editar-tipo:hover{background-color:var(--ui-cor-botao-secundario-hover, #2a2a34);border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-autocad-bar{display:flex;align-items:center;gap:2px;width:100%;min-width:0;box-sizing:border-box;background:transparent}.ui-prop__tipo-autocad-acoes{display:flex;align-items:center;gap:1px;flex-shrink:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding-left:3px;margin-left:1px}.ui-prop__btn-autocad{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;padding:0;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-autocad{width:18px;height:18px}:host([densidade="ultracompacta"]) .ui-prop__btn-autocad{width:16px;height:16px}.ui-prop__btn-autocad:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .1));color:var(--ui-cor-destaque, #00E08A)}.ui-prop__btn-autocad:active{transform:scale(.92);background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-prop__filtro-container{display:flex;align-items:center;padding:4px 8px;background-color:var(--ui-cor-fundo, #0b0b0d);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));gap:6px;flex-shrink:0}.ui-prop__filtro-icone{color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0}.ui-prop__filtro-input{flex:1;background:transparent;border:none;outline:none;font-size:11px;color:var(--ui-cor-texto, #e1e1e6);padding:3px 0}.ui-prop__filtro-input::placeholder{color:var(--ui-cor-texto-secundario, #666677)}.ui-prop__corpo-wrapper{position:relative;flex:1;min-height:0;width:100%;overflow:hidden;display:flex;flex-direction:column}.ui-prop__corpo{flex:1;min-height:0;width:100%;overflow-y:auto;overflow-x:hidden;background-color:var(--ui-cor-superficie, #141417);position:relative;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent) var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar{width:8px}.ui-prop__corpo::-webkit-scrollbar-track{background:var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-radius:var(--ui-raio-sm, 4px)}.ui-prop__corpo::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent)}.ui-prop__categoria{border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1))}.ui-prop__categoria-header{position:relative;z-index:25;display:flex;align-items:center;justify-content:space-between;height:21px;padding:0 6px;background-color:var(--ui-cor-fundo-elevado, #18181d);cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:600;font-size:10.5px;color:var(--ui-cor-texto, #ffffff);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .05));transition:background-color .15s ease;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__categoria-header{height:19px;font-size:10px;padding:0 5px}:host([densidade="ultracompacta"]) .ui-prop__categoria-header{height:17px;font-size:9.5px;padding:0 4px}.ui-prop__categoria-header:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .06))}.ui-prop__categoria-titulo-bloco{display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__categoria-seta{display:inline-flex;align-items:center;justify-content:center;font-size:9px;width:12px;height:12px;color:var(--ui-cor-texto-secundario, #888899);transition:transform .15s ease}.ui-prop__categoria--aberta .ui-prop__categoria-seta{transform:rotate(90deg)}.ui-prop__categoria-contador{font-size:10px;font-weight:400;color:var(--ui-cor-texto-secundario, #888899)}.ui-prop__categoria-conteudo{display:none}.ui-prop__categoria--aberta .ui-prop__categoria-conteudo{display:block}.ui-prop__linha{display:flex;align-items:stretch;min-height:var(--ui-prop-altura-linha, 24px);border-bottom:1px dotted var(--ui-cor-borda, rgba(255, 255, 255, .08));box-sizing:border-box;position:relative;z-index:1;transition:background-color .1s ease}.ui-prop__linha:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-prop__linha:focus-within{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__linha:focus-within .ui-prop__col-rotulo{color:var(--ui-cor-texto, #ffffff);font-weight:500}.ui-prop__linha--modificada{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo{width:var(--ui-prop-rotulo-largura, 45%);padding:1px 4px 1px 8px;display:flex;align-items:center;color:var(--ui-cor-texto-secundario, #9999aa);border-right:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;position:relative;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__col-rotulo{padding:0 4px 0 6px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__col-rotulo{padding:0 3px 0 5px;font-size:9.5px}.ui-prop__col-rotulo span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__col-rotulo--scrub{cursor:ew-resize;-webkit-user-select:none;user-select:none;transition:color .15s ease,background-color .15s ease}.ui-prop__col-rotulo--scrub:hover{color:var(--ui-cor-destaque, #00E08A);background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo--arrastando{color:#000!important;background-color:var(--ui-cor-destaque, #00E08A)!important;font-weight:600;cursor:ew-resize!important}.ui-prop__col-rotulo--arrastando span{color:#000!important}.ui-prop__splitter{position:absolute;top:0;bottom:0;min-height:100%;left:calc(var(--ui-prop-rotulo-largura, 45%) - 4px);width:8px;cursor:col-resize;z-index:30;touch-action:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:center}.ui-prop__splitter:after{content:"";position:absolute;top:0;bottom:0;left:3px;width:2px;background-color:transparent;pointer-events:none;transition:background-color .15s ease,box-shadow .15s ease}.ui-prop__splitter:hover:after,.ui-prop__splitter--ativo:after{background-color:var(--ui-cor-destaque, #00E08A);box-shadow:0 0 6px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 50%,transparent)}.ui-prop__splitter--ativo{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__col-valor{width:calc(100% - var(--ui-prop-rotulo-largura, 45%));flex:1 1 0px;min-width:0!important;display:flex;align-items:stretch;padding:0;overflow:hidden;box-sizing:border-box;position:relative;transition:background-color .1s ease,box-shadow .1s ease}.ui-prop__col-valor:focus-within{background-color:var(--ui-cor-fundo, #0b0b0d);box-shadow:inset 0 0 0 1px var(--ui-cor-destaque, #00E08A)}.ui-prop__editor-input{width:100%;min-width:0;height:100%;min-height:var(--ui-prop-altura-linha, 24px);background:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-family:inherit;font-size:11px;padding:0 8px;outline:none;box-sizing:border-box;transition:background-color .1s ease}.ui-prop__editor-input:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-input--numero{text-align:right;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__editor-input--calculando{color:var(--ui-cor-destaque, #00E08A)!important;font-weight:500}.ui-prop__col-valor:has(.ui-prop__editor-input--calculando){background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)!important;box-shadow:inset 0 0 0 1.5px var(--ui-cor-destaque, #00E08A)!important}.ui-prop__editor-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);background-color:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 8px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;transition:background-color .1s ease}.ui-prop__editor-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 20px 0 8px;box-sizing:border-box;position:relative;border:none;border-radius:0;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;transition:background-color .1s ease}.ui-prop__editor-cor-container:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent)}.ui-prop__cor-amostra{width:13px;height:13px;border-radius:2px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);flex-shrink:0;box-sizing:border-box}.ui-prop__cor-texto{flex:1 1 0px;min-width:0!important;width:0!important;font-size:11px;color:var(--ui-cor-texto, #ffffff);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__cor-picker-oculto{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.ui-prop__editor-linha-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__linha-amostra-svg{width:24px;height:10px;flex-shrink:0}.ui-prop__linha-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6);stroke-width:1.5}.ui-prop__linha-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__linha-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__linha-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-espessura-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__espessura-amostra-svg{width:20px;height:10px;flex-shrink:0}.ui-prop__espessura-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6)}.ui-prop__espessura-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__espessura-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__espessura-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-cad-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__cor-cad-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__cor-cad-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__cor-cad-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-booleano{display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.ui-prop__editor-booleano:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__checkbox-custom{width:13px;height:13px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .25));border-radius:2px;background-color:var(--ui-cor-fundo, #0b0b0d);display:flex;align-items:center;justify-content:center;transition:all .15s ease}.ui-prop__checkbox-custom--marcado{background-color:var(--ui-cor-destaque, #00E08A);border-color:var(--ui-cor-destaque, #00E08A);color:#000}.ui-prop__booleano-rotulo{font-size:11px;color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-acao-inline{width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 8px;background-color:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-size:11px;font-weight:500;cursor:pointer;white-space:nowrap;text-align:left;transition:all .15s ease;box-sizing:border-box}.ui-prop__btn-acao-inline:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent);color:var(--ui-cor-destaque, #00E08A)}.ui-prop__valor-readonly{display:flex;align-items:center;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);font-size:11px;color:var(--ui-cor-texto-secundario, #777788);padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;-webkit-user-select:text;user-select:text}.ui-prop__valor-readonly--numero{justify-content:flex-end;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__unidade-sufixo{display:flex;align-items:center;font-size:10px;color:var(--ui-cor-texto-secundario, #777788);padding-right:8px;flex-shrink:0;-webkit-user-select:none;user-select:none}.ui-prop__vazio{padding:24px 16px;text-align:center;color:var(--ui-cor-texto-secundario, #888899);font-size:12px}.ui-prop__footer{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;background-color:var(--ui-cor-fundo-elevado, #18181c);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1));flex-shrink:0}.ui-prop__link-ajuda{font-size:11px;color:var(--ui-cor-destaque, #00E08A);text-decoration:none;cursor:pointer}.ui-prop__link-ajuda:hover{text-decoration:underline}.ui-prop__footer-botoes{display:flex;gap:6px}.ui-prop__btn-aplicar{height:24px;padding:0 12px;background-color:var(--ui-cor-destaque, #00E08A);color:#000;border:none;border-radius:3px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s ease}.ui-prop__btn-aplicar:disabled{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent);color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);cursor:not-allowed}.ui-prop__btn-desfazer{height:24px;padding:0 8px;background:transparent;color:var(--ui-cor-texto-secundario, #888899);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;font-size:11px;cursor:pointer;transition:all .15s ease}.ui-prop__btn-desfazer:hover:not(:disabled){background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-desfazer:disabled{opacity:.4;cursor:not-allowed}@media (max-width: 640px){:host{--ui-prop-altura-linha: 28px;font-size:13px}.ui-prop__btn-icone{min-width:28px;min-height:28px}.ui-prop__footer-botoes{gap:8px}.ui-prop__btn-aplicar,.ui-prop__btn-desfazer{height:30px;font-size:12px;padding:0 12px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-prop__editor-input,.ui-prop__editor-select{touch-action:manipulation;font-size:14px}}`;
1872
+ function ut() {
1873
+ return `
1874
+ <style>${ct}</style>
1875
+ <div class="ui-prop__container" id="container">
1876
+ <!-- 0. Faixa Vertical da Coluna Estreita (visível quando colapsado) -->
1877
+ <div class="ui-prop__faixa-estreita" id="faixa-estreita" title="Clique para expandir painel">
1878
+ <span class="ui-prop__faixa-icone">
1879
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
1880
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
1881
+ <line x1="3" y1="9" x2="21" y2="9"></line>
1882
+ <line x1="9" y1="21" x2="9" y2="9"></line>
1883
+ </svg>
1884
+ </span>
1885
+ <button type="button" class="ui-prop__faixa-btn-expandir" id="btn-expandir-faixa" title="Expandir painel de propriedades">
1886
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
1887
+ <polyline points="9 18 15 12 9 6"></polyline>
1888
+ <line x1="5" y1="5" x2="5" y2="19"></line>
1889
+ </svg>
1890
+ </button>
1891
+ <span class="ui-prop__faixa-texto">PROPRIEDADES</span>
1892
+ </div>
1893
+
1894
+ <!-- 1. Header Superior -->
1895
+ <header class="ui-prop__header" id="header">
1896
+ <div class="ui-prop__header-titulo">
1897
+ <span class="ui-prop__header-icone">
1898
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
1899
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
1900
+ <line x1="3" y1="9" x2="21" y2="9"></line>
1901
+ <line x1="9" y1="21" x2="9" y2="9"></line>
1902
+ </svg>
1903
+ </span>
1904
+ <span id="header-titulo-texto">Propriedades</span>
1905
+ </div>
1906
+ <div class="ui-prop__header-acoes">
1907
+ <button type="button" class="ui-prop__btn-icone" id="btn-flutuante" title="Desacoplar / Modo flutuante (CAD)" aria-label="Modo flutuante">
1908
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
1909
+ <rect x="3" y="3" width="14" height="14" rx="2"></rect>
1910
+ <polyline points="15 3 21 3 21 9"></polyline>
1911
+ <line x1="10" y1="14" x2="21" y2="3"></line>
1912
+ </svg>
1913
+ </button>
1914
+ <button type="button" class="ui-prop__btn-icone" id="btn-colapsar-horizontal" title="Recolher para coluna estreita" aria-label="Recolher para coluna estreita">
1915
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
1916
+ <polyline points="11 17 6 12 11 7"></polyline>
1917
+ <line x1="18" y1="5" x2="18" y2="19"></line>
1918
+ </svg>
1919
+ </button>
1920
+ <button type="button" class="ui-prop__btn-icone" id="btn-densidade" title="Alternar compressão vertical" aria-label="Alternar densidade vertical">
1921
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
1922
+ <polyline points="4 7 12 11 20 7"></polyline>
1923
+ <polyline points="4 17 12 13 20 17"></polyline>
1924
+ <line x1="4" y1="12" x2="20" y2="12"></line>
1925
+ </svg>
1926
+ </button>
1927
+ <button type="button" class="ui-prop__btn-icone" id="btn-expandir-tudo" title="Expandir/Recolher Tudo" aria-label="Expandir ou recolher tudo">
1928
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1929
+ <polyline points="7 13 12 18 17 13"></polyline>
1930
+ <polyline points="7 6 12 11 17 6"></polyline>
1931
+ </svg>
1932
+ </button>
1933
+ <button type="button" class="ui-prop__btn-icone" id="btn-fechar" title="Fechar" aria-label="Fechar" style="display: none;">
1934
+ ✕
1935
+ </button>
1936
+ </div>
1937
+ </header>
1938
+
1939
+ <!-- 2. Seletor de Tipo (AutoCAD / Revit) -->
1940
+ <div class="ui-prop__tipo-seletor-container" id="tipo-container" style="display: none;"></div>
1941
+
1942
+ <!-- 3. Busca Rápida de Propriedades -->
1943
+ <div class="ui-prop__filtro-container" id="filtro-container" style="display: none;">
1944
+ <svg class="ui-prop__filtro-icone" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1945
+ <circle cx="11" cy="11" r="8"></circle>
1946
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
1947
+ </svg>
1948
+ <input type="text" class="ui-prop__filtro-input" id="filtro-input" placeholder="Filtrar propriedades..." />
1949
+ </div>
1950
+
1951
+ <!-- 4. Corpo Rolável com Grade de Categorias -->
1952
+ <div class="ui-prop__corpo-wrapper" id="corpo-wrapper">
1953
+ <div class="ui-prop__splitter" id="splitter"></div>
1954
+ <div class="ui-prop__corpo" id="corpo">
1955
+ <div class="ui-prop__lista-categorias" id="lista-categorias"></div>
1956
+ </div>
1957
+ </div>
1958
+
1959
+ <!-- 5. Rodapé com Ações (Aplicar / Desfazer) -->
1960
+ <footer class="ui-prop__footer" id="footer" style="display: none;">
1961
+ <a class="ui-prop__link-ajuda" id="link-ajuda" href="#" role="button">Ajuda de propriedades</a>
1962
+ <div class="ui-prop__footer-botoes">
1963
+ <button type="button" class="ui-prop__btn-desfazer" id="btn-desfazer" disabled>Desfazer</button>
1964
+ <button type="button" class="ui-prop__btn-aplicar" id="btn-aplicar" disabled>Aplicar</button>
1965
+ </div>
1966
+ </footer>
1967
+
1968
+ <!-- 6. Grip para redimensionar no modo flutuante -->
1969
+ <div class="ui-prop__resizer-canto" id="resizer-canto" title="Redimensionar"></div>
1970
+ </div>
1971
+ `;
1972
+ }
1973
+ function I(t, r) {
1974
+ return t == null && r == null ? !0 : Object.is(t, r);
1975
+ }
1976
+ class pt {
1977
+ constructor(r) {
1978
+ b(this, "valoresOriginais", {});
1979
+ b(this, "valoresAtuais", {});
1980
+ this.ctx = r;
1981
+ }
1982
+ inicializarCategorias(r) {
1983
+ this.valoresOriginais = {}, this.valoresAtuais = {};
1984
+ const e = /* @__PURE__ */ new Set();
1985
+ r.forEach((i) => {
1986
+ (i.propriedades || []).forEach((o) => {
1987
+ e.has(o.id) && typeof console < "u" && console.warn(`[ui-tabela-propriedades] id de propriedade repetido: "${o.id}". Os valores são indexados por id e serão compartilhados.`), e.add(o.id), this.valoresOriginais[o.id] = o.valor, this.valoresAtuais[o.id] = o.valor;
1988
+ });
1989
+ }), this.ctx.onAtualizarBotoesFooter(!1);
1990
+ }
1991
+ /** Há alguma propriedade com valor diferente do original (último aplicar/carregar)? */
1992
+ get isDirty() {
1993
+ return Object.keys(this.valoresAtuais).some((r) => this.isModificada(r));
1994
+ }
1995
+ isModificada(r) {
1996
+ return !I(this.valoresAtuais[r], this.valoresOriginais[r]);
1997
+ }
1998
+ getValores() {
1999
+ return { ...this.valoresAtuais };
2000
+ }
2001
+ getValoresOriginais() {
2002
+ return { ...this.valoresOriginais };
2003
+ }
2004
+ setValores(r) {
2005
+ !r || typeof r != "object" || (Object.keys(r).forEach((e) => {
2006
+ this.valoresAtuais[e] = r[e], this.valoresOriginais[e] = r[e];
2007
+ }), this.ctx.onAtualizarBotoesFooter(this.isDirty));
2008
+ }
2009
+ obterValor(r) {
2010
+ return this.valoresAtuais[r];
2011
+ }
2012
+ /** Alteração programática: atualiza o editor na tela; não emite se o valor não mudou. */
2013
+ definirValor(r, e, i = !0) {
2014
+ const o = this.valoresAtuais[r];
2015
+ I(o, e) || (this.valoresAtuais[r] = e, this.aposAlterar(r), this.ctx.onAtualizarCampoVisual(r, e), i && this.emitirAlteracao(r, e, o, this.categoriaDe(r)));
2016
+ }
2017
+ /** Alteração feita pelo usuário num editor. Em modo manual só emite no Aplicar. */
2018
+ registrarAlteracao(r, e, i) {
2019
+ const o = this.valoresAtuais[e];
2020
+ I(o, i) || (this.valoresAtuais[e] = i, this.aposAlterar(e), this.ctx.isModoManual() || this.emitirAlteracao(e, i, o, r));
2021
+ }
2022
+ aplicar() {
2023
+ var e;
2024
+ if (!this.isDirty) return;
2025
+ this.valoresOriginais = { ...this.valoresAtuais }, this.ctx.onAtualizarBotoesFooter(!1);
2026
+ const r = (e = this.ctx.hostElement.shadowRoot) == null ? void 0 : e.querySelectorAll(".ui-prop__linha--modificada");
2027
+ r == null || r.forEach((i) => i.classList.remove("ui-prop__linha--modificada")), this.ctx.hostElement.dispatchEvent(
2028
+ new CustomEvent("ui-aplicar", {
2029
+ bubbles: !0,
2030
+ composed: !0,
2031
+ detail: { valores: { ...this.valoresAtuais } }
2032
+ })
2033
+ );
2034
+ }
2035
+ desfazer() {
2036
+ this.isDirty && (this.valoresAtuais = { ...this.valoresOriginais }, this.ctx.onAtualizarBotoesFooter(!1), this.ctx.onRenderCategorias(), this.ctx.hostElement.dispatchEvent(
2037
+ new CustomEvent("ui-desfazer", {
2038
+ bubbles: !0,
2039
+ composed: !0,
2040
+ detail: { valores: { ...this.valoresAtuais } }
2041
+ })
2042
+ ));
2043
+ }
2044
+ /** Marca/desmarca a linha e recalcula os botões do rodapé (voltar ao original limpa o estado). */
2045
+ aposAlterar(r) {
2046
+ const e = se(this.ctx.hostElement.shadowRoot, r);
2047
+ e == null || e.classList.toggle("ui-prop__linha--modificada", this.isModificada(r)), this.ctx.onAtualizarBotoesFooter(this.isDirty);
2048
+ }
2049
+ categoriaDe(r) {
2050
+ var e;
2051
+ for (const i of this.ctx.getCategorias())
2052
+ if ((e = i.propriedades) != null && e.some((o) => o.id === r)) return i.id;
2053
+ return "";
2054
+ }
2055
+ emitirAlteracao(r, e, i, o = "") {
2056
+ this.ctx.hostElement.dispatchEvent(
2057
+ new CustomEvent("ui-propriedade-alterada", {
2058
+ bubbles: !0,
2059
+ composed: !0,
2060
+ detail: {
2061
+ id: r,
2062
+ categoriaId: o,
2063
+ valor: e,
2064
+ valorAnterior: i,
2065
+ todosValores: { ...this.valoresAtuais }
2066
+ }
2067
+ })
2068
+ );
2069
+ }
2070
+ }
2071
+ function ht(t) {
2072
+ const { listaContainer: r, categorias: e, termoBusca: i, onToggleCategoria: o, linhaCtx: a } = t;
2073
+ if (r.innerHTML = "", !e || e.length === 0) {
2074
+ const s = document.createElement("div");
2075
+ s.className = "ui-prop__vazio", s.textContent = "Nenhuma propriedade disponível.", r.appendChild(s);
2076
+ return;
2077
+ }
2078
+ const n = document.createDocumentFragment();
2079
+ e.forEach((s) => {
2080
+ const d = (s.propriedades || []).filter((f) => i ? f.rotulo.toLowerCase().includes(i) || String(f.id).toLowerCase().includes(i) : !0);
2081
+ if (i && d.length === 0)
2082
+ return;
2083
+ const c = !!i || s.aberto !== !1, l = document.createElement("div");
2084
+ l.className = `ui-prop__categoria ${c ? "ui-prop__categoria--aberta" : ""}`, l.setAttribute("data-cat-id", s.id);
2085
+ const u = document.createElement("div");
2086
+ u.className = "ui-prop__categoria-header", u.setAttribute("role", "button"), u.tabIndex = 0, u.setAttribute("aria-expanded", String(c));
2087
+ const p = document.createElement("div");
2088
+ p.className = "ui-prop__categoria-titulo-bloco";
2089
+ const h = document.createElement("span");
2090
+ h.className = "ui-prop__categoria-seta", h.textContent = "▶";
2091
+ const m = document.createElement("span");
2092
+ m.textContent = s.titulo, p.appendChild(h), p.appendChild(m);
2093
+ const x = document.createElement("span");
2094
+ x.className = "ui-prop__categoria-contador", x.textContent = String(d.length), u.appendChild(p), u.appendChild(x), u.addEventListener("click", () => o(s.id)), u.addEventListener("keydown", (f) => {
2095
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), o(s.id));
2096
+ });
2097
+ const g = document.createElement("div");
2098
+ g.className = "ui-prop__categoria-conteudo", d.forEach((f) => {
2099
+ const _ = mt(s.id, f, a);
2100
+ g.appendChild(_);
2101
+ }), l.appendChild(u), l.appendChild(g), n.appendChild(l);
2102
+ }), r.appendChild(n);
2103
+ }
2104
+ function mt(t, r, e) {
2105
+ const i = document.createElement("div");
2106
+ i.className = "ui-prop__linha", i.setAttribute("data-prop-id", r.id);
2107
+ const o = e.valoresAtuais[r.id] !== void 0 ? e.valoresAtuais[r.id] : r.valor, a = r.id in e.valoresOriginais ? e.valoresOriginais[r.id] : r.valor;
2108
+ I(o, a) || i.classList.add("ui-prop__linha--modificada"), i.addEventListener("dblclick", () => {
2109
+ const l = i.querySelector(
2110
+ 'input:not([type="color"]):not(.ui-prop__cor-picker-oculto), select, .ui-prop__btn-acao-inline'
2111
+ );
2112
+ l && (l.focus(), l instanceof HTMLInputElement && l.select());
2113
+ });
2114
+ const n = document.createElement("div");
2115
+ n.className = "ui-prop__col-rotulo", n.title = r.rotulo;
2116
+ const s = document.createElement("span");
2117
+ s.textContent = r.rotulo, n.appendChild(s), r.tipo === "numero" && !r.somenteLeitura && bt(n, t, r, e);
2118
+ const d = document.createElement("div");
2119
+ d.className = "ui-prop__col-valor";
2120
+ const c = st(t, r, o, e.editorCtx);
2121
+ if (d.appendChild(c), r.unidade) {
2122
+ const l = document.createElement("span");
2123
+ l.className = "ui-prop__unidade-sufixo", l.textContent = r.unidade, d.appendChild(l);
2124
+ }
2125
+ return i.appendChild(n), i.appendChild(d), i;
2126
+ }
2127
+ function bt(t, r, e, i) {
2128
+ t.classList.add("ui-prop__col-rotulo--scrub"), t.title = `${e.rotulo} (Arraste para ajustar, duplo-clique para editar)`;
2129
+ let o = 0, a = 0, n = !1;
2130
+ t.addEventListener("pointerdown", (s) => {
2131
+ if (s.button !== 0) return;
2132
+ o = s.clientX;
2133
+ const d = i.editorCtx.obterValorAtual(e.id);
2134
+ a = typeof d == "number" ? d : parseFloat(String(d || 0)) || 0, n = !1;
2135
+ try {
2136
+ t.setPointerCapture(s.pointerId);
2137
+ } catch {
2138
+ }
2139
+ t.classList.add("ui-prop__col-rotulo--arrastando");
2140
+ const c = (u) => {
2141
+ const p = u.clientX - o;
2142
+ if (Math.abs(p) > 2 && (n = !0), n) {
2143
+ let h = 1;
2144
+ u.shiftKey ? h = 0.1 : (u.ctrlKey || u.metaKey) && (h = 10);
2145
+ const m = e.casasDecimais !== void 0 ? e.casasDecimais : 2, x = Math.pow(10, -Math.min(m, 2));
2146
+ let g = a + p * x * h;
2147
+ e.casasDecimais !== void 0 ? g = Number(g.toFixed(e.casasDecimais)) : g = Math.round(g * 100) / 100, i.editorCtx.registrarAlteracao(r, e.id, g), i.onAtualizarCampoVisual(e.id, g);
2148
+ }
2149
+ }, l = (u) => {
2150
+ t.classList.remove("ui-prop__col-rotulo--arrastando");
2151
+ try {
2152
+ t.hasPointerCapture(u.pointerId) && t.releasePointerCapture(u.pointerId);
2153
+ } catch {
2154
+ }
2155
+ t.removeEventListener("pointermove", c), t.removeEventListener("pointerup", l), t.removeEventListener("pointercancel", l);
2156
+ };
2157
+ t.addEventListener("pointermove", c), t.addEventListener("pointerup", l), t.addEventListener("pointercancel", l);
2158
+ });
2159
+ }
2160
+ const ee = 300, gt = 480, T = /* @__PURE__ */ new WeakMap();
2161
+ function ft(t) {
2162
+ var i, o, a;
2163
+ const r = t.hasAttribute("flutuante"), e = t.style;
2164
+ if (r) {
2165
+ const n = T.get(t) ?? { acoplado: { width: "", height: "" } };
2166
+ n.flutuante = { left: e.left, top: e.top, width: e.width, height: e.height }, T.set(t, n), t.removeAttribute("flutuante"), e.left = "", e.top = "", e.right = "", e.bottom = "", e.position = "", e.zIndex = "", e.width = n.acoplado.width, e.height = n.acoplado.height;
2167
+ } else {
2168
+ const n = {
2169
+ acoplado: { width: e.width, height: e.height },
2170
+ flutuante: (i = T.get(t)) == null ? void 0 : i.flutuante
2171
+ };
2172
+ if (T.set(t, n), t.setAttribute("flutuante", ""), e.position = "fixed", (o = n.flutuante) != null && o.left || (a = n.flutuante) != null && a.top)
2173
+ e.left = n.flutuante.left, e.top = n.flutuante.top, e.width = n.flutuante.width, e.height = n.flutuante.height;
2174
+ else if (!e.left && !e.top) {
2175
+ const s = Math.max(
2176
+ 20,
2177
+ (typeof window < "u" ? window.innerWidth : 1024) - ee - 30
2178
+ );
2179
+ e.left = `${s}px`, e.top = "70px", e.width = `${ee}px`, e.height = `${gt}px`;
2180
+ }
2181
+ }
2182
+ return !r;
2183
+ }
2184
+ function xt(t, r, e) {
2185
+ const i = r.getElementById("header");
2186
+ if (i) {
2187
+ let a = null, n = 0, s = 0, d = 0, c = 0;
2188
+ const l = (p) => {
2189
+ if (a === null) return;
2190
+ const h = p.clientX - n, m = p.clientY - s;
2191
+ let x = d + h, g = c + m;
2192
+ const f = Math.max(0, (typeof window < "u" ? window.innerWidth : 1024) - t.offsetWidth), _ = Math.max(0, (typeof window < "u" ? window.innerHeight : 768) - 30);
2193
+ x = Math.max(0, Math.min(f, x)), g = Math.max(0, Math.min(_, g)), t.style.left = `${x}px`, t.style.top = `${g}px`, t.style.right = "auto", t.style.bottom = "auto";
2194
+ }, u = (p) => {
2195
+ if (a !== null) {
2196
+ try {
2197
+ i.releasePointerCapture(p.pointerId);
2198
+ } catch {
2199
+ }
2200
+ i.removeEventListener("pointermove", l), i.removeEventListener("pointerup", u), i.removeEventListener("pointercancel", u), a = null, t.classList.remove("arrastando"), t.dispatchEvent(new CustomEvent("ui-mover", {
2201
+ bubbles: !0,
2202
+ composed: !0,
2203
+ detail: { left: t.style.left, top: t.style.top }
2204
+ }));
2205
+ }
2206
+ };
2207
+ e.add(i, "pointerdown", (p) => {
2208
+ if (!t.hasAttribute("flutuante") || p.target.closest("button, input, select, a") || p.button !== 0) return;
2209
+ p.preventDefault(), a = p.pointerId, n = p.clientX, s = p.clientY;
2210
+ const m = t.getBoundingClientRect();
2211
+ d = m.left, c = m.top, t.classList.add("arrastando");
2212
+ try {
2213
+ i.setPointerCapture(p.pointerId);
2214
+ } catch {
2215
+ }
2216
+ i.addEventListener("pointermove", l), i.addEventListener("pointerup", u), i.addEventListener("pointercancel", u);
2217
+ });
2218
+ }
2219
+ const o = r.getElementById("resizer-canto");
2220
+ if (o) {
2221
+ let a = null, n = 0, s = 0, d = 0, c = 0;
2222
+ const l = (p) => {
2223
+ if (a === null) return;
2224
+ const h = Math.max(200, n + (p.clientX - d)), m = Math.max(180, s + (p.clientY - c));
2225
+ t.style.width = `${h}px`, t.style.height = `${m}px`;
2226
+ }, u = (p) => {
2227
+ if (a !== null) {
2228
+ try {
2229
+ o.releasePointerCapture(p.pointerId);
2230
+ } catch {
2231
+ }
2232
+ o.removeEventListener("pointermove", l), o.removeEventListener("pointerup", u), o.removeEventListener("pointercancel", u), a = null, t.dispatchEvent(new CustomEvent("ui-redimensionar", {
2233
+ bubbles: !0,
2234
+ composed: !0,
2235
+ detail: { width: t.style.width, height: t.style.height }
2236
+ }));
2237
+ }
2238
+ };
2239
+ e.add(o, "pointerdown", (p) => {
2240
+ if (!t.hasAttribute("flutuante") || p.button !== 0) return;
2241
+ p.preventDefault(), p.stopPropagation(), a = p.pointerId, d = p.clientX, c = p.clientY;
2242
+ const h = t.getBoundingClientRect();
2243
+ n = h.width, s = h.height;
2244
+ try {
2245
+ o.setPointerCapture(p.pointerId);
2246
+ } catch {
2247
+ }
2248
+ o.addEventListener("pointermove", l), o.addEventListener("pointerup", u), o.addEventListener("pointercancel", u);
2249
+ });
2250
+ }
2251
+ }
2252
+ function vt(t) {
2253
+ return t === "compacta" ? "ultracompacta" : t === "ultracompacta" ? "padrao" : "compacta";
2254
+ }
2255
+ function _t(t) {
2256
+ const {
2257
+ shadow: r,
2258
+ listeners: e,
2259
+ host: i,
2260
+ onToggleExpandirTodas: o,
2261
+ onFiltrar: a,
2262
+ onAplicar: n,
2263
+ onDesfazer: s,
2264
+ onAlternarDensidade: d,
2265
+ onAlternarFlutuante: c,
2266
+ onAlternarColapsoHorizontal: l
2267
+ } = t, u = r.getElementById("btn-flutuante");
2268
+ u && c && e.add(u, "click", c);
2269
+ const p = r.getElementById("btn-colapsar-horizontal");
2270
+ p && l && e.add(p, "click", l);
2271
+ const h = r.getElementById("faixa-estreita");
2272
+ h && l && e.add(h, "click", l);
2273
+ const m = r.getElementById("btn-expandir-faixa");
2274
+ m && l && e.add(m, "click", (v) => {
2275
+ v.stopPropagation(), l();
2276
+ });
2277
+ const x = r.getElementById("btn-densidade");
2278
+ x && d && e.add(x, "click", d);
2279
+ const g = r.getElementById("btn-expandir-tudo");
2280
+ g && e.add(g, "click", o);
2281
+ const f = r.getElementById("btn-fechar");
2282
+ f && e.add(f, "click", () => {
2283
+ i.dispatchEvent(new CustomEvent("ui-fechar", { bubbles: !0, composed: !0 }));
2284
+ });
2285
+ const _ = r.getElementById("filtro-input");
2286
+ _ && e.add(_, "input", () => {
2287
+ const v = (_.value || "").trim().toLowerCase();
2288
+ a(v);
2289
+ });
2290
+ const y = r.getElementById("btn-aplicar");
2291
+ y && e.add(y, "click", n);
2292
+ const A = r.getElementById("btn-desfazer");
2293
+ A && e.add(A, "click", s);
2294
+ const w = r.getElementById("link-ajuda");
2295
+ w && e.add(w, "click", (v) => {
2296
+ v.preventDefault(), i.dispatchEvent(new CustomEvent("ui-ajuda", { bubbles: !0, composed: !0 }));
2297
+ });
2298
+ }
2299
+ function M(t, r) {
2300
+ const e = t.getElementById("header-titulo-texto");
2301
+ e && (e.textContent = r.getAttribute("titulo") || "Propriedades");
2302
+ const i = t.getElementById("btn-fechar");
2303
+ i && (i.style.display = r.hasAttribute("fechavel") ? "inline-flex" : "none");
2304
+ const o = t.getElementById("btn-flutuante");
2305
+ if (o) {
2306
+ const c = r.hasAttribute("flutuante");
2307
+ o.title = c ? "Acoplar painel (Dock)" : "Desacoplar / Modo flutuante (CAD)", o.classList.toggle("ui-prop__btn-icone--ativo", c);
2308
+ }
2309
+ const a = t.getElementById("btn-colapsar-horizontal");
2310
+ if (a) {
2311
+ const c = r.hasAttribute("colapsado");
2312
+ a.title = c ? "Expandir painel" : "Recolher para coluna estreita", a.classList.toggle("ui-prop__btn-icone--ativo", c);
2313
+ }
2314
+ const n = t.getElementById("btn-densidade");
2315
+ if (n) {
2316
+ const c = r.getAttribute("densidade") || "padrão";
2317
+ n.title = `Compressão vertical: ${c} (clique para alternar)`;
2318
+ }
2319
+ const s = t.getElementById("filtro-container");
2320
+ s && (s.style.display = r.hasAttribute("filtro") ? "flex" : "none");
2321
+ const d = t.getElementById("footer");
2322
+ d && (d.style.display = r.getAttribute("modo-aplicar") === "manual" ? "flex" : "none");
2323
+ }
2324
+ class Et extends re {
2325
+ constructor() {
2326
+ super();
2327
+ b(this, "shadow");
2328
+ b(this, "listeners", new O());
2329
+ b(this, "splitterListeners", new O());
2330
+ b(this, "controladorSplitter");
2331
+ b(this, "gerenciadorValores");
2332
+ b(this, "_categorias", []);
2333
+ b(this, "_tipos", []);
2334
+ b(this, "_tipoSelecionadoId", "");
2335
+ b(this, "_termoBusca", "");
2336
+ b(this, "_larguraRotuloPorcentagem", 45);
2337
+ b(this, "tipoContainerElement");
2338
+ b(this, "corpoElement");
2339
+ b(this, "btnAplicarElement");
2340
+ b(this, "btnDesfazerElement");
2341
+ b(this, "splitterElement");
2342
+ this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = ut(), this.tipoContainerElement = this.shadow.getElementById("tipo-container"), this.corpoElement = this.shadow.getElementById("corpo"), this.btnAplicarElement = this.shadow.getElementById("btn-aplicar"), this.btnDesfazerElement = this.shadow.getElementById("btn-desfazer"), this.splitterElement = this.shadow.getElementById("splitter"), this.gerenciadorValores = new pt({
2343
+ hostElement: this,
2344
+ getCategorias: () => this._categorias,
2345
+ onAtualizarBotoesFooter: (e) => {
2346
+ this.btnAplicarElement.disabled = !e, this.btnDesfazerElement.disabled = !e;
2347
+ },
2348
+ onAtualizarCampoVisual: (e, i) => J(this.shadow, e, i),
2349
+ onRenderCategorias: () => this.renderCategorias(),
2350
+ isModoManual: () => this.getAttribute("modo-aplicar") === "manual"
2351
+ }), this.controladorSplitter = dt({
2352
+ hostElement: this,
2353
+ corpoElement: this.corpoElement,
2354
+ splitterElement: this.splitterElement,
2355
+ splitterListeners: this.splitterListeners,
2356
+ onLarguraAlterada: (e) => {
2357
+ this._larguraRotuloPorcentagem = e;
2358
+ }
2359
+ });
2360
+ }
2361
+ static get observedAttributes() {
2362
+ return [
2363
+ "titulo",
2364
+ "estilo-visual",
2365
+ "modo-aplicar",
2366
+ "filtro",
2367
+ "densidade",
2368
+ "largura-rotulo",
2369
+ "fechavel",
2370
+ "colapsado",
2371
+ "flutuante"
2372
+ ];
2373
+ }
2374
+ get larguraRotuloPorcentagem() {
2375
+ return this._larguraRotuloPorcentagem;
2376
+ }
2377
+ connectedCallback() {
2378
+ this.listeners.cleanup(), _t({
2379
+ shadow: this.shadow,
2380
+ listeners: this.listeners,
2381
+ host: this,
2382
+ onToggleExpandirTodas: () => this.toggleExpandirTodas(),
2383
+ onFiltrar: (e) => {
2384
+ this._termoBusca = e, this.renderCategorias();
2385
+ },
2386
+ onAplicar: () => this.aplicar(),
2387
+ onDesfazer: () => this.desfazer(),
2388
+ onAlternarDensidade: () => this.alternarDensidade(),
2389
+ onAlternarFlutuante: () => this.alternarFlutuante(),
2390
+ onAlternarColapsoHorizontal: () => this.alternarColapsoHorizontal()
2391
+ }), xt(this, this.shadow, this.listeners), this.controladorSplitter.init(), this.syncState();
2392
+ }
2393
+ disconnectedCallback() {
2394
+ this.listeners.cleanup(), this.splitterListeners.cleanup();
2395
+ }
2396
+ /**
2397
+ * Cada atributo atualiza só o que depende dele: redesenhar todas as linhas (ex.: ao trocar o
2398
+ * `titulo`) tiraria o foco de um campo em edição.
2399
+ */
2400
+ attributeChangedCallback(e, i, o) {
2401
+ if (i !== o)
2402
+ switch (e) {
2403
+ case "largura-rotulo": {
2404
+ const a = parseFloat(o ?? "");
2405
+ isNaN(a) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(a));
2406
+ return;
2407
+ }
2408
+ case "estilo-visual":
2409
+ this.renderSeletorTipos();
2410
+ return;
2411
+ case "filtro":
2412
+ if (M(this.shadow, this), o === null && this._termoBusca) {
2413
+ this._termoBusca = "";
2414
+ const a = this.shadow.getElementById("filtro-input");
2415
+ a && (a.value = ""), this.renderCategorias();
2416
+ }
2417
+ return;
2418
+ default:
2419
+ M(this.shadow, this);
2420
+ }
2421
+ }
2422
+ get categorias() {
2423
+ return this._categorias;
2424
+ }
2425
+ set categorias(e) {
2426
+ this._categorias = Array.isArray(e) ? e : [], this.gerenciadorValores.inicializarCategorias(this._categorias), this.renderCategorias();
2427
+ }
2428
+ get tipos() {
2429
+ return this._tipos;
2430
+ }
2431
+ set tipos(e) {
2432
+ this._tipos = Array.isArray(e) ? e : [], this.renderSeletorTipos();
2433
+ }
2434
+ get tipoSelecionado() {
2435
+ return this._tipoSelecionadoId;
2436
+ }
2437
+ set tipoSelecionado(e) {
2438
+ this._tipoSelecionadoId = e, this.renderSeletorTipos();
2439
+ }
2440
+ get valores() {
2441
+ return this.gerenciadorValores.getValores();
2442
+ }
2443
+ set valores(e) {
2444
+ this.gerenciadorValores.setValores(e), this.renderCategorias();
2445
+ }
2446
+ get isDirty() {
2447
+ return this.gerenciadorValores.isDirty;
2448
+ }
2449
+ get dirty() {
2450
+ return this.gerenciadorValores.isDirty;
2451
+ }
2452
+ obterValor(e) {
2453
+ return this.gerenciadorValores.obterValor(e);
2454
+ }
2455
+ definirValor(e, i, o = !0) {
2456
+ this.gerenciadorValores.definirValor(e, i, o);
2457
+ }
2458
+ aplicar() {
2459
+ this.gerenciadorValores.aplicar();
2460
+ }
2461
+ desfazer() {
2462
+ this.gerenciadorValores.desfazer();
2463
+ }
2464
+ expandirTudo() {
2465
+ Xe(this.shadow, this._categorias);
2466
+ }
2467
+ colapsarTudo() {
2468
+ Ye(this.shadow, this._categorias);
2469
+ }
2470
+ toggleCategoria(e) {
2471
+ Ge(this.shadow, this, this._categorias, e);
2472
+ }
2473
+ get densidade() {
2474
+ return this.getAttribute("densidade") || "padrao";
2475
+ }
2476
+ set densidade(e) {
2477
+ !e || e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e);
2478
+ }
2479
+ alternarDensidade() {
2480
+ const e = vt(this.getAttribute("densidade") || "padrao");
2481
+ return e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e), this.dispatchEvent(
2482
+ new CustomEvent("ui-densidade-alterada", {
2483
+ bubbles: !0,
2484
+ composed: !0,
2485
+ detail: { densidade: e }
2486
+ })
2487
+ ), M(this.shadow, this), e;
2488
+ }
2489
+ get flutuante() {
2490
+ return this.hasAttribute("flutuante");
2491
+ }
2492
+ set flutuante(e) {
2493
+ !!e !== this.hasAttribute("flutuante") && this.alternarFlutuante();
2494
+ }
2495
+ get colapsado() {
2496
+ return this.hasAttribute("colapsado");
2497
+ }
2498
+ set colapsado(e) {
2499
+ !!e !== this.hasAttribute("colapsado") && this.alternarColapsoHorizontal();
2500
+ }
2501
+ alternarFlutuante() {
2502
+ const e = ft(this);
2503
+ return M(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-flutuante-alterado", {
2504
+ bubbles: !0,
2505
+ composed: !0,
2506
+ detail: {
2507
+ flutuante: e,
2508
+ left: this.style.left,
2509
+ top: this.style.top,
2510
+ width: this.style.width,
2511
+ height: this.style.height
2512
+ }
2513
+ })), e;
2514
+ }
2515
+ alternarColapsoHorizontal() {
2516
+ const e = this.hasAttribute("colapsado");
2517
+ e ? this.removeAttribute("colapsado") : this.setAttribute("colapsado", "");
2518
+ const i = !e;
2519
+ return M(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-colapso-horizontal", {
2520
+ bubbles: !0,
2521
+ composed: !0,
2522
+ detail: { colapsado: i }
2523
+ })), i;
2524
+ }
2525
+ syncState() {
2526
+ M(this.shadow, this);
2527
+ const e = this.getAttribute("largura-rotulo");
2528
+ if (e) {
2529
+ const i = parseFloat(e);
2530
+ isNaN(i) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(i));
2531
+ }
2532
+ this.renderSeletorTipos(), this.renderCategorias();
2533
+ }
2534
+ toggleExpandirTodas() {
2535
+ this._categorias.some((i) => i.aberto === !1) ? this.expandirTudo() : this.colapsarTudo();
2536
+ }
2537
+ renderSeletorTipos() {
2538
+ lt({
2539
+ tipoContainerElement: this.tipoContainerElement,
2540
+ tipos: this._tipos,
2541
+ tipoSelecionadoId: this._tipoSelecionadoId,
2542
+ estiloVisual: this.getAttribute("estilo-visual") || "autocad",
2543
+ onSelecionarTipo: (e) => {
2544
+ this._tipoSelecionadoId = e, this.renderSeletorTipos();
2545
+ const i = this._tipos.find((o) => String(o.id) === String(e));
2546
+ this.dispatchEvent(new CustomEvent("ui-tipo-alterado", { bubbles: !0, composed: !0, detail: { id: e, tipo: i } }));
2547
+ },
2548
+ onEditarTipo: (e) => this.dispatchEvent(new CustomEvent("ui-editar-tipo-clique", { bubbles: !0, composed: !0, detail: { tipo: e } })),
2549
+ onQuickSelect: (e) => this.dispatchEvent(new CustomEvent("ui-quick-select", { bubbles: !0, composed: !0, detail: { tipo: e } })),
2550
+ onSelectObjects: (e) => this.dispatchEvent(new CustomEvent("ui-selecionar-objetos", { bubbles: !0, composed: !0, detail: { tipo: e } })),
2551
+ onCalculadora: (e) => this.dispatchEvent(new CustomEvent("ui-calculadora", { bubbles: !0, composed: !0, detail: { tipo: e } }))
2552
+ });
2553
+ }
2554
+ renderCategorias() {
2555
+ const e = this.shadow.getElementById("lista-categorias");
2556
+ e && ht({
2557
+ listaContainer: e,
2558
+ categorias: this._categorias,
2559
+ termoBusca: this._termoBusca,
2560
+ onToggleCategoria: (i) => this.toggleCategoria(i),
2561
+ linhaCtx: {
2562
+ valoresAtuais: this.gerenciadorValores.getValores(),
2563
+ valoresOriginais: this.gerenciadorValores.getValoresOriginais(),
2564
+ onAtualizarCampoVisual: (i, o) => J(this.shadow, i, o),
2565
+ editorCtx: {
2566
+ obterValorAtual: (i) => this.gerenciadorValores.obterValor(i),
2567
+ registrarAlteracao: (i, o, a) => {
2568
+ this.gerenciadorValores.registrarAlteracao(i, o, a);
2569
+ },
2570
+ focarProximoEditor: (i) => We(this.shadow, i),
2571
+ despacharEventoAcao: (i, o) => {
2572
+ this.dispatchEvent(
2573
+ new CustomEvent("ui-acao-clique", {
2574
+ bubbles: !0,
2575
+ composed: !0,
2576
+ detail: { id: i.id, categoriaId: o, propriedade: i }
2577
+ })
2578
+ );
2579
+ }
2580
+ }
2581
+ }
2582
+ });
2583
+ }
2584
+ }
2585
+ te("ui-tabela-propriedades", Et);
2586
+ export {
2587
+ Me as $,
2588
+ mt as A,
2589
+ Fe as B,
2590
+ Pe as C,
2591
+ Te as D,
2592
+ Oe as E,
2593
+ Be as F,
2594
+ pt as G,
2595
+ Xe as H,
2596
+ We as I,
2597
+ oe as J,
2598
+ ie as K,
2599
+ K as L,
2600
+ ae as M,
2601
+ He as N,
2602
+ De as O,
2603
+ Y as P,
2604
+ $ as Q,
2605
+ xe as R,
2606
+ ke as S,
2607
+ Ce as T,
2608
+ $e as U,
2609
+ V,
2610
+ Ve as W,
2611
+ vt as X,
2612
+ Ne as Y,
2613
+ k as Z,
2614
+ ht as _,
2615
+ be as a,
2616
+ ze as a0,
2617
+ lt as a1,
2618
+ ne as a2,
2619
+ M as a3,
2620
+ z as a4,
2621
+ qe as a5,
2622
+ I as a6,
2623
+ ve as b,
2624
+ Et as c,
2625
+ Ie as d,
2626
+ Ge as e,
2627
+ _e as f,
2628
+ ft as g,
2629
+ we as h,
2630
+ J as i,
2631
+ Z as j,
2632
+ se as k,
2633
+ Ye as l,
2634
+ xt as m,
2635
+ _t as n,
2636
+ dt as o,
2637
+ Je as p,
2638
+ Qe as q,
2639
+ at as r,
2640
+ nt as s,
2641
+ rt as t,
2642
+ ot as u,
2643
+ et as v,
2644
+ Ke as w,
2645
+ Ze as x,
2646
+ tt as y,
2647
+ st as z
2648
+ };