@thibezer/ui-components-kit 2.21.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/README.md +1 -1
  3. package/dist/camadas.cjs +1 -311
  4. package/dist/camadas.js +148 -3248
  5. package/dist/canvas.cjs +82 -82
  6. package/dist/canvas.js +2964 -3442
  7. package/dist/components/ui-barra-ferramentas/paleta-ajuste.d.ts +43 -0
  8. package/dist/components/ui-barra-ferramentas/paleta-excesso.d.ts +8 -0
  9. package/dist/components/ui-barra-ferramentas/tipos.d.ts +15 -0
  10. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +47 -6
  11. package/dist/components/ui-canvas-prancha/index.d.ts +13 -0
  12. package/dist/components/ui-canvas-prancha/prancha-acessibilidade.d.ts +5 -0
  13. package/dist/components/ui-canvas-prancha/prancha-atributos-sync.d.ts +14 -0
  14. package/dist/components/ui-canvas-prancha/prancha-bus.d.ts +5 -0
  15. package/dist/components/ui-canvas-prancha/prancha-comandos-organizacao.d.ts +45 -0
  16. package/dist/components/ui-canvas-prancha/prancha-comandos-pathfinder.d.ts +3 -0
  17. package/dist/components/ui-canvas-prancha/prancha-comandos-propriedades.d.ts +12 -0
  18. package/dist/components/ui-canvas-prancha/prancha-comandos.d.ts +27 -0
  19. package/dist/components/ui-canvas-prancha/prancha-controlador.d.ts +122 -0
  20. package/dist/components/ui-canvas-prancha/prancha-cores.d.ts +23 -0
  21. package/dist/components/ui-canvas-prancha/prancha-documento.d.ts +59 -0
  22. package/dist/components/ui-canvas-prancha/prancha-estado-ui.d.ts +45 -0
  23. package/dist/components/ui-canvas-prancha/prancha-ferramentas-edicao.d.ts +7 -0
  24. package/dist/components/ui-canvas-prancha/prancha-ferramentas.d.ts +38 -0
  25. package/dist/components/ui-canvas-prancha/prancha-gestos.d.ts +88 -0
  26. package/dist/components/ui-canvas-prancha/prancha-interacao.d.ts +31 -0
  27. package/dist/components/ui-canvas-prancha/prancha-medidor-texto.d.ts +6 -0
  28. package/dist/components/ui-canvas-prancha/prancha-paineis.d.ts +29 -0
  29. package/dist/components/ui-canvas-prancha/prancha-painel-camadas.d.ts +52 -0
  30. package/dist/components/ui-canvas-prancha/prancha-painel-propriedades.d.ts +50 -0
  31. package/dist/components/ui-canvas-prancha/prancha-paleta.d.ts +13 -0
  32. package/dist/components/ui-canvas-prancha/prancha-pintura.d.ts +55 -0
  33. package/dist/components/ui-canvas-prancha/prancha-reguas.d.ts +26 -0
  34. package/dist/components/ui-canvas-prancha/prancha-render.d.ts +35 -0
  35. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +12 -0
  36. package/dist/components/ui-canvas-prancha/prancha-template.d.ts +1 -0
  37. package/dist/components/ui-canvas-prancha/prancha-vista.d.ts +31 -0
  38. package/dist/components/ui-canvas-prancha/tipos.d.ts +138 -0
  39. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +158 -0
  40. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +119 -0
  41. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +12 -0
  42. package/dist/components/ui-editor-prancha/index.d.ts +2 -0
  43. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +60 -0
  44. package/dist/cores-utils-BmkzhA1v.cjs +1 -0
  45. package/dist/cores-utils-BrdynxRd.js +54 -0
  46. package/dist/cores.cjs +1 -1
  47. package/dist/cores.js +12 -11
  48. package/dist/custom-elements.json +21776 -11591
  49. package/dist/data.cjs +1 -1
  50. package/dist/data.js +99 -98
  51. package/dist/feature_caixa-2Sxv3tGa.js +824 -0
  52. package/dist/feature_caixa-4M4MkFH7.cjs +1 -0
  53. package/dist/feature_caixa-CnYPKVFS.cjs +1 -0
  54. package/dist/feature_caixa-DCs9ZeSk.js +1038 -0
  55. package/dist/feature_desenho-BH-E1Q9Q.cjs +1 -0
  56. package/dist/feature_desenho-BVHivWIB.js +222 -0
  57. package/dist/feature_historico-BAIYk1Me.cjs +3 -0
  58. package/dist/feature_historico-C4h9y5fu.js +3039 -0
  59. package/dist/geometria-px-Cyi_oPD6.cjs +1 -0
  60. package/dist/geometria-px-DKrWq_XY.js +639 -0
  61. package/dist/geometria-px-DUs5FgLE.js +639 -0
  62. package/dist/gerencigeo-canvas/booleanas/classificacao.d.ts +41 -0
  63. package/dist/gerencigeo-canvas/booleanas/index.d.ts +10 -0
  64. package/dist/gerencigeo-canvas/booleanas/montagem.d.ts +23 -0
  65. package/dist/gerencigeo-canvas/booleanas/segmentos.d.ts +38 -0
  66. package/dist/gerencigeo-canvas/booleanas/tipos.d.ts +44 -0
  67. package/dist/gerencigeo-canvas/espaco/espaco_geografico.d.ts +2 -0
  68. package/dist/gerencigeo-canvas/espaco/espaco_matriz.d.ts +58 -0
  69. package/dist/gerencigeo-canvas/espaco/espaco_plano.d.ts +13 -0
  70. package/dist/gerencigeo-canvas/espaco/espaco_tipos.d.ts +35 -0
  71. package/dist/gerencigeo-canvas/espaco/index.d.ts +4 -0
  72. package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +12 -8
  73. package/dist/gerencigeo-canvas/feature_amostra.d.ts +2 -1
  74. package/dist/gerencigeo-canvas/feature_caixa.d.ts +3 -2
  75. package/dist/gerencigeo-canvas/feature_curvas.d.ts +9 -2
  76. package/dist/gerencigeo-canvas/feature_desenho.d.ts +23 -2
  77. package/dist/gerencigeo-canvas/feature_edicao_nos.d.ts +68 -0
  78. package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +28 -8
  79. package/dist/gerencigeo-canvas/feature_editor_painel_no.d.ts +40 -0
  80. package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +46 -0
  81. package/dist/gerencigeo-canvas/feature_formas.d.ts +7 -3
  82. package/dist/gerencigeo-canvas/feature_historico.d.ts +41 -0
  83. package/dist/gerencigeo-canvas/feature_indice.d.ts +10 -2
  84. package/dist/gerencigeo-canvas/feature_metricas.d.ts +15 -4
  85. package/dist/gerencigeo-canvas/feature_types.d.ts +14 -2
  86. package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +2 -0
  87. package/dist/gerencigeo-canvas/prancha/ajuste_caixa.d.ts +32 -0
  88. package/dist/gerencigeo-canvas/prancha/aparencia_estilo.d.ts +86 -0
  89. package/dist/gerencigeo-canvas/prancha/aparencia_lote.d.ts +49 -0
  90. package/dist/gerencigeo-canvas/prancha/camadas.d.ts +14 -0
  91. package/dist/gerencigeo-canvas/prancha/cantos_vivos.d.ts +18 -0
  92. package/dist/gerencigeo-canvas/prancha/elemento_consulta.d.ts +63 -0
  93. package/dist/gerencigeo-canvas/prancha/elemento_criacao.d.ts +27 -0
  94. package/dist/gerencigeo-canvas/prancha/elemento_edicao.d.ts +24 -0
  95. package/dist/gerencigeo-canvas/prancha/elemento_geometria.d.ts +60 -0
  96. package/dist/gerencigeo-canvas/prancha/elemento_predefinicoes.d.ts +88 -0
  97. package/dist/gerencigeo-canvas/prancha/elemento_snap.d.ts +39 -0
  98. package/dist/gerencigeo-canvas/prancha/elemento_transformacao.d.ts +65 -0
  99. package/dist/gerencigeo-canvas/prancha/elemento_validacao.d.ts +27 -0
  100. package/dist/gerencigeo-canvas/prancha/envelope_visual.d.ts +12 -0
  101. package/dist/gerencigeo-canvas/prancha/exportar_svg.d.ts +18 -0
  102. package/dist/gerencigeo-canvas/prancha/guias_inteligentes.d.ts +21 -0
  103. package/dist/gerencigeo-canvas/prancha/index.d.ts +28 -0
  104. package/dist/gerencigeo-canvas/prancha/operacoes_caminho.d.ts +35 -0
  105. package/dist/gerencigeo-canvas/prancha/organizacao.d.ts +46 -0
  106. package/dist/gerencigeo-canvas/prancha/pathfinder.d.ts +17 -0
  107. package/dist/gerencigeo-canvas/prancha/pintura_canvas.d.ts +118 -0
  108. package/dist/gerencigeo-canvas/prancha/pintura_contexto.d.ts +54 -0
  109. package/dist/gerencigeo-canvas/prancha/pintura_formas.d.ts +32 -0
  110. package/dist/gerencigeo-canvas/prancha/pintura_gradiente_faixas.d.ts +21 -0
  111. package/dist/gerencigeo-canvas/prancha/pintura_plano.d.ts +126 -0
  112. package/dist/gerencigeo-canvas/prancha/propriedades.d.ts +15 -0
  113. package/dist/gerencigeo-canvas/prancha/tipos.d.ts +228 -0
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.d.ts +8 -0
  116. package/dist/index.js +252 -248
  117. package/dist/motor.cjs +1 -1
  118. package/dist/motor.js +822 -57
  119. package/dist/prancha-nucleo.cjs +1 -0
  120. package/dist/prancha-nucleo.d.ts +3 -0
  121. package/dist/prancha-nucleo.js +302 -0
  122. package/dist/prancha-paleta-BZ-9QDgh.js +5276 -0
  123. package/dist/prancha-paleta-Bb24vP71.cjs +17 -0
  124. package/dist/prancha.cjs +1 -0
  125. package/dist/prancha.d.ts +13 -0
  126. package/dist/prancha.js +231 -0
  127. package/dist/register.cjs +1 -1
  128. package/dist/register.js +10 -6
  129. package/dist/tabela.cjs +1 -1
  130. package/dist/tabela.js +90 -89
  131. package/dist/tipos-elementos.d.ts +73 -1
  132. package/dist/tipos-react.d.ts +4 -0
  133. package/dist/tipos-vue.d.ts +73 -1
  134. package/dist/tools.cjs +1 -1
  135. package/dist/tools.js +1 -1
  136. package/dist/ui-camadas-DoHPnbQm.js +3133 -0
  137. package/dist/ui-camadas-Vx7wYD4D.cjs +311 -0
  138. package/dist/ui-controle-cores-BcH9k2Fa.js +292 -0
  139. package/dist/ui-controle-cores-CvSTP6gJ.cjs +32 -0
  140. package/dist/ui-editor-prancha-CIngI6yI.js +2886 -0
  141. package/dist/ui-editor-prancha-DorSe6sC.cjs +31 -0
  142. package/dist/ui-kit.css +1 -1
  143. package/dist/ui-paleta-ferramentas-DebHYiwd.js +1615 -0
  144. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +22 -0
  145. package/dist/ui-seletor-cor-0RLjcME6.cjs +83 -0
  146. package/dist/ui-seletor-cor-Cd8jkzXG.js +354 -0
  147. package/dist/ui-tabela-CXxqbwXv.cjs +7 -0
  148. package/dist/ui-tabela-Cd0vOwnT.js +1459 -0
  149. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +136 -0
  150. package/dist/ui-tabela-propriedades-ahQhQauu.js +2329 -0
  151. package/package.json +11 -1
