@wrrdev/fenix-ui 1.1.2 → 1.1.4

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.
@@ -151,7 +151,7 @@
151
151
  @media (prefers-reduced-motion: reduce) {
152
152
  .spinner { animation-duration: 2.5s; }
153
153
  }
154
- `;let I=Ne;function Ot(){return b("fx-spinner",I)}Ot();const je=class je extends g{static get observedAttributes(){return["size","disabled","placeholder","searchable","clearable","error","success"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,i,o;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(o=(i=e.textContent)==null?void 0:i.trim())!=null?o:""}})}connectedCallback(){super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}select(e){this.value=e,this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}_navigateOptions(e){var i;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(i=t[a])==null||i.focus()}render(){var p,v,_,x,w,S,A;const e=this.hasAttr("open"),t=this.root.querySelector(".search"),r=(p=t==null?void 0:t.value)!=null?p:"",a=t!=null&&this.root.activeElement===t,i=a?t.selectionStart:null,o=this.options;let s=this.getAttr("value");if(!s){const y=this.querySelector("option[selected]");s=(x=(_=y==null?void 0:y.getAttribute("value"))!=null?_:(v=y==null?void 0:y.textContent)==null?void 0:v.trim())!=null?x:""}const n=(S=(w=o.find(y=>y.value===s))==null?void 0:w.label)!=null?S:"",l=this.getAttr("placeholder","Selecione…"),h=r?o.filter(y=>y.label.toLowerCase().includes(r.toLowerCase())):o;this.setTemplate(`
154
+ `;let I=Ne;function Ot(){return b("fx-spinner",I)}Ot();const je=class je extends g{static get observedAttributes(){return["size","disabled","placeholder","searchable","clearable","error","success"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,i,o;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(o=(i=e.textContent)==null?void 0:i.trim())!=null?o:""}})}connectedCallback(){super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}select(e){this.value=e,this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}_navigateOptions(e){var i;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(i=t[a])==null||i.focus()}render(){var p,v,u,x,w,S,A;const e=this.hasAttr("open"),t=this.root.querySelector(".search"),r=(p=t==null?void 0:t.value)!=null?p:"",a=t!=null&&this.root.activeElement===t,i=a?t.selectionStart:null,o=this.options;let s=this.getAttr("value");if(!s){const y=this.querySelector("option[selected]");s=(x=(u=y==null?void 0:y.getAttribute("value"))!=null?u:(v=y==null?void 0:y.textContent)==null?void 0:v.trim())!=null?x:""}const n=(S=(w=o.find(y=>y.value===s))==null?void 0:w.label)!=null?S:"",l=this.getAttr("placeholder","Selecione…"),h=r?o.filter(y=>y.label.toLowerCase().includes(r.toLowerCase())):o;this.setTemplate(`
155
155
  <span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${e}">
156
156
  <span class="${n?"label":"placeholder"}">${c(n)||c(l)}</span>
157
157
  <span class="actions">
@@ -166,7 +166,7 @@
166
166
  aria-selected="${y.value===s}">${c(y.label)}</button>`).join("")}
167
167
  ${h.length===0?`<div class="empty">${c(this.getAttr("no-results","Nenhum resultado"))}</div>`:""}
168
168
  </div>
169
- `),e&&this.setAttribute("open","");const f=this.root.querySelector(".search");if(f&&(f.value=r,f.addEventListener("input",()=>this.render()),f.addEventListener("click",y=>y.stopPropagation()),a)){f.focus();try{f.setSelectionRange(i,i)}catch(y){}}const u=this.root.querySelector(".trigger");u&&(this.disabled&&u.setAttribute("aria-disabled","true"),u.addEventListener("click",y=>{var C;this.disabled||y.target.closest(".clear")||(this.toggleAttribute("open"),this.render(),(C=this.root.querySelector(".search"))==null||C.focus())}),u.addEventListener("keydown",y=>{var C;if(!this.disabled){if(y.key==="Enter"||y.key===" "){y.preventDefault(),u.click();return}if(y.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(C=this.root.querySelector(".trigger"))==null||C.focus());return}(y.key==="ArrowDown"||y.key==="ArrowUp"||y.key==="Home"||y.key==="End")&&this._navigateOptions(y)}}),(A=this.root.querySelector(".clear"))==null||A.addEventListener("click",y=>{y.stopPropagation(),this.value="",this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:""}}))}),this.root.querySelectorAll(".opt").forEach(y=>{y.addEventListener("click",()=>this.select(y.dataset.value))}))}};je.styles=m`
169
+ `),e&&this.setAttribute("open","");const f=this.root.querySelector(".search");if(f&&(f.value=r,f.addEventListener("input",()=>this.render()),f.addEventListener("click",y=>y.stopPropagation()),a)){f.focus();try{f.setSelectionRange(i,i)}catch(y){}}const _=this.root.querySelector(".trigger");_&&(this.disabled&&_.setAttribute("aria-disabled","true"),_.addEventListener("click",y=>{var C;this.disabled||y.target.closest(".clear")||(this.toggleAttribute("open"),this.render(),(C=this.root.querySelector(".search"))==null||C.focus())}),_.addEventListener("keydown",y=>{var C;if(!this.disabled){if(y.key==="Enter"||y.key===" "){y.preventDefault(),_.click();return}if(y.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(C=this.root.querySelector(".trigger"))==null||C.focus());return}(y.key==="ArrowDown"||y.key==="ArrowUp"||y.key==="Home"||y.key==="End")&&this._navigateOptions(y)}}),(A=this.root.querySelector(".clear"))==null||A.addEventListener("click",y=>{y.stopPropagation(),this.value="",this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:""}}))}),this.root.querySelectorAll(".opt").forEach(y=>{y.addEventListener("click",()=>this.select(y.dataset.value))}))}};je.styles=m`
170
170
  :host {
171
171
  display: inline-block;
172
172
  vertical-align: middle;
@@ -315,7 +315,7 @@
315
315
  ${i?`min="${c(i)}"`:""} ${o?`max="${c(o)}"`:""} ${s?`step="${c(s)}"`:""}
316
316
  />
317
317
  ${this.hasAttr("clearable")?'<button type="button" class="clear" part="clear" aria-label="Limpar" tabindex="-1">×</button></div>':""}
318
- `);const n=this.root.querySelector(".field");if(!n)return;n.value=this.getAttr("value"),a&&n.setAttribute("disabled",""),r&&n.setAttribute("readonly","");const l=u=>{this.value=n.value,this.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0,detail:{value:n.value}}))};n.addEventListener("input",u=>{u.stopPropagation(),l("input")}),n.addEventListener("change",u=>{u.stopPropagation(),l("change")});const h=this.root.querySelector(".clear"),f=()=>{h==null||h.toggleAttribute("hidden",n.value==="")};f(),h==null||h.addEventListener("click",()=>{n.value="",f(),l("input"),l("change"),n.focus()}),n.addEventListener("input",f)}};Ie.styles=m`
318
+ `);const n=this.root.querySelector(".field");if(!n)return;n.value=this.getAttr("value"),a&&n.setAttribute("disabled",""),r&&n.setAttribute("readonly","");const l=_=>{this.value=n.value,this.dispatchEvent(new CustomEvent(_,{bubbles:!0,composed:!0,detail:{value:n.value}}))};n.addEventListener("input",_=>{_.stopPropagation(),l("input")}),n.addEventListener("change",_=>{_.stopPropagation(),l("change")});const h=this.root.querySelector(".clear"),f=()=>{h==null||h.toggleAttribute("hidden",n.value==="")};f(),h==null||h.addEventListener("click",()=>{n.value="",f(),l("input"),l("change"),n.focus()}),n.addEventListener("input",f)}};Ie.styles=m`
319
319
  :host {
320
320
  display: inline-block;
321
321
  vertical-align: middle;
@@ -446,7 +446,7 @@
446
446
  :host([size='lg']) .track { width: 48px; height: 26px; }
447
447
  :host([size='lg']) .thumb { top: 4px; left: 4px; width: 18px; height: 18px; }
448
448
  :host([size='lg'][checked]) .thumb { transform: translateX(22px); }
449
- `;let V=Fe;function Yt(){return b("fx-switch",V)}Yt();const Pe=class Pe extends g{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder"]}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,i,o;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(o=(i=e.textContent)==null?void 0:i.trim())!=null?o:""}})}connectedCallback(){this.selected=new Set(this.values),super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}commit(){this.values=[...this.selected],this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:[...this.selected]}}))}toggleValue(e){this.selected.has(e)?this.selected.delete(e):this.selected.add(e),this.commit()}_navigateOptions(e){var i;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(i=t[a])==null||i.focus()}render(){var l,h,f,u;const e=this.hasAttr("open"),t=(h=(l=this.root.querySelector(".search"))==null?void 0:l.value)!=null?h:"",r=this.options;for(const p of[...this.selected])r.some(v=>v.value===p)||this.selected.delete(p);const a=r.filter(p=>this.selected.has(p.value)),i=this.getAttr("placeholder","Selecione…"),o=t?r.filter(p=>p.label.toLowerCase().includes(t.toLowerCase())):r;this.setTemplate(`
449
+ `;let V=Fe;function Yt(){return b("fx-switch",V)}Yt();const Pe=class Pe extends g{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder"]}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,i,o;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(o=(i=e.textContent)==null?void 0:i.trim())!=null?o:""}})}connectedCallback(){this.selected=new Set(this.values),super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}commit(){this.values=[...this.selected],this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:[...this.selected]}}))}toggleValue(e){this.selected.has(e)?this.selected.delete(e):this.selected.add(e),this.commit()}_navigateOptions(e){var i;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(i=t[a])==null||i.focus()}render(){var l,h,f,_;const e=this.hasAttr("open"),t=(h=(l=this.root.querySelector(".search"))==null?void 0:l.value)!=null?h:"",r=this.options;for(const p of[...this.selected])r.some(v=>v.value===p)||this.selected.delete(p);const a=r.filter(p=>this.selected.has(p.value)),i=this.getAttr("placeholder","Selecione…"),o=t?r.filter(p=>p.label.toLowerCase().includes(t.toLowerCase())):r;this.setTemplate(`
450
450
  <span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${e}" aria-disabled="${this.disabled}">
451
451
  <span class="lead">
452
452
  ${a.length?a.map(p=>`
@@ -475,7 +475,7 @@
475
475
  ${o.length===0?`<li class="empty">${c(this.getAttr("no-results","Nenhum resultado"))}</li>`:""}
476
476
  </ul>
477
477
  </div>
478
- `),e&&this.setAttribute("open","");const s=this.root.querySelector(".search");s&&(s.value=t,s.addEventListener("input",()=>{var _;const p=(_=s.selectionStart)!=null?_:s.value.length;this.render();const v=this.root.querySelector(".search");v&&(v.focus(),v.setSelectionRange(p,p))}),s.addEventListener("click",p=>p.stopPropagation()));const n=this.root.querySelector(".trigger");n&&(n.addEventListener("click",p=>{if(!this.disabled&&!p.target.closest(".clear")&&!p.target.closest(".chip__x")){if(this.toggleAttribute("open"),this.hasAttr("open")){const v=this.getBoundingClientRect();this.toggleAttribute("up",v.bottom+300>window.innerHeight&&v.top>300)}else this.removeAttribute("up");this.render()}}),n.addEventListener("keydown",p=>{var v;if(!this.disabled){if(p.key==="Enter"||p.key===" "){p.preventDefault(),n.dispatchEvent(new MouseEvent("click",{bubbles:!0}));return}if(p.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(v=this.root.querySelector(".trigger"))==null||v.focus());return}(p.key==="ArrowDown"||p.key==="ArrowUp"||p.key==="Home"||p.key==="End")&&this._navigateOptions(p)}}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",p=>{p.stopPropagation(),this.selected.clear(),this.commit()}),(u=this.root.querySelector(".clear-all"))==null||u.addEventListener("click",p=>{p.stopPropagation(),this.selected.clear(),this.commit()}),this.root.querySelectorAll(".chip").forEach(p=>{var v;(v=p.querySelector(".chip__x"))==null||v.addEventListener("click",_=>{_.stopPropagation(),this.toggleValue(p.dataset.value)})}),this.root.querySelectorAll(".opt").forEach(p=>{p.addEventListener("click",()=>this.toggleValue(p.dataset.value))}))}};Pe.styles=m`
478
+ `),e&&this.setAttribute("open","");const s=this.root.querySelector(".search");s&&(s.value=t,s.addEventListener("input",()=>{var u;const p=(u=s.selectionStart)!=null?u:s.value.length;this.render();const v=this.root.querySelector(".search");v&&(v.focus(),v.setSelectionRange(p,p))}),s.addEventListener("click",p=>p.stopPropagation()));const n=this.root.querySelector(".trigger");n&&(n.addEventListener("click",p=>{if(!this.disabled&&!p.target.closest(".clear")&&!p.target.closest(".chip__x")){if(this.toggleAttribute("open"),this.hasAttr("open")){const v=this.getBoundingClientRect();this.toggleAttribute("up",v.bottom+300>window.innerHeight&&v.top>300)}else this.removeAttribute("up");this.render()}}),n.addEventListener("keydown",p=>{var v;if(!this.disabled){if(p.key==="Enter"||p.key===" "){p.preventDefault(),n.dispatchEvent(new MouseEvent("click",{bubbles:!0}));return}if(p.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(v=this.root.querySelector(".trigger"))==null||v.focus());return}(p.key==="ArrowDown"||p.key==="ArrowUp"||p.key==="Home"||p.key==="End")&&this._navigateOptions(p)}}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",p=>{p.stopPropagation(),this.selected.clear(),this.commit()}),(_=this.root.querySelector(".clear-all"))==null||_.addEventListener("click",p=>{p.stopPropagation(),this.selected.clear(),this.commit()}),this.root.querySelectorAll(".chip").forEach(p=>{var v;(v=p.querySelector(".chip__x"))==null||v.addEventListener("click",u=>{u.stopPropagation(),this.toggleValue(p.dataset.value)})}),this.root.querySelectorAll(".opt").forEach(p=>{p.addEventListener("click",()=>this.toggleValue(p.dataset.value))}))}};Pe.styles=m`
479
479
  :host {
480
480
  display: inline-block;
481
481
  vertical-align: middle;
@@ -690,14 +690,14 @@
690
690
  .opt[aria-selected='true'] .box::after { content: '✓'; }
691
691
  .empty { padding: var(--fx-space-md); color: var(--fx-text-muted); text-align: center; }
692
692
  :host([disabled]) .trigger { opacity: 0.55; cursor: not-allowed; background: var(--fx-surface-surface-hover); }
693
- `;let R=Pe;function Xt(){return b("fx-multiselect",R)}Xt();const $=(d,e,t)=>d*1e4+e*100+t;function E(d){const e=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(d.trim());if(!e)return null;const t=+e[1],r=e[2]?+e[2]:1,a=e[3]?+e[3]:null;return a!==null?{lo:$(t,r,a),hi:$(t,r,a)}:e[2]?{lo:$(t,r,1),hi:$(t,r,31)}:{lo:$(t,1,1),hi:$(t,12,31)}}const Ve=class Ve extends g{constructor(){super(...arguments),this.view="days",this.cursor={y:new Date().getFullYear(),m:new Date().getMonth()},this.pickStart=null,this.pickEnd=null}static get observedAttributes(){return["value","start","end","min","max","range","mode","values","locale","disabled"]}get mode(){const e=this.getAttr("mode");return e==="range"||e==="multiple"?e:this.hasAttr("range")?"range":"single"}set mode(e){this.setAttribute("mode",e)}get range(){return this.mode==="range"}set range(e){this.toggleAttr("range",!!e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}bounds(){return{min:E(this.getAttr("min","")),max:E(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(e,t){try{return new Intl.DateTimeFormat(this.locale(),e).format(t)}catch(r){return new Intl.DateTimeFormat("pt-BR",e).format(t)}}dayDisabled(e,t,r){const{min:a,max:i}=this.bounds(),o=$(e,t+1,r);return a!==null&&o<a.lo||i!==null&&o>i.hi}monthDisabled(e,t){const{min:r,max:a}=this.bounds(),i=$(e,t,1),o=$(e,t,31);return r!==null&&o<r.lo||a!==null&&i>a.hi}yearDisabled(e){const{min:t,max:r}=this.bounds(),a=$(e,1,1),i=$(e,12,31);return t!==null&&i<t.lo||r!==null&&a>r.hi}dayKeyOf(e){return $(e.getFullYear(),e.getMonth()+1,e.getDate())}keyToDate(e){return new Date(Math.floor(e/1e4),Math.floor(e/100)%100-1,e%100)}iso(e){const t=this.keyToDate(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}selection(){const e=new Set(this.values.map(r=>{var a,i;return(i=(a=E(r))==null?void 0:a.lo)!=null?i:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,a=this.pickEnd;const i=E(this.getAttr("start","")),o=E(this.getAttr("end",""));return r===null&&i&&(r=i.lo),a===null&&o&&(a=o.lo),{start:r,end:a,single:null,multi:e}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:e};const t=E(this.getAttr("value",""));return{start:null,end:null,single:t?t.lo:null,multi:e}}emit(){if(this.mode==="range"){const e={start:this.pickStart!==null?this.iso(this.pickStart):this.getAttr("start",""),end:this.pickEnd!==null?this.iso(this.pickEnd):this.getAttr("end","")};this.setAttribute("start",e.start),this.setAttribute("end",e.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}else if(this.mode==="multiple"){const e=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:e}}))}else{const e=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}}pickDay(e){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=e,this.pickEnd=null,this.setAttribute("start",this.iso(e)),this.removeAttribute("end"),this.render();return}e<this.pickStart?[this.pickStart,this.pickEnd]=[e,this.pickStart]:this.pickEnd=e,this.emit()}else if(this.mode==="multiple"){const t=new Set(this.values),r=this.iso(e);t.has(r)?t.delete(r):t.add(r),this.values=[...t].sort(),this.emit()}else this.value=this.iso(e),this.emit();this.render()}navigate(e){if(this.view==="days"){const t=new Date(this.cursor.y,this.cursor.m+e,1);this.cursor={y:t.getFullYear(),m:t.getMonth()}}else this.view==="months"?this.cursor.y+=e:this.cursor.y+=e*12;this.render()}render(){const e=this.dayKeyOf(new Date),t=this.selection(),r=this.locale(),a={days:this.fmt({month:"long",year:"numeric"},new Date(this.cursor.y,this.cursor.m,1)),months:String(this.cursor.y),years:`${Math.floor(this.cursor.y/12)*12} – ${Math.floor(this.cursor.y/12)*12+11}`};let i="";if(this.view==="days")i=[...Array(7)].map((l,h)=>this.fmt({weekday:"short"},new Date(2024,8,1+h))).map(l=>`<span class="wd">${l}</span>`).join("")+this.daysHtml(e,t,r);else if(this.view==="months")i=[...Array(12)].map((n,l)=>{const h=this.monthDisabled(this.cursor.y,l+1);return`<button type="button" class="cell" data-month="${l}" ${h?"disabled":""}>${this.fmt({month:"short"},new Date(this.cursor.y,l,1))}</button>`}).join("");else{const n=Math.floor(this.cursor.y/12)*12;i=[...Array(12)].map((l,h)=>{const f=n+h,u=this.yearDisabled(f);return`<button type="button" class="cell" data-year="${f}" ${u?"disabled":""}>${f}</button>`}).join("")}const o=this.view==="days"?'data-goto="months"':this.view==="months"?'data-goto="years"':"";this.setTemplate(`
693
+ `;let R=Pe;function Xt(){return b("fx-multiselect",R)}Xt();const $=(d,e,t)=>d*1e4+e*100+t;function E(d){const e=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(d.trim());if(!e)return null;const t=+e[1],r=e[2]?+e[2]:1,a=e[3]?+e[3]:null;return a!==null?{lo:$(t,r,a),hi:$(t,r,a)}:e[2]?{lo:$(t,r,1),hi:$(t,r,31)}:{lo:$(t,1,1),hi:$(t,12,31)}}const Ve=class Ve extends g{constructor(){super(...arguments),this.view="days",this.cursor={y:new Date().getFullYear(),m:new Date().getMonth()},this.pickStart=null,this.pickEnd=null}static get observedAttributes(){return["value","start","end","min","max","range","mode","values","locale","disabled"]}get mode(){const e=this.getAttr("mode");return e==="range"||e==="multiple"?e:this.hasAttr("range")?"range":"single"}set mode(e){this.setAttribute("mode",e)}get range(){return this.mode==="range"}set range(e){this.toggleAttr("range",!!e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}bounds(){return{min:E(this.getAttr("min","")),max:E(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(e,t){try{return new Intl.DateTimeFormat(this.locale(),e).format(t)}catch(r){return new Intl.DateTimeFormat("pt-BR",e).format(t)}}dayDisabled(e,t,r){const{min:a,max:i}=this.bounds(),o=$(e,t+1,r);return a!==null&&o<a.lo||i!==null&&o>i.hi}monthDisabled(e,t){const{min:r,max:a}=this.bounds(),i=$(e,t,1),o=$(e,t,31);return r!==null&&o<r.lo||a!==null&&i>a.hi}yearDisabled(e){const{min:t,max:r}=this.bounds(),a=$(e,1,1),i=$(e,12,31);return t!==null&&i<t.lo||r!==null&&a>r.hi}dayKeyOf(e){return $(e.getFullYear(),e.getMonth()+1,e.getDate())}keyToDate(e){return new Date(Math.floor(e/1e4),Math.floor(e/100)%100-1,e%100)}iso(e){const t=this.keyToDate(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}selection(){const e=new Set(this.values.map(r=>{var a,i;return(i=(a=E(r))==null?void 0:a.lo)!=null?i:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,a=this.pickEnd;const i=E(this.getAttr("start","")),o=E(this.getAttr("end",""));return r===null&&i&&(r=i.lo),a===null&&o&&(a=o.lo),{start:r,end:a,single:null,multi:e}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:e};const t=E(this.getAttr("value",""));return{start:null,end:null,single:t?t.lo:null,multi:e}}emit(){if(this.mode==="range"){const e={start:this.pickStart!==null?this.iso(this.pickStart):this.getAttr("start",""),end:this.pickEnd!==null?this.iso(this.pickEnd):this.getAttr("end","")};this.setAttribute("start",e.start),this.setAttribute("end",e.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}else if(this.mode==="multiple"){const e=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:e}}))}else{const e=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}}pickDay(e){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=e,this.pickEnd=null,this.setAttribute("start",this.iso(e)),this.removeAttribute("end"),this.render();return}e<this.pickStart?[this.pickStart,this.pickEnd]=[e,this.pickStart]:this.pickEnd=e,this.emit()}else if(this.mode==="multiple"){const t=new Set(this.values),r=this.iso(e);t.has(r)?t.delete(r):t.add(r),this.values=[...t].sort(),this.emit()}else this.value=this.iso(e),this.emit();this.render()}navigate(e){if(this.view==="days"){const t=new Date(this.cursor.y,this.cursor.m+e,1);this.cursor={y:t.getFullYear(),m:t.getMonth()}}else this.view==="months"?this.cursor.y+=e:this.cursor.y+=e*12;this.render()}render(){const e=this.dayKeyOf(new Date),t=this.selection(),r=this.locale(),a={days:this.fmt({month:"long",year:"numeric"},new Date(this.cursor.y,this.cursor.m,1)),months:String(this.cursor.y),years:`${Math.floor(this.cursor.y/12)*12} – ${Math.floor(this.cursor.y/12)*12+11}`};let i="";if(this.view==="days")i=[...Array(7)].map((l,h)=>this.fmt({weekday:"short"},new Date(2024,8,1+h))).map(l=>`<span class="wd">${l}</span>`).join("")+this.daysHtml(e,t,r);else if(this.view==="months")i=[...Array(12)].map((n,l)=>{const h=this.monthDisabled(this.cursor.y,l+1);return`<button type="button" class="cell" data-month="${l}" ${h?"disabled":""}>${this.fmt({month:"short"},new Date(this.cursor.y,l,1))}</button>`}).join("");else{const n=Math.floor(this.cursor.y/12)*12;i=[...Array(12)].map((l,h)=>{const f=n+h,_=this.yearDisabled(f);return`<button type="button" class="cell" data-year="${f}" ${_?"disabled":""}>${f}</button>`}).join("")}const o=this.view==="days"?'data-goto="months"':this.view==="months"?'data-goto="years"':"";this.setTemplate(`
694
694
  <div class="head">
695
695
  <button type="button" class="nav" data-nav="-1" aria-label="Anterior">‹</button>
696
696
  <button type="button" class="title" part="title" ${o}>${a[this.view]}</button>
697
697
  <button type="button" class="nav" data-nav="1" aria-label="Próximo">›</button>
698
698
  </div>
699
699
  <div class="grid ${this.view}">${i}</div>
700
- `),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const s=this.root.querySelector("[data-goto]");s==null||s.addEventListener("click",()=>{this.view=s.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(e,t,r){const{y:a,m:i}=this.cursor,o=new Date(a,i,1).getDay(),s=new Date(a,i+1,0).getDate(),n=new Date(a,i,0).getDate();let l="";for(let h=o-1;h>=0;h--)l+=`<span class="cell muted">${n-h}</span>`;for(let h=1;h<=s;h++){const f=$(a,i+1,h),u=t.single===f||t.start===f||t.end===f||t.multi.has(f),p=t.start!==null&&t.end!==null&&f>t.start&&f<t.end,v=["cell",u?"sel":"",p?"in-range":"",f===e?"today":""].filter(Boolean).join(" ");l+=`<button type="button" class="${v}" data-day="${f}" ${this.dayDisabled(a,i,h)?"disabled":""}>${h}</button>`}return l}};Ve.styles=m`
700
+ `),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const s=this.root.querySelector("[data-goto]");s==null||s.addEventListener("click",()=>{this.view=s.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(e,t,r){const{y:a,m:i}=this.cursor,o=new Date(a,i,1).getDay(),s=new Date(a,i+1,0).getDate(),n=new Date(a,i,0).getDate();let l="";for(let h=o-1;h>=0;h--)l+=`<span class="cell muted">${n-h}</span>`;for(let h=1;h<=s;h++){const f=$(a,i+1,h),_=t.single===f||t.start===f||t.end===f||t.multi.has(f),p=t.start!==null&&t.end!==null&&f>t.start&&f<t.end,v=["cell",_?"sel":"",p?"in-range":"",f===e?"today":""].filter(Boolean).join(" ");l+=`<button type="button" class="${v}" data-day="${f}" ${this.dayDisabled(a,i,h)?"disabled":""}>${h}</button>`}return l}};Ve.styles=m`
701
701
  :host {
702
702
  display: inline-block;
703
703
  font-family: var(--fx-font-family);
@@ -827,7 +827,7 @@
827
827
  cursor: not-allowed;
828
828
  pointer-events: none;
829
829
  }
830
- `;let B=Ve;function Ut(){return b("fx-calendar",B)}Ut();const Re=class Re extends g{constructor(){super(...arguments),this.time={h:0,m:0,s:0}}static get observedAttributes(){return["value","start","end","values","mode","min","max","placeholder","disabled","format","show-time","free-text"]}get mode(){const e=this.getAttr("mode","single");return["single","range","multiple"].includes(e)?e:"single"}set mode(e){this.setAttribute("mode",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}connectedCallback(){super.connectedCallback(),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||this.removeAttribute("open"))},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener)}formatDate(e){if(!e)return"";const t=this.getAttr("format");if(!t)return e.split("T")[0];const[r,a]=e.split("T"),[i="",o="",s=""]=r.split("-"),[n="00",l="00",h="00"]=(a!=null?a:"").split(":");return t.replace(/yyyy/gi,"").replace(/MM/g,"").replace(/mm/g,"").replace(/dd/gi,"").replace(/HH/g,"").replace(/SS/gi,"").replace(/\u0001/g,i).replace(/\u0002/g,o).replace(/\u0003/g,s).replace(/\u0004/g,n).replace(/\u0005/g,l).replace(/\u0006/g,h)}displayText(){if(this.mode==="range"){const t=this.getAttr("start"),r=this.getAttr("end");if(this.hasAttr("show-time"),!t&&!r)return"";if(this.hasAttr("show-time")){const a=i=>i?`${this.formatDate(i)} ${this.timeText()}`:i?`${this.formatDate(i)} …`:"";return t&&r?`${a(t)} → ${a(r)}`:a(t)}return t&&r?`${this.formatDate(t)} → ${this.formatDate(r)}`:t?`${this.formatDate(t)} → …`:""}if(this.mode==="multiple")return this.values.map(t=>this.formatDate(t)).join(", ");const e=this.formatDate(this.value);return e&&this.hasAttr("show-time")?`${e} ${this.timeText()}`:e}timeText(){const e=t=>String(t).padStart(2,"0");return`${e(this.time.h)}:${e(this.time.m)}:${e(this.time.s)}`}loadTimeFromValue(){const t=(this.value||this.getAttr("start")||"").split("T")[1];if(!t)return;const[r,a,i]=t.split(":").map(o=>parseInt(o,10));this.time={h:r||0,m:a||0,s:i||0}}withTime(e){return e&&(this.hasAttr("show-time")?`${e}T${this.timeText()}`:e)}render(){var h,f;const e=this.disabled,t=this.hasAttr("clearable"),r=this.displayText(),a=r.length>0,i=this.hasAttr("show-time");this.loadTimeFromValue();let o=`min="${c(this.getAttr("min"))}" max="${c(this.getAttr("max"))}"`;if(this.mode==="range")o+=` range start="${c(this.getAttr("start"))}" end="${c(this.getAttr("end"))}"`;else if(this.mode==="multiple"){const u=this.values.map(p=>p.split("T")[0]).join(",");o+=` mode="multiple" values="${c(u)}"`}else{const u=(h=this.value.split("T")[0])!=null?h:"";o+=` value="${c(u)}"`}this.setTemplate(`
830
+ `;let B=Ve;function Ut(){return b("fx-calendar",B)}Ut();const Re=class Re extends g{constructor(){super(...arguments),this.time={h:0,m:0,s:0}}static get observedAttributes(){return["value","start","end","values","mode","min","max","placeholder","disabled","format","show-time","free-text"]}get mode(){const e=this.getAttr("mode","single");return["single","range","multiple"].includes(e)?e:"single"}set mode(e){this.setAttribute("mode",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}connectedCallback(){super.connectedCallback(),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||this.removeAttribute("open"))},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener)}formatDate(e){if(!e)return"";const t=this.getAttr("format");if(!t)return e.split("T")[0];const[r,a]=e.split("T"),[i="",o="",s=""]=r.split("-"),[n="00",l="00",h="00"]=(a!=null?a:"").split(":");return t.replace(/yyyy/gi,"").replace(/MM/g,"").replace(/mm/g,"").replace(/dd/gi,"").replace(/HH/g,"").replace(/SS/gi,"").replace(/\u0001/g,i).replace(/\u0002/g,o).replace(/\u0003/g,s).replace(/\u0004/g,n).replace(/\u0005/g,l).replace(/\u0006/g,h)}displayText(){if(this.mode==="range"){const t=this.getAttr("start"),r=this.getAttr("end");if(this.hasAttr("show-time"),!t&&!r)return"";if(this.hasAttr("show-time")){const a=i=>i?`${this.formatDate(i)} ${this.timeText()}`:i?`${this.formatDate(i)} …`:"";return t&&r?`${a(t)} → ${a(r)}`:a(t)}return t&&r?`${this.formatDate(t)} → ${this.formatDate(r)}`:t?`${this.formatDate(t)} → …`:""}if(this.mode==="multiple")return this.values.map(t=>this.formatDate(t)).join(", ");const e=this.formatDate(this.value);return e&&this.hasAttr("show-time")?`${e} ${this.timeText()}`:e}timeText(){const e=t=>String(t).padStart(2,"0");return`${e(this.time.h)}:${e(this.time.m)}:${e(this.time.s)}`}loadTimeFromValue(){const t=(this.value||this.getAttr("start")||"").split("T")[1];if(!t)return;const[r,a,i]=t.split(":").map(o=>parseInt(o,10));this.time={h:r||0,m:a||0,s:i||0}}withTime(e){return e&&(this.hasAttr("show-time")?`${e}T${this.timeText()}`:e)}render(){var h,f;const e=this.disabled,t=this.hasAttr("clearable"),r=this.displayText(),a=r.length>0,i=this.hasAttr("show-time");this.loadTimeFromValue();let o=`min="${c(this.getAttr("min"))}" max="${c(this.getAttr("max"))}"`;if(this.mode==="range")o+=` range start="${c(this.getAttr("start"))}" end="${c(this.getAttr("end"))}"`;else if(this.mode==="multiple"){const _=this.values.map(p=>p.split("T")[0]).join(",");o+=` mode="multiple" values="${c(_)}"`}else{const _=(h=this.value.split("T")[0])!=null?h:"";o+=` value="${c(_)}"`}this.setTemplate(`
831
831
  <div class="field" part="field">
832
832
  <input class="display" part="display" type="text" ${this.hasAttr("free-text")&&!e?"":"readonly"}
833
833
  placeholder="${c(this.getAttr("placeholder","dd/mm/aaaa"))}"
@@ -852,7 +852,7 @@
852
852
  <input class="t-s" type="number" min="0" max="59" value="${this.time.s}" aria-label="Segundo">
853
853
  </div>`:""}
854
854
  </div>
855
- `);const s=this.root.querySelector(".field");if(!s||e)return;s.addEventListener("click",u=>{if(!u.target.closest(".clear")&&!(this.hasAttr("free-text")&&u.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const p=this.getBoundingClientRect();this.toggleAttribute("up",p.bottom+340>window.innerHeight&&p.top>340)}else this.removeAttribute("up")}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",u=>{u.stopPropagation(),this.removeAttribute("value"),this.removeAttribute("start"),this.removeAttribute("end"),this.removeAttribute("values"),this.removeAttribute("open"),this.render(),this.emitChange({})});const n=this.root.querySelector(".pop fx-calendar");n==null||n.addEventListener("change",u=>{var v;const p=(v=u.detail)!=null?v:{};(p.start!==void 0||p.end!==void 0)&&(p.start?this.setAttribute("start",this.withTime(p.start)):this.removeAttribute("start"),p.end?this.setAttribute("end",this.withTime(p.end)):this.removeAttribute("end")),p.values!==void 0&&(this.values=p.values.map(_=>this.withTime(_))),p.value!==void 0&&(p.value?this.setAttribute("value",this.withTime(p.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(p)});const l=this.root.querySelector(".display");if(l&&this.hasAttr("free-text")&&!e&&(l.addEventListener("keydown",u=>{u.key==="Enter"&&(u.preventDefault(),this.commitTyped(l))}),l.addEventListener("blur",()=>this.commitTyped(l))),i){const u=()=>{const p=this.root.querySelector(".t-h"),v=this.root.querySelector(".t-m"),_=this.root.querySelector(".t-s"),x=(A,y)=>Math.min(y,Math.max(0,parseInt(A!=null?A:"0",10)||0));this.time={h:x(p==null?void 0:p.value,23),m:x(v==null?void 0:v.value,59),s:x(_==null?void 0:_.value,59)};const w=A=>A.split("T")[0]?`${A.split("T")[0]}T${this.timeText()}`:A;this.value&&this.setAttribute("value",w(this.value)),this.getAttr("start")&&this.setAttribute("start",w(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",w(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(A=>w(A)));const S=this.root.querySelector(".display");S&&(S.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(p=>{var v;(v=this.root.querySelector(p))==null||v.addEventListener("input",u)})}}emitChange(e){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}parseTyped(e){var _,x;const t=e.trim();if(!t)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),a=["dd","mm","yyyy"].filter(w=>r.includes(w));if(a.length<3)return null;const i=t.split(new RegExp("[^0-9]+")).filter(Boolean);if(i.length!==3)return null;const o={};a.forEach((w,S)=>o[w]=i[S]);const s=`${o.yyyy}-${((_=o.mm)!=null?_:"").padStart(2,"0")}-${((x=o.dd)!=null?x:"").padStart(2,"0")}`,n=new Date(`${s}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[l,h,f]=s.split("-").map(w=>parseInt(w,10));if(n.getFullYear()!==l||n.getMonth()+1!==h||n.getDate()!==f)return null;const u=(w,S)=>w.split("T")[0].localeCompare(S.split("T")[0]),p=this.getAttr("min"),v=this.getAttr("max");return p&&u(s,p)<0||v&&u(s,v)>0?null:s}commitTyped(e){const t=this.parseTyped(e.value);if(!t){e.classList.add("invalid"),this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{text:e.value}})),e.value=this.displayText(),setTimeout(()=>e.classList.remove("invalid"),1500);return}if(this.mode==="single")this.setAttribute("value",this.withTime(t)),this.emitChange({value:this.value});else if(this.mode==="range"){if(!this.getAttr("start")||this.getAttr("start")&&this.getAttr("end"))this.setAttribute("start",this.withTime(t)),this.removeAttribute("end");else{const[r,a]=[this.getAttr("start").split("T")[0],t].sort();this.setAttribute("start",this.withTime(r)),this.setAttribute("end",this.withTime(a))}this.emitChange({start:this.getAttr("start"),end:this.getAttr("end")})}else{const r=this.values.filter(a=>a.split("T")[0]!==t);r.push(this.withTime(t)),this.values=r,this.emitChange({values:this.values})}this.render()}};Re.styles=m`
855
+ `);const s=this.root.querySelector(".field");if(!s||e)return;s.addEventListener("click",_=>{if(!_.target.closest(".clear")&&!(this.hasAttr("free-text")&&_.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const p=this.getBoundingClientRect();this.toggleAttribute("up",p.bottom+340>window.innerHeight&&p.top>340)}else this.removeAttribute("up")}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",_=>{_.stopPropagation(),this.removeAttribute("value"),this.removeAttribute("start"),this.removeAttribute("end"),this.removeAttribute("values"),this.removeAttribute("open"),this.render(),this.emitChange({})});const n=this.root.querySelector(".pop fx-calendar");n==null||n.addEventListener("change",_=>{var v;const p=(v=_.detail)!=null?v:{};(p.start!==void 0||p.end!==void 0)&&(p.start?this.setAttribute("start",this.withTime(p.start)):this.removeAttribute("start"),p.end?this.setAttribute("end",this.withTime(p.end)):this.removeAttribute("end")),p.values!==void 0&&(this.values=p.values.map(u=>this.withTime(u))),p.value!==void 0&&(p.value?this.setAttribute("value",this.withTime(p.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(p)});const l=this.root.querySelector(".display");if(l&&this.hasAttr("free-text")&&!e&&(l.addEventListener("keydown",_=>{_.key==="Enter"&&(_.preventDefault(),this.commitTyped(l))}),l.addEventListener("blur",()=>this.commitTyped(l))),i){const _=()=>{const p=this.root.querySelector(".t-h"),v=this.root.querySelector(".t-m"),u=this.root.querySelector(".t-s"),x=(A,y)=>Math.min(y,Math.max(0,parseInt(A!=null?A:"0",10)||0));this.time={h:x(p==null?void 0:p.value,23),m:x(v==null?void 0:v.value,59),s:x(u==null?void 0:u.value,59)};const w=A=>A.split("T")[0]?`${A.split("T")[0]}T${this.timeText()}`:A;this.value&&this.setAttribute("value",w(this.value)),this.getAttr("start")&&this.setAttribute("start",w(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",w(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(A=>w(A)));const S=this.root.querySelector(".display");S&&(S.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(p=>{var v;(v=this.root.querySelector(p))==null||v.addEventListener("input",_)})}}emitChange(e){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}parseTyped(e){var u,x;const t=e.trim();if(!t)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),a=["dd","mm","yyyy"].filter(w=>r.includes(w));if(a.length<3)return null;const i=t.split(new RegExp("[^0-9]+")).filter(Boolean);if(i.length!==3)return null;const o={};a.forEach((w,S)=>o[w]=i[S]);const s=`${o.yyyy}-${((u=o.mm)!=null?u:"").padStart(2,"0")}-${((x=o.dd)!=null?x:"").padStart(2,"0")}`,n=new Date(`${s}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[l,h,f]=s.split("-").map(w=>parseInt(w,10));if(n.getFullYear()!==l||n.getMonth()+1!==h||n.getDate()!==f)return null;const _=(w,S)=>w.split("T")[0].localeCompare(S.split("T")[0]),p=this.getAttr("min"),v=this.getAttr("max");return p&&_(s,p)<0||v&&_(s,v)>0?null:s}commitTyped(e){const t=this.parseTyped(e.value);if(!t){e.classList.add("invalid"),this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{text:e.value}})),e.value=this.displayText(),setTimeout(()=>e.classList.remove("invalid"),1500);return}if(this.mode==="single")this.setAttribute("value",this.withTime(t)),this.emitChange({value:this.value});else if(this.mode==="range"){if(!this.getAttr("start")||this.getAttr("start")&&this.getAttr("end"))this.setAttribute("start",this.withTime(t)),this.removeAttribute("end");else{const[r,a]=[this.getAttr("start").split("T")[0],t].sort();this.setAttribute("start",this.withTime(r)),this.setAttribute("end",this.withTime(a))}this.emitChange({start:this.getAttr("start"),end:this.getAttr("end")})}else{const r=this.values.filter(a=>a.split("T")[0]!==t);r.push(this.withTime(t)),this.values=r,this.emitChange({values:this.values})}this.render()}};Re.styles=m`
856
856
  :host {
857
857
  display: inline-block;
858
858
  vertical-align: middle;
@@ -1127,16 +1127,16 @@
1127
1127
  cursor: not-allowed;
1128
1128
  pointer-events: none;
1129
1129
  }
1130
- `;let H=Oe;function Gt(){return b("fx-radio",H)}Gt();const L="pt-BR",Zt={currency:d=>{if(d==null||d==="")return"";try{return new Intl.NumberFormat(L,{style:"currency",currency:"BRL"}).format(Number(d))}catch(e){return String(d)}},date:(d,e)=>{const t=$t(d);if(!t)return String(d!=null?d:"");const r={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"}},a=e&&r[e]?r[e]:r.medium;try{return new Intl.DateTimeFormat(L,a).format(t)}catch(i){return t.toLocaleDateString(L)}},dateTime:d=>{const e=$t(d);if(!e)return String(d!=null?d:"");try{return new Intl.DateTimeFormat(L,{dateStyle:"medium",timeStyle:"short"}).format(e)}catch(t){return e.toLocaleString(L)}},number:(d,e)=>{if(d==null||d==="")return"";try{const t={};if(e!==void 0){const r=Number(e);t.minimumFractionDigits=r,t.maximumFractionDigits=r}return new Intl.NumberFormat(L,t).format(Number(d))}catch(t){return String(d)}}};function $t(d){if(d==null||d==="")return null;if(d instanceof Date)return isNaN(d.getTime())?null:d;if(typeof d=="number"){const e=new Date(d);return isNaN(e.getTime())?null:e}if(typeof d=="string"){const e=new Date(d);return isNaN(e.getTime())?null:e}return null}const Qt=d=>/[a-z_$]/i.test(d),er=d=>/[a-z0-9_$]/i.test(d);function tr(d){const e=[];let t=0;for(;t<d.length;){const r=d[t];if(/\s/.test(r)){t++;continue}if(r==="'"||r==='"'){const i=r;let o="";for(t++;t<d.length&&d[t]!==i;)d[t]==="\\"&&t+1<d.length?(o+=d[t+1],t+=2):(o+=d[t],t++);t++,e.push({type:"str",value:o});continue}if(r>="0"&&r<="9"){let i="";for(;t<d.length&&(d[t]>="0"&&d[t]<="9"||d[t]===".");)i+=d[t],t++;e.push({type:"num",value:i});continue}if(Qt(r)){let i="";for(;t<d.length&&er(d[t]);)i+=d[t],t++;i==="true"||i==="false"||i==="null"?e.push({type:"kw",value:i}):e.push({type:"id",value:i});continue}const a=d.slice(t,t+2);if(a==="=="||a==="!="||a===">="||a==="<="){e.push({type:"cmp",value:a}),t+=2;continue}if(r==="+"){e.push({type:"op",value:"+"}),t++;continue}if(r==="-"){e.push({type:"op",value:"-"}),t++;continue}if(r==="*"){e.push({type:"op",value:"*"}),t++;continue}if(r==="/"){e.push({type:"op",value:"/"}),t++;continue}if(r===">"){e.push({type:"cmp",value:">"}),t++;continue}if(r==="<"){e.push({type:"cmp",value:"<"}),t++;continue}if(r==="!"){e.push({type:"op",value:"!"}),t++;continue}if(r==="?"){e.push({type:"qm",value:"?"}),t++;continue}if(r===":"){e.push({type:"colon",value:":"}),t++;continue}if(r==="|"){e.push({type:"pipe",value:"|"}),t++;continue}if(r==="("){e.push({type:"lparen",value:"("}),t++;continue}if(r===")"){e.push({type:"rparen",value:")"}),t++;continue}if(r==="."){e.push({type:"dot",value:"."}),t++;continue}t++}return e}class rr{constructor(e,t){this.tokens=e,this.ctx=t,this.pos=0}peek(){return this.pos<this.tokens.length?this.tokens[this.pos]:null}next(){return this.pos<this.tokens.length?this.tokens[this.pos++]:null}matchType(e){var t;return((t=this.peek())==null?void 0:t.type)===e?this.next():null}parse(){return this.parsePipe()}parsePipe(){var t,r;let e=this.parseTernary();for(;((t=this.peek())==null?void 0:t.type)==="pipe";){this.next();const a=this.matchType("id");if(!a)break;let i;if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const o=this.peek();o&&(o.type==="str"||o.type==="num"||o.type==="id")&&(i=o.type==="str"?o.value:String(o.value),this.next())}e=this.applyPipe(a.value,i,e)}return e}parseTernary(){var t,r;const e=this.parseComparison();if(((t=this.peek())==null?void 0:t.type)==="qm"){this.next();const a=this.parsePipe();if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const i=this.parsePipe();return e?a:i}return a}return e}parseComparison(){const e=this.parseAdditive(),t=this.peek();if((t==null?void 0:t.type)==="cmp"){this.next();const r=this.parseAdditive();return this.compare(e,t.value,r)}return e}compare(e,t,r){const a=Et(e),i=Et(r);switch(t){case"==":return a==i;case"!=":return a!=i;case">":return a>i;case"<":return a<i;case">=":return a>=i;case"<=":return a<=i}return!1}parseAdditive(){let e=this.parseMultiplicative();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="+"||t.value==="-")){this.next();const r=this.parseMultiplicative();e=t.value==="+"?this.add(e,r):this.subtract(e,r)}else break}return e}add(e,t){return typeof e=="string"||typeof t=="string"?String(e!=null?e:"")+String(t!=null?t:""):Number(e)+Number(t)}subtract(e,t){return Number(e)-Number(t)}parseMultiplicative(){let e=this.parseUnary();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="*"||t.value==="/")){this.next();const r=this.parseUnary();e=t.value==="*"?Number(e)*Number(r):Number(e)/Number(r)}else break}return e}parseUnary(){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="+"||e.value==="-")){this.next();const t=Number(this.parseUnary());return e.value==="-"?-t:t}return(e==null?void 0:e.type)==="op"&&e.value==="!"?(this.next(),!this.parseUnary()):this.parsePrimary()}parsePrimary(){var t;const e=this.peek();if(e){if(e.type==="lparen"){this.next();const r=this.parsePipe();return this.matchType("rparen"),r}if(e.type==="str")return this.next(),e.value;if(e.type==="num")return this.next(),Number(e.value);if(e.type==="kw")return this.next(),e.value==="true"?!0:e.value==="false"?!1:null;if(e.type==="id"){this.next();let r=this.resolveId(e.value);for(;((t=this.peek())==null?void 0:t.type)==="dot";){this.next();const a=this.peek();if((a==null?void 0:a.type)==="id")this.next(),r=r==null?void 0:r[a.value];else break}return r}this.next()}}resolveId(e){switch(e){case"value":return this.ctx.value;case"row":return this.ctx.row;case"true":return!0;case"false":return!1;case"null":return null;default:return this.ctx.row[e]}}applyPipe(e,t,r){const a=Zt[e];if(!a)return Y(r);try{return a(r,t)}catch(i){return Y(r)}}}function Et(d){return typeof d=="number"?d:typeof d=="boolean"?d?1:0:String(d!=null?d:"")}function Y(d){return d==null?"":typeof d=="object"?"[object Object]":String(d)}function ar(d,e){try{const t=tr(d),a=new rr(t,e).parse();return Y(a)}catch(t){return""}}function ir(d,e,t){const r={value:e[t],row:e};return d.replace(/\{\{([^}]+)\}\}/g,(a,i)=>c(ar(or(i.trim()),r)))}function or(d){return d.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&#39;/g,"'")}const Ke=class Ke extends g{constructor(){super(...arguments),this._data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={},this.globalSearch=""}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position","lazy","total","loading","loading-message"]}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e:[],this.render()}get total(){var e;return(e=this._total)!=null?e:this._data.length}set total(e){this._total=e,this.setAttribute("total",String(e))}get rowsPerPage(){const e=Number(this.getAttr("rows","10"));return e>0?e:10}set rowsPerPage(e){this.setAttribute("rows",String(e))}get lazy(){return this.hasAttr("lazy")}get columns(){return[...this.querySelectorAll("fx-column")].map(e=>{var i,o,s,n;const t=e.querySelector("template"),r=t?void 0:e.innerHTML.trim(),a=(i=e.getAttribute("align"))!=null?i:"left";return{field:(o=e.getAttribute("field"))!=null?o:"",header:(n=(s=e.getAttribute("header"))!=null?s:e.getAttribute("field"))!=null?n:"",sortable:e.hasAttribute("sortable"),filterable:e.hasAttribute("filterable"),align:["left","center","right","justify","start","end"].includes(a)?a:"left",template:t!=null?t:void 0,directTemplate:r||void 0}})}get toolbarTemplate(){return this.querySelector('template[slot="toolbar"]')}connectedCallback(){this._parseDataAttribute(),super.connectedCallback(),this._columnObserver=new MutationObserver(()=>this.render()),this._columnObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){var e;(e=this._columnObserver)==null||e.disconnect(),super.disconnectedCallback()}_parseDataAttribute(){if(!this._data.length)try{const t=this.getAttr("data");t&&(this._data=JSON.parse(t))}catch(t){}const e=this.getAttr("total");if(e){const t=Number(e);isNaN(t)||(this._total=t)}}computeRows(){let e=[...this._data];for(const[r,a]of Object.entries(this.filters)){if(!a)continue;const i=a.toLowerCase();e=e.filter(o=>{var s;return String((s=o[r])!=null?s:"").toLowerCase().includes(i)})}if(this.globalSearch){const r=this.globalSearch.toLowerCase(),a=this._getSearchFields();e=e.filter(i=>(a.length?a:Object.keys(i)).some(s=>{var n;return String((n=i[s])!=null?n:"").toLowerCase().includes(r)}))}const t=this.lazy?this.total:e.length;if(this.sortField&&e.sort((r,a)=>{const i=r[this.sortField],o=a[this.sortField];return typeof i=="number"&&typeof o=="number"?(i-o)*this.sortDir:String(i!=null?i:"").localeCompare(String(o!=null?o:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")&&!this.lazy){const r=this.page*this.rowsPerPage;e=e.slice(r,r+this.rowsPerPage)}return{rows:e,total:t}}_getSearchFields(){const e=this.root.querySelector("[data-search-fields]");if(!e)return[];const t=e.getAttribute("data-search-fields");return t===null?[]:t.split(",").map(r=>r.trim()).filter(Boolean)}cellHtml(e,t){var a,i,o;const r=(i=(a=e.template)==null?void 0:a.innerHTML)!=null?i:e.directTemplate;return r?ir(r,t,e.field):c(String((o=t[e.field])!=null?o:""))}render(){var v;const e=this.columns.filter(_=>_.field),{rows:t,total:r}=this.computeRows(),a=this.hasAttr("pagination"),i=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=i&&(this.page=i-1);const o=this.toolbarTemplate,s=o?`<div class="toolbar" part="toolbar">${o.innerHTML}</div>`:"",n=e.map(_=>{const x=this.sortField===_.field,w=x?this.sortDir===1?"▲":"▼":_.sortable?"⇅":"",S=x?"active":"";return`<th part="header" class="${_.sortable?"sortable":""}" style="text-align:${_.align}" data-field="${c(_.field)}">${c(_.header)}${w?`<span class="sort-ind ${S}">${w}</span>`:""}</th>`}).join(""),l=e.some(_=>_.filterable)?`<tr class="filter-row">${e.map(_=>{var x;return`<th style="text-align:${_.align}">${_.filterable?`<input class="filter" data-field="${c(_.field)}" placeholder="${c("Filtrar…")}" value="${c((x=this.filters[_.field])!=null?x:"")}">`:""}</th>`}).join("")}</tr>`:"",h=t.length?t.map((_,x)=>`<tr part="row" data-index="${x}">${e.map(w=>`<td part="cell" style="text-align:${w.align}">${this.cellHtml(w,_)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${e.length||1}">${c(this.getAttr("empty-message","Nenhum registro encontrado"))}</td></tr>`,f=a?`
1130
+ `;let H=Oe;function Gt(){return b("fx-radio",H)}Gt();const L="pt-BR",Zt={currency:d=>{if(d==null||d==="")return"";try{return new Intl.NumberFormat(L,{style:"currency",currency:"BRL"}).format(Number(d))}catch(e){return String(d)}},date:(d,e)=>{const t=$t(d);if(!t)return String(d!=null?d:"");const r={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"}},a=e&&r[e]?r[e]:r.medium;try{return new Intl.DateTimeFormat(L,a).format(t)}catch(i){return t.toLocaleDateString(L)}},dateTime:d=>{const e=$t(d);if(!e)return String(d!=null?d:"");try{return new Intl.DateTimeFormat(L,{dateStyle:"medium",timeStyle:"short"}).format(e)}catch(t){return e.toLocaleString(L)}},number:(d,e)=>{if(d==null||d==="")return"";try{const t={};if(e!==void 0){const r=Number(e);t.minimumFractionDigits=r,t.maximumFractionDigits=r}return new Intl.NumberFormat(L,t).format(Number(d))}catch(t){return String(d)}}};function $t(d){if(d==null||d==="")return null;if(d instanceof Date)return isNaN(d.getTime())?null:d;if(typeof d=="number"){const e=new Date(d);return isNaN(e.getTime())?null:e}if(typeof d=="string"){const e=new Date(d);return isNaN(e.getTime())?null:e}return null}const Qt=d=>/[a-z_$]/i.test(d),er=d=>/[a-z0-9_$]/i.test(d);function tr(d){const e=[];let t=0;for(;t<d.length;){const r=d[t];if(/\s/.test(r)){t++;continue}if(r==="'"||r==='"'){const i=r;let o="";for(t++;t<d.length&&d[t]!==i;)d[t]==="\\"&&t+1<d.length?(o+=d[t+1],t+=2):(o+=d[t],t++);t++,e.push({type:"str",value:o});continue}if(r>="0"&&r<="9"){let i="";for(;t<d.length&&(d[t]>="0"&&d[t]<="9"||d[t]===".");)i+=d[t],t++;e.push({type:"num",value:i});continue}if(Qt(r)){let i="";for(;t<d.length&&er(d[t]);)i+=d[t],t++;i==="true"||i==="false"||i==="null"?e.push({type:"kw",value:i}):e.push({type:"id",value:i});continue}const a=d.slice(t,t+2);if(a==="=="||a==="!="||a===">="||a==="<="){e.push({type:"cmp",value:a}),t+=2;continue}if(r==="+"){e.push({type:"op",value:"+"}),t++;continue}if(r==="-"){e.push({type:"op",value:"-"}),t++;continue}if(r==="*"){e.push({type:"op",value:"*"}),t++;continue}if(r==="/"){e.push({type:"op",value:"/"}),t++;continue}if(r===">"){e.push({type:"cmp",value:">"}),t++;continue}if(r==="<"){e.push({type:"cmp",value:"<"}),t++;continue}if(r==="!"){e.push({type:"op",value:"!"}),t++;continue}if(r==="?"){e.push({type:"qm",value:"?"}),t++;continue}if(r===":"){e.push({type:"colon",value:":"}),t++;continue}if(r==="|"){e.push({type:"pipe",value:"|"}),t++;continue}if(r==="("){e.push({type:"lparen",value:"("}),t++;continue}if(r===")"){e.push({type:"rparen",value:")"}),t++;continue}if(r==="."){e.push({type:"dot",value:"."}),t++;continue}t++}return e}class rr{constructor(e,t){this.tokens=e,this.ctx=t,this.pos=0}peek(){return this.pos<this.tokens.length?this.tokens[this.pos]:null}next(){return this.pos<this.tokens.length?this.tokens[this.pos++]:null}matchType(e){var t;return((t=this.peek())==null?void 0:t.type)===e?this.next():null}parse(){return this.parsePipe()}parsePipe(){var t,r;let e=this.parseTernary();for(;((t=this.peek())==null?void 0:t.type)==="pipe";){this.next();const a=this.matchType("id");if(!a)break;let i;if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const o=this.peek();o&&(o.type==="str"||o.type==="num"||o.type==="id")&&(i=o.type==="str"?o.value:String(o.value),this.next())}e=this.applyPipe(a.value,i,e)}return e}parseTernary(){var t,r;const e=this.parseComparison();if(((t=this.peek())==null?void 0:t.type)==="qm"){this.next();const a=this.parsePipe();if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const i=this.parsePipe();return e?a:i}return a}return e}parseComparison(){const e=this.parseAdditive(),t=this.peek();if((t==null?void 0:t.type)==="cmp"){this.next();const r=this.parseAdditive();return this.compare(e,t.value,r)}return e}compare(e,t,r){const a=Et(e),i=Et(r);switch(t){case"==":return a==i;case"!=":return a!=i;case">":return a>i;case"<":return a<i;case">=":return a>=i;case"<=":return a<=i}return!1}parseAdditive(){let e=this.parseMultiplicative();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="+"||t.value==="-")){this.next();const r=this.parseMultiplicative();e=t.value==="+"?this.add(e,r):this.subtract(e,r)}else break}return e}add(e,t){return typeof e=="string"||typeof t=="string"?String(e!=null?e:"")+String(t!=null?t:""):Number(e)+Number(t)}subtract(e,t){return Number(e)-Number(t)}parseMultiplicative(){let e=this.parseUnary();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="*"||t.value==="/")){this.next();const r=this.parseUnary();e=t.value==="*"?Number(e)*Number(r):Number(e)/Number(r)}else break}return e}parseUnary(){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="+"||e.value==="-")){this.next();const t=Number(this.parseUnary());return e.value==="-"?-t:t}return(e==null?void 0:e.type)==="op"&&e.value==="!"?(this.next(),!this.parseUnary()):this.parsePrimary()}parsePrimary(){var t;const e=this.peek();if(e){if(e.type==="lparen"){this.next();const r=this.parsePipe();return this.matchType("rparen"),r}if(e.type==="str")return this.next(),e.value;if(e.type==="num")return this.next(),Number(e.value);if(e.type==="kw")return this.next(),e.value==="true"?!0:e.value==="false"?!1:null;if(e.type==="id"){this.next();let r=this.resolveId(e.value);for(;((t=this.peek())==null?void 0:t.type)==="dot";){this.next();const a=this.peek();if((a==null?void 0:a.type)==="id")this.next(),r=r==null?void 0:r[a.value];else break}return r}this.next()}}resolveId(e){switch(e){case"value":return this.ctx.value;case"row":return this.ctx.row;case"true":return!0;case"false":return!1;case"null":return null;default:return this.ctx.row[e]}}applyPipe(e,t,r){const a=Zt[e];if(!a)return Y(r);try{return a(r,t)}catch(i){return Y(r)}}}function Et(d){return typeof d=="number"?d:typeof d=="boolean"?d?1:0:String(d!=null?d:"")}function Y(d){return d==null?"":typeof d=="object"?"[object Object]":String(d)}function ar(d,e){try{const t=tr(d),a=new rr(t,e).parse();return Y(a)}catch(t){return""}}function ir(d,e,t){const r={value:e[t],row:e};return d.replace(/\{\{([^}]+)\}\}/g,(a,i)=>c(ar(or(i.trim()),r)))}function or(d){return d.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&#39;/g,"'")}const Ke=class Ke extends g{constructor(){super(...arguments),this._data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={},this.globalSearch=""}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position","lazy","total","loading","loading-message"]}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e:[],this.render()}get total(){var e;return(e=this._total)!=null?e:this._data.length}set total(e){this._total=e,this.setAttribute("total",String(e))}get rowsPerPage(){const e=Number(this.getAttr("rows","10"));return e>0?e:10}set rowsPerPage(e){this.setAttribute("rows",String(e))}get lazy(){return this.hasAttr("lazy")}get columns(){return[...this.querySelectorAll("fx-column")].map(e=>{var i,o,s,n;const t=e.querySelector("template"),r=t?void 0:e.innerHTML.trim(),a=(i=e.getAttribute("align"))!=null?i:"left";return{field:(o=e.getAttribute("field"))!=null?o:"",header:(n=(s=e.getAttribute("header"))!=null?s:e.getAttribute("field"))!=null?n:"",sortable:e.hasAttribute("sortable"),filterable:e.hasAttribute("filterable"),align:["left","center","right","justify","start","end"].includes(a)?a:"left",template:t!=null?t:void 0,directTemplate:r||void 0}})}get toolbarTemplate(){return this.querySelector('template[slot="toolbar"]')}connectedCallback(){this._parseDataAttribute(),super.connectedCallback(),this._columnObserver=new MutationObserver(()=>this.render()),this._columnObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){var e;(e=this._columnObserver)==null||e.disconnect(),super.disconnectedCallback()}_parseDataAttribute(){if(!this._data.length)try{const t=this.getAttr("data");t&&(this._data=JSON.parse(t))}catch(t){}const e=this.getAttr("total");if(e){const t=Number(e);isNaN(t)||(this._total=t)}}computeRows(){let e=[...this._data];for(const[r,a]of Object.entries(this.filters)){if(!a)continue;const i=a.toLowerCase();e=e.filter(o=>{var s;return String((s=o[r])!=null?s:"").toLowerCase().includes(i)})}if(this.globalSearch){const r=this.globalSearch.toLowerCase(),a=this._getSearchFields();e=e.filter(i=>(a.length?a:Object.keys(i)).some(s=>{var n;return String((n=i[s])!=null?n:"").toLowerCase().includes(r)}))}const t=this.lazy?this.total:e.length;if(this.sortField&&e.sort((r,a)=>{const i=r[this.sortField],o=a[this.sortField];return typeof i=="number"&&typeof o=="number"?(i-o)*this.sortDir:String(i!=null?i:"").localeCompare(String(o!=null?o:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")&&!this.lazy){const r=this.page*this.rowsPerPage;e=e.slice(r,r+this.rowsPerPage)}return{rows:e,total:t}}_getSearchFields(){const e=this.root.querySelector("[data-search-fields]");if(!e)return[];const t=e.getAttribute("data-search-fields");return t===null?[]:t.split(",").map(r=>r.trim()).filter(Boolean)}cellHtml(e,t){var a,i,o;const r=(i=(a=e.template)==null?void 0:a.innerHTML)!=null?i:e.directTemplate;return r?ir(r,t,e.field):c(String((o=t[e.field])!=null?o:""))}render(){var v;const e=this.columns.filter(u=>u.field),{rows:t,total:r}=this.computeRows(),a=this.hasAttr("pagination"),i=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=i&&(this.page=i-1);const o=this.toolbarTemplate,s=o?`<div class="toolbar" part="toolbar">${o.innerHTML}</div>`:"",n=e.map(u=>{const x=this.sortField===u.field,w=x?this.sortDir===1?"▲":"▼":u.sortable?"⇅":"",S=x?"active":"";return`<th part="header" class="${u.sortable?"sortable":""}" style="text-align:${u.align}" data-field="${c(u.field)}">${c(u.header)}${w?`<span class="sort-ind ${S}">${w}</span>`:""}</th>`}).join(""),l=e.some(u=>u.filterable)?`<tr class="filter-row">${e.map(u=>{var x;return`<th style="text-align:${u.align}">${u.filterable?`<input class="filter" data-field="${c(u.field)}" placeholder="${c("Filtrar…")}" value="${c((x=this.filters[u.field])!=null?x:"")}">`:""}</th>`}).join("")}</tr>`:"",h=t.length?t.map((u,x)=>`<tr part="row" data-index="${x}">${e.map(w=>`<td part="cell" style="text-align:${w.align}">${this.cellHtml(w,u)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${e.length||1}">${c(this.getAttr("empty-message","Nenhum registro encontrado"))}</td></tr>`,f=a?`
1131
1131
  <div class="pager" part="pager">
1132
1132
  <span class="info">Página ${this.page+1} de ${i} · ${r} registros</span>
1133
1133
  <button type="button" class="pg-btn" data-pg="first" ${this.page===0?"disabled":""}>«</button>
1134
1134
  <button type="button" class="pg-btn" data-pg="prev" ${this.page===0?"disabled":""}>‹</button>
1135
- ${Array.from({length:i},(_,x)=>`<button type="button" class="pg-btn" data-pg="${x}" aria-current="${x===this.page}">${x+1}</button>`).join("")}
1135
+ ${Array.from({length:i},(u,x)=>`<button type="button" class="pg-btn" data-pg="${x}" aria-current="${x===this.page}">${x+1}</button>`).join("")}
1136
1136
  <button type="button" class="pg-btn" data-pg="next" ${this.page>=i-1?"disabled":""}>›</button>
1137
1137
  <button type="button" class="pg-btn" data-pg="last" ${this.page>=i-1?"disabled":""}>»</button>
1138
1138
  <label class="info">${c("Por página:")}
1139
- <fx-select class="rows-sel" size="sm" value="${this.rowsPerPage}" aria-label="Itens por página">${this.getAttr("rows-options","5,10,20,50").split(",").map(_=>_.trim()).map(_=>`<option value="${c(_)}">${c(_)}</option>`).join("")}</fx-select>
1139
+ <fx-select class="rows-sel" size="sm" value="${this.rowsPerPage}" aria-label="Itens por página">${this.getAttr("rows-options","5,10,20,50").split(",").map(u=>u.trim()).map(u=>`<option value="${c(u)}">${c(u)}</option>`).join("")}</fx-select>
1140
1140
  </label>
1141
1141
  </div>`:"",p=this.hasAttr("loading")?`<div class="loading-overlay" part="loading-overlay"><div class="tbl-spinner" part="spinner"></div><span class="loading-text">${c(this.getAttr("loading-message","Carregando…"))}</span></div>`:"";this.setTemplate(`
1142
1142
  ${s}
@@ -1150,7 +1150,7 @@
1150
1150
  ${p}
1151
1151
  </div>
1152
1152
  ${f}
1153
- `),this.root.querySelectorAll("th.sortable").forEach(_=>{_.addEventListener("click",()=>{const x=_.dataset.field;this.sortField===x?this.sortDir=this.sortDir===1?-1:1:(this.sortField=x,this.sortDir=1),this.render(),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,composed:!0,detail:{field:this.sortField,direction:this.sortDir===1?"asc":"desc",lazy:this.lazy}}))})}),this.root.querySelectorAll(".filter").forEach(_=>{_.addEventListener("input",()=>{const x=_.dataset.field,w=_.value,S=_.selectionStart;this.filters[x]=w,this.page=0,this.render(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,composed:!0,detail:{field:x,value:w,lazy:this.lazy}}));const A=this.root.querySelector(`.filter[data-field="${c(x)}"]`);A&&(A.focus(),A.setSelectionRange(S,S))}),_.addEventListener("click",x=>x.stopPropagation())}),this.root.querySelectorAll("[data-search-fields]").forEach(_=>{_.addEventListener("input",()=>{this.globalSearch=_.value,this.page=0;const x=_.selectionStart;this.render();const w=this.root.querySelector("[data-search-fields]");w&&(w.focus(),w.setSelectionRange(x,x))})}),this.root.querySelectorAll(".pg-btn").forEach(_=>{_.addEventListener("click",()=>{const x=_.dataset.pg;this.page=x==="first"?0:x==="prev"?Math.max(0,this.page-1):x==="next"?Math.min(i-1,this.page+1):x==="last"?i-1:Number(x),this.render(),this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page+1,pages:i,rowsPerPage:this.rowsPerPage,total:r,lazy:this.lazy}}))})}),(v=this.root.querySelector("fx-select.rows-sel"))==null||v.addEventListener("change",_=>{var w;const x=Number((w=_.detail)==null?void 0:w.value);!x||x===this.rowsPerPage||(this.rowsPerPage=x,this.page=0,this.render())}),this.root.querySelectorAll("tbody tr[data-index]").forEach(_=>{_.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,composed:!0,detail:{row:t[Number(_.dataset.index)],index:Number(_.dataset.index)}}))})}),this._restoreToolbarSearch()}_restoreToolbarSearch(){const e=this.root.querySelector("[data-search-fields]");e&&this.globalSearch&&(e.value=this.globalSearch)}};Ke.styles=m`
1153
+ `),this.root.querySelectorAll("th.sortable").forEach(u=>{u.addEventListener("click",()=>{const x=u.dataset.field;this.sortField===x?this.sortDir=this.sortDir===1?-1:1:(this.sortField=x,this.sortDir=1),this.render(),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,composed:!0,detail:{field:this.sortField,direction:this.sortDir===1?"asc":"desc",lazy:this.lazy}}))})}),this.root.querySelectorAll(".filter").forEach(u=>{u.addEventListener("input",()=>{const x=u.dataset.field,w=u.value,S=u.selectionStart;this.filters[x]=w,this.page=0,this.render(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,composed:!0,detail:{field:x,value:w,lazy:this.lazy}}));const A=this.root.querySelector(`.filter[data-field="${c(x)}"]`);A&&(A.focus(),A.setSelectionRange(S,S))}),u.addEventListener("click",x=>x.stopPropagation())}),this.root.querySelectorAll("[data-search-fields]").forEach(u=>{u.addEventListener("input",()=>{this.globalSearch=u.value,this.page=0;const x=u.selectionStart;this.render();const w=this.root.querySelector("[data-search-fields]");w&&(w.focus(),w.setSelectionRange(x,x))})}),this.root.querySelectorAll(".pg-btn").forEach(u=>{u.addEventListener("click",()=>{const x=u.dataset.pg;this.page=x==="first"?0:x==="prev"?Math.max(0,this.page-1):x==="next"?Math.min(i-1,this.page+1):x==="last"?i-1:Number(x),this.render(),this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page+1,pages:i,rowsPerPage:this.rowsPerPage,total:r,lazy:this.lazy}}))})}),(v=this.root.querySelector("fx-select.rows-sel"))==null||v.addEventListener("change",u=>{var w;const x=Number((w=u.detail)==null?void 0:w.value);!x||x===this.rowsPerPage||(this.rowsPerPage=x,this.page=0,this.render())}),this.root.querySelectorAll("tbody tr[data-index]").forEach(u=>{u.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,composed:!0,detail:{row:t[Number(u.dataset.index)],index:Number(u.dataset.index)}}))})}),this._restoreToolbarSearch()}_restoreToolbarSearch(){const e=this.root.querySelector("[data-search-fields]");e&&this.globalSearch&&(e.value=this.globalSearch)}};Ke.styles=m`
1154
1154
  :host {
1155
1155
  display: block;
1156
1156
  font-family: var(--fx-font-family);
@@ -1524,7 +1524,7 @@
1524
1524
  }
1525
1525
  :host([size='sm']) .field { width: 220px; min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
1526
1526
  :host([size='lg']) .field { width: 300px; min-height: calc(var(--fx-size-lg) + 80px); }
1527
- `;let J=Ye;function lr(){return b("fx-textarea",J)}lr();const Xe=class Xe extends g{constructor(){super(...arguments),this._previouslyFocused=null}static get observedAttributes(){return["open","size","heading"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){const e=this.open,t=this.getAttr("heading");if(this.setTemplate(`
1527
+ `;let J=Ye;function lr(){return b("fx-textarea",J)}lr();const Xe=class Xe extends g{constructor(){super(...arguments),this._previouslyFocused=null}static get observedAttributes(){return["open","size","heading"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var s;const e=this.open,t=this.getAttr("heading");if(this.setTemplate(`
1528
1528
  <div class="overlay" part="overlay" ${e?"":"hidden"}>
1529
1529
  <div class="dialog" role="dialog" aria-modal="true" aria-label="${c(t)}" tabindex="-1">
1530
1530
  <header>
@@ -1535,7 +1535,7 @@
1535
1535
  <footer part="footer"><slot name="footer"></slot></footer>
1536
1536
  </div>
1537
1537
  </div>
1538
- `),!e)return;const r=this.root.querySelector(".overlay"),a=this.root.querySelector(".close"),i=()=>{var s;this.open=!1,(s=this._cleanup)==null||s.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))};r==null||r.addEventListener("click",s=>{s.target===r&&i()}),a==null||a.addEventListener("click",i);const o=s=>{if(s.key==="Escape"){s.stopPropagation(),i();return}s.key==="Tab"&&this._trapFocus(s)};document.addEventListener("keydown",o),this._cleanup=()=>document.removeEventListener("keydown",o),requestAnimationFrame(()=>{var s;this._previouslyFocused=document.activeElement,(s=this.root.querySelector(".dialog"))==null||s.focus()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}_trapFocus(e){const t=this.root.querySelector(".dialog");if(!t)return;const r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r.length)return;const a=r[0],i=r[r.length-1],o=this.root.activeElement;e.shiftKey&&(o===a||o===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&o===i&&(e.preventDefault(),a.focus())}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._cleanup)==null||e.call(this),this._cleanup=void 0,this._restoreFocus()}};Xe.styles=m`
1538
+ `),!e)return;(s=this._cleanup)==null||s.call(this),this._cleanup=void 0;const r=this.root.querySelector(".overlay"),a=this.root.querySelector(".close"),i=()=>{var n;this.open=!1,(n=this._cleanup)==null||n.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))};r==null||r.addEventListener("click",n=>{n.target===r&&i()}),a==null||a.addEventListener("click",i);const o=n=>{if(n.key==="Escape"){n.stopPropagation(),i();return}n.key==="Tab"&&this._trapFocus(n)};document.addEventListener("keydown",o),this._cleanup=()=>document.removeEventListener("keydown",o),requestAnimationFrame(()=>{var n;this._previouslyFocused=document.activeElement,(n=this.root.querySelector(".dialog"))==null||n.focus()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}_trapFocus(e){const t=this.root.querySelector(".dialog");if(!t)return;const r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r.length)return;const a=r[0],i=r[r.length-1],o=this.root.activeElement;e.shiftKey&&(o===a||o===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&o===i&&(e.preventDefault(),a.focus())}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._cleanup)==null||e.call(this),this._cleanup=void 0,this._restoreFocus()}};Xe.styles=m`
1539
1539
  :host { display: contents; }
1540
1540
  .overlay {
1541
1541
  position: fixed;
@@ -1631,7 +1631,7 @@
1631
1631
  }
1632
1632
  .fx-icon.fx-icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
1633
1633
  .fx-icon.fx-icon-bold { font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24; }
1634
- `;function q(d){return/^[a-z][a-z0-9_]*$/.test(d.trim())}const Ue=class Ue extends g{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)}}static get observedAttributes(){return["open","target","message","icon","accept-label","reject-label","position"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var h,f;const e=this.getAttr("message"),t=this.getAttr("icon"),r=q(t);r&&Promise.resolve().then(()=>D);const a=this.getAttr("accept-label","Sim"),i=this.getAttr("reject-label","Não");if(this.setTemplate(`
1634
+ `;function q(d){return/^[a-z][a-z0-9_]*$/.test(d.trim())}const Ue=class Ue extends g{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)}}static get observedAttributes(){return["open","target","message","icon","accept-label","reject-label","position"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var h,f,_;const e=this.getAttr("message"),t=this.getAttr("icon"),r=q(t);r&&Promise.resolve().then(()=>D);const a=this.getAttr("accept-label","Sim"),i=this.getAttr("reject-label","Não");if(this.setTemplate(`
1635
1635
  <div class="popup" part="popup" role="alertdialog" aria-modal="false" ${this.open?"":"hidden"}>
1636
1636
  <div class="message" part="message">
1637
1637
  ${t?`<span class="icon${r?" fx-icon":""}" aria-hidden="true">${c(t)}</span>`:""}
@@ -1646,7 +1646,7 @@
1646
1646
  </slot>
1647
1647
  </footer>
1648
1648
  </div>
1649
- `),!this.open)return;const o=this.root.querySelector(".popup");if(!o)return;const s=u=>{var p;this.open=!1,(p=this._cleanup)==null||p.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent(u,{bubbles:!0,composed:!0}))};(h=this.root.querySelector(".reject"))==null||h.addEventListener("click",()=>s("reject")),(f=this.root.querySelector(".accept"))==null||f.addEventListener("click",()=>s("accept"));const n=u=>{u.key==="Escape"&&(u.stopPropagation(),s("reject"))},l=u=>{const p=u.composedPath(),v=this._anchor(),_=v?p.includes(v):!1;!p.includes(o)&&!_&&s("reject")};document.addEventListener("keydown",n),document.addEventListener("pointerdown",l,!0),this._cleanup=()=>{document.removeEventListener("keydown",n),document.removeEventListener("pointerdown",l,!0)},this._position(o),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>{var u;(u=this.root.querySelector("button.accept"))==null||u.focus()})}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=8,o=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+i+a.height<=window.innerHeight-o?"bottom":"top";const l=Math.min(Math.max(o,r.left+r.width/2-a.width/2),window.innerWidth-a.width-o),h=s==="bottom"?r.bottom+i:r.top-i-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(o,h))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxcp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._cleanup)==null||e.call(this),this._cleanup=void 0,this._restoreFocus()}};Ue.styles=m`
1649
+ `),!this.open)return;const o=this.root.querySelector(".popup");if(!o)return;(h=this._cleanup)==null||h.call(this),this._cleanup=void 0;const s=p=>{var v;this.open=!1,(v=this._cleanup)==null||v.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent(p,{bubbles:!0,composed:!0}))};(f=this.root.querySelector(".reject"))==null||f.addEventListener("click",()=>s("reject")),(_=this.root.querySelector(".accept"))==null||_.addEventListener("click",()=>s("accept"));const n=p=>{p.key==="Escape"&&(p.stopPropagation(),s("reject"))},l=p=>{const v=p.composedPath(),u=this._anchor(),x=u?v.includes(u):!1;!v.includes(o)&&!x&&s("reject")};document.addEventListener("keydown",n),document.addEventListener("pointerdown",l,!0),this._cleanup=()=>{document.removeEventListener("keydown",n),document.removeEventListener("pointerdown",l,!0)},this._position(o),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>{var p;(p=this.root.querySelector("button.accept"))==null||p.focus()})}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=8,o=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+i+a.height<=window.innerHeight-o?"bottom":"top";const l=Math.min(Math.max(o,r.left+r.width/2-a.width/2),window.innerWidth-a.width-o),h=s==="bottom"?r.bottom+i:r.top-i-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(o,h))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxcp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._cleanup)==null||e.call(this),this._cleanup=void 0,this._restoreFocus()}};Ue.styles=m`
1650
1650
  :host { display: contents; }
1651
1651
  .popup {
1652
1652
  position: fixed;
@@ -2188,13 +2188,13 @@
2188
2188
  display: inline-flex;
2189
2189
  align-items: center;
2190
2190
  }
2191
- `;let ie=et;function mr(){return b("fx-breadcrumb",ie)}mr();const tt=class tt extends g{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)},this._onEnter=()=>{this.open=!0},this._onLeave=()=>{this.open=!1},this._onClick=()=>{this.open=!this.open}}static get observedAttributes(){return["open","target","trigger","position","dismissible"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){if(this.setTemplate(`
2191
+ `;let ie=et;function mr(){return b("fx-breadcrumb",ie)}mr();const tt=class tt extends g{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)},this._onEnter=()=>{this.open=!0},this._onLeave=()=>{this.open=!1},this._onClick=()=>{this.open=!this.open}}static get observedAttributes(){return["open","target","trigger","position","dismissible"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var i;if(this.setTemplate(`
2192
2192
  <div class="popup" part="popover" role="dialog" aria-modal="false" ${this.open?"":"hidden"}>
2193
2193
  <header part="header" hidden><slot name="header"></slot></header>
2194
2194
  <div class="body" part="content"><slot></slot></div>
2195
2195
  <footer part="footer" hidden><slot name="footer"></slot></footer>
2196
2196
  </div>
2197
- `),!this.open)return;const e=this.root.querySelector(".popup");if(!e)return;const t=()=>{var i;this.open=!1,(i=this._cleanup)==null||i.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0}))},r=i=>{i.key==="Escape"&&(i.stopPropagation(),t())},a=i=>{if(!this.hasAttr("dismissible"))return;const o=i.composedPath(),s=this._anchor(),n=s?o.includes(s):!1;!o.includes(e)&&!n&&t()};document.addEventListener("keydown",r),document.addEventListener("pointerdown",a,!0),this._cleanup=()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",a,!0)},this._syncSlots(),this._position(e),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>e.focus({preventScroll:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0}))}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_syncSlots(){const e=this.root.querySelector('slot[name="header"]'),t=this.root.querySelector('slot[name="footer"]'),r=this.root.querySelector("header"),a=this.root.querySelector("footer"),i=!!e&&e.assignedNodes().length>0,o=!!t&&t.assignedNodes().length>0;r==null||r.toggleAttribute("hidden",!i),a==null||a.toggleAttribute("hidden",!o)}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=8,o=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+i+a.height<=window.innerHeight-o?"bottom":"top",s==="top"&&r.top-i-a.height<o&&r.bottom+i+a.height<=window.innerHeight-o?s="bottom":s==="bottom"&&r.bottom+i+a.height>window.innerHeight-o&&r.top-i-a.height>=o&&(s="top");const l=Math.min(Math.max(o,r.left+r.width/2-a.width/2),window.innerWidth-a.width-o),h=s==="bottom"?r.bottom+i:r.top-i-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(o,h))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxpp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),this._bindTrigger()}disconnectedCallback(){var e,t;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._triggerCleanup)==null||e.call(this),this._triggerCleanup=void 0,(t=this._cleanup)==null||t.call(this),this._cleanup=void 0,this._restoreFocus()}_bindTrigger(){const e=this._anchor();if(!e)return;this.getAttr("trigger","click")==="hover"?(e.addEventListener("mouseenter",this._onEnter),e.addEventListener("mouseleave",this._onLeave),this._triggerCleanup=()=>{e.removeEventListener("mouseenter",this._onEnter),e.removeEventListener("mouseleave",this._onLeave)}):(e.addEventListener("pointerdown",this._onClick),this._triggerCleanup=()=>e.removeEventListener("pointerdown",this._onClick))}};tt.styles=m`
2197
+ `),!this.open)return;const e=this.root.querySelector(".popup");if(!e)return;(i=this._cleanup)==null||i.call(this),this._cleanup=void 0;const t=()=>{var o;this.open=!1,(o=this._cleanup)==null||o.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0}))},r=o=>{o.key==="Escape"&&(o.stopPropagation(),t())},a=o=>{if(!this.hasAttr("dismissible"))return;const s=o.composedPath(),n=this._anchor(),l=n?s.includes(n):!1;!s.includes(e)&&!l&&t()};document.addEventListener("keydown",r),document.addEventListener("pointerdown",a,!0),this._cleanup=()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",a,!0)},this._syncSlots(),this._position(e),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>e.focus({preventScroll:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0}))}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_syncSlots(){const e=this.root.querySelector('slot[name="header"]'),t=this.root.querySelector('slot[name="footer"]'),r=this.root.querySelector("header"),a=this.root.querySelector("footer"),i=!!e&&e.assignedNodes().length>0,o=!!t&&t.assignedNodes().length>0;r==null||r.toggleAttribute("hidden",!i),a==null||a.toggleAttribute("hidden",!o)}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=8,o=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+i+a.height<=window.innerHeight-o?"bottom":"top",s==="top"&&r.top-i-a.height<o&&r.bottom+i+a.height<=window.innerHeight-o?s="bottom":s==="bottom"&&r.bottom+i+a.height>window.innerHeight-o&&r.top-i-a.height>=o&&(s="top");const l=Math.min(Math.max(o,r.left+r.width/2-a.width/2),window.innerWidth-a.width-o),h=s==="bottom"?r.bottom+i:r.top-i-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(o,h))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxpp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),this._bindTrigger()}disconnectedCallback(){var e,t;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._triggerCleanup)==null||e.call(this),this._triggerCleanup=void 0,(t=this._cleanup)==null||t.call(this),this._cleanup=void 0,this._restoreFocus()}_bindTrigger(){const e=this._anchor();if(!e)return;this.getAttr("trigger","click")==="hover"?(e.addEventListener("mouseenter",this._onEnter),e.addEventListener("mouseleave",this._onLeave),this._triggerCleanup=()=>{e.removeEventListener("mouseenter",this._onEnter),e.removeEventListener("mouseleave",this._onLeave)}):(e.addEventListener("pointerdown",this._onClick),this._triggerCleanup=()=>e.removeEventListener("pointerdown",this._onClick))}};tt.styles=m`
2198
2198
  :host { display: contents; }
2199
2199
  .popup {
2200
2200
  position: fixed;
@@ -2544,7 +2544,7 @@
2544
2544
  :host([data-score='2']) { --_color: var(--fx-color-warning); }
2545
2545
  :host([data-score='3']) { --_color: var(--fx-color-info); }
2546
2546
  :host([data-score='4']) { --_color: var(--fx-color-success); }
2547
- `;let pe=nt;function kr(){return b("fx-password-strength",pe)}kr();const lt=class lt extends g{static get observedAttributes(){return["marker","size","orientation"]}render(){this.setTemplate('<ol class="tl" part="timeline"></ol>'),this._decorate()}_decorate(){var a;const e=(a=this.shadowRoot)==null?void 0:a.querySelector("ol");if(!e)return;const t=this.getAttr("marker","●"),r=Array.from(this.querySelectorAll('[slot="item"]'));r.length&&(e.innerHTML=r.map(i=>{var f,u;const o=(f=i.getAttribute("time"))!=null?f:"",s=(u=i.getAttribute("title"))!=null?u:"",n=[o?`<span class="time">${c(o)}</span>`:"",s?`<span class="title">${c(s)}</span>`:""].join(""),l=i.getAttribute("icon");return`<li class="event" part="event">${l?`<span class="dot fx-icon" part="marker" aria-hidden="true">${c(l)}</span>`:`<span class="dot" part="marker" aria-hidden="true">${c(t)}</span>`}<div class="head">${n}</div><div class="content">${i.innerHTML}</div></li>`}).join(""),r.some(i=>i.hasAttribute("icon"))&&Promise.resolve().then(()=>D))}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>this._decorate()),this._observer.observe(this,{childList:!0,subtree:!1}),this._decorate()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect(),this._observer=void 0}};lt.styles=m`
2547
+ `;let pe=nt;function kr(){return b("fx-password-strength",pe)}kr();const lt=class lt extends g{static get observedAttributes(){return["marker","size","orientation"]}render(){this.setTemplate('<ol class="tl" part="timeline"></ol>'),this._decorate()}_decorate(){var a;const e=(a=this.shadowRoot)==null?void 0:a.querySelector("ol");if(!e)return;const t=this.getAttr("marker","●"),r=Array.from(this.querySelectorAll('[slot="item"]'));r.length&&(e.innerHTML=r.map(i=>{var f,_;const o=(f=i.getAttribute("time"))!=null?f:"",s=(_=i.getAttribute("title"))!=null?_:"",n=[o?`<span class="time">${c(o)}</span>`:"",s?`<span class="title">${c(s)}</span>`:""].join(""),l=i.getAttribute("icon");return`<li class="event" part="event">${l?`<span class="dot fx-icon" part="marker" aria-hidden="true">${c(l)}</span>`:`<span class="dot" part="marker" aria-hidden="true">${c(t)}</span>`}<div class="head">${n}</div><div class="content">${i.innerHTML}</div></li>`}).join(""),r.some(i=>i.hasAttribute("icon"))&&Promise.resolve().then(()=>D))}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>this._decorate()),this._observer.observe(this,{childList:!0,subtree:!1}),this._decorate()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect(),this._observer=void 0}};lt.styles=m`
2548
2548
  :host {
2549
2549
  display: block;
2550
2550
  font-family: var(--fx-font-family);
@@ -2830,7 +2830,7 @@
2830
2830
  color: var(--fx-text-muted, #64748b); font-size: 15px; padding: 2px 4px; border-radius: 4px;
2831
2831
  }
2832
2832
  .close:hover { color: var(--fx-color-danger, #f43f5e); background: var(--fx-surface-surface-hover, rgba(0,0,0,.05)); }
2833
- `;class Er extends HTMLElement{constructor(){super();jt(this,M);this.timer=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["kind","title","message","duration","icon","mode"]}get mode(){const t=this.getAttribute("mode");return t==="light"||t==="dark"?t:void 0}set mode(t){t?this.setAttribute("mode",t):this.removeAttribute("mode")}connectedCallback(){var a;this.shadowRoot.firstChild||It(this,M,Ft).call(this);const t=Number((a=this.getAttribute("duration"))!=null?a:"4000"),r=t===0?0:Math.max(Number.isNaN(t)?4e3:t,1e3);!Number.isNaN(r)&&r>0&&!this.timer&&(this.timer=setTimeout(()=>this.dismiss(),r))}disconnectedCallback(){this.timer&&clearTimeout(this.timer),this.timer=null}dismiss(){this.timer&&clearTimeout(this.timer),this.timer=null;const t=this.shadowRoot.querySelector(".card");t?(t.classList.add("leaving"),setTimeout(()=>this.remove(),200)):this.remove()}}M=new WeakSet,Ft=function(){var f,u,p,v;const t=this.getAttribute("kind")||"info",r=(f=this.getAttribute("title"))!=null?f:"",a=(u=this.getAttribute("message"))!=null?u:"",i=(p=Lt[t])!=null?p:Lt.info,o=this.getAttribute("icon"),s=!!o&&/^[a-z][a-z0-9_]*$/.test(o);s&&Promise.resolve().then(()=>D);const n=s?o:(v=Ct[t])!=null?v:Ct.info;this.shadowRoot.innerHTML=`
2833
+ `;class Er extends HTMLElement{constructor(){super();jt(this,M);this.timer=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["kind","title","message","duration","icon","mode"]}get mode(){const t=this.getAttribute("mode");return t==="light"||t==="dark"?t:void 0}set mode(t){t?this.setAttribute("mode",t):this.removeAttribute("mode")}connectedCallback(){var a;this.shadowRoot.firstChild||It(this,M,Ft).call(this);const t=Number((a=this.getAttribute("duration"))!=null?a:"4000"),r=t===0?0:Math.max(Number.isNaN(t)?4e3:t,1e3);!Number.isNaN(r)&&r>0&&!this.timer&&(this.timer=setTimeout(()=>this.dismiss(),r))}disconnectedCallback(){this.timer&&clearTimeout(this.timer),this.timer=null}dismiss(){this.timer&&clearTimeout(this.timer),this.timer=null;const t=this.shadowRoot.querySelector(".card");t?(t.classList.add("leaving"),setTimeout(()=>this.remove(),200)):this.remove()}}M=new WeakSet,Ft=function(){var f,_,p,v;const t=this.getAttribute("kind")||"info",r=(f=this.getAttribute("title"))!=null?f:"",a=(_=this.getAttribute("message"))!=null?_:"",i=(p=Lt[t])!=null?p:Lt.info,o=this.getAttribute("icon"),s=!!o&&/^[a-z][a-z0-9_]*$/.test(o);s&&Promise.resolve().then(()=>D);const n=s?o:(v=Ct[t])!=null?v:Ct.info;this.shadowRoot.innerHTML=`
2834
2834
  <style>${$r}</style>
2835
2835
  <div class="card" style="--kind:${i}" role="status" part="card">
2836
2836
  <span class="icon${s?" fx-icon":""}">${n}</span>
@@ -3394,7 +3394,7 @@
3394
3394
  }
3395
3395
  .opt:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
3396
3396
  .empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm) var(--fx-space-md); }
3397
- `;let ze=yt;function Or(){return b("fx-autocomplete",ze)}Or();const wt=class wt extends g{constructor(){super(...arguments),this._isDragging=!1,this._startY=0,this._startValue=0,this._onMouseMove=e=>{if(!this._isDragging)return;const t=this._startY-e.clientY,r=(this.max-this.min)/100;this.emitChange(this._startValue+t*r)},this._onMouseUp=()=>{this._isDragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}}static get observedAttributes(){return["value","min","max","step","size","stroke-width","value-color","range-color","readonly","disabled","value-template"]}get value(){return this.clampValue(Number(this.getAttr("value","0"))||0)}set value(e){if(this.readonly||this.disabled)return;const t=this.clampValue(e),r=this.clampValue(Number(this.getAttr("value","0"))||0);t!==r&&(this.setAttribute("value",String(t)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}})))}get min(){return Number(this.getAttr("min","0"))||0}set min(e){this.setAttribute("min",String(e))}get max(){return Number(this.getAttr("max","100"))||100}set max(e){this.setAttribute("max",String(e))}get step(){return Number(this.getAttr("step","1"))||1}set step(e){this.setAttribute("step",String(e))}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get strokeWidth(){return Number(this.getAttr("stroke-width","8"))||8}set strokeWidth(e){this.setAttribute("stroke-width",String(e))}get valueColor(){return this.getAttr("value-color","")}set valueColor(e){this.setAttribute("value-color",e)}get rangeColor(){return this.getAttr("range-color","")}set rangeColor(e){this.setAttribute("range-color",e)}get readonly(){return this.hasAttr("readonly")}set readonly(e){this.toggleAttr("readonly",!!e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get valueTemplate(){return this.getAttr("value-template","{value}")}set valueTemplate(e){this.setAttribute("value-template",e)}render(){const e=this.min,t=this.max,r=this.clampValue(this.value),a=t-e,i=a>0?(r-e)/a:0,o=this.getSizeNum(),s=this.strokeWidth,n=(o-s)/2,l=2*Math.PI*n,h=l*(1-i),f=this.valueColor?this.safeColor(this.valueColor):"",u=this.rangeColor?this.safeColor(this.rangeColor):"",p=f?`--_value-color: ${f};`:"",v=u?`--_range-color: ${u};`:"",_=this.valueTemplate.replace("{value}",String(Math.round(r)));this.setTemplate(`
3397
+ `;let ze=yt;function Or(){return b("fx-autocomplete",ze)}Or();const wt=class wt extends g{constructor(){super(...arguments),this._isDragging=!1,this._startY=0,this._startValue=0,this._onMouseMove=e=>{if(!this._isDragging)return;const t=this._startY-e.clientY,r=(this.max-this.min)/100;this.emitChange(this._startValue+t*r)},this._onMouseUp=()=>{this._isDragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}}static get observedAttributes(){return["value","min","max","step","size","stroke-width","value-color","range-color","readonly","disabled","value-template"]}get value(){return this.clampValue(Number(this.getAttr("value","0"))||0)}set value(e){if(this.readonly||this.disabled)return;const t=this.clampValue(e),r=this.clampValue(Number(this.getAttr("value","0"))||0);t!==r&&(this.setAttribute("value",String(t)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}})))}get min(){return Number(this.getAttr("min","0"))||0}set min(e){this.setAttribute("min",String(e))}get max(){return Number(this.getAttr("max","100"))||100}set max(e){this.setAttribute("max",String(e))}get step(){return Number(this.getAttr("step","1"))||1}set step(e){this.setAttribute("step",String(e))}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get strokeWidth(){return Number(this.getAttr("stroke-width","8"))||8}set strokeWidth(e){this.setAttribute("stroke-width",String(e))}get valueColor(){return this.getAttr("value-color","")}set valueColor(e){this.setAttribute("value-color",e)}get rangeColor(){return this.getAttr("range-color","")}set rangeColor(e){this.setAttribute("range-color",e)}get readonly(){return this.hasAttr("readonly")}set readonly(e){this.toggleAttr("readonly",!!e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get valueTemplate(){return this.getAttr("value-template","{value}")}set valueTemplate(e){this.setAttribute("value-template",e)}render(){const e=this.min,t=this.max,r=this.clampValue(this.value),a=t-e,i=a>0?(r-e)/a:0,o=this.getSizeNum(),s=this.strokeWidth,n=(o-s)/2,l=2*Math.PI*n,h=l*(1-i),f=this.valueColor?this.safeColor(this.valueColor):"",_=this.rangeColor?this.safeColor(this.rangeColor):"",p=f?`--_value-color: ${f};`:"",v=_?`--_range-color: ${_};`:"",u=this.valueTemplate.replace("{value}",String(Math.round(r)));this.setTemplate(`
3398
3398
  <div class="knob" part="knob" tabindex="${this.disabled?"-1":"0"}"
3399
3399
  role="slider" aria-valuenow="${r}" aria-valuemin="${e}" aria-valuemax="${t}"
3400
3400
  aria-readonly="${this.readonly}" aria-disabled="${this.disabled}"
@@ -3407,7 +3407,7 @@
3407
3407
  stroke-dasharray="${l}"
3408
3408
  stroke-dashoffset="${h}" />
3409
3409
  </svg>
3410
- <div class="label" part="label">${c(_)}</div>
3410
+ <div class="label" part="label">${c(u)}</div>
3411
3411
  </div>
3412
3412
  `),this.attachListeners()}getSizeNum(){const e=this.size;return e==="sm"?60:e==="lg"?140:100}safeColor(e){const t=e.trim();return/^#[0-9a-fA-F]{3,8}$/.test(t)||/^(rgb|rgba|hsl|hsla)\([\d\s.,%()]+\)$/i.test(t)||/^var\(--[\w-]+(,\s*[^)]*)?\)$/.test(t)||/^[a-zA-Z]+$/.test(t)?t:""}clampValue(e){const t=this.min,r=this.max,a=this.step;let i=Math.min(r,Math.max(t,e));return a>0&&(i=Math.round((i-t)/a)*a+t,i=Math.min(r,Math.max(t,i))),i}emitChange(e){const t=this.clampValue(e);t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}})))}attachListeners(){const e=this.root.querySelector(".knob");e&&(e.addEventListener("mousedown",t=>{this.readonly||this.disabled||(t.preventDefault(),this._isDragging=!0,this._startY=t.clientY,this._startValue=this.value,e.focus(),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}),e.addEventListener("touchstart",t=>{this.readonly||this.disabled||(t.preventDefault(),this._isDragging=!0,this._startY=t.touches[0].clientY,this._startValue=this.value,e.focus())},{passive:!1}),e.addEventListener("touchmove",t=>{if(!this._isDragging||this.readonly||this.disabled)return;t.preventDefault();const r=this._startY-t.touches[0].clientY,a=(this.max-this.min)/100;this.emitChange(this._startValue+r*a)},{passive:!1}),e.addEventListener("touchend",()=>{this._isDragging=!1}),e.addEventListener("keydown",t=>{if(this.readonly||this.disabled)return;const r=this.step;switch(t.key){case"ArrowUp":case"ArrowRight":t.preventDefault(),this.emitChange(this.value+r);break;case"ArrowDown":case"ArrowLeft":t.preventDefault(),this.emitChange(this.value-r);break;case"Home":t.preventDefault(),this.emitChange(this.min);break;case"End":t.preventDefault(),this.emitChange(this.max);break;case"PageUp":t.preventDefault(),this.emitChange(this.value+r*10);break;case"PageDown":t.preventDefault(),this.emitChange(this.value-r*10);break}}))}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),super.disconnectedCallback()}};wt.styles=m`
3413
3413
  :host {
@@ -3652,7 +3652,7 @@
3652
3652
  @media (max-width: 640px) { .main-row { flex-direction: column; } .controls-bar { flex-direction: row; flex-wrap: wrap; justify-content: center; position: relative; } .control-group { flex-direction: row; } .control-group + .control-group { margin-top: 0; margin-left: 4px; padding-top: 0; padding-left: 4px; border-top: none; border-left: 1px solid var(--orderlist-border); } button.control-btn { width: 44px; height: 40px; } button.control-btn::after { display: none; } .list { max-height: 300px; } }
3653
3653
  @keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
3654
3654
  .list-item { animation: slideIn 0.2s ease-out; }
3655
- `;let $e=kt;function Hr(){return b("fx-orderlist",$e)}Hr();const At=class At extends g{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(e){this._source=e,this._filteredSource=null,this.render()}get source(){return this._source}set target(e){this._target=e,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(e){this._sourceSelection=e,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(e){this._targetSelection=e,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(e){this.setAttribute("source-key",e)}get targetKey(){return this.getAttr("target-key","")}set targetKey(e){this.setAttribute("target-key",e)}get filter(){return this.hasAttr("filter")}set filter(e){this.toggleAttr("filter",e)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(e){this.setAttribute("filter-by",e)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(e){this.setAttribute("filter-placeholder",e)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(e){this.toggleAttr("dragdrop",e)}get striped(){return this.hasAttr("striped")}set striped(e){this.toggleAttr("striped",e)}get selectionMode(){const e=this.getAttr("selection-mode","");return e==="single"||e==="multiple"?e:""}set selectionMode(e){this.setAttribute("selection-mode",e)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(e){this.toggleAttr("show-select-all",e)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(e){this.setAttribute("source-label",e)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(e){this.setAttribute("target-label",e)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(e){this._sourceFilterValue=e,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(e){this._targetFilterValue=e,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(e){this._optionTemplate=e,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(e,t,r){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback(e,t,r)}_parseSourceAttribute(){const e=this.getAttr("source","");if(e)try{this._source=JSON.parse(e),this._filteredSource=null}catch(t){this._source=[]}}_parseTargetAttribute(){const e=this.getAttr("target","");if(e)try{this._target=JSON.parse(e),this._filteredTarget=null}catch(t){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredSource=this._source.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredTarget=this._target.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(e,t,r){const a=r?this.sourceKey:this.targetKey;return a&&e[a]!=null?String(e[a]):e.id!=null?String(e.id):e.key!=null?String(e.key):e.label!=null?String(e.label):e.name!=null?String(e.name):e.value!=null?String(e.value):String(t)}_getItemLabel(e){const t=["label","name","title","text","value"];for(const r of t)if(e[r]!=null)return String(e[r]);return JSON.stringify(e)}_isSourceSelected(e,t){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,t,!0))}_isTargetSelected(e,t){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,t,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const e=this._getDisplaySource(),t=this._getDisplayTarget(),r=this.selectionMode,a=r==="multiple"&&this.showSelectAll,i=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:e.map((l,h)=>`<li class="list-item${this._isSourceSelected(l,h)?" selected":""}" data-index="${h}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):c(this._getItemLabel(l))}</span></li>`).join(""),o=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:t.map((l,h)=>`<li class="list-item${this._isTargetSelected(l,h)?" selected":""}" data-index="${h}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):c(this._getItemLabel(l))}</span></li>`).join(""),s=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${c(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+c(this._sourceFilterValue)+'" /></div>':""}${s}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${i}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${c(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+c(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${o}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",e=>{const t=e.target;if(t.classList.contains("select-all-checkbox")){this._handleSelectAll(t);return}t.classList.contains("source-filter")?this.sourceFilterValue=t.value:t.classList.contains("target-filter")&&(this.targetFilterValue=t.value)}),this.root.addEventListener("click",e=>{const t=e.target,r=t.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const a=t.closest(".list-item");if(!a)return;const i=a.dataset.list==="source",o=Number(a.dataset.index),s=(i?this._getDisplaySource():this._getDisplayTarget())[o];i?this._toggleSourceSelection(s,o):this._toggleTargetSelection(s,o)})),this._updateControlsState()}_handleSelectAll(e){e.dataset.list==="source"?(this._sourceSelection=e.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=e.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const e=(t,r,a)=>{t&&t.querySelectorAll(".list-item").forEach(i=>{const o=Number(i.dataset.index),s=r(a()[o],o);i.classList.toggle("selected",s),i.setAttribute("aria-selected",String(s));const n=i.querySelector(".checkbox");n&&(n.checked=s)})};e(this.root.querySelector(".source-list"),(t,r)=>this._isSourceSelected(t,r),()=>this._getDisplaySource()),e(this.root.querySelector(".target-list"),(t,r)=>this._isTargetSelected(t,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:t,total:r,sel:a})=>{var o;if(!t)return;t.checked=r>0&&a===r;const i=(o=t.closest(".select-all-bar"))==null?void 0:o.querySelector(".selection-count");i&&(i.textContent=`${a} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(e=>{const t=e.dataset.action;e.disabled=t==="move-target"&&this._sourceSelection.length===0||t==="move-all-target"&&this._source.length===0||t==="move-source"&&this._targetSelection.length===0||t==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const e=[...this._sourceSelection];this._source=this._source.filter(t=>!e.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,-1,!0))),this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const e=[...this._targetSelection];this._target=this._target.filter(t=>!e.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,-1,!1))),this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const e=[...this._source];this._source=[],this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const e=[...this._target];this._target=[],this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!0),i=this._sourceSelection.findIndex(o=>this._getItemKey(o,-1,!0)===a);i>=0?this._sourceSelection.splice(i,1):r==="multiple"?this._sourceSelection.push(e):this._sourceSelection=[e],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!1),i=this._targetSelection.findIndex(o=>this._getItemKey(o,-1,!1)===a);i>=0?this._targetSelection.splice(i,1):r==="multiple"?this._targetSelection.push(e):this._targetSelection=[e],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var h,f;const e=(h=this.root.querySelector(".source-list"))==null?void 0:h.parentElement,t=(f=this.root.querySelector(".target-list"))==null?void 0:f.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),a=this.root.querySelector(".list-container:last-of-type .list-label");if(!e||!t){this.render();return}const i=this._getDisplaySource(),o=this._getDisplayTarget(),s=this.selectionMode,n=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:i.map((u,p)=>`<li class="list-item${this._isSourceSelected(u,p)?" selected":""}" part="list-item" data-index="${p}" data-list="source" role="option" aria-selected="${this._isSourceSelected(u,p)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(u,p)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(u):c(this._getItemLabel(u))}</span></li>`).join(""),l=o.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:o.map((u,p)=>`<li class="list-item${this._isTargetSelected(u,p)?" selected":""}" part="list-item" data-index="${p}" data-list="target" role="option" aria-selected="${this._isTargetSelected(u,p)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(u,p)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(u):c(this._getItemLabel(u))}</span></li>`).join("");e.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,t.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${l}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),a&&(a.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};At.styles=m`
3655
+ `;let $e=kt;function Hr(){return b("fx-orderlist",$e)}Hr();const At=class At extends g{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(e){this._source=e,this._filteredSource=null,this.render()}get source(){return this._source}set target(e){this._target=e,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(e){this._sourceSelection=e,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(e){this._targetSelection=e,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(e){this.setAttribute("source-key",e)}get targetKey(){return this.getAttr("target-key","")}set targetKey(e){this.setAttribute("target-key",e)}get filter(){return this.hasAttr("filter")}set filter(e){this.toggleAttr("filter",e)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(e){this.setAttribute("filter-by",e)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(e){this.setAttribute("filter-placeholder",e)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(e){this.toggleAttr("dragdrop",e)}get striped(){return this.hasAttr("striped")}set striped(e){this.toggleAttr("striped",e)}get selectionMode(){const e=this.getAttr("selection-mode","");return e==="single"||e==="multiple"?e:""}set selectionMode(e){this.setAttribute("selection-mode",e)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(e){this.toggleAttr("show-select-all",e)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(e){this.setAttribute("source-label",e)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(e){this.setAttribute("target-label",e)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(e){this._sourceFilterValue=e,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(e){this._targetFilterValue=e,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(e){this._optionTemplate=e,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(e,t,r){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback(e,t,r)}_parseSourceAttribute(){const e=this.getAttr("source","");if(e)try{this._source=JSON.parse(e),this._filteredSource=null}catch(t){this._source=[]}}_parseTargetAttribute(){const e=this.getAttr("target","");if(e)try{this._target=JSON.parse(e),this._filteredTarget=null}catch(t){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredSource=this._source.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredTarget=this._target.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(e,t,r){const a=r?this.sourceKey:this.targetKey;return a&&e[a]!=null?String(e[a]):e.id!=null?String(e.id):e.key!=null?String(e.key):e.label!=null?String(e.label):e.name!=null?String(e.name):e.value!=null?String(e.value):String(t)}_getItemLabel(e){const t=["label","name","title","text","value"];for(const r of t)if(e[r]!=null)return String(e[r]);return JSON.stringify(e)}_isSourceSelected(e,t){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,t,!0))}_isTargetSelected(e,t){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,t,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const e=this._getDisplaySource(),t=this._getDisplayTarget(),r=this.selectionMode,a=r==="multiple"&&this.showSelectAll,i=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:e.map((l,h)=>`<li class="list-item${this._isSourceSelected(l,h)?" selected":""}" data-index="${h}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):c(this._getItemLabel(l))}</span></li>`).join(""),o=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:t.map((l,h)=>`<li class="list-item${this._isTargetSelected(l,h)?" selected":""}" data-index="${h}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):c(this._getItemLabel(l))}</span></li>`).join(""),s=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${c(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+c(this._sourceFilterValue)+'" /></div>':""}${s}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${i}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${c(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+c(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${o}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",e=>{const t=e.target;if(t.classList.contains("select-all-checkbox")){this._handleSelectAll(t);return}t.classList.contains("source-filter")?this.sourceFilterValue=t.value:t.classList.contains("target-filter")&&(this.targetFilterValue=t.value)}),this.root.addEventListener("click",e=>{const t=e.target,r=t.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const a=t.closest(".list-item");if(!a)return;const i=a.dataset.list==="source",o=Number(a.dataset.index),s=(i?this._getDisplaySource():this._getDisplayTarget())[o];i?this._toggleSourceSelection(s,o):this._toggleTargetSelection(s,o)})),this._updateControlsState()}_handleSelectAll(e){e.dataset.list==="source"?(this._sourceSelection=e.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=e.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const e=(t,r,a)=>{t&&t.querySelectorAll(".list-item").forEach(i=>{const o=Number(i.dataset.index),s=r(a()[o],o);i.classList.toggle("selected",s),i.setAttribute("aria-selected",String(s));const n=i.querySelector(".checkbox");n&&(n.checked=s)})};e(this.root.querySelector(".source-list"),(t,r)=>this._isSourceSelected(t,r),()=>this._getDisplaySource()),e(this.root.querySelector(".target-list"),(t,r)=>this._isTargetSelected(t,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:t,total:r,sel:a})=>{var o;if(!t)return;t.checked=r>0&&a===r;const i=(o=t.closest(".select-all-bar"))==null?void 0:o.querySelector(".selection-count");i&&(i.textContent=`${a} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(e=>{const t=e.dataset.action;e.disabled=t==="move-target"&&this._sourceSelection.length===0||t==="move-all-target"&&this._source.length===0||t==="move-source"&&this._targetSelection.length===0||t==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const e=[...this._sourceSelection];this._source=this._source.filter(t=>!e.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,-1,!0))),this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const e=[...this._targetSelection];this._target=this._target.filter(t=>!e.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,-1,!1))),this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const e=[...this._source];this._source=[],this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const e=[...this._target];this._target=[],this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!0),i=this._sourceSelection.findIndex(o=>this._getItemKey(o,-1,!0)===a);i>=0?this._sourceSelection.splice(i,1):r==="multiple"?this._sourceSelection.push(e):this._sourceSelection=[e],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!1),i=this._targetSelection.findIndex(o=>this._getItemKey(o,-1,!1)===a);i>=0?this._targetSelection.splice(i,1):r==="multiple"?this._targetSelection.push(e):this._targetSelection=[e],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var h,f;const e=(h=this.root.querySelector(".source-list"))==null?void 0:h.parentElement,t=(f=this.root.querySelector(".target-list"))==null?void 0:f.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),a=this.root.querySelector(".list-container:last-of-type .list-label");if(!e||!t){this.render();return}const i=this._getDisplaySource(),o=this._getDisplayTarget(),s=this.selectionMode,n=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:i.map((_,p)=>`<li class="list-item${this._isSourceSelected(_,p)?" selected":""}" part="list-item" data-index="${p}" data-list="source" role="option" aria-selected="${this._isSourceSelected(_,p)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(_,p)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):c(this._getItemLabel(_))}</span></li>`).join(""),l=o.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:o.map((_,p)=>`<li class="list-item${this._isTargetSelected(_,p)?" selected":""}" part="list-item" data-index="${p}" data-list="target" role="option" aria-selected="${this._isTargetSelected(_,p)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(_,p)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):c(this._getItemLabel(_))}</span></li>`).join("");e.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,t.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${l}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),a&&(a.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};At.styles=m`
3656
3656
  :host {
3657
3657
  display: block;
3658
3658
  font-family: var(--fx-font-family);