@@ -0,0 +1,1615 @@
1
+ var ut = Object.defineProperty;
2
+ var dt = (a, s, t) => s in a ? ut(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
+ var c = (a, s, t) => dt(a, typeof s != "symbol" ? s + "" : s, t);
4
+ import { L as F } from "./listener-bag-DQgv7OON.js";
5
+ import { d as V, S as K } from "./ssr-safe-5cWfJP-s.js";
6
+ import { A as et, a as T, e as it } from "./degrade-gDa5sW__.js";
7
+ import { h as ct } from "./svg-seguro-ChVJ2L2z.js";
8
+ const ht = ':host{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;color:inherit;flex-shrink:0;width:var(--ui-tamanho-icone, 20px);height:var(--ui-tamanho-icone, 20px);box-sizing:border-box}.ui-icone{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit;font-size:var(--ui-tamanho-icone, 20px)}::slotted(svg),.ui-icone svg{width:100%!important;height:100%!important;display:block;shape-rendering:geometricPrecision}:host([cor="primaria"]),:host([color="primaria"]){color:var(--ui-cor-primaria, #00E08A)}:host([cor="secundaria"]),:host([color="secundaria"]){color:var(--ui-cor-texto-secundario, #888899)}:host([cor="erro"]),:host([color="erro"]){color:var(--ui-cor-texto-erro, #ff5555)}:host([cor="sucesso"]),:host([color="sucesso"]){color:var(--ui-cor-texto-sucesso, #00E08A)}:host([cor="alerta"]),:host([color="alerta"]){color:var(--ui-cor-texto-alerta, #ffb86c)}', Z = {
9
+ search: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
10
+ check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
11
+ eye: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>',
12
+ eyeOff: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>',
13
+ lock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>',
14
+ trash: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>',
15
+ gear: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',
16
+ bell: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>',
17
+ alert: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',
18
+ close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'
19
+ };
20
+ class bt extends K {
21
+ constructor() {
22
+ super();
23
+ c(this, "iconContainer");
24
+ c(this, "svgContainer");
25
+ c(this, "slotElement");
26
+ c(this, "handleSlotChange", () => {
27
+ this.syncState();
28
+ });
29
+ const t = this.attachShadow({ mode: "open" });
30
+ t.innerHTML = `
31
+ <style>${ht}</style>
32
+ <span class="ui-icone" aria-hidden="true">
33
+ <span class="ui-icone__svg" style="display: none;"></span>
34
+ <slot></slot>
35
+ </span>
36
+ `, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
37
+ }
38
+ static get observedAttributes() {
39
+ return ["tamanho", "size", "cor", "color", "nome", "name"];
40
+ }
41
+ connectedCallback() {
42
+ this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
43
+ }
44
+ disconnectedCallback() {
45
+ this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
46
+ }
47
+ attributeChangedCallback(t, e, i) {
48
+ this.syncState();
49
+ }
50
+ resolveTamanhoPx() {
51
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
52
+ switch (t.toLowerCase()) {
53
+ case "sm":
54
+ return "16px";
55
+ case "md":
56
+ return "20px";
57
+ case "lg":
58
+ return "24px";
59
+ case "xl":
60
+ return "32px";
61
+ default:
62
+ return isNaN(Number(t)) ? t : `${t}px`;
63
+ }
64
+ }
65
+ syncState() {
66
+ const t = this.resolveTamanhoPx();
67
+ this.style.setProperty("--ui-tamanho-icone", t);
68
+ const e = this.getAttribute("cor") || this.getAttribute("color");
69
+ e ? (this.style.setProperty("--ui-cor-icone", e), this.iconContainer.style.color = e) : (this.style.removeProperty("--ui-cor-icone"), this.iconContainer.style.color = ""), this.hasAttribute("aria-label") || this.hasAttribute("label") ? this.iconContainer.removeAttribute("aria-hidden") : this.iconContainer.setAttribute("aria-hidden", "true");
70
+ const r = this.getAttribute("nome") || this.getAttribute("name"), o = this.slotElement.assignedNodes().length > 0;
71
+ r && Z[r] && !o ? (this.svgContainer.innerHTML = Z[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
72
+ }
73
+ }
74
+ V("ui-icone", bt);
75
+ const pt = ':host{display:block;position:relative;box-sizing:border-box;min-height:122px;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}:host([recolhido]){min-height:31px}.ui-ribbon{display:flex;flex-direction:column;background:var(--ui-degrade-interno, var(--ui-ribbon-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));-webkit-user-select:none;user-select:none}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-ribbon[data-degrade]:not([data-degrade=false]){--ui-ribbon-fundo: var(--ui-gradiente-superficie)}.ui-ribbon__cabecalho{display:flex;align-items:stretch;height:30px;box-sizing:border-box;box-shadow:inset 0 -1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__abas{display:flex;flex:1;min-width:0;align-items:flex-end;gap:2px;padding:0 8px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none;background:linear-gradient(to right,var(--ui-cor-superficie, #141417) 20px,transparent) left top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to left,var(--ui-cor-superficie, #141417) 20px,transparent) right top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to right,rgba(0,0,0,.35),transparent) left top / 14px calc(100% - 1px) no-repeat scroll,linear-gradient(to left,rgba(0,0,0,.35),transparent) right top / 14px calc(100% - 1px) no-repeat scroll}.ui-ribbon__abas::-webkit-scrollbar{display:none}.ui-ribbon__aba{position:relative;flex-shrink:0;height:28px;margin-bottom:1px;padding:0 14px;border:0;border-radius:6px 6px 0 0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);font:inherit;font-size:.75rem;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color .12s ease,color .12s ease}.ui-ribbon__aba:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__aba:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:30px;margin-bottom:0;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-fundo-elevado, #1a1a1e);box-shadow:inset 1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset -1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset 0 1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__aba--ativa:after{content:"";position:absolute;inset-inline:8px;bottom:1px;height:2px;border-radius:2px 2px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual{color:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual:before{content:"";position:absolute;inset-inline:0;top:0;height:2px;border-radius:6px 6px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__mais-abas{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__mais-abas[hidden]{display:none}.ui-ribbon__mais-abas:hover,.ui-ribbon__mais-abas[aria-expanded=true]{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__mais-abas:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__mais-abas:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:0 2px 2px 0;transform:translateY(-2px) rotate(45deg)}.ui-ribbon__fixar{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:28px;height:24px;margin-inline:2px 6px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__fixar:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__fixar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__fixar:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:2px 0 0 2px;transform:translateY(2px) rotate(45deg)}:host([recolhido]) .ui-ribbon__fixar:before{transform:translateY(-2px) rotate(225deg)}.ui-ribbon__painel{background:var(--ui-cor-fundo-elevado, #1a1a1e);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--ui-cor-borda, rgba(255, 255, 255, .2)) transparent}.ui-ribbon__grupos{display:flex;align-items:stretch;width:max-content;min-width:100%;min-height:92px;padding:4px 8px;box-sizing:border-box}.ui-ribbon__grupo{display:flex;flex-direction:column;justify-content:center;flex-shrink:0;padding:0 var(--ui-espaco-sm, 8px);border-inline-end:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__grupo:last-child{border-inline-end:0}.ui-ribbon__grupo-itens{display:flex;flex:1;align-items:center;gap:var(--ui-espaco-xs, 4px)}.ui-ribbon__grupo-rotulo{position:relative;display:flex;align-items:center;justify-content:center;padding:3px 0 1px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;line-height:1.2;text-align:center;white-space:nowrap}.ui-ribbon__grupo-rotulo:empty{display:none;padding:0}.ui-ribbon__lancador{position:absolute;right:0;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;border-radius:2px;opacity:.7}[dir=rtl] .ui-ribbon__lancador{right:auto;left:0}.ui-ribbon__lancador:hover{opacity:1;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__lancador:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-1px}.ui-ribbon__grupo--colapsado{padding:0 4px;justify-content:center}.ui-ribbon__btn-colapsado{height:calc(100% - 6px);margin:3px 0}.ui-ribbon__keytip{position:absolute;z-index:100;padding:1px 4px;font-size:.625rem;font-weight:700;line-height:1;color:#111;background:#fef08a;border:1px solid #ca8a04;border-radius:2px;box-shadow:0 1px 3px #0006;pointer-events:none}.ui-ribbon__coluna{display:flex;flex-direction:column;justify-content:center;gap:2px}.ui-ribbon__separador{width:1px;height:68px;align-self:center;margin:0 var(--ui-espaco-xs, 4px);background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;height:76px;padding:6px 8px;gap:3px;box-sizing:border-box;border-radius:var(--ui-raio-borda, 6px);justify-content:center;align-items:center}.ui-ferr-btn--grande .ui-ferr-btn__rotulo{max-width:72px;white-space:normal;text-align:center;line-height:1.15;overflow-wrap:anywhere}.ui-ferr-btn--pequeno{height:24px;padding:0 8px;border-radius:var(--ui-raio-sm, 4px);justify-content:flex-start;box-sizing:border-box}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ferr-split--pequeno{border-radius:var(--ui-raio-sm, 4px)}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-radius:var(--ui-raio-sm, 4px) 0 0 var(--ui-raio-sm, 4px);padding:0 6px 0 8px}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{border-radius:0 var(--ui-raio-sm, 4px) var(--ui-raio-sm, 4px) 0}.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;box-shadow:none}:host([recolhido]) .ui-ribbon__painel{display:none;position:absolute;top:100%;inset-inline:0;z-index:var(--ui-z-docked-bar, 600);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35))}:host([recolhido]) .ui-ribbon--aberto .ui-ribbon__painel{display:block}:host([recolhido]) .ui-ribbon__aba--ativa:after{display:none}:host([compacto]) .ui-ribbon__grupos{min-height:0;padding-block:2px}:host([compacto]) .ui-ribbon__grupo-rotulo{display:none}:host([compacto]) .ui-ferr-btn--grande{min-width:44px}@media (pointer: coarse){.ui-ribbon__cabecalho{height:38px}.ui-ribbon__aba{height:36px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:38px}.ui-ferr-btn--pequeno{height:32px}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:32px}.ui-ribbon__mais-abas{width:32px;height:32px}.ui-ribbon__fixar{width:36px;height:32px}}@media (prefers-reduced-motion: reduce){.ui-ribbon__aba{transition:none}}@media (forced-colors: active){.ui-ribbon__aba--ativa:after,.ui-ribbon__aba--contextual:before{background:Highlight;forced-color-adjust:none}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{box-shadow:none;border:1px solid CanvasText;border-bottom-color:Canvas}.ui-ribbon__aba:focus-visible,.ui-ribbon__mais-abas:focus-visible,.ui-ribbon__fixar:focus-visible,.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline-color:Highlight}}', rt = '.ui-ferr-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;padding:0;border:1px solid transparent;border-radius:var(--ui-raio-borda, 6px);background:transparent;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.75rem;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .12s ease,border-color .12s ease,color .12s ease}.ui-ferr-btn:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-btn:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent)}.ui-ferr-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-ferr-btn:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-btn--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 55%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 28%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 36%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn__icone{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.ui-ferr-btn__rotulo{white-space:nowrap}.ui-ferr-btn__caret{width:0;height:0;flex-shrink:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid currentColor;opacity:.7}.ui-ferr-menu{position:fixed;z-index:var(--ui-z-popover, 1050);display:flex;flex-direction:column;gap:1px;min-width:180px;max-height:calc(100vh - 8px);overflow-y:auto;padding:4px;box-sizing:border-box;background:var(--ui-degrade-interno, var(--ui-ferr-menu-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-menu, #18181c))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35));font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-ferr-menu__item{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:inherit;font:inherit;font-size:.75rem;text-align:start;cursor:pointer}.ui-ferr-menu__item:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-menu__item--ativo,.ui-ferr-menu__item[aria-checked=true]{color:var(--ui-cor-primaria, #00E08A);font-weight:600}.ui-ferr-menu__item--ativo:after,.ui-ferr-menu__item[aria-checked=true]:after{content:"";flex-shrink:0;width:4px;height:8px;margin-inline-start:4px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-1px)}.ui-ferr-menu__icone{display:inline-flex;width:16px;justify-content:center}.ui-ferr-menu__rotulo{flex:1}.ui-ferr-menu__atalho{margin-inline-start:16px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;font-variant-numeric:tabular-nums}.ui-ferr-menu__sep{height:1px;margin:3px 2px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}@media (pointer: coarse){.ui-ferr-menu__item{height:36px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn{transition:none}}.ui-ferr-tooltip{position:fixed;z-index:var(--ui-z-tooltip, 1200);pointer-events:none;display:none;align-items:center;gap:6px;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);background:var(--ui-degrade-interno, var(--ui-ferr-tooltip-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-tooltip, #18181c))));color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.6875rem;line-height:1.2;white-space:nowrap;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));box-shadow:var(--ui-sombra-md, 0 4px 12px rgba(0, 0, 0, .35));opacity:0;transform:translateY(-2px);transition:opacity .12s ease,transform .12s ease}.ui-ferr-tooltip--visivel{display:inline-flex;opacity:1;transform:translateY(0)}.ui-ferr-tooltip__atalho{display:inline-flex;align-items:center;padding:1px 4px;border-radius:3px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-size:.625rem;font-weight:600;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08))}.ui-ferr-split{display:inline-flex;align-items:stretch;border-radius:var(--ui-raio-borda, 6px);position:relative}.ui-ferr-split--grande{flex-direction:column}.ui-ferr-split--grande .ui-ferr-split__acao{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui-ferr-split--grande .ui-ferr-split__gatilho{height:16px;width:100%;border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding:0;justify-content:center}.ui-ferr-split--pequeno{flex-direction:row}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-top-right-radius:0;border-bottom-right-radius:0}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{width:16px;height:24px;padding:0;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));justify-content:center}.ui-ferr-split:hover:not(:has(:disabled)){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-ferr-menu__caret-sub{width:0;height:0;margin-inline-start:auto;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.7}[dir=rtl] .ui-ferr-menu__caret-sub{border-left:0;border-right:4px solid currentColor}@media (forced-colors: active){.ui-ferr-btn:focus-visible,.ui-ferr-menu__item:focus-visible{outline:2px solid Highlight}.ui-ferr-btn--ativo{background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-ferr-btn:disabled,.ui-ferr-menu__item:disabled{opacity:1;color:GrayText}.ui-ferr-menu{border-color:CanvasText}.ui-ferr-menu__item:hover:not(:disabled){background:Highlight;color:HighlightText}}';
76
+ function L(a, s) {
77
+ if (!a) return null;
78
+ const t = document.createElement("ui-icone");
79
+ if (t.setAttribute("tamanho", String(s)), a.trimStart().startsWith("<")) {
80
+ const e = ct(a);
81
+ if (!e) return null;
82
+ t.appendChild(e);
83
+ } else
84
+ t.setAttribute("nome", a);
85
+ return t;
86
+ }
87
+ const J = /* @__PURE__ */ new Set();
88
+ function k(a) {
89
+ return a.rotuloAcessivel ? a.rotuloAcessivel : a.rotulo ? a.rotulo : a.icone && !a.icone.trimStart().startsWith("<") ? a.icone : (J.has(a.id) || (J.add(a.id), console.warn(`[ui-barra-ferramentas] O item "${a.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), a.id);
90
+ }
91
+ function B(a, s) {
92
+ const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
93
+ a.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${s}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
94
+ }
95
+ function W(a, s = []) {
96
+ for (const t of a)
97
+ t.tipo !== "separador" && (s.push(t.id), t.filhos && W(t.filhos, s));
98
+ return s;
99
+ }
100
+ function C(a, s) {
101
+ a.disabled = !!s.disabled;
102
+ const t = s.tipo, e = t === "toggle" || t === "ferramenta";
103
+ e ? a.setAttribute("aria-pressed", String(!!s.ativo)) : a.removeAttribute("aria-pressed"), a.classList.toggle("ui-ferr-btn--ativo", e && !!s.ativo);
104
+ }
105
+ function $(a, s, t) {
106
+ var n;
107
+ const e = document.createElement("button");
108
+ e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${s}`, e.dataset.id = a.id, e.tabIndex = -1;
109
+ const i = !!((n = a.filhos) != null && n.length), r = s !== "paleta" && !a.somenteIcone && !!a.rotulo;
110
+ a.rotuloAcessivel ? e.setAttribute("aria-label", a.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", k(a)), a.atalho && e.setAttribute("aria-keyshortcuts", a.atalho), e.dataset.tooltip = k(a), a.atalho && (e.dataset.atalho = a.atalho);
111
+ const o = L(a.icone, t);
112
+ if (o) {
113
+ const u = document.createElement("span");
114
+ u.className = "ui-ferr-btn__icone", u.appendChild(o), e.appendChild(u);
115
+ }
116
+ if (s !== "paleta" && a.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
117
+ const u = document.createElement("span");
118
+ u.className = "ui-ferr-btn__rotulo", u.textContent = a.rotulo, e.appendChild(u);
119
+ }
120
+ if (i && !a.dividido) {
121
+ if (s === "paleta")
122
+ e.classList.add("ui-ferr-btn--grupo");
123
+ else {
124
+ const u = document.createElement("span");
125
+ u.className = "ui-ferr-btn__caret", e.appendChild(u);
126
+ }
127
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
128
+ }
129
+ return C(e, a), e;
130
+ }
131
+ function ft(a, s, t) {
132
+ const e = document.createElement("div");
133
+ e.className = `ui-ferr-split ui-ferr-split--${s}`, e.dataset.id = a.id;
134
+ const i = $({ ...a, filhos: void 0, dividido: !1 }, s, t);
135
+ i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
136
+ const r = document.createElement("button");
137
+ r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${s}`, r.dataset.id = a.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!a.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${k(a)}`), r.dataset.tooltip = `Opções de ${k(a)}`;
138
+ const o = document.createElement("span");
139
+ return o.className = "ui-ferr-btn__caret", r.appendChild(o), e.appendChild(i), e.appendChild(r), e;
140
+ }
141
+ function _(a, s) {
142
+ for (const t of a) {
143
+ if (t.id === s) return t;
144
+ if (t.filhos) {
145
+ const e = _(t.filhos, s);
146
+ if (e) return e;
147
+ }
148
+ }
149
+ }
150
+ function at(a, s) {
151
+ if (!s || !s.trim()) return !1;
152
+ const t = s.split("+").map((b) => b.trim()), e = t[t.length - 1], i = t.some((b) => /^(ctrl|control|cmd|meta)$/i.test(b)), r = t.some((b) => /^alt$/i.test(b)), o = t.some((b) => /^shift$/i.test(b)), n = a.ctrlKey || a.metaKey, u = a.altKey, d = a.shiftKey;
153
+ if (i !== n || r !== u || o !== d) return !1;
154
+ const l = e.toLowerCase(), h = (a.key || "").toLowerCase();
155
+ return l === "esc" || l === "escape" ? h === "escape" : l === "del" || l === "delete" ? h === "delete" : l === "enter" ? h === "enter" : l === "space" || l === "espaço" ? h === " " || h === "space" : h === l;
156
+ }
157
+ function U(a) {
158
+ const s = a.filter((t) => !t.disabled);
159
+ a.forEach((t) => t.tabIndex = -1), s.length && (s[0].tabIndex = 0);
160
+ }
161
+ function ot(a) {
162
+ const s = a.find((t) => t.tabIndex === 0 && !t.disabled);
163
+ s ? a.forEach((t) => {
164
+ t !== s && (t.tabIndex = -1);
165
+ }) : U(a);
166
+ }
167
+ function st(a, s) {
168
+ const t = a.find((e) => e === s || e.contains(s));
169
+ !t || t.disabled || a.forEach((e) => e.tabIndex = e === t ? 0 : -1);
170
+ }
171
+ function H(a, s, t, e) {
172
+ const i = s.filter((u) => !u.disabled), r = i.length, o = i.findIndex((u) => u === a.target);
173
+ if (r === 0 || o < 0) return !1;
174
+ let n = o;
175
+ if (t.includes(a.key)) n = (o - 1 + r) % r;
176
+ else if (e.includes(a.key)) n = (o + 1) % r;
177
+ else if (a.key === "Home") n = 0;
178
+ else if (a.key === "End") n = r - 1;
179
+ else return !1;
180
+ return a.preventDefault(), s.forEach((u) => u.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
181
+ }
182
+ function mt(a, s, t = !1) {
183
+ const e = s.filter((u) => !u.disabled), i = e.length, r = e.findIndex((u) => u === a.target);
184
+ if (i === 0 || r < 0) return !1;
185
+ let o = r;
186
+ const n = r % 2;
187
+ if (a.key === "ArrowRight")
188
+ t ? n === 1 && (o = r - 1) : n === 0 && r + 1 < i && (o = r + 1);
189
+ else if (a.key === "ArrowLeft")
190
+ t ? n === 0 && r + 1 < i && (o = r + 1) : n === 1 && (o = r - 1);
191
+ else if (a.key === "ArrowDown")
192
+ r + 2 < i ? o = r + 2 : r + 1 < i && n === 0 && (o = r + 1);
193
+ else if (a.key === "ArrowUp")
194
+ r - 2 >= 0 ? o = r - 2 : r - 1 >= 0 && n === 1 && (o = r - 1);
195
+ else if (a.key === "Home")
196
+ o = 0;
197
+ else if (a.key === "End")
198
+ o = i - 1;
199
+ else
200
+ return !1;
201
+ return a.preventDefault(), s.forEach((u) => u.tabIndex = -1), e[o].tabIndex = 0, e[o].focus(), !0;
202
+ }
203
+ let gt = 0;
204
+ class nt {
205
+ constructor(s, t) {
206
+ c(this, "el");
207
+ c(this, "textoEl");
208
+ c(this, "atalhoEl");
209
+ c(this, "timer");
210
+ c(this, "alvoAtual", null);
211
+ c(this, "id", `ui-ferr-tooltip-${++gt}`);
212
+ c(this, "listeners", new F());
213
+ this.raiz = s, this.el = document.createElement("div"), this.el.className = "ui-ferr-tooltip", this.el.id = this.id, this.el.setAttribute("role", "tooltip"), this.el.setAttribute("aria-hidden", "true"), this.textoEl = document.createElement("span"), this.textoEl.className = "ui-ferr-tooltip__texto", this.atalhoEl = document.createElement("kbd"), this.atalhoEl.className = "ui-ferr-tooltip__atalho", this.el.appendChild(this.textoEl), this.el.appendChild(this.atalhoEl), this.raiz.appendChild(this.el), this.listeners.add(t, "pointerover", (e) => {
214
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
215
+ if (i && i !== this.alvoAtual) {
216
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", o = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
217
+ r && this.agendar(i, r, o);
218
+ }
219
+ }), this.listeners.add(t, "pointerout", (e) => {
220
+ const r = e.relatedTarget;
221
+ this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
222
+ }), this.listeners.add(t, "focusin", (e) => {
223
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
224
+ if (i) {
225
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", o = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
226
+ r && this.mostrar(i, r, o);
227
+ }
228
+ }), this.listeners.add(t, "focusout", () => this.esconder()), this.listeners.add(t, "pointerdown", () => this.esconder()), this.listeners.add(t, "click", () => this.esconder()), this.listeners.add(window, "scroll", () => this.esconder(), !0), this.listeners.add(window, "resize", () => this.esconder());
229
+ }
230
+ agendar(s, t, e) {
231
+ this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(s, t, e), 140);
232
+ }
233
+ mostrar(s, t, e) {
234
+ if (this.limparTimer(), !s.isConnected || !t) return;
235
+ this.alvoAtual = s, this.textoEl.textContent = t, e ? (this.atalhoEl.textContent = `(${e})`, this.atalhoEl.style.display = "") : (this.atalhoEl.textContent = "", this.atalhoEl.style.display = "none"), this.el.classList.add("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "false"), s.setAttribute("aria-describedby", this.id);
236
+ const i = s.getBoundingClientRect(), r = this.el.getBoundingClientRect();
237
+ let o = i.bottom + 6, n = i.left + (i.width - (r.width || 80)) / 2;
238
+ o + (r.height || 24) > window.innerHeight - 6 && (o = Math.max(6, i.top - (r.height || 24) - 6)), n < 6 ? n = 6 : n + (r.width || 80) > window.innerWidth - 6 && (n = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${o}px`, this.el.style.left = `${n}px`;
239
+ }
240
+ esconder() {
241
+ this.limparTimer(), this.alvoAtual && (this.alvoAtual.removeAttribute("aria-describedby"), this.alvoAtual = null), this.el.classList.remove("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "true");
242
+ }
243
+ limparTimer() {
244
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
245
+ }
246
+ destruir() {
247
+ this.esconder(), this.listeners.cleanup(), this.el.remove();
248
+ }
249
+ }
250
+ let vt = 0;
251
+ function R(a, s, t, e, i = {}) {
252
+ var M;
253
+ const r = i.lado ?? "baixo", o = new F(), n = document.createElement("div");
254
+ n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++vt}`, n.setAttribute("aria-label", s.getAttribute("aria-label") || "Menu"), s.setAttribute("aria-controls", n.id);
255
+ const u = [];
256
+ let d = !1, l = null;
257
+ const h = () => {
258
+ l && (l.fechar(), l = null);
259
+ }, b = () => {
260
+ var p;
261
+ d || (d = !0, h(), s.removeAttribute("aria-controls"), o.cleanup(), n.remove(), (p = i.onFechar) == null || p.call(i));
262
+ }, m = getComputedStyle(s).direction === "rtl";
263
+ t.forEach((p) => {
264
+ var Y;
265
+ if (p.tipo === "separador") {
266
+ const y = document.createElement("div");
267
+ y.className = "ui-ferr-menu__sep", y.setAttribute("role", "separator"), n.appendChild(y);
268
+ return;
269
+ }
270
+ const f = document.createElement("button");
271
+ f.type = "button", f.className = "ui-ferr-menu__item";
272
+ const z = p.tipo ?? i.tipoPadrao ?? "botao";
273
+ z === "toggle" ? (f.setAttribute("role", "menuitemcheckbox"), f.setAttribute("aria-checked", String(!!p.ativo))) : z === "ferramenta" ? (f.setAttribute("role", "menuitemradio"), f.setAttribute("aria-checked", String(!!p.ativo))) : f.setAttribute("role", "menuitem"), f.dataset.id = p.id, f.disabled = !!p.disabled, p.atalho && f.setAttribute("aria-keyshortcuts", p.atalho), p.ativo && f.classList.add("ui-ferr-menu__item--ativo");
274
+ const P = document.createElement("span");
275
+ P.className = "ui-ferr-menu__icone";
276
+ const N = L(p.icone, 14);
277
+ N && P.appendChild(N), f.appendChild(P);
278
+ const A = document.createElement("span");
279
+ if (A.className = "ui-ferr-menu__rotulo", A.textContent = k(p), f.appendChild(A), p.atalho) {
280
+ const y = document.createElement("span");
281
+ y.className = "ui-ferr-menu__atalho", y.textContent = p.atalho, f.appendChild(y);
282
+ }
283
+ if (!!((Y = p.filhos) != null && Y.length)) {
284
+ f.classList.add("ui-ferr-menu__item--has-sub"), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false");
285
+ const y = document.createElement("span");
286
+ y.className = "ui-ferr-menu__caret-sub", f.appendChild(y);
287
+ const X = (O) => {
288
+ (l == null ? void 0 : l.ancora) !== f && (h(), f.setAttribute("aria-expanded", "true"), l = R(a, f, p.filhos, e, {
289
+ lado: m ? "esquerda" : "direita",
290
+ focar: O,
291
+ tipoPadrao: i.tipoPadrao,
292
+ onFechar: () => {
293
+ f.setAttribute("aria-expanded", "false"), l = null;
294
+ }
295
+ }));
296
+ };
297
+ f.addEventListener("pointerenter", () => X(!1)), f.addEventListener("click", (O) => {
298
+ O.stopPropagation(), X(!0);
299
+ });
300
+ } else
301
+ f.addEventListener("pointerenter", h), f.addEventListener("click", (y) => {
302
+ y.stopPropagation(), b(), s.focus(), e(p);
303
+ });
304
+ u.push(f), n.appendChild(f);
305
+ }), a.appendChild(n);
306
+ const v = s.getBoundingClientRect(), g = n.getBoundingClientRect();
307
+ let w = r === "baixo" ? v.bottom + 2 : v.top, E = r === "direita" ? v.right + 4 : r === "esquerda" ? v.left - g.width - 4 : m ? v.right - g.width : v.left;
308
+ g.width && E + g.width > window.innerWidth - 4 && (E = Math.max(4, window.innerWidth - g.width - 4)), E < 4 && (E = 4), g.height && w + g.height > window.innerHeight - 4 && (w = Math.max(4, window.innerHeight - g.height - 4)), n.style.top = `${w}px`, n.style.left = `${E}px`;
309
+ const S = () => u.filter((p) => !p.disabled);
310
+ return o.add(n, "keydown", (p) => {
311
+ const f = S(), z = f.findIndex((A) => A === p.target), P = m ? "ArrowLeft" : "ArrowRight", N = m ? "ArrowRight" : "ArrowLeft";
312
+ if (p.key === "Escape")
313
+ p.preventDefault(), p.stopPropagation(), b(), s.focus();
314
+ else if (p.key === "Tab")
315
+ b();
316
+ else if (f.length && (p.key === "ArrowDown" || p.key === "ArrowUp")) {
317
+ p.preventDefault(), h();
318
+ const A = p.key === "ArrowDown" ? 1 : -1;
319
+ f[(z + A + f.length) % f.length].focus();
320
+ } else if (f.length && p.key === P) {
321
+ const A = f[z];
322
+ A != null && A.classList.contains("ui-ferr-menu__item--has-sub") && (p.preventDefault(), A.click());
323
+ } else p.key === N && (r === "direita" || r === "esquerda") ? (p.preventDefault(), p.stopPropagation(), b(), s.focus()) : f.length && p.key === "Home" ? (p.preventDefault(), f[0].focus()) : f.length && p.key === "End" && (p.preventDefault(), f[f.length - 1].focus());
324
+ }), o.add(document, "pointerdown", (p) => {
325
+ const f = p.composedPath();
326
+ !f.includes(n) && !f.includes(s) && !(l != null && l.elemento.contains(p.target)) && b();
327
+ }, !0), o.add(window, "resize", b), o.add(window, "scroll", (p) => {
328
+ p.target instanceof Node && n.contains(p.target) || b();
329
+ }, !0), i.focar && ((M = S()[0]) == null || M.focus()), { elemento: n, ancora: s, fechar: b, focarPrimeiro: () => {
330
+ var p;
331
+ return (p = S()[0]) == null ? void 0 : p.focus();
332
+ } };
333
+ }
334
+ const xt = 3;
335
+ function _t({ aba: a, ativa: s, idBotao: t, idPainel: e }) {
336
+ const i = document.createElement("button");
337
+ return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = a.id, i.id = t, s && i.setAttribute("aria-controls", e), i.textContent = a.rotulo, i.tabIndex = s ? 0 : -1, i.setAttribute("aria-selected", String(s)), i.classList.toggle("ui-ribbon__aba--ativa", s), i.classList.toggle("ui-ribbon__aba--contextual", !!a.contextual), i;
338
+ }
339
+ const At = '<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', yt = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', wt = (a) => a.rotuloLancador || `Mais opções de ${a.rotulo || "ferramentas"}`;
340
+ function Et(a, s) {
341
+ s.classList.add("ui-ribbon__grupo--colapsado");
342
+ const t = document.createElement("button");
343
+ t.type = "button", t.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", t.dataset.grupoColapsado = a.id, t.dataset.tooltip = a.rotulo, t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", "false");
344
+ const e = L(a.icone, 24) || L(At, 24);
345
+ if (e) {
346
+ const o = document.createElement("span");
347
+ o.className = "ui-ferr-btn__icone", o.appendChild(e), t.appendChild(o);
348
+ }
349
+ const i = document.createElement("span");
350
+ i.className = "ui-ferr-btn__rotulo", i.textContent = a.rotulo, t.appendChild(i);
351
+ const r = document.createElement("span");
352
+ return r.className = "ui-ferr-btn__caret", t.appendChild(r), s.appendChild(t), s;
353
+ }
354
+ function Ct(a, s, t = {}) {
355
+ const e = document.createElement("div");
356
+ if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", a.rotulo), e.dataset.id = a.id, t.colapsado) return Et(a, e);
357
+ t.reduzido && e.classList.add("ui-ribbon__grupo--reduzido");
358
+ const i = (d, l, h) => {
359
+ var m;
360
+ const b = t.reduzido && l === "pequeno" && d.icone && !d.somenteIcone ? { ...d, somenteIcone: !0 } : d;
361
+ return b.dividido && ((m = b.filhos) != null && m.length) && t.criarDividido ? t.criarDividido(b, l, h) : s(b, l, h);
362
+ }, r = document.createElement("div");
363
+ r.className = "ui-ribbon__grupo-itens";
364
+ let o = null, n = 0;
365
+ const u = () => {
366
+ o && r.appendChild(o), o = null, n = 0;
367
+ };
368
+ if (a.itens.forEach((d) => {
369
+ if (d.tipo === "separador") {
370
+ u();
371
+ const l = document.createElement("div");
372
+ l.className = "ui-ribbon__separador", l.setAttribute("role", "separator"), r.appendChild(l);
373
+ } else d.tamanho === "grande" ? (u(), r.appendChild(i(d, "grande", 24))) : (o || (o = document.createElement("div"), o.className = "ui-ribbon__coluna"), o.appendChild(i(d, "pequeno", 16)), ++n === xt && u());
374
+ }), u(), a.rotulo || a.lancadorDialogo) {
375
+ const d = document.createElement("div");
376
+ if (d.className = "ui-ribbon__grupo-rotulo", a.rotulo && (d.textContent = a.rotulo), a.lancadorDialogo) {
377
+ const l = document.createElement("button");
378
+ l.type = "button", l.className = "ui-ribbon__lancador", l.dataset.lancador = a.id;
379
+ const h = wt(a);
380
+ l.setAttribute("aria-label", h), l.dataset.tooltip = h;
381
+ const b = L(yt, 10);
382
+ b && l.appendChild(b), d.appendChild(l);
383
+ }
384
+ return e.appendChild(r), e.appendChild(d), e;
385
+ }
386
+ return e.appendChild(r), e;
387
+ }
388
+ function kt(a, s, t, e, i = !1) {
389
+ if (s < 0 || t <= 0) return null;
390
+ if (i && (a === "Enter" || a === " ")) return { tipo: "ativar", indice: s };
391
+ const [r, o] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
392
+ return a === r ? { tipo: "ir-para", indice: (s + 1) % t } : a === o ? { tipo: "ir-para", indice: (s - 1 + t) % t } : a === "Home" ? { tipo: "ir-para", indice: 0 } : a === "End" ? { tipo: "ir-para", indice: t - 1 } : a === "ArrowDown" ? { tipo: "descer" } : null;
393
+ }
394
+ const G = 0, I = 1, q = 2, D = (a) => typeof a == "number" && Number.isFinite(a) && a >= 0;
395
+ function St(a, s, t = 0) {
396
+ const e = /* @__PURE__ */ new Map(), i = [];
397
+ Array.isArray(a) && a.forEach((l, h) => {
398
+ if (!l || typeof l.id != "string") return;
399
+ const b = Array.isArray(l.larguras) ? l.larguras.map((m) => D(m) ? m : NaN) : [];
400
+ e.set(l.id, G), i.push({ id: l.id, prio: Number.isFinite(l.prioridade) ? l.prioridade : 0, ordem: h, larguras: b });
401
+ });
402
+ const r = Number.isFinite(s) ? s : 0;
403
+ if (!i.length || r <= 0) return { niveis: e, cabe: !0 };
404
+ const o = /* @__PURE__ */ new Map();
405
+ let n = D(t) ? t : 0;
406
+ for (const l of i) {
407
+ const h = l.larguras[G];
408
+ o.set(l.id, D(h) ? h : 0), n += o.get(l.id);
409
+ }
410
+ if (n <= r) return { niveis: e, cabe: !0 };
411
+ const u = [...i].sort((l, h) => l.prio - h.prio || h.ordem - l.ordem), d = i.reduce((l, h) => Math.max(l, h.larguras.length - 1), 0);
412
+ for (let l = I; l <= d; l++)
413
+ for (const h of u) {
414
+ const b = h.larguras[l], m = o.get(h.id);
415
+ if (!(!D(b) || b >= m) && (n -= m - b, o.set(h.id, b), e.set(h.id, l), n <= r))
416
+ return { niveis: e, cabe: !0 };
417
+ }
418
+ return { niveis: e, cabe: !1 };
419
+ }
420
+ function Mt(a, s, t, e, i) {
421
+ const r = { estreito: a, acao: null };
422
+ if (!Number.isFinite(s) || s <= 0 || !Number.isFinite(t) || t <= 0) return r;
423
+ const o = s < t;
424
+ return o === a ? r : o ? { estreito: o, acao: e ? null : "recolher" } : { estreito: o, acao: e && i ? "restaurar" : null };
425
+ }
426
+ function zt({ inicio: a, tamanho: s, rolagem: t, visivel: e, margem: i = 8 }) {
427
+ const r = Number.isFinite(t) && t > 0 ? t : 0;
428
+ if (!Number.isFinite(a) || !Number.isFinite(s) || !Number.isFinite(e) || e <= 0) return r;
429
+ const o = Number.isFinite(i) && i > 0 ? i : 0, n = Math.max(0, a - o), u = a + Math.max(0, s) + o;
430
+ return u - n > e || n < r ? n : u > r + e ? u - e : r;
431
+ }
432
+ let Pt = 0;
433
+ class Rt extends K {
434
+ constructor() {
435
+ super();
436
+ c(this, "rootElement");
437
+ c(this, "abasElement");
438
+ c(this, "gruposElement");
439
+ c(this, "painelElement");
440
+ c(this, "fixarElement");
441
+ c(this, "maisAbasElement");
442
+ c(this, "menuAbas", null);
443
+ c(this, "uid", `ui-ribbon-${++Pt}`);
444
+ c(this, "_abaPendente", "");
445
+ c(this, "_pronto", !1);
446
+ c(this, "_modoControlado", !1);
447
+ c(this, "_abas", []);
448
+ c(this, "_abaAtiva", "");
449
+ c(this, "menu", null);
450
+ c(this, "listeners", new F());
451
+ c(this, "tooltip", null);
452
+ c(this, "observerResize", null);
453
+ /** Grupos no nível 2 (botão único com flyout). */
454
+ c(this, "gruposColapsados", /* @__PURE__ */ new Set());
455
+ /** Grupos no nível 1 (botões pequenos só com ícone). */
456
+ c(this, "gruposReduzidos", /* @__PURE__ */ new Set());
457
+ /** Larguras medidas por nível da aba ativa; `chave` invalida quando o layout pode ter mudado. */
458
+ c(this, "medidas", null);
459
+ c(this, "revisaoLayout", 0);
460
+ c(this, "keytipsAtivas", !1);
461
+ /** Lado do `recolher-abaixo` na última medição (`null` = ainda não medido). */
462
+ c(this, "estreito", null);
463
+ c(this, "aplicandoRecolhimentoAuto", !1);
464
+ c(this, "recolhidoPorAuto", !1);
465
+ c(this, "handleFocusInGrupos", (t) => st(this.botoesPainel(), t.target));
466
+ c(this, "handleClickMaisAbas", (t) => {
467
+ this.alternarMenuAbas(t.detail === 0);
468
+ });
469
+ c(this, "handleKeyDownMaisAbas", (t) => {
470
+ t.key === "ArrowDown" && (t.preventDefault(), this.menuAbas ? this.menuAbas.focarPrimeiro() : this.alternarMenuAbas(!0));
471
+ });
472
+ /* ---------- Interação ---------- */
473
+ c(this, "handleClickAbas", (t) => {
474
+ const e = t.target.closest(".ui-ribbon__aba");
475
+ e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
476
+ });
477
+ c(this, "handleClickFixar", () => {
478
+ this.recolhido = !this.recolhido;
479
+ });
480
+ c(this, "handleDblClickAbas", (t) => {
481
+ t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
482
+ });
483
+ c(this, "handleKeyDownAbas", (t) => {
484
+ var o, n;
485
+ const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = kt(t.key, e.findIndex((u) => u === t.target), e.length, this.rtl, this.ativacaoManual);
486
+ if (!i) return;
487
+ if (t.preventDefault(), i.tipo === "descer") {
488
+ this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (o = this.botoesPainel().find((u) => !u.disabled)) == null || o.focus();
489
+ return;
490
+ }
491
+ if (i.tipo === "ativar") {
492
+ const u = e[i.indice].dataset.id;
493
+ u && this.selecionarAba(u);
494
+ return;
495
+ }
496
+ const r = e[i.indice].dataset.id;
497
+ if (this.ativacaoManual) {
498
+ e.forEach((u) => u.tabIndex = -1), e[i.indice].tabIndex = 0, e[i.indice].focus();
499
+ return;
500
+ }
501
+ r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
502
+ });
503
+ c(this, "handleClickGrupos", (t) => {
504
+ var d;
505
+ const e = t.target, i = this._abas.find((l) => l.id === this._abaAtiva), r = e.closest(".ui-ribbon__btn-colapsado");
506
+ if (r) {
507
+ const l = i == null ? void 0 : i.grupos.find((h) => h.id === r.dataset.grupoColapsado);
508
+ l && this.alternarMenuGrupoColapsado(r, l);
509
+ return;
510
+ }
511
+ const o = e.closest(".ui-ribbon__lancador");
512
+ if (o) {
513
+ const l = i == null ? void 0 : i.grupos.find((h) => h.id === o.dataset.lancador);
514
+ l && this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
515
+ detail: { id: typeof l.lancadorDialogo == "string" ? l.lancadorDialogo : l.id, grupo: l },
516
+ bubbles: !0,
517
+ composed: !0
518
+ }));
519
+ return;
520
+ }
521
+ const n = e.closest(".ui-ferr-split__gatilho");
522
+ if (n) {
523
+ const l = n.closest(".ui-ferr-split"), h = l == null ? void 0 : l.dataset.id, b = i && _(i.grupos.flatMap((m) => m.itens), h ?? "");
524
+ b && ((d = b.filhos) != null && d.length) && this.alternarMenu(n, b, !1);
525
+ return;
526
+ }
527
+ const u = e.closest(".ui-ferr-btn");
528
+ u != null && u.dataset.id && this.acionar(u, t.detail === 0);
529
+ });
530
+ c(this, "handleKeyDownGrupos", (t) => {
531
+ var r;
532
+ const e = this.botoesPainel();
533
+ if (this.rtl ? H(t, e, ["ArrowRight"], ["ArrowLeft"]) : H(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
534
+ const i = t.target instanceof HTMLButtonElement ? t.target : null;
535
+ (i == null ? void 0 : i.getAttribute("aria-haspopup")) === "menu" && t.key === "ArrowDown" && (t.preventDefault(), ((r = this.menu) == null ? void 0 : r.ancora) === i ? this.menu.focarPrimeiro() : this.acionar(i, !0));
536
+ });
537
+ c(this, "handleEscape", (t) => {
538
+ t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
539
+ });
540
+ c(this, "handlePointerDownFora", (t) => {
541
+ !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
542
+ });
543
+ c(this, "handleAtalho", (t) => {
544
+ if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
545
+ const e = t.composedPath(), i = e[0];
546
+ if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((l) => {
547
+ var b, m;
548
+ const h = (b = l.getAttribute) == null ? void 0 : b.call(l, "role");
549
+ return ((m = l.getAttribute) == null ? void 0 : m.call(l, "aria-modal")) === "true" || h === "textbox" || h === "searchbox" || h === "combobox" || h === "spinbutton";
550
+ })) return;
551
+ if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
552
+ t.preventDefault(), this.alternarKeyTips();
553
+ return;
554
+ }
555
+ if (!this.hasAttribute("atalhos")) return;
556
+ const o = this._abas.find((l) => l.id === this._abaAtiva);
557
+ if (!o) return;
558
+ const u = o.grupos.flatMap((l) => l.itens).find((l) => !l.disabled && at(t, l.atalho));
559
+ if (!u) return;
560
+ t.preventDefault();
561
+ const d = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(u.id)}"]`);
562
+ d ? this.acionar(d, !1) : this.emitir(u);
563
+ });
564
+ const t = this.attachShadow({ mode: "open" });
565
+ t.innerHTML = `
566
+ <style>${rt}${pt}</style>
567
+ <div class="ui-ribbon" part="base">
568
+ <div class="ui-ribbon__cabecalho" part="cabecalho">
569
+ <div class="ui-ribbon__abas" part="abas" role="tablist"></div>
570
+ <button type="button" class="ui-ribbon__mais-abas" part="mais-abas" aria-haspopup="menu" aria-expanded="false" hidden></button>
571
+ <button type="button" class="ui-ribbon__fixar" part="fixar"></button>
572
+ </div>
573
+ <div class="ui-ribbon__painel" part="painel" role="tabpanel">
574
+ <div class="ui-ribbon__grupos" part="grupos" role="toolbar" aria-label="Ferramentas"></div>
575
+ </div>
576
+ </div>
577
+ `, this.rootElement = t.querySelector(".ui-ribbon"), this.abasElement = t.querySelector(".ui-ribbon__abas"), this.gruposElement = t.querySelector(".ui-ribbon__grupos"), this.painelElement = t.querySelector(".ui-ribbon__painel"), this.fixarElement = t.querySelector(".ui-ribbon__fixar"), this.maisAbasElement = t.querySelector(".ui-ribbon__mais-abas"), this.painelElement.id = `${this.uid}-painel`;
578
+ }
579
+ static get observedAttributes() {
580
+ return [
581
+ "aba-ativa",
582
+ "recolhido",
583
+ "compacto",
584
+ "ativacao-manual",
585
+ "copiar-dados",
586
+ "modo-controlado",
587
+ "atalhos",
588
+ "keytips",
589
+ "recolher-abaixo",
590
+ "aria-label",
591
+ "rotulo-abas",
592
+ "rotulo-mais-abas",
593
+ "rotulo-fixar",
594
+ "rotulo-expandir",
595
+ ...et
596
+ ];
597
+ }
598
+ connectedCallback() {
599
+ var e;
600
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new nt(this.shadowRoot, this.rootElement), this.listeners.add(this.abasElement, "click", this.handleClickAbas), this.listeners.add(this.fixarElement, "click", this.handleClickFixar), this.listeners.add(this.maisAbasElement, "click", this.handleClickMaisAbas), this.listeners.add(this.maisAbasElement, "keydown", this.handleKeyDownMaisAbas), this.listeners.add(this.abasElement, "dblclick", this.handleDblClickAbas), this.listeners.add(this.abasElement, "keydown", this.handleKeyDownAbas), this.listeners.add(this.gruposElement, "click", this.handleClickGrupos), this.listeners.add(this.gruposElement, "keydown", this.handleKeyDownGrupos), this.listeners.add(document, "pointerdown", this.handlePointerDownFora, !0), this.listeners.add(this.rootElement, "keydown", this.handleEscape), this.listeners.add(this.gruposElement, "focusin", this.handleFocusInGrupos), this.listeners.add(document, "keydown", this.handleAtalho), this.iniciarResizeObserver();
601
+ const t = this.getAttribute("aba-ativa");
602
+ t && !this._abaAtiva && (this._abaPendente = t), T(this, this.rootElement), this.aplicarRotulos(), this.estreito = null, this.invalidarMedidas(), this.renderizar(), this._pronto = !0, this.avaliarRecolhimentoAuto();
603
+ }
604
+ disconnectedCallback() {
605
+ var t, e;
606
+ this._pronto = !1, this.fecharMenu(), this.fecharMenuAbas(), (t = this.observerResize) == null || t.disconnect(), this.observerResize = null, (e = this.tooltip) == null || e.destruir(), this.tooltip = null, this.listeners.cleanup();
607
+ }
608
+ attributeChangedCallback(t, e, i) {
609
+ if (e !== i) {
610
+ if (it(t)) {
611
+ T(this, this.rootElement);
612
+ return;
613
+ }
614
+ if (t === "aba-ativa") {
615
+ if (!i || i === this._abaAtiva) return;
616
+ this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
617
+ } else t === "compacto" ? (this.invalidarMedidas(), this.ajustarResponsivo()) : t === "recolher-abaixo" ? (this.estreito = null, this.avaliarRecolhimentoAuto()) : t === "recolhido" ? (this.aplicandoRecolhimentoAuto || (this.recolhidoPorAuto = !1), this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
618
+ new CustomEvent("ui-recolhido-change", {
619
+ detail: { recolhido: i !== null },
620
+ bubbles: !0,
621
+ composed: !0
622
+ })
623
+ )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-mais-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
624
+ }
625
+ }
626
+ aplicarRotulos() {
627
+ this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
628
+ const t = this.getAttribute("rotulo-mais-abas") || "Todas as abas";
629
+ this.maisAbasElement.setAttribute("aria-label", t), this.maisAbasElement.title = t;
630
+ const e = this.hasAttribute("recolhido"), i = e ? this.getAttribute("rotulo-expandir") || "Fixar faixa de opções" : this.getAttribute("rotulo-fixar") || "Recolher faixa de opções";
631
+ this.fixarElement.setAttribute("aria-label", i), this.fixarElement.title = i, this.fixarElement.setAttribute("aria-expanded", String(!e)), this.fixarElement.setAttribute("aria-controls", this.painelElement.id);
632
+ }
633
+ /* ---------- API pública ---------- */
634
+ get modoControlado() {
635
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
636
+ }
637
+ set modoControlado(t) {
638
+ this._modoControlado = !!t;
639
+ }
640
+ get copiarDados() {
641
+ return this.modoControlado;
642
+ }
643
+ set copiarDados(t) {
644
+ this.modoControlado = t;
645
+ }
646
+ get ativacaoManual() {
647
+ return this.hasAttribute("ativacao-manual");
648
+ }
649
+ set ativacaoManual(t) {
650
+ t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
651
+ }
652
+ get abas() {
653
+ return this._abas;
654
+ }
655
+ set abas(t) {
656
+ const e = Array.isArray(t) ? t : [];
657
+ this._abas = this.modoControlado ? e.map((i) => ({
658
+ ...i,
659
+ grupos: i.grupos.map((r) => ({
660
+ ...r,
661
+ itens: r.itens.map((o) => {
662
+ var n;
663
+ return {
664
+ ...o,
665
+ filhos: (n = o.filhos) == null ? void 0 : n.map((u) => ({ ...u }))
666
+ };
667
+ })
668
+ }))
669
+ })) : e, B(this._abas.map((i) => i.id), "<ui-ribbon> abas"), B(
670
+ this._abas.flatMap((i) => i.grupos.flatMap((r) => W(r.itens))),
671
+ "<ui-ribbon> itens"
672
+ ), this.gruposColapsados.clear(), this.gruposReduzidos.clear(), this.invalidarMedidas(), this.renderizar();
673
+ }
674
+ get abaAtiva() {
675
+ return this._abaAtiva;
676
+ }
677
+ set abaAtiva(t) {
678
+ this.selecionarAba(t);
679
+ }
680
+ get recolhido() {
681
+ return this.hasAttribute("recolhido");
682
+ }
683
+ set recolhido(t) {
684
+ t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
685
+ }
686
+ get compacto() {
687
+ return this.hasAttribute("compacto");
688
+ }
689
+ set compacto(t) {
690
+ t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
691
+ }
692
+ /** Largura (px) abaixo da qual a faixa se recolhe sozinha. `0` desliga. */
693
+ get recolherAbaixo() {
694
+ const t = Number(this.getAttribute("recolher-abaixo"));
695
+ return Number.isFinite(t) && t > 0 ? t : 0;
696
+ }
697
+ set recolherAbaixo(t) {
698
+ Number.isFinite(t) && t > 0 ? this.setAttribute("recolher-abaixo", String(t)) : this.removeAttribute("recolher-abaixo");
699
+ }
700
+ selecionarAba(t, e = !0) {
701
+ const i = this._abas.find((r) => r.id === t && !r.oculta);
702
+ if (!i) {
703
+ t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
704
+ return;
705
+ }
706
+ i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this.gruposColapsados.clear(), this.gruposReduzidos.clear(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
707
+ new CustomEvent("ui-aba-change", {
708
+ detail: { id: i.id, aba: i },
709
+ bubbles: !0,
710
+ composed: !0
711
+ })
712
+ ));
713
+ }
714
+ definirAbaVisivel(t, e) {
715
+ const i = this._abas.find((n) => n.id === t);
716
+ if (!i) return;
717
+ const r = this._abaAtiva;
718
+ i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
719
+ const o = this._abas.find((n) => n.id === this._abaAtiva);
720
+ !e && r === t && o && this.dispatchEvent(
721
+ new CustomEvent("ui-aba-change", { detail: { id: o.id, aba: o }, bubbles: !0, composed: !0 })
722
+ );
723
+ }
724
+ /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
725
+ atualizarItem(t, e) {
726
+ const i = this._abas.flatMap((d) => d.grupos.flatMap((l) => l.itens)), r = _(i, t);
727
+ if (!r) {
728
+ console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
729
+ return;
730
+ }
731
+ Object.assign(r, e);
732
+ const o = this._abas.find((d) => d.id === this._abaAtiva);
733
+ if (!o || !_(o.grupos.flatMap((d) => d.itens), t)) return;
734
+ const n = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), u = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
735
+ n ? u && (C(u, this.efetivo(r)), ot(this.botoesPainel())) : (this.invalidarMedidas(), this.comFoco(() => this.renderizarPainel()), this.ajustarResponsivo());
736
+ }
737
+ efetivo(t) {
738
+ var e;
739
+ return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
740
+ }
741
+ /* ---------- Foco preservado em re-renderizações ---------- */
742
+ capturarFoco() {
743
+ var e, i;
744
+ const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
745
+ return (i = t == null ? void 0 : t.dataset) != null && i.id ? t.classList.contains("ui-ribbon__aba") ? { seletor: ".ui-ribbon__aba", id: t.dataset.id } : t.classList.contains("ui-ferr-btn") ? { seletor: ".ui-ferr-btn", id: t.dataset.id } : null : null;
746
+ }
747
+ comFoco(t) {
748
+ const e = this.capturarFoco();
749
+ if (t(), !e) return;
750
+ const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
751
+ i && !i.disabled && i.focus();
752
+ }
753
+ /* ---------- Renderização ---------- */
754
+ abasVisiveis() {
755
+ return this._abas.filter((t) => !t.oculta);
756
+ }
757
+ renderizar() {
758
+ var e;
759
+ const t = this.abasVisiveis();
760
+ this._abaPendente && t.length && (t.some((i) => i.id === this._abaPendente) ? (this._abaAtiva = this._abaPendente, this._abaPendente = "") : this._abas.some((i) => i.id === this._abaPendente) || (console.warn(`[ui-ribbon] aba-ativa="${this._abaPendente}" não existe em "abas".`), this._abaPendente = "")), t.some((i) => i.id === this._abaAtiva) || (this._abaAtiva = ((e = t[0]) == null ? void 0 : e.id) ?? ""), this._abaAtiva && !this._abaPendente && this.getAttribute("aba-ativa") !== this._abaAtiva && this.setAttribute("aba-ativa", this._abaAtiva), this.comFoco(() => {
761
+ this.renderizarAbas(), this.renderizarPainel();
762
+ }), this.ajustarResponsivo(), this.rolarAbaAtivaParaVisivel(), this.atualizarMaisAbas();
763
+ }
764
+ renderizarAbas() {
765
+ this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
766
+ this.abasElement.appendChild(_t({
767
+ aba: t,
768
+ ativa: t.id === this._abaAtiva,
769
+ idBotao: this.idAba(t.id),
770
+ idPainel: this.painelElement.id
771
+ }));
772
+ });
773
+ }
774
+ /* ---------- Menu "mais abas" (lista transborda) ---------- */
775
+ /** Mostra o botão só quando as abas não cabem; fecha o menu se ele deixar de ser necessário. */
776
+ atualizarMaisAbas() {
777
+ const t = this.abasElement, e = t.scrollWidth > t.clientWidth + 1 && this.abasVisiveis().length > 1;
778
+ this.maisAbasElement.hidden = !e, e || this.fecharMenuAbas();
779
+ }
780
+ fecharMenuAbas() {
781
+ var t;
782
+ (t = this.menuAbas) == null || t.fechar(), this.menuAbas = null;
783
+ }
784
+ alternarMenuAbas(t) {
785
+ const e = !!this.menuAbas;
786
+ if (this.fecharMenuAbas(), e) return;
787
+ const i = this.maisAbasElement;
788
+ i.setAttribute("aria-expanded", "true");
789
+ const r = this.abasVisiveis().map((o) => ({
790
+ id: o.id,
791
+ rotulo: o.rotulo,
792
+ tipo: "ferramenta",
793
+ ativo: o.id === this._abaAtiva
794
+ }));
795
+ this.menuAbas = R(
796
+ this.shadowRoot,
797
+ i,
798
+ r,
799
+ (o) => {
800
+ var n;
801
+ this.selecionarAba(o.id), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(o.id)}"]`)) == null || n.focus();
802
+ },
803
+ {
804
+ lado: "baixo",
805
+ focar: t,
806
+ onFechar: () => {
807
+ i.setAttribute("aria-expanded", "false"), this.menuAbas = null;
808
+ }
809
+ }
810
+ );
811
+ }
812
+ /** Mantém a aba ativa dentro da área visível da lista de abas (sem rolar a página, só a lista). */
813
+ rolarAbaAtivaParaVisivel() {
814
+ const t = this.abasElement, e = t.querySelector(".ui-ribbon__aba--ativa");
815
+ if (!e || !(t.scrollWidth > t.clientWidth)) return;
816
+ const i = e.getBoundingClientRect(), r = zt({
817
+ inicio: i.left - t.getBoundingClientRect().left + t.scrollLeft,
818
+ tamanho: i.width,
819
+ rolagem: t.scrollLeft,
820
+ visivel: t.clientWidth
821
+ });
822
+ r !== t.scrollLeft && (t.scrollLeft = r);
823
+ }
824
+ idAba(t) {
825
+ return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
826
+ }
827
+ renderizarPainel() {
828
+ this.fecharMenu(), this.gruposElement.innerHTML = "";
829
+ const t = this._abas.find((e) => e.id === this._abaAtiva);
830
+ if (!t) {
831
+ this.painelElement.removeAttribute("aria-labelledby");
832
+ return;
833
+ }
834
+ this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(Ct(
835
+ e,
836
+ (i, r, o) => this.criarBotao(i, r, o),
837
+ {
838
+ colapsado: this.gruposColapsados.has(e.id),
839
+ reduzido: this.gruposReduzidos.has(e.id),
840
+ criarDividido: (i, r, o) => ft(this.efetivo(i), r, o)
841
+ }
842
+ ))), U(this.botoesPainel());
843
+ }
844
+ iniciarResizeObserver() {
845
+ typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
846
+ this.avaliarRecolhimentoAuto(), this.ajustarResponsivo(), this.atualizarMaisAbas();
847
+ }), this.observerResize.observe(this.painelElement), this.observerResize.observe(this.abasElement), this.observerResize.observe(this));
848
+ }
849
+ /* ---------- Responsividade: degradê dos grupos por falta de espaço ---------- */
850
+ invalidarMedidas() {
851
+ this.revisaoLayout++, this.medidas = null;
852
+ }
853
+ /** Largura fixa do contêiner dos grupos fora dos próprios grupos (padding) + 1px de tolerância de arredondamento. */
854
+ larguraFixaGrupos() {
855
+ try {
856
+ const t = getComputedStyle(this.gruposElement);
857
+ return (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0) + 1;
858
+ } catch {
859
+ return 1;
860
+ }
861
+ }
862
+ larguraDoGrupo(t) {
863
+ var e;
864
+ return ((e = this.gruposElement.querySelector(`.ui-ribbon__grupo[data-id="${CSS.escape(t)}"]`)) == null ? void 0 : e.offsetWidth) ?? 0;
865
+ }
866
+ definirNiveis(t, e) {
867
+ this.gruposReduzidos = new Set(t), this.gruposColapsados = new Set(e);
868
+ }
869
+ /**
870
+ * Mede a largura de cada grupo da aba nos três níveis (renderiza os três estados de forma síncrona, sem pintura
871
+ * entre eles) e guarda em cache até o layout poder mudar (outra aba, `compacto`, itens alterados).
872
+ * Deixa o DOM no último estado medido: quem chama deve renderizar o resultado final.
873
+ */
874
+ medirGrupos(t) {
875
+ var n;
876
+ const e = `${t.id}|${this.compacto}|${this.revisaoLayout}`;
877
+ if (((n = this.medidas) == null ? void 0 : n.chave) === e) return { grupos: this.medidas.grupos, mediu: !1 };
878
+ const i = t.grupos.map((u) => u.id), r = i.map(() => []);
879
+ for (const u of [G, I, q])
880
+ this.definirNiveis(u === I ? i : [], u === q ? i : []), this.renderizarPainel(), i.forEach((d, l) => r[l].push(this.larguraDoGrupo(d)));
881
+ const o = t.grupos.map((u, d) => ({ id: u.id, prioridade: u.prioridade, larguras: r[d] }));
882
+ return this.medidas = { chave: e, grupos: o }, { grupos: o, mediu: !0 };
883
+ }
884
+ /**
885
+ * Ajusta o nível de cada grupo ao espaço real do painel. Só re-renderiza quando o resultado muda, então
886
+ * notificações repetidas do ResizeObserver (inclusive as causadas por esta própria renderização) não fazem laço.
887
+ * Painel oculto (faixa recolhida) ou sem layout: não decide nada.
888
+ */
889
+ ajustarResponsivo() {
890
+ if (!this.isConnected) return;
891
+ const t = this._abas.find((i) => i.id === this._abaAtiva);
892
+ if (!(t != null && t.grupos.length)) return;
893
+ const e = this.painelElement.clientWidth;
894
+ e > 0 && this.comFoco(() => {
895
+ const i = new Set(this.gruposReduzidos), r = new Set(this.gruposColapsados), { grupos: o, mediu: n } = this.medirGrupos(t), { niveis: u } = St(o, e, this.larguraFixaGrupos()), d = (m) => [...u].filter(([, v]) => v === m).map(([v]) => v), l = d(I), h = d(q), b = (m, v) => m.size === v.length && v.every((g) => m.has(g));
896
+ !n && b(i, l) && b(r, h) || (this.definirNiveis(l, h), this.renderizarPainel());
897
+ });
898
+ }
899
+ /** `recolher-abaixo`: recolhe a faixa ao cruzar para estreito e restaura (só se foi automático) ao alargar. */
900
+ avaliarRecolhimentoAuto() {
901
+ const t = this.recolherAbaixo;
902
+ if (!t) {
903
+ this.estreito = null;
904
+ return;
905
+ }
906
+ const e = Mt(this.estreito, this.offsetWidth, t, this.recolhido, this.recolhidoPorAuto);
907
+ if (this.estreito = e.estreito, !!e.acao) {
908
+ this.aplicandoRecolhimentoAuto = !0;
909
+ try {
910
+ this.recolhido = e.acao === "recolher";
911
+ } finally {
912
+ this.aplicandoRecolhimentoAuto = !1;
913
+ }
914
+ this.recolhidoPorAuto = e.acao === "recolher";
915
+ }
916
+ }
917
+ alternarMenuGrupoColapsado(t, e) {
918
+ var r;
919
+ const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
920
+ this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = R(
921
+ this.shadowRoot,
922
+ t,
923
+ e.itens,
924
+ (o) => {
925
+ const n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(o.id)}"]`);
926
+ if (n) this.acionar(n, !1);
927
+ else {
928
+ const u = o.ativo;
929
+ o.tipo === "toggle" ? o.ativo = !u : o.tipo === "ferramenta" && (o.ativo = !0), this.emitir(o) || (o.ativo = u);
930
+ }
931
+ this.rootElement.classList.remove("ui-ribbon--aberto");
932
+ },
933
+ {
934
+ lado: "baixo",
935
+ onFechar: () => {
936
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
937
+ }
938
+ }
939
+ ));
940
+ }
941
+ criarBotao(t, e, i) {
942
+ return $(this.efetivo(t), e, i);
943
+ }
944
+ botoesPainel() {
945
+ return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
946
+ }
947
+ get rtl() {
948
+ return getComputedStyle(this).direction === "rtl";
949
+ }
950
+ alternarKeyTips() {
951
+ if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
952
+ Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
953
+ const r = document.createElement("span");
954
+ r.className = "ui-ribbon__keytip", r.textContent = String(i + 1), r.style.top = "2px", r.style.left = "4px", e.style.position = "relative", e.appendChild(r);
955
+ });
956
+ }
957
+ acionar(t, e) {
958
+ var n;
959
+ const i = this._abas.find((u) => u.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((u) => _(u.itens, t.dataset.id)), o = r && _(r.itens, t.dataset.id);
960
+ if (!(!o || o.disabled)) {
961
+ if ((n = o.filhos) != null && n.length && !o.dividido) {
962
+ this.alternarMenu(t, o, e);
963
+ return;
964
+ }
965
+ if (o.tipo === "toggle") {
966
+ const u = o.ativo;
967
+ o.ativo = !u, C(t, o), this.emitir(o) || (o.ativo = u, C(t, o));
968
+ } else if (o.tipo === "ferramenta") {
969
+ const u = o.ativo, d = r ? r.exclusivo !== !1 : !0, l = d && r ? r.itens.filter((h) => h.tipo === "ferramenta" && h.id !== o.id && h.ativo) : [];
970
+ o.ativo = !0, C(t, o), d && l.forEach((h) => {
971
+ h.ativo = !1;
972
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(h.id)}"]`);
973
+ b && C(b, h);
974
+ }), this.emitir(o) || (o.ativo = u, C(t, o), d && l.forEach((h) => {
975
+ h.ativo = !0;
976
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(h.id)}"]`);
977
+ b && C(b, h);
978
+ }));
979
+ } else
980
+ this.emitir(o);
981
+ this.rootElement.classList.remove("ui-ribbon--aberto");
982
+ }
983
+ }
984
+ alternarMenu(t, e, i) {
985
+ var o;
986
+ const r = ((o = this.menu) == null ? void 0 : o.ancora) === t;
987
+ this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = R(
988
+ this.shadowRoot,
989
+ t,
990
+ e.filhos,
991
+ (n) => {
992
+ if (n.tipo === "toggle") {
993
+ const u = n.ativo;
994
+ n.ativo = !u, this.emitir(n, e) || (n.ativo = u);
995
+ } else
996
+ this.emitir(n, e);
997
+ this.rootElement.classList.remove("ui-ribbon--aberto");
998
+ },
999
+ {
1000
+ lado: "baixo",
1001
+ focar: i,
1002
+ onFechar: () => {
1003
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1004
+ }
1005
+ }
1006
+ ));
1007
+ }
1008
+ fecharMenu() {
1009
+ var t;
1010
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1011
+ }
1012
+ /** Retorna false se o consumidor cancelou o evento (preventDefault). */
1013
+ emitir(t, e) {
1014
+ return this.dispatchEvent(
1015
+ new CustomEvent("ui-ferramenta", {
1016
+ detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
1017
+ bubbles: !0,
1018
+ composed: !0,
1019
+ cancelable: !0
1020
+ })
1021
+ );
1022
+ }
1023
+ }
1024
+ V("ui-ribbon", Rt);
1025
+ const Lt = ':host{display:inline-flex;flex-direction:column;max-width:100%;max-height:100%;vertical-align:top;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-paleta{--ui-paleta-btn: 34px;--ui-paleta-padding: 4px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 10px);--ui-paleta-btn-raio: var(--ui-paleta-raio-botao, max(2px, calc(var(--ui-paleta-raio) - var(--ui-paleta-padding))));display:flex;flex-direction:column;align-items:center;gap:2px;padding:var(--ui-paleta-padding);box-sizing:border-box;background:var(--ui-degrade-interno, var(--ui-paleta-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-paleta-raio);-webkit-user-select:none;user-select:none;min-width:0;min-height:0;max-width:100%;overflow:auto;scrollbar-width:thin}.ui-paleta--horizontal{flex-direction:row}.ui-paleta--sm{--ui-paleta-btn: 28px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 8px)}.ui-paleta--lg{--ui-paleta-btn: 42px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 12px)}.ui-paleta--cols-2{display:grid;grid-template-columns:repeat(2,var(--ui-paleta-btn));justify-content:center}.ui-paleta--cols-2 .ui-paleta__sep{grid-column:1 / -1}.ui-paleta .ui-ferr-btn{width:var(--ui-paleta-btn);height:var(--ui-paleta-btn);border-radius:var(--ui-paleta-btn-raio)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 86%,#fff)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 80%,#000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:inherit}.ui-ferr-btn--grupo:after{content:"";position:absolute;inset-inline-end:3px;bottom:3px;width:0;height:0;border-inline-start:6px solid transparent;border-bottom:6px solid currentColor;opacity:.8;pointer-events:none;transition:opacity .12s ease,transform .12s ease}.ui-ferr-btn--grupo:hover:after,.ui-ferr-btn--grupo:focus-visible:after,.ui-ferr-btn--grupo[aria-expanded=true]:after{opacity:1;transform:scale(1.2);transform-origin:bottom right}.ui-paleta__sep{grid-column:1 / -1}.ui-paleta__sep{width:70%;height:1px;margin:3px 0;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-paleta--horizontal .ui-paleta__sep{width:1px;height:70%;margin:0 3px}@media (pointer: coarse){.ui-paleta{--ui-paleta-btn: 40px}.ui-paleta--sm{--ui-paleta-btn: 36px}.ui-paleta--lg{--ui-paleta-btn: 48px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn--grupo:after{transition:none}}@media (forced-colors: active){.ui-paleta{border-color:CanvasText}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-paleta__sep{background:CanvasText}}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-paleta[data-degrade]:not([data-degrade=false]){--ui-paleta-fundo: var(--ui-gradiente-superficie)}', Nt = 380, Dt = 8, jt = 50;
1026
+ class It {
1027
+ constructor() {
1028
+ c(this, "timer");
1029
+ c(this, "timerSupressao");
1030
+ c(this, "inicio", null);
1031
+ c(this, "suprimir", !1);
1032
+ }
1033
+ /** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
1034
+ iniciar(s, t, e) {
1035
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: s, y: t }, this.timer = window.setTimeout(() => {
1036
+ this.suprimir = !0, e();
1037
+ }, Nt);
1038
+ }
1039
+ /** Arrastar/rolar com o dedo cancela o clique longo. */
1040
+ mover(s, t) {
1041
+ this.timer === void 0 || !this.inicio || Math.hypot(s - this.inicio.x, t - this.inicio.y) > Dt && this.cancelar();
1042
+ }
1043
+ /** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
1044
+ fim() {
1045
+ this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
1046
+ this.suprimir = !1;
1047
+ }, jt));
1048
+ }
1049
+ cancelar() {
1050
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
1051
+ }
1052
+ /** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
1053
+ consumirSupressao() {
1054
+ return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
1055
+ }
1056
+ destruir() {
1057
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
1058
+ }
1059
+ }
1060
+ function Tt(a, s) {
1061
+ return a.find(s) ?? a[0];
1062
+ }
1063
+ const Ft = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
1064
+ function $t(a) {
1065
+ const s = a[0];
1066
+ return s && (/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) || s.isContentEditable) ? !0 : a.some((t) => {
1067
+ var r, o;
1068
+ const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
1069
+ return ((o = e.getAttribute) == null ? void 0 : o.call(e, "aria-modal")) === "true" || !!i && Ft.has(i);
1070
+ });
1071
+ }
1072
+ function Ot(a, s, t, e) {
1073
+ const i = typeof a == "string" ? { key: a, ctrlKey: !1, metaKey: !1, altKey: !1, shiftKey: !1 } : a;
1074
+ if (!i || !i.key) return null;
1075
+ const r = s.filter((u) => !u.disabled && at(i, u.atalho));
1076
+ if (r.length === 0) return null;
1077
+ let o = r[0];
1078
+ if (r.length > 1) {
1079
+ const u = r.findIndex((d) => d.id === e);
1080
+ o = r[(u + 1) % r.length];
1081
+ }
1082
+ const n = t.find((u) => {
1083
+ var d;
1084
+ return (d = u.filhos) == null ? void 0 : d.some((l) => l.id === o.id);
1085
+ });
1086
+ return { alvo: o, pai: n };
1087
+ }
1088
+ function j(a, s) {
1089
+ return Number.isFinite(a) && a >= 0 ? a : s;
1090
+ }
1091
+ function Q(a, s, t, e) {
1092
+ const i = j(a.botao, 0), r = j(a.gap, 0), o = j(a.separador, 0), n = a.vertical && e === 2;
1093
+ let u = 0, d = 0;
1094
+ const l = (m) => {
1095
+ u += (u > 0 ? r : 0) + m;
1096
+ }, h = () => {
1097
+ if (!n) return l(i);
1098
+ d === 0 && l(i), d = (d + 1) % 2;
1099
+ }, b = Math.min(Math.max(0, Math.floor(s)), a.separadores.length);
1100
+ for (let m = 0; m < b; m++)
1101
+ a.separadores[m] ? (l(o), d = 0) : h();
1102
+ return t && h(), u + j(a.moldura, 0);
1103
+ }
1104
+ function qt(a) {
1105
+ const s = Array.isArray(a.separadores) ? a.separadores.length : 0, t = a.vertical ? a.colunas === "auto" ? [1, 2] : [a.colunas === 2 ? 2 : 1] : [1];
1106
+ if (!(a.limite > 0) || !Number.isFinite(a.limite) || s === 0) return { colunas: t[0], visiveis: s };
1107
+ for (const r of t)
1108
+ if (Q(a, s, !1, r) <= a.limite) return { colunas: r, visiveis: s };
1109
+ const i = t[t.length - 1];
1110
+ if (!a.excessoMenu) return { colunas: i, visiveis: s };
1111
+ for (let r = s - 1; r >= 1; r--)
1112
+ if (Q(a, r, !0, i) <= a.limite) return { colunas: i, visiveis: r };
1113
+ return { colunas: i, visiveis: 1 };
1114
+ }
1115
+ function Bt(a, s, t) {
1116
+ const e = Math.min(Math.max(0, Math.floor(s)), a.length);
1117
+ let i = a.slice(0, e), r = a.slice(e);
1118
+ for (; r.length && t(r[0]); ) r = r.slice(1);
1119
+ for (; r.length && t(r[r.length - 1]); ) r = r.slice(0, -1);
1120
+ if (!r.length) return { visiveis: a, excesso: [] };
1121
+ for (; i.length && t(i[i.length - 1]); ) i = i.slice(0, -1);
1122
+ return { visiveis: i, excesso: r };
1123
+ }
1124
+ const Ht = '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>', Gt = "Mais ferramentas";
1125
+ function lt(a, s) {
1126
+ var t;
1127
+ if (s)
1128
+ for (const e of a) {
1129
+ if (e.id === s) return e;
1130
+ const i = (t = e.filhos) == null ? void 0 : t.find((r) => r.id === s);
1131
+ if (i) return i;
1132
+ }
1133
+ }
1134
+ function Vt(a) {
1135
+ return a.filter((s) => s.tipo !== "separador").map((s) => s.id);
1136
+ }
1137
+ function Kt(a, s, t, e = Gt) {
1138
+ const i = lt(a, s), r = a.some((n) => n.tipo !== "separador" && !n.disabled), o = $(
1139
+ {
1140
+ id: "__mais",
1141
+ rotulo: e,
1142
+ rotuloAcessivel: i ? `${e}: ${k(i)} ativa` : e,
1143
+ icone: (i == null ? void 0 : i.icone) ?? Ht,
1144
+ tipo: "botao",
1145
+ disabled: !r
1146
+ },
1147
+ "paleta",
1148
+ t
1149
+ );
1150
+ return o.removeAttribute("data-id"), o.dataset.mais = "", o.dataset.tooltip = i ? `${e} — ${k(i)}` : e, o.classList.add("ui-ferr-btn--mais", "ui-ferr-btn--grupo"), o.classList.toggle("ui-ferr-btn--ativo", !!i), o.setAttribute("aria-haspopup", "menu"), o.setAttribute("aria-expanded", "false"), o;
1151
+ }
1152
+ const Wt = { sm: 16, md: 18, lg: 22 }, tt = { sm: [28, 36], md: [34, 40], lg: [42, 48] }, Ut = 7, x = (a, s) => {
1153
+ const t = parseFloat(a ?? "");
1154
+ return Number.isFinite(t) ? t : s;
1155
+ };
1156
+ class Yt extends K {
1157
+ constructor() {
1158
+ super();
1159
+ c(this, "rootElement");
1160
+ c(this, "_ferramentas", []);
1161
+ c(this, "_ativo", "");
1162
+ c(this, "_pendente", "");
1163
+ c(this, "visiveis", /* @__PURE__ */ new Map());
1164
+ // id do grupo → id do filho exibido
1165
+ c(this, "menu", null);
1166
+ c(this, "pressao", new It());
1167
+ c(this, "listeners", new F());
1168
+ c(this, "tooltip", null);
1169
+ c(this, "_modoControlado", !1);
1170
+ /** Ajuste ao espaço atual (null até a primeira renderização). */
1171
+ c(this, "_ajuste", null);
1172
+ /** Quantidade de itens da lista para a qual `_ajuste` foi calculado. */
1173
+ c(this, "_totalAjustado", 0);
1174
+ /** Itens de topo que não couberam (menu "Mais ferramentas"). */
1175
+ c(this, "_excesso", []);
1176
+ c(this, "observador", null);
1177
+ c(this, "rafAjuste", null);
1178
+ c(this, "handleClick", (t) => {
1179
+ var o;
1180
+ if (this.pressao.consumirSupressao()) return;
1181
+ const e = t.target.closest(".ui-ferr-btn");
1182
+ if (e && e.dataset.mais !== void 0) {
1183
+ if (e.disabled) return;
1184
+ ((o = this.menu) == null ? void 0 : o.ancora) === e ? this.fecharMenu() : this.abrirFlyout(e, !1);
1185
+ return;
1186
+ }
1187
+ const i = e != null && e.dataset.id ? _(this._ferramentas, e.dataset.id) : void 0;
1188
+ if (!e || !i) return;
1189
+ const r = e.dataset.grupo ? _(this._ferramentas, e.dataset.grupo) : void 0;
1190
+ this.acionar(i, r);
1191
+ });
1192
+ c(this, "handleFocusIn", (t) => st(this.botoes(), t.target));
1193
+ c(this, "handlePointerDown", (t) => {
1194
+ const e = t;
1195
+ if (e.pointerType === "mouse" && e.button !== 0) return;
1196
+ const i = t.target.closest(".ui-ferr-btn--grupo");
1197
+ !i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
1198
+ });
1199
+ c(this, "handlePointerMove", (t) => {
1200
+ const e = t;
1201
+ this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
1202
+ });
1203
+ c(this, "handlePointerFim", () => this.pressao.fim());
1204
+ c(this, "handleContextMenu", (t) => {
1205
+ const e = t.target.closest(".ui-ferr-btn--grupo");
1206
+ e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
1207
+ });
1208
+ c(this, "handleKeyDown", (t) => {
1209
+ var u;
1210
+ const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
1211
+ if (!e && r === 2) {
1212
+ if (mt(t, this.botoes(), i)) return;
1213
+ } else {
1214
+ const d = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], l = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
1215
+ if (H(t, this.botoes(), d, l)) return;
1216
+ }
1217
+ const o = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
1218
+ n && (n.dataset.grupo || n.dataset.mais !== void 0) && t.key === o && (t.preventDefault(), ((u = this.menu) == null ? void 0 : u.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
1219
+ });
1220
+ c(this, "handleAtalho", (t) => {
1221
+ if (!this.hasAttribute("atalhos") || t.defaultPrevented || $t(t.composedPath()) || !this.donaDosAtalhos()) return;
1222
+ const e = Ot(t, this.todasFerramentas(), this._ferramentas, this._ativo);
1223
+ e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
1224
+ });
1225
+ const t = this.attachShadow({ mode: "open" });
1226
+ t.innerHTML = `
1227
+ <style>${rt}${Lt}</style>
1228
+ <div class="ui-paleta ui-paleta--vertical" part="base" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
1229
+ `, this.rootElement = t.querySelector(".ui-paleta");
1230
+ }
1231
+ static get observedAttributes() {
1232
+ return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "excesso", "aria-label", "copiar-dados", "modo-controlado", ...et];
1233
+ }
1234
+ connectedCallback() {
1235
+ var e;
1236
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new nt(this.shadowRoot, this.rootElement), this.listeners.add(this.rootElement, "click", this.handleClick), this.listeners.add(this.rootElement, "pointerdown", this.handlePointerDown), this.listeners.add(this.rootElement, "pointermove", this.handlePointerMove), this.listeners.add(this.rootElement, "pointerup", this.handlePointerFim), this.listeners.add(this.rootElement, "pointerleave", this.handlePointerFim), this.listeners.add(this.rootElement, "pointercancel", this.handlePointerFim), this.listeners.add(this.rootElement, "contextmenu", this.handleContextMenu), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.rootElement, "focusin", this.handleFocusIn), this.listeners.add(document, "keydown", this.handleAtalho);
1237
+ const t = this.getAttribute("valor") || this.getAttribute("value");
1238
+ t && !this._ativo && (this._pendente = t), T(this, this.rootElement), this.aplicarPendente(), this.renderizar(), this.iniciarObservador();
1239
+ }
1240
+ disconnectedCallback() {
1241
+ var t;
1242
+ this.pararObservador(), this.pressao.destruir(), this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
1243
+ }
1244
+ attributeChangedCallback(t, e, i) {
1245
+ if (e !== i) {
1246
+ if (it(t)) {
1247
+ T(this, this.rootElement);
1248
+ return;
1249
+ }
1250
+ if (t === "valor" || t === "value") {
1251
+ const r = this.getAttribute("valor") || this.getAttribute("value") || "";
1252
+ r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
1253
+ } else
1254
+ this.renderizar();
1255
+ }
1256
+ }
1257
+ /* ---------- API pública ---------- */
1258
+ /**
1259
+ * Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
1260
+ * para não mutar os objetos fornecidos pelo consumidor (Item 11).
1261
+ */
1262
+ get modoControlado() {
1263
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
1264
+ }
1265
+ set modoControlado(t) {
1266
+ this._modoControlado = !!t;
1267
+ }
1268
+ get copiarDados() {
1269
+ return this.modoControlado;
1270
+ }
1271
+ set copiarDados(t) {
1272
+ this.modoControlado = t;
1273
+ }
1274
+ get ferramentas() {
1275
+ return this._ferramentas;
1276
+ }
1277
+ set ferramentas(t) {
1278
+ const e = Array.isArray(t) ? t : [];
1279
+ this._ferramentas = this.modoControlado ? e.map((i) => {
1280
+ var r;
1281
+ return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((o) => ({ ...o })) };
1282
+ }) : e, B(W(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
1283
+ }
1284
+ get valor() {
1285
+ return this._ativo;
1286
+ }
1287
+ set valor(t) {
1288
+ this.ativar(t);
1289
+ }
1290
+ get value() {
1291
+ return this.valor;
1292
+ }
1293
+ set value(t) {
1294
+ this.valor = t;
1295
+ }
1296
+ get orientacao() {
1297
+ return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
1298
+ }
1299
+ set orientacao(t) {
1300
+ this.setAttribute("orientacao", t);
1301
+ }
1302
+ /** Colunas em uso. Com `colunas="auto"` reflete o ajuste atual ao espaço (1 ou 2). */
1303
+ get colunas() {
1304
+ var e;
1305
+ const t = this.getAttribute("colunas");
1306
+ return t === "2" ? 2 : t === "auto" ? ((e = this._ajuste) == null ? void 0 : e.colunas) ?? 1 : 1;
1307
+ }
1308
+ set colunas(t) {
1309
+ this.setAttribute("colunas", String(t));
1310
+ }
1311
+ get modoColunas() {
1312
+ const t = this.getAttribute("colunas");
1313
+ return t === "2" ? 2 : t === "auto" ? "auto" : 1;
1314
+ }
1315
+ /** O que fazer quando a paleta não cabe: `menu` (botão "Mais ferramentas", padrão) ou `rolar` (barra de rolagem). */
1316
+ get excesso() {
1317
+ return this.getAttribute("excesso") === "rolar" ? "rolar" : "menu";
1318
+ }
1319
+ set excesso(t) {
1320
+ this.setAttribute("excesso", t);
1321
+ }
1322
+ get tamanho() {
1323
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
1324
+ return t === "sm" || t === "lg" ? t : "md";
1325
+ }
1326
+ set tamanho(t) {
1327
+ this.setAttribute("tamanho", t);
1328
+ }
1329
+ /**
1330
+ * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
1331
+ * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
1332
+ */
1333
+ ativar(t, e = !0) {
1334
+ if (!t) {
1335
+ this.limpar(e);
1336
+ return;
1337
+ }
1338
+ const i = _(this._ferramentas, t);
1339
+ if (!i) {
1340
+ this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
1341
+ return;
1342
+ }
1343
+ if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
1344
+ console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
1345
+ return;
1346
+ }
1347
+ this._pendente = "";
1348
+ const r = this._ativo;
1349
+ this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
1350
+ }
1351
+ /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
1352
+ limpar(t = !0) {
1353
+ const e = this._ativo;
1354
+ !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
1355
+ }
1356
+ atualizarItem(t, e) {
1357
+ var u;
1358
+ const i = _(this._ferramentas, t);
1359
+ if (!i) {
1360
+ console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
1361
+ return;
1362
+ }
1363
+ Object.assign(i, e);
1364
+ const r = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), o = this._ferramentas.find((d) => {
1365
+ var l;
1366
+ return (l = d.filhos) == null ? void 0 : l.some((h) => h.id === t);
1367
+ }), n = this._excesso.some((d) => d.id === ((o == null ? void 0 : o.id) ?? t));
1368
+ if (r && !n && !(o && "disabled" in e)) {
1369
+ const d = this.botoes().find((l) => l.dataset.id === t || l.dataset.grupo === t);
1370
+ if (d) {
1371
+ C(d, this.itemParaBotao(o ?? i)), ot(this.botoes());
1372
+ return;
1373
+ }
1374
+ if (o || (u = i.filhos) != null && u.length) return;
1375
+ }
1376
+ this.renderizar();
1377
+ }
1378
+ /**
1379
+ * Reavalia o espaço disponível (colunas e itens ocultos). É chamado sozinho quando o contêiner
1380
+ * muda de tamanho; chame manualmente após mudanças de layout que o navegador não notifica.
1381
+ */
1382
+ reajustar() {
1383
+ if (!this.isConnected) return;
1384
+ const t = this.calcularAtual();
1385
+ this.mesmoAjuste(t, this._ajuste) || this.renderizar(t);
1386
+ }
1387
+ /* ---------- Ajuste ao espaço ---------- */
1388
+ /** `a` foi calculado para a lista atual; `b` (o ajuste guardado) para a lista de `_totalAjustado` itens. */
1389
+ mesmoAjuste(t, e) {
1390
+ if (!e || t.colunas !== e.colunas) return !1;
1391
+ const i = t.visiveis >= this._ferramentas.length, r = e.visiveis >= this._totalAjustado;
1392
+ return i && r || t.visiveis === e.visiveis;
1393
+ }
1394
+ /**
1395
+ * Só reduz quando a paleta realmente transborda (ou já estava reduzida e precisa decidir se pode
1396
+ * crescer): um contêiner de altura automática nunca causa ocultação por erro de estimativa.
1397
+ */
1398
+ calcularAtual() {
1399
+ const t = this._ferramentas.length, e = this.modoColunas, i = this.orientacao === "vertical", r = { colunas: i && e === 2 ? 2 : 1, visiveis: t };
1400
+ if (!this.isConnected || t === 0) return r;
1401
+ const o = this._ajuste;
1402
+ if (!(!!o && (o.visiveis < this._totalAjustado || i && e === "auto" && o.colunas === 2)) && !this.transbordando(i)) return r;
1403
+ const u = this.medirPaleta(i);
1404
+ return qt({
1405
+ separadores: this._ferramentas.map((d) => (d == null ? void 0 : d.tipo) === "separador"),
1406
+ vertical: i,
1407
+ colunas: e,
1408
+ limite: this.limiteDisponivel(i),
1409
+ ...u,
1410
+ excessoMenu: this.excesso === "menu"
1411
+ });
1412
+ }
1413
+ transbordando(t) {
1414
+ const e = this.rootElement;
1415
+ return t ? e.scrollHeight > e.clientHeight + 1 : e.scrollWidth > e.clientWidth + 1;
1416
+ }
1417
+ /** Espaço (px) que o elemento pai oferece no eixo principal; 0 = desconhecido (sem limite). */
1418
+ limiteDisponivel(t) {
1419
+ const e = this.parentElement;
1420
+ if (!e) return 0;
1421
+ const i = getComputedStyle(e), r = t ? e.clientHeight : e.clientWidth, o = t ? x(i.paddingTop, 0) + x(i.paddingBottom, 0) : x(i.paddingLeft, 0) + x(i.paddingRight, 0);
1422
+ return r - o;
1423
+ }
1424
+ /** Medidas reais do CSS (tamanho/toque/tema); cai em valores padrão se o navegador não as expõe. */
1425
+ medirPaleta(t) {
1426
+ const e = getComputedStyle(this.rootElement), i = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, [r, o] = tt[this.tamanho] ?? tt.md, n = t ? x(e.paddingTop, 4) + x(e.paddingBottom, 4) + x(e.borderTopWidth, 1) + x(e.borderBottomWidth, 1) : x(e.paddingLeft, 4) + x(e.paddingRight, 4) + x(e.borderLeftWidth, 1) + x(e.borderRightWidth, 1);
1427
+ return {
1428
+ botao: x(e.getPropertyValue("--ui-paleta-btn"), i ? o : r),
1429
+ gap: x(t ? e.rowGap : e.columnGap, 2),
1430
+ moldura: n,
1431
+ separador: Ut
1432
+ };
1433
+ }
1434
+ iniciarObservador() {
1435
+ this.pararObservador(), !(typeof ResizeObserver > "u") && (this.observador = new ResizeObserver(() => this.agendarAjuste()), this.parentElement && this.observador.observe(this.parentElement), this.observador.observe(this));
1436
+ }
1437
+ pararObservador() {
1438
+ var t;
1439
+ (t = this.observador) == null || t.disconnect(), this.observador = null, this.rafAjuste !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.rafAjuste), this.rafAjuste = null;
1440
+ }
1441
+ /** Agrupa rajadas de resize num único reajuste por quadro (evita "ResizeObserver loop"). */
1442
+ agendarAjuste() {
1443
+ if (typeof requestAnimationFrame != "function") {
1444
+ this.reajustar();
1445
+ return;
1446
+ }
1447
+ this.rafAjuste === null && (this.rafAjuste = requestAnimationFrame(() => {
1448
+ this.rafAjuste = null, this.reajustar();
1449
+ }));
1450
+ }
1451
+ /* ---------- Estado interno ---------- */
1452
+ refletirValor(t) {
1453
+ const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
1454
+ this.getAttribute(e) !== t && this.setAttribute(e, t);
1455
+ }
1456
+ aplicarPendente() {
1457
+ if (!this._pendente) return;
1458
+ const t = _(this._ferramentas, this._pendente);
1459
+ t && !t.disabled && (t.tipo ?? "ferramenta") === "ferramenta" ? (this.definirAtivoInterno(this._pendente), this._pendente = "") : this._ferramentas.length && (console.warn(`[ui-paleta-ferramentas] valor="${this._pendente}" não é uma ferramenta ativável em "ferramentas".`), this._pendente = "");
1460
+ }
1461
+ definirAtivoInterno(t) {
1462
+ this._ativo = t;
1463
+ const e = this._ferramentas.find((i) => {
1464
+ var r;
1465
+ return (r = i.filhos) == null ? void 0 : r.some((o) => o.id === t);
1466
+ });
1467
+ e && this.visiveis.set(e.id, t);
1468
+ }
1469
+ emitirMudanca(t, e, i) {
1470
+ const r = { valor: t, item: e, anterior: i };
1471
+ this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
1472
+ }
1473
+ /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
1474
+ itemExibido(t) {
1475
+ var o;
1476
+ if (!((o = t.filhos) != null && o.length)) return t;
1477
+ const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
1478
+ return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
1479
+ }
1480
+ itemParaBotao(t) {
1481
+ const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
1482
+ return {
1483
+ ...e,
1484
+ tipo: i,
1485
+ ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
1486
+ filhos: t.filhos
1487
+ };
1488
+ }
1489
+ todasFerramentas() {
1490
+ return this._ferramentas.flatMap((t) => {
1491
+ var e;
1492
+ return (e = t.filhos) != null && e.length ? t.filhos : [t];
1493
+ }).filter((t) => t.tipo !== "separador");
1494
+ }
1495
+ /* ---------- Renderização ---------- */
1496
+ renderizar(t) {
1497
+ var v;
1498
+ const e = (v = this.shadowRoot) == null ? void 0 : v.activeElement, i = e && e.classList.contains("ui-ferr-btn") ? { id: e.dataset.id ?? "", grupo: e.dataset.grupo ?? "", mais: e.dataset.mais !== void 0 } : null;
1499
+ this.fecharMenu();
1500
+ const r = this.orientacao, o = this.tamanho, n = t ?? this.calcularAtual(), u = this._ajuste, d = !!u && !this.mesmoAjuste(n, u);
1501
+ this._ajuste = n, this._totalAjustado = this._ferramentas.length, this.rootElement.className = `ui-paleta ui-paleta--${r} ui-paleta--${o}`, n.colunas === 2 && r === "vertical" && this.rootElement.classList.add("ui-paleta--cols-2"), this.rootElement.setAttribute("aria-orientation", r), this.rootElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.rootElement.innerHTML = "";
1502
+ const l = Wt[o] ?? 18, { visiveis: h, excesso: b } = Bt(this._ferramentas, n.visiveis, (g) => g.tipo === "separador");
1503
+ this._excesso = b, h.forEach((g) => {
1504
+ var S;
1505
+ if (g.tipo === "separador") {
1506
+ const M = document.createElement("div");
1507
+ M.className = "ui-paleta__sep", M.setAttribute("role", "separator"), this.rootElement.appendChild(M);
1508
+ return;
1509
+ }
1510
+ const w = this.itemExibido(g), E = $(this.itemParaBotao(g), "paleta", l);
1511
+ E.dataset.id = w.id, (S = g.filhos) != null && S.length && (E.dataset.grupo = g.id), this.rootElement.appendChild(E);
1512
+ }), b.length && this.rootElement.appendChild(Kt(b, this._ativo, l)), U(this.botoes());
1513
+ const m = this.botoes().find((g) => g.dataset.id === this._ativo && !g.disabled) ?? (lt(b, this._ativo) ? this.botaoMais() : null);
1514
+ if (m && !m.disabled && (this.botoes().forEach((g) => g.tabIndex = -1), m.tabIndex = 0), i) {
1515
+ const g = i.mais ? this.botaoMais() : this.botoes().find((w) => i.grupo ? w.dataset.grupo === i.grupo : w.dataset.id === i.id);
1516
+ g && !g.disabled && g.focus();
1517
+ }
1518
+ d && this.dispatchEvent(
1519
+ new CustomEvent("ui-paleta-ajuste", {
1520
+ detail: {
1521
+ colunas: n.colunas,
1522
+ visiveis: h.filter((g) => g.tipo !== "separador").length,
1523
+ total: this._ferramentas.filter((g) => g.tipo !== "separador").length,
1524
+ ocultos: Vt(b)
1525
+ },
1526
+ bubbles: !0,
1527
+ composed: !0
1528
+ })
1529
+ );
1530
+ }
1531
+ botaoMais() {
1532
+ return this.rootElement.querySelector(".ui-ferr-btn--mais");
1533
+ }
1534
+ botoes() {
1535
+ return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
1536
+ }
1537
+ /** Reflete no botão o estado atual do item (sem recriar o DOM). */
1538
+ atualizarBotaoDe(t, e) {
1539
+ const i = this.botoes().find((r) => r.dataset.id === t.id);
1540
+ i && C(i, this.itemParaBotao(e ?? t));
1541
+ }
1542
+ /* ---------- Interação ---------- */
1543
+ acionar(t, e) {
1544
+ if (t.disabled) return;
1545
+ const i = t.tipo ?? "ferramenta", r = this._ativo, o = t.ativo;
1546
+ i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
1547
+ new CustomEvent("ui-ferramenta", {
1548
+ detail: {
1549
+ id: t.id,
1550
+ item: t,
1551
+ pai: e,
1552
+ ativo: i === "ferramenta" ? !0 : t.ativo,
1553
+ origem: "paleta"
1554
+ },
1555
+ bubbles: !0,
1556
+ composed: !0,
1557
+ cancelable: !0
1558
+ })
1559
+ ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = o, this.atualizarBotaoDe(t, e)));
1560
+ }
1561
+ /** Várias paletas com `atalhos` na página: só a que contém o foco (ou a primeira no DOM) responde. */
1562
+ donaDosAtalhos() {
1563
+ const t = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
1564
+ return t.length <= 1 ? !0 : Tt(t, (e) => {
1565
+ var i;
1566
+ return e.matches(":focus-within") || !!((i = e.shadowRoot) != null && i.activeElement);
1567
+ }) === this;
1568
+ }
1569
+ abrirFlyout(t, e) {
1570
+ const i = t.dataset.mais !== void 0, r = !i && t.dataset.grupo ? _(this._ferramentas, t.dataset.grupo) : void 0, o = i ? this._excesso : r == null ? void 0 : r.filhos;
1571
+ if (!(o != null && o.length)) return;
1572
+ this.fecharMenu();
1573
+ const n = (h) => {
1574
+ var b, m;
1575
+ return {
1576
+ ...h,
1577
+ ativo: !((b = h.filhos) != null && b.length) && (h.tipo ?? "ferramenta") === "ferramenta" ? h.id === this._ativo : h.ativo,
1578
+ filhos: (m = h.filhos) == null ? void 0 : m.map(n)
1579
+ };
1580
+ }, u = o.map(n), d = this.getAttribute("orientacao") !== "horizontal", l = getComputedStyle(this).direction === "rtl";
1581
+ t.setAttribute("aria-expanded", "true"), this.menu = R(
1582
+ this.shadowRoot,
1583
+ t,
1584
+ u,
1585
+ (h) => {
1586
+ var v;
1587
+ const b = _(this._ferramentas, h.id);
1588
+ if (!b) return;
1589
+ const m = r ?? this._ferramentas.find((g) => {
1590
+ var w;
1591
+ return (w = g.filhos) == null ? void 0 : w.some((E) => E.id === b.id);
1592
+ });
1593
+ this.acionar(b, m), (v = i ? this.botaoMais() : this.botoes().find((g) => g.dataset.grupo === (r == null ? void 0 : r.id))) == null || v.focus();
1594
+ },
1595
+ {
1596
+ lado: d ? l ? "esquerda" : "direita" : "baixo",
1597
+ focar: e,
1598
+ tipoPadrao: "ferramenta",
1599
+ onFechar: () => {
1600
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1601
+ }
1602
+ }
1603
+ );
1604
+ }
1605
+ fecharMenu() {
1606
+ var t;
1607
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1608
+ }
1609
+ }
1610
+ V("ui-paleta-ferramentas", Yt);
1611
+ export {
1612
+ bt as U,
1613
+ Yt as a,
1614
+ Rt as b
1615
+ };