@adia-ai/web-components 0.8.2 → 0.8.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/components/accordion/accordion.css +5 -0
  3. package/components/agent-artifact/agent-artifact.css +1 -0
  4. package/components/agent-reasoning/agent-reasoning.css +9 -5
  5. package/components/button/button.class.js +4 -1
  6. package/components/button/button.css +1 -1
  7. package/components/calendar-picker/calendar-picker.css +2 -0
  8. package/components/chat-thread/chat-input.a2ui.json +3 -1
  9. package/components/chat-thread/chat-input.css +12 -13
  10. package/components/chat-thread/chat-input.js +6 -2
  11. package/components/chat-thread/chat-input.yaml +3 -0
  12. package/components/check/check.css +1 -1
  13. package/components/combobox/combobox.a2ui.json +3 -1
  14. package/components/combobox/combobox.class.js +1 -3
  15. package/components/combobox/combobox.css +9 -12
  16. package/components/combobox/combobox.yaml +2 -0
  17. package/components/date-range-picker/date-range-picker.css +1 -0
  18. package/components/input/input.css +6 -2
  19. package/components/nav-group/nav-group.css +5 -6
  20. package/components/option-card/option-card.css +1 -0
  21. package/components/radio/radio.css +1 -1
  22. package/components/range/range.css +2 -0
  23. package/components/select/select.a2ui.json +2 -1
  24. package/components/select/select.class.js +9 -9
  25. package/components/select/select.css +29 -40
  26. package/components/select/select.test.js +6 -2
  27. package/components/select/select.yaml +1 -0
  28. package/components/swatch/swatch.a2ui.json +3 -1
  29. package/components/swatch/swatch.class.js +14 -8
  30. package/components/swatch/swatch.css +13 -18
  31. package/components/swatch/swatch.yaml +2 -0
  32. package/components/switch/switch.css +1 -1
  33. package/components/tag/tag.a2ui.json +4 -1
  34. package/components/tag/tag.class.js +3 -1
  35. package/components/tag/tag.css +13 -15
  36. package/components/tag/tag.yaml +3 -0
  37. package/components/tags-input/tags-input.css +1 -0
  38. package/components/textarea/textarea.css +2 -0
  39. package/components/time-picker/time-picker.css +2 -0
  40. package/components/timeline/timeline.a2ui.json +2 -1
  41. package/components/timeline/timeline.class.js +7 -8
  42. package/components/timeline/timeline.css +14 -26
  43. package/components/timeline/timeline.yaml +1 -0
  44. package/components/toggle-group/toggle-group.css +1 -0
  45. package/components/tree/tree.css +5 -2
  46. package/components/upload/upload.css +1 -0
  47. package/dist/theme-provider.min.js +1 -1
  48. package/dist/web-components.min.css +1 -1
  49. package/dist/web-components.min.js +7 -11
  50. package/dist/web-components.sheet.js +1 -1
  51. package/package.json +1 -1
  52. package/styles/colors/semantics/features.css +6 -1
@@ -64,7 +64,7 @@ ${i.join(`
64
64
  installIconLoaders({ regular: import.meta.glob(
65
65
  '/node_modules/@phosphor-icons/core/assets/regular/*.svg',
66
66
  { query: '?raw', import: 'default', eager: true }) });
67
- See USAGE.md \xA7 Icons.`)},0))}var tn=class extends k{static properties={name:{type:String,default:"",reflect:!0},size:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},weight:{type:String,default:"regular",reflect:!0}};#t=this.signal(0);#e=null;connected(){this.setAttribute("role",this.label?"img":"presentation"),this.label||this.setAttribute("aria-hidden","true"),this.#e=new AbortController;let t=this.#e;zl.then(()=>{t.signal.aborted||this.#t.value++})}disconnected(){this.#e?.abort(),this.#e=null}render(){this.#t.value,this.label&&this.setAttribute("aria-label",this.label);let t=qO(this.name,this.weight||"regular");t&&this.innerHTML!==t?this.innerHTML=t:this.name&&!t&&$A(),this.size&&this.#i(this.size)?this.style.setProperty("--icon-size",this.#s(this.size)):this.style.getPropertyValue("--icon-size")&&this.style.removeProperty("--icon-size")}#i(t){return/^\d+(\.\d+)?(px|rem|em)?$/.test(t)}#s(t){return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}};x("icon-ui",tn);P();var CA={plus:["+","\uFF0B"],minus:["-","\u2212","\u2013"],x:["\xD7","x ","X "],check:["\u2713","\u2714"],"arrow-right":["\u2192",">"],"arrow-left":["\u2190","<"]},en=class s extends k{static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"solid",reflect:!0},color:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},stretch:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0},iconTrailing:{type:String,default:"",reflect:!0,attribute:"icon-trailing"},type:{type:String,default:"button",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#i),this.addEventListener("keydown",this.#s)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.icon){let e=this.querySelector(":scope > icon-ui:not([slot])");if(!e||e.name!==this.icon){e&&e.remove();let i=document.createElement("icon-ui");i.setAttribute("name",this.icon),this.prepend(i)}}if(this.iconTrailing){let e=this.querySelector(':scope > icon-ui[slot="icon-trailing"]');if(!e||e.name!==this.iconTrailing){e&&e.remove();let i=document.createElement("icon-ui");i.setAttribute("name",this.iconTrailing),i.setAttribute("slot","icon-trailing"),this.appendChild(i)}}let t=Array.from(this.childNodes).some(e=>e.nodeType===3&&e.textContent.trim()!=="");if(this.toggleAttribute("data-icon-only",!this.text&&!t),this.icon&&this.text){let e=CA[this.icon];e&&e.some(i=>this.text.startsWith(i))&&(s.#e.has(this)||(s.#e.add(this),console.warn(`[button-ui] text="${this.text}" begins with a symbol that icon="${this.icon}" already renders \u2014 the glyph appears twice. Drop the leading symbol from text= (the icon provides it).`,this)))}if(this.icon&&!this.text&&!t){let e=this.getAttribute("aria-label"),i=this.getAttribute("aria-labelledby"),n=this.getAttribute("title");!e&&!i&&n?this.setAttribute("aria-label",n):!e&&!i&&!n&&(s.#t.has(this)||(s.#t.add(this),console.warn(`[button-ui] Icon-only button is missing an accessible name.
67
+ See USAGE.md \xA7 Icons.`)},0))}var tn=class extends k{static properties={name:{type:String,default:"",reflect:!0},size:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},weight:{type:String,default:"regular",reflect:!0}};#t=this.signal(0);#e=null;connected(){this.setAttribute("role",this.label?"img":"presentation"),this.label||this.setAttribute("aria-hidden","true"),this.#e=new AbortController;let t=this.#e;zl.then(()=>{t.signal.aborted||this.#t.value++})}disconnected(){this.#e?.abort(),this.#e=null}render(){this.#t.value,this.label&&this.setAttribute("aria-label",this.label);let t=qO(this.name,this.weight||"regular");t&&this.innerHTML!==t?this.innerHTML=t:this.name&&!t&&$A(),this.size&&this.#i(this.size)?this.style.setProperty("--icon-size",this.#s(this.size)):this.style.getPropertyValue("--icon-size")&&this.style.removeProperty("--icon-size")}#i(t){return/^\d+(\.\d+)?(px|rem|em)?$/.test(t)}#s(t){return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}};x("icon-ui",tn);P();var CA={plus:["+","\uFF0B"],minus:["-","\u2212","\u2013"],x:["\xD7","x ","X "],check:["\u2713","\u2714"],"arrow-right":["\u2192",">"],"arrow-left":["\u2190","<"]},en=class s extends k{static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"solid",reflect:!0},color:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},stretch:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0},iconTrailing:{type:String,default:"",reflect:!0,attribute:"icon-trailing"},type:{type:String,default:"button",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this.#i),this.addEventListener("keydown",this.#s)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.icon){let e=this.querySelector(":scope > icon-ui:not([slot])");if(!e||e.name!==this.icon){e&&e.remove();let i=document.createElement("icon-ui");i.setAttribute("name",this.icon),this.prepend(i)}}if(this.iconTrailing){let e=this.querySelector(':scope > icon-ui[slot="icon-trailing"]');if(!e||e.name!==this.iconTrailing){e&&e.remove();let i=document.createElement("icon-ui");i.setAttribute("name",this.iconTrailing),i.setAttribute("slot","icon-trailing"),this.appendChild(i)}}let t=Array.from(this.childNodes).some(e=>e.nodeType===3&&e.textContent.trim()!=="");if(this.toggleAttribute("data-icon-only",!this.text&&!t),this.icon&&this.text){let e=CA[this.icon];e&&e.some(i=>this.text.startsWith(i))&&(s.#e.has(this)||(s.#e.add(this),console.warn(`[button-ui] text="${this.text}" begins with a symbol that icon="${this.icon}" already renders \u2014 the glyph appears twice. Drop the leading symbol from text= (the icon provides it).`,this)))}if(this.icon&&!this.text&&!t){let e=this.getAttribute("aria-label"),i=this.getAttribute("aria-labelledby"),n=this.getAttribute("title");!e&&!i&&n?this.setAttribute("aria-label",n):!e&&!i&&!n&&(s.#t.has(this)||(s.#t.add(this),console.warn(`[button-ui] Icon-only button is missing an accessible name.
68
68
  Element: <button-ui icon="${this.icon}">
69
69
  Add one of:
70
70
  aria-label="Undo" \u2190 explicit accessible name
@@ -126,13 +126,11 @@ parent-template-re-read pattern that works across frameworks.`);return}if(this.d
126
126
  ${i}
127
127
  <span data-chips></span>
128
128
  ${n}
129
- <button type="button" data-clear-all aria-label="Clear all" hidden>
130
- <icon-ui name="x"></icon-ui>
131
- </button>
129
+ <button-ui variant="ghost" size="xs" icon="x" aria-label="Clear all" data-clear-all hidden></button-ui>
132
130
  <icon-ui name="caret-down" slot="caret"></icon-ui>
133
131
  </span>
134
132
  ${o}
135
- `,this.hint&&this.setAttribute("aria-describedby",r);let a=this.querySelector("[data-clear-all]");a&&(a.removeEventListener("click",this.#y),a.addEventListener("click",this.#y)),this.searchable&&(this.#o&&(this.#o.removeEventListener("input",this.#T),this.#o.removeEventListener("focus",this.#h),this.#o.removeEventListener("click",this.#u)),this.#o=this.querySelector('input[slot="display"]'),this.#o&&(this.#o.addEventListener("input",this.#T),this.#o.addEventListener("focus",this.#h),this.#o.addEventListener("click",this.#u))),e&&this.appendChild(e)}this.#A(),this.multiple&&this.#M();let t=this.querySelector("[data-clear-all]");if(t&&(this.multiple&&this.clearable&&this.#f().length>0&&!this.disabled&&!this.readonly?t.removeAttribute("hidden"):t.setAttribute("hidden","")),this.#n||(this.#n=this.querySelector('[slot="listbox"]'),this.#n||(this.#n=document.createElement("div"),this.#n.setAttribute("slot","listbox"),this.#n.setAttribute("role","listbox"),this.#n.setAttribute("popover","manual"),this.appendChild(this.#n)),this.#$()),this.#n){let e=this.multiple?new Set(this.value.split(",").map(i=>i.trim()).filter(Boolean)):null;for(let i of this.#n.querySelectorAll('[role="option"]')){let n=i.getAttribute("data-value");(e?e.has(n):n===this.value)?i.setAttribute("aria-selected","true"):i.removeAttribute("aria-selected")}}if(this.setAttribute("aria-expanded",String(this.open)),this.open){this.#n?.showPopover?.();let e=this.querySelector('[slot="trigger"]')||this;this.#n.style.minWidth=`${e.getBoundingClientRect().width}px`,this.#n.style.width="max-content",this.#r=lt(e,this.#n,{placement:this.getAttribute("placement")||"bottom-start",gap:4,matchWidth:!1}),this.#l=requestAnimationFrame(()=>{this.#l=null,document.addEventListener("pointerdown",this.#R,{once:!0})})}else this.#r?.(),this.#r=null,this.#n?.hidePopover?.(),this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#R)}#v(){let t=[],e=i=>{for(let n of i.children)if(!n.hasAttribute("slot")){if(n.tagName==="OPTION"||n.tagName==="OPTGROUP"){t.push(n);continue}if(n.matches('[role="presentation"]')||n.style?.display==="contents"){e(n);continue}t.push(n)}};return e(this),t}#w(){this.#i=[];let t=new Set,e=[];for(let i of this.#v())if(i.tagName==="OPTGROUP"){let n={label:i.label||i.getAttribute("label")||"",options:[]};for(let r of i.querySelectorAll("option"))n.options.push({value:r.value,label:r.textContent.trim(),disabled:r.disabled,icon:r.getAttribute("icon")||"",avatar:r.getAttribute("avatar")||""}),r.hasAttribute("selected")&&e.push(r.value);this.#i.push(n)}else i.tagName==="OPTION"?(this.#i.push({value:i.value,label:i.textContent.trim(),disabled:i.disabled,icon:i.getAttribute("icon")||"",avatar:i.getAttribute("avatar")||""}),i.hasAttribute("selected")&&e.push(i.value)):i.hasAttribute("slot")||t.add(i.tagName.toLowerCase());for(let i of[...this.querySelectorAll("option, optgroup")])i.remove();!this.value&&e.length&&(this.value=this.multiple?e.join(","):e[0]),t.size>0&&!s.#t.has(this)&&(s.#t.add(this),console.warn(`<select-ui>: ignoring unrecognized child element(s) [${[...t].join(", ")}]. Consumer-authored children must be native <option> or <optgroup>, NOT <select-option> or other <*-ui> shapes. Or set element.options = [...] programmatically. (Once-per-element warn; see select.yaml usage: for details.)`))}set options(t){Lt(()=>{this.#i=t,this.#n||(this.#n=this.querySelector('[slot="listbox"]'),this.#n||(this.#n=document.createElement("div"),this.#n.setAttribute("slot","listbox"),this.#n.setAttribute("role","listbox"),this.#n.setAttribute("popover","manual"),this.appendChild(this.#n))),this.#$();let e=this.querySelector('[slot="display"]');e&&(e.textContent=this.#E())})}get options(){return this.#i}static#k(t){return t?t.avatar?`<img data-option-avatar src="${Mt(t.avatar)}" alt="" />`:t.icon?`<icon-ui name="${Mt(t.icon)}"></icon-ui>`:"":""}#A(){if(this.multiple||!this.#s)return;let t=this.querySelector('[slot="trigger"]');if(!t)return;let i=this.#i.flatMap(c=>c.options||[c]).find(c=>!c.header&&!c.separator&&c.value===this.value),n=i&&i.avatar||this.avatar||"",r=i&&i.icon||this.icon||"",o=t.querySelector(":scope > [data-select-leading]"),a="";if(n?a=`<img slot="leading" data-select-leading src="${Mt(n)}" alt="" />`:r&&(a=`<icon-ui slot="leading" data-select-leading name="${Mt(r)}"></icon-ui>`),!a){o?.remove();return}let l=document.createElement("template");l.innerHTML=a;let h=l.content.firstElementChild;o?o.tagName===h.tagName?h.tagName==="IMG"?o.getAttribute("src")!==h.getAttribute("src")&&o.setAttribute("src",h.getAttribute("src")):o.getAttribute("name")!==h.getAttribute("name")&&o.setAttribute("name",h.getAttribute("name")):o.replaceWith(h):t.insertBefore(h,t.firstChild)}#$(){if(!this.#n)return;if(this.#n.innerHTML="",this.multiple?this.#n.setAttribute("aria-multiselectable","true"):this.#n.removeAttribute("aria-multiselectable"),this.multiple&&this.selectAll){let e=document.createElement("div");e.setAttribute("data-select-all","");let i=document.createElement("button");i.type="button",i.dataset.selectAllBtn="",i.textContent=this.#C()?"Clear":"Select all",i.addEventListener("click",this.#O),e.appendChild(i),this.#n.appendChild(e)}let t=e=>{if(e.separator){let a=document.createElement("hr");return a.setAttribute("data-separator",""),a}let i=document.createElement("div");i.setAttribute("role","option"),i.setAttribute("data-value",e.value||"");let n=this.multiple?new Set(this.value.split(",").map(a=>a.trim()).filter(Boolean)):null,r=n?n.has(e.value):e.value===this.value,o=s.#k(e);if(this.multiple){i.setAttribute("data-multi-option","");let a=document.createElement("span");a.setAttribute("data-checkbox",""),a.innerHTML='<icon-ui name="check" aria-hidden="true"></icon-ui>',i.appendChild(a);let l=document.createElement("span");l.setAttribute("data-option-label",""),o?l.innerHTML=`${o}${Mt(e.label)}`:l.textContent=e.label,i.appendChild(l)}else o?i.innerHTML=`${o}${Mt(e.label)}`:i.textContent=e.label;return r&&i.setAttribute("aria-selected","true"),e.disabled&&i.setAttribute("aria-disabled","true"),e.action&&(i.dataset.action=e.action),i.__adiaOption=e,i.addEventListener("click",this.#d),i};for(let e of this.#i)if(e.separator)this.#n.appendChild(t(e));else if(e.header){let i=document.createElement("div");i.setAttribute("data-menu-header",""),i.innerHTML=e.avatar?`<img src="${e.avatar}" alt="" /><div><strong>${Mt(e.label)}</strong><span>${Mt(e.description||"")}</span></div>`:`<div><strong>${Mt(e.label)}</strong><span>${Mt(e.description||"")}</span></div>`,this.#n.appendChild(i)}else if(e.options){let i=document.createElement("div");i.setAttribute("role","group"),i.innerHTML=`<div slot="group-label">${Mt(e.label)}</div>`;for(let n of e.options)i.appendChild(t(n));this.#n.appendChild(i)}else this.#n.appendChild(t(e));if(this.#i.length===0){let e=document.createElement("div");e.setAttribute("data-empty",""),e.textContent="No options",this.#n.appendChild(e)}this.#a&&this.#I()}#C(){if(!this.multiple)return!1;let t=this.#i.flatMap(i=>i.options||[i]).filter(i=>!i.disabled&&!i.separator&&!i.header&&i.value!=null);if(t.length===0)return!1;let e=new Set(this.#f());return t.every(i=>e.has(String(i.value)))}#M(){let t=this.querySelector('[slot="trigger"] [data-chips]');if(!t)return;let e=this.#f(),i=Number(this.maxChips)||0,n=i>0&&e.length>i?e.slice(0,i):e,r=i>0&&e.length>i?e.length-i:0,o=this.#i.flatMap(l=>l.options||[l]).filter(l=>!l.separator&&!l.header&&l.value!=null),a=l=>{let h=o.find(c=>String(c.value)===String(l));return h?h.label:String(l)};for(;t.firstChild;)t.removeChild(t.firstChild);for(let l of n){let h=document.createElement("tag-ui");h.setAttribute("size","sm"),!this.disabled&&!this.readonly&&h.setAttribute("removable",""),h.dataset.chipValue=String(l),h.setAttribute("text",a(l)),t.appendChild(h)}if(r>0){let l=document.createElement("button");l.type="button",l.dataset.more="",l.textContent=`+${r} more`,l.addEventListener("click",this.#b),t.appendChild(l)}}#E(){return this.multiple?this.value?"":this.placeholder:this.#i.flatMap(i=>i.options||[i]).find(i=>i.value===this.value||i.header&&i.label===this.value)?.label||this.value||this.placeholder}#P=t=>{this.disabled||this.#n&&t.composedPath().includes(this.#n)||(this.open=!this.open)};#R=t=>{!this.contains(t.target)&&!(this.#n&&t.composedPath().includes(this.#n))&&(this.open=!1)};#L=t=>{if(t.key==="Backspace"&&this.multiple&&!this.disabled&&!this.readonly){let e=t.target,i=e&&e.tagName==="INPUT"&&e.getAttribute("slot")==="display",n=!this.#a||this.#a.length===0;if((!i||n)&&this.#f().length>0){t.preventDefault(),this.#m();return}}if(t.key==="Escape"){if(this.searchable&&this.#a){this.#a="";let e=this.querySelector('input[slot="display"]');e&&(e.value=""),this.#I();return}this.open=!1;return}if(t.key==="Enter"){if(t.preventDefault(),this.open){let e=this.#n?.querySelector('[role="option"][data-focused]:not([data-filtered-out])');if(e)e.click(),this.multiple&&(this.open=!1);else if(this.searchable&&this.freeText&&this.#a){let i=this.#a;this.value=i,this.#a="",this.open=!1,this.syncValue?.(i),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))}else this.open=!1}else this.open=!0;return}if(t.key===" "&&!this.searchable){if(t.preventDefault(),this.open){let e=this.#n?.querySelector('[role="option"][data-focused]');e?e.click():this.multiple||(this.open=!1)}else this.open=!0;return}t.key==="ArrowDown"&&this.open&&(t.preventDefault(),this.#Q(1)),t.key==="ArrowUp"&&this.open&&(t.preventDefault(),this.#Q(-1))};#T=t=>{this.#a=t.target.value||"",this.open||(this.open=!0),this.#I()};#I(){if(!this.#n)return;let t=this.#a.toLowerCase(),e=this.#n.querySelectorAll('[role="option"]'),i=!1;for(let r of e){let o=(r.textContent||"").toLowerCase();!t||o.includes(t)?(r.removeAttribute("data-filtered-out"),r.style.display="",i=!0):(r.setAttribute("data-filtered-out",""),r.style.display="none")}for(let r of this.#n.querySelectorAll('[role="group"]')){let o=r.querySelectorAll('[role="option"]:not([data-filtered-out])').length;r.style.display=o?"":"none"}let n=this.#n.querySelector('[role="option"][data-focused]');n&&n.hasAttribute("data-filtered-out")&&n.removeAttribute("data-focused")}#Q(t){if(!this.#n)return;let e=[...this.#n.querySelectorAll('[role="option"]:not([aria-disabled]):not([data-filtered-out])')];if(!e.length)return;let i=this.#n.querySelector('[role="option"][data-focused]'),n=i?e.indexOf(i):-1,r=e[(n+t+e.length)%e.length];i&&i.removeAttribute("data-focused"),r&&(r.setAttribute("data-focused",""),r.scrollIntoView({block:"nearest"}))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#P),this.removeEventListener("keydown",this.#L),this.removeEventListener("remove",this.#g),this.#c?.disconnect(),this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#R),this.#o&&(this.#o.removeEventListener("input",this.#T),this.#o.removeEventListener("focus",this.#h),this.#o.removeEventListener("click",this.#u),this.#o=null),this.#r?.(),this.#r=null,this.#n?.hidePopover?.(),this.#n=null}};x("select-ui",dn);P();var fn=class extends k{static properties={value:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","radio"),this.getAttribute("tabindex")||this.setAttribute("tabindex","-1")}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.setAttribute("aria-checked",this.selected?"true":"false"),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),this.icon){let t=this.querySelector(":scope > icon-ui");if(!t||t.getAttribute("name")!==this.icon){t?.remove();let e=document.createElement("icon-ui");e.setAttribute("name",this.icon),e.setAttribute("aria-hidden","true"),this.prepend(e)}}else this.querySelector(":scope > icon-ui")?.remove()}};x("segment-ui",fn);var pn=class s extends Z{static properties={...Z.properties,value:{type:String,default:"",reflect:!0}};static template=()=>null;static#t=new WeakSet;#e=null;#i=!1;#s=null;#n=null;#r=null;connected(){if(super.connected(),this.setAttribute("role","radiogroup"),this.#i||(this.#i=!0,this.addEventListener("click",this.#h),this.addEventListener("keydown",this.#u)),!this.value){let t=this.querySelector("segment-ui:not([disabled])");t&&(this.value=t.value||t.getAttribute("value")||"")}typeof ResizeObserver<"u"&&(this.#n=new ResizeObserver(()=>this.#l(this.#a)),this.#n.observe(this)),document.fonts?.ready&&(this.#r=document.fonts.ready.then(()=>{this.#r=null,this.#l(this.#a)}))}disconnected(){super.disconnected(),this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#n?.disconnect(),this.#n=null,this.#r&&(this.#r=null),this.removeEventListener("click",this.#h),this.removeEventListener("keydown",this.#u),this.#e=null,this.#i=!1}get#a(){return[...this.querySelectorAll("segment-ui")]}get#o(){return this.#a.filter(t=>!t.disabled)}render(){if(!s.#t.has(this)){let e=[...this.children].find(i=>i.tagName!=="SEGMENT-UI"&&!i.hasAttribute("data-indicator")&&!(i.tagName==="SPAN"&&i.style.display==="contents"));e&&(s.#t.add(this),console.warn(`[segmented-ui] child <${e.tagName.toLowerCase()}> is not <segment-ui> \u2014 bare <segment> tags render text but receive no sliding indicator or aria-checked state. Use <segment-ui>.`))}let t=this.#a;if(t.length){for(let e of t){let n=(e.value||e.getAttribute("value")||"")===this.value;n?e.setAttribute("selected",""):e.removeAttribute("selected"),e.setAttribute("tabindex",n?"0":"-1")}this.label&&this.setAttribute("aria-label",this.label),this.#l(t)}}#l(t){let e=t.findIndex(n=>(n.value||n.getAttribute("value")||"")===this.value);if(e<0){this.removeAttribute("data-indicator-ready");return}let i=!this.#e||!this.contains(this.#e);if(i){for(let n of this.querySelectorAll(":scope > [data-indicator]"))n.remove();this.#e=document.createElement("span"),this.#e.setAttribute("data-indicator",""),this.prepend(this.#e)}this.style.setProperty("--_segment-count",`${t.length}`),i?(this.#e.style.transition="none",this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""),this.#s=requestAnimationFrame(()=>{this.#s=null,this.#e&&(this.#e.style.transition="")})):(this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""))}#c(t){t.disabled||(this.value=t.value,this.syncValue(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#h=t=>{let e=t.target.closest("segment-ui");e&&this.contains(e)&&this.#c(e)};#u=t=>{let e=t.target;if(e.tagName!=="SEGMENT-UI")return;let i=this.#o,n=i.indexOf(e);if(n<0)return;let r;switch(t.key){case"ArrowRight":case"ArrowDown":r=n<i.length-1?n+1:0;break;case"ArrowLeft":case"ArrowUp":r=n>0?n-1:i.length-1;break;case"Home":r=0;break;case"End":r=i.length-1;break;default:return}t.preventDefault(),i[r].focus(),this.#c(i[r])}};x("segmented-ui",pn);var mn=class extends Z{static labelDeprecated=!1;static properties={...Z.properties,value:{type:Number,default:0,reflect:!0},min:{type:Number,default:0,reflect:!0},max:{type:Number,default:100,reflect:!0},step:{type:Number,default:1,reflect:!0},label:{type:String,default:"",reflect:!0},suffix:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=0;#n=0;connected(){if(super.connected(),this.setAttribute("role","spinbutton"),this.setAttribute("tabindex","0"),!this.querySelector('[slot="field"]')){let t=`
133
+ `,this.hint&&this.setAttribute("aria-describedby",r);let a=this.querySelector("[data-clear-all]");a&&(a.removeEventListener("click",this.#y),a.addEventListener("click",this.#y)),this.searchable&&(this.#o&&(this.#o.removeEventListener("input",this.#T),this.#o.removeEventListener("focus",this.#h),this.#o.removeEventListener("click",this.#u)),this.#o=this.querySelector('input[slot="display"]'),this.#o&&(this.#o.addEventListener("input",this.#T),this.#o.addEventListener("focus",this.#h),this.#o.addEventListener("click",this.#u))),e&&this.appendChild(e)}this.#A(),this.multiple&&this.#M();let t=this.querySelector("[data-clear-all]");if(t&&(this.multiple&&this.clearable&&this.#f().length>0&&!this.disabled&&!this.readonly?t.removeAttribute("hidden"):t.setAttribute("hidden","")),this.#n||(this.#n=this.querySelector('[slot="listbox"]'),this.#n||(this.#n=document.createElement("div"),this.#n.setAttribute("slot","listbox"),this.#n.setAttribute("role","listbox"),this.#n.setAttribute("popover","manual"),this.appendChild(this.#n)),this.#$()),this.#n){let e=this.multiple?new Set(this.value.split(",").map(i=>i.trim()).filter(Boolean)):null;for(let i of this.#n.querySelectorAll('[role="option"]')){let n=i.getAttribute("data-value");(e?e.has(n):n===this.value)?i.setAttribute("aria-selected","true"):i.removeAttribute("aria-selected")}}if(this.setAttribute("aria-expanded",String(this.open)),this.open){this.#n?.showPopover?.();let e=this.querySelector('[slot="trigger"]')||this;this.#n.style.minWidth=`${e.getBoundingClientRect().width}px`,this.#n.style.width="max-content",this.#r=lt(e,this.#n,{placement:this.getAttribute("placement")||"bottom-start",gap:4,matchWidth:!1}),this.#l=requestAnimationFrame(()=>{this.#l=null,document.addEventListener("pointerdown",this.#R,{once:!0})})}else this.#r?.(),this.#r=null,this.#n?.hidePopover?.(),this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#R)}#v(){let t=[],e=i=>{for(let n of i.children)if(!n.hasAttribute("slot")){if(n.tagName==="OPTION"||n.tagName==="OPTGROUP"){t.push(n);continue}if(n.matches('[role="presentation"]')||n.style?.display==="contents"){e(n);continue}t.push(n)}};return e(this),t}#w(){this.#i=[];let t=new Set,e=[];for(let i of this.#v())if(i.tagName==="OPTGROUP"){let n={label:i.label||i.getAttribute("label")||"",options:[]};for(let r of i.querySelectorAll("option"))n.options.push({value:r.value,label:r.textContent.trim(),disabled:r.disabled,icon:r.getAttribute("icon")||"",avatar:r.getAttribute("avatar")||""}),r.hasAttribute("selected")&&e.push(r.value);this.#i.push(n)}else i.tagName==="OPTION"?(this.#i.push({value:i.value,label:i.textContent.trim(),disabled:i.disabled,icon:i.getAttribute("icon")||"",avatar:i.getAttribute("avatar")||""}),i.hasAttribute("selected")&&e.push(i.value)):i.hasAttribute("slot")||t.add(i.tagName.toLowerCase());for(let i of[...this.querySelectorAll("option, optgroup")])i.remove();!this.value&&e.length&&(this.value=this.multiple?e.join(","):e[0]),t.size>0&&!s.#t.has(this)&&(s.#t.add(this),console.warn(`<select-ui>: ignoring unrecognized child element(s) [${[...t].join(", ")}]. Consumer-authored children must be native <option> or <optgroup>, NOT <select-option> or other <*-ui> shapes. Or set element.options = [...] programmatically. (Once-per-element warn; see select.yaml usage: for details.)`))}set options(t){Lt(()=>{this.#i=t,this.#n||(this.#n=this.querySelector('[slot="listbox"]'),this.#n||(this.#n=document.createElement("div"),this.#n.setAttribute("slot","listbox"),this.#n.setAttribute("role","listbox"),this.#n.setAttribute("popover","manual"),this.appendChild(this.#n))),this.#$();let e=this.querySelector('[slot="display"]');e&&(e.textContent=this.#E())})}get options(){return this.#i}static#k(t){return t?t.avatar?`<img data-option-avatar src="${Mt(t.avatar)}" alt="" />`:t.icon?`<icon-ui name="${Mt(t.icon)}"></icon-ui>`:"":""}#A(){if(this.multiple||!this.#s)return;let t=this.querySelector('[slot="trigger"]');if(!t)return;let i=this.#i.flatMap(c=>c.options||[c]).find(c=>!c.header&&!c.separator&&c.value===this.value),n=i&&i.avatar||this.avatar||"",r=i&&i.icon||this.icon||"",o=t.querySelector(":scope > [data-select-leading]"),a="";if(n?a=`<img slot="leading" data-select-leading src="${Mt(n)}" alt="" />`:r&&(a=`<icon-ui slot="leading" data-select-leading name="${Mt(r)}"></icon-ui>`),!a){o?.remove();return}let l=document.createElement("template");l.innerHTML=a;let h=l.content.firstElementChild;o?o.tagName===h.tagName?h.tagName==="IMG"?o.getAttribute("src")!==h.getAttribute("src")&&o.setAttribute("src",h.getAttribute("src")):o.getAttribute("name")!==h.getAttribute("name")&&o.setAttribute("name",h.getAttribute("name")):o.replaceWith(h):t.insertBefore(h,t.firstChild)}#$(){if(!this.#n)return;if(this.#n.innerHTML="",this.multiple?this.#n.setAttribute("aria-multiselectable","true"):this.#n.removeAttribute("aria-multiselectable"),this.multiple&&this.selectAll){let e=document.createElement("div");e.setAttribute("data-select-all","");let i=document.createElement("button-ui");i.setAttribute("variant","ghost"),i.setAttribute("size","xs"),i.dataset.selectAllBtn="",i.setAttribute("text",this.#C()?"Clear":"Select all"),i.addEventListener("click",this.#O),e.appendChild(i),this.#n.appendChild(e)}let t=e=>{if(e.separator){let a=document.createElement("hr");return a.setAttribute("data-separator",""),a}let i=document.createElement("div");i.setAttribute("role","option"),i.setAttribute("data-value",e.value||"");let n=this.multiple?new Set(this.value.split(",").map(a=>a.trim()).filter(Boolean)):null,r=n?n.has(e.value):e.value===this.value,o=s.#k(e);if(this.multiple){i.setAttribute("data-multi-option","");let a=document.createElement("span");a.setAttribute("data-checkbox",""),a.innerHTML='<icon-ui name="check" aria-hidden="true"></icon-ui>',i.appendChild(a);let l=document.createElement("span");l.setAttribute("data-option-label",""),o?l.innerHTML=`${o}${Mt(e.label)}`:l.textContent=e.label,i.appendChild(l)}else o?i.innerHTML=`${o}${Mt(e.label)}`:i.textContent=e.label;return r&&i.setAttribute("aria-selected","true"),e.disabled&&i.setAttribute("aria-disabled","true"),e.action&&(i.dataset.action=e.action),i.__adiaOption=e,i.addEventListener("click",this.#d),i};for(let e of this.#i)if(e.separator)this.#n.appendChild(t(e));else if(e.header){let i=document.createElement("div");i.setAttribute("data-menu-header",""),i.innerHTML=e.avatar?`<img src="${e.avatar}" alt="" /><div><strong>${Mt(e.label)}</strong><span>${Mt(e.description||"")}</span></div>`:`<div><strong>${Mt(e.label)}</strong><span>${Mt(e.description||"")}</span></div>`,this.#n.appendChild(i)}else if(e.options){let i=document.createElement("div");i.setAttribute("role","group"),i.innerHTML=`<div slot="group-label">${Mt(e.label)}</div>`;for(let n of e.options)i.appendChild(t(n));this.#n.appendChild(i)}else this.#n.appendChild(t(e));if(this.#i.length===0){let e=document.createElement("div");e.setAttribute("data-empty",""),e.textContent="No options",this.#n.appendChild(e)}this.#a&&this.#I()}#C(){if(!this.multiple)return!1;let t=this.#i.flatMap(i=>i.options||[i]).filter(i=>!i.disabled&&!i.separator&&!i.header&&i.value!=null);if(t.length===0)return!1;let e=new Set(this.#f());return t.every(i=>e.has(String(i.value)))}#M(){let t=this.querySelector('[slot="trigger"] [data-chips]');if(!t)return;let e=this.#f(),i=Number(this.maxChips)||0,n=i>0&&e.length>i?e.slice(0,i):e,r=i>0&&e.length>i?e.length-i:0,o=this.#i.flatMap(l=>l.options||[l]).filter(l=>!l.separator&&!l.header&&l.value!=null),a=l=>{let h=o.find(c=>String(c.value)===String(l));return h?h.label:String(l)};for(;t.firstChild;)t.removeChild(t.firstChild);for(let l of n){let h=document.createElement("tag-ui");h.setAttribute("size","sm"),!this.disabled&&!this.readonly&&h.setAttribute("removable",""),h.dataset.chipValue=String(l),h.setAttribute("text",a(l)),t.appendChild(h)}if(r>0){let l=document.createElement("button-ui");l.setAttribute("variant","ghost"),l.setAttribute("size","xs"),l.dataset.more="",l.setAttribute("text",`+${r} more`),l.addEventListener("click",this.#b),t.appendChild(l)}}#E(){return this.multiple?this.value?"":this.placeholder:this.#i.flatMap(i=>i.options||[i]).find(i=>i.value===this.value||i.header&&i.label===this.value)?.label||this.value||this.placeholder}#P=t=>{this.disabled||this.#n&&t.composedPath().includes(this.#n)||(this.open=!this.open)};#R=t=>{!this.contains(t.target)&&!(this.#n&&t.composedPath().includes(this.#n))&&(this.open=!1)};#L=t=>{if(t.key==="Backspace"&&this.multiple&&!this.disabled&&!this.readonly){let e=t.target,i=e&&e.tagName==="INPUT"&&e.getAttribute("slot")==="display",n=!this.#a||this.#a.length===0;if((!i||n)&&this.#f().length>0){t.preventDefault(),this.#m();return}}if(t.key==="Escape"){if(this.searchable&&this.#a){this.#a="";let e=this.querySelector('input[slot="display"]');e&&(e.value=""),this.#I();return}this.open=!1;return}if(t.key==="Enter"){if(t.preventDefault(),this.open){let e=this.#n?.querySelector('[role="option"][data-focused]:not([data-filtered-out])');if(e)e.click(),this.multiple&&(this.open=!1);else if(this.searchable&&this.freeText&&this.#a){let i=this.#a;this.value=i,this.#a="",this.open=!1,this.syncValue?.(i),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))}else this.open=!1}else this.open=!0;return}if(t.key===" "&&!this.searchable){if(t.preventDefault(),this.open){let e=this.#n?.querySelector('[role="option"][data-focused]');e?e.click():this.multiple||(this.open=!1)}else this.open=!0;return}t.key==="ArrowDown"&&this.open&&(t.preventDefault(),this.#Q(1)),t.key==="ArrowUp"&&this.open&&(t.preventDefault(),this.#Q(-1))};#T=t=>{this.#a=t.target.value||"",this.open||(this.open=!0),this.#I()};#I(){if(!this.#n)return;let t=this.#a.toLowerCase(),e=this.#n.querySelectorAll('[role="option"]'),i=!1;for(let r of e){let o=(r.textContent||"").toLowerCase();!t||o.includes(t)?(r.removeAttribute("data-filtered-out"),r.style.display="",i=!0):(r.setAttribute("data-filtered-out",""),r.style.display="none")}for(let r of this.#n.querySelectorAll('[role="group"]')){let o=r.querySelectorAll('[role="option"]:not([data-filtered-out])').length;r.style.display=o?"":"none"}let n=this.#n.querySelector('[role="option"][data-focused]');n&&n.hasAttribute("data-filtered-out")&&n.removeAttribute("data-focused")}#Q(t){if(!this.#n)return;let e=[...this.#n.querySelectorAll('[role="option"]:not([aria-disabled]):not([data-filtered-out])')];if(!e.length)return;let i=this.#n.querySelector('[role="option"][data-focused]'),n=i?e.indexOf(i):-1,r=e[(n+t+e.length)%e.length];i&&i.removeAttribute("data-focused"),r&&(r.setAttribute("data-focused",""),r.scrollIntoView({block:"nearest"}))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#P),this.removeEventListener("keydown",this.#L),this.removeEventListener("remove",this.#g),this.#c?.disconnect(),this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#R),this.#o&&(this.#o.removeEventListener("input",this.#T),this.#o.removeEventListener("focus",this.#h),this.#o.removeEventListener("click",this.#u),this.#o=null),this.#r?.(),this.#r=null,this.#n?.hidePopover?.(),this.#n=null}};x("select-ui",dn);P();var fn=class extends k{static properties={value:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","radio"),this.getAttribute("tabindex")||this.setAttribute("tabindex","-1")}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.setAttribute("aria-checked",this.selected?"true":"false"),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),this.icon){let t=this.querySelector(":scope > icon-ui");if(!t||t.getAttribute("name")!==this.icon){t?.remove();let e=document.createElement("icon-ui");e.setAttribute("name",this.icon),e.setAttribute("aria-hidden","true"),this.prepend(e)}}else this.querySelector(":scope > icon-ui")?.remove()}};x("segment-ui",fn);var pn=class s extends Z{static properties={...Z.properties,value:{type:String,default:"",reflect:!0}};static template=()=>null;static#t=new WeakSet;#e=null;#i=!1;#s=null;#n=null;#r=null;connected(){if(super.connected(),this.setAttribute("role","radiogroup"),this.#i||(this.#i=!0,this.addEventListener("click",this.#h),this.addEventListener("keydown",this.#u)),!this.value){let t=this.querySelector("segment-ui:not([disabled])");t&&(this.value=t.value||t.getAttribute("value")||"")}typeof ResizeObserver<"u"&&(this.#n=new ResizeObserver(()=>this.#l(this.#a)),this.#n.observe(this)),document.fonts?.ready&&(this.#r=document.fonts.ready.then(()=>{this.#r=null,this.#l(this.#a)}))}disconnected(){super.disconnected(),this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#n?.disconnect(),this.#n=null,this.#r&&(this.#r=null),this.removeEventListener("click",this.#h),this.removeEventListener("keydown",this.#u),this.#e=null,this.#i=!1}get#a(){return[...this.querySelectorAll("segment-ui")]}get#o(){return this.#a.filter(t=>!t.disabled)}render(){if(!s.#t.has(this)){let e=[...this.children].find(i=>i.tagName!=="SEGMENT-UI"&&!i.hasAttribute("data-indicator")&&!(i.tagName==="SPAN"&&i.style.display==="contents"));e&&(s.#t.add(this),console.warn(`[segmented-ui] child <${e.tagName.toLowerCase()}> is not <segment-ui> \u2014 bare <segment> tags render text but receive no sliding indicator or aria-checked state. Use <segment-ui>.`))}let t=this.#a;if(t.length){for(let e of t){let n=(e.value||e.getAttribute("value")||"")===this.value;n?e.setAttribute("selected",""):e.removeAttribute("selected"),e.setAttribute("tabindex",n?"0":"-1")}this.label&&this.setAttribute("aria-label",this.label),this.#l(t)}}#l(t){let e=t.findIndex(n=>(n.value||n.getAttribute("value")||"")===this.value);if(e<0){this.removeAttribute("data-indicator-ready");return}let i=!this.#e||!this.contains(this.#e);if(i){for(let n of this.querySelectorAll(":scope > [data-indicator]"))n.remove();this.#e=document.createElement("span"),this.#e.setAttribute("data-indicator",""),this.prepend(this.#e)}this.style.setProperty("--_segment-count",`${t.length}`),i?(this.#e.style.transition="none",this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""),this.#s=requestAnimationFrame(()=>{this.#s=null,this.#e&&(this.#e.style.transition="")})):(this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""))}#c(t){t.disabled||(this.value=t.value,this.syncValue(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#h=t=>{let e=t.target.closest("segment-ui");e&&this.contains(e)&&this.#c(e)};#u=t=>{let e=t.target;if(e.tagName!=="SEGMENT-UI")return;let i=this.#o,n=i.indexOf(e);if(n<0)return;let r;switch(t.key){case"ArrowRight":case"ArrowDown":r=n<i.length-1?n+1:0;break;case"ArrowLeft":case"ArrowUp":r=n>0?n-1:i.length-1;break;case"Home":r=0;break;case"End":r=i.length-1;break;default:return}t.preventDefault(),i[r].focus(),this.#c(i[r])}};x("segmented-ui",pn);var mn=class extends Z{static labelDeprecated=!1;static properties={...Z.properties,value:{type:Number,default:0,reflect:!0},min:{type:Number,default:0,reflect:!0},max:{type:Number,default:100,reflect:!0},step:{type:Number,default:1,reflect:!0},label:{type:String,default:"",reflect:!0},suffix:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=0;#n=0;connected(){if(super.connected(),this.setAttribute("role","spinbutton"),this.setAttribute("tabindex","0"),!this.querySelector('[slot="field"]')){let t=`
136
134
  <span slot="label">${this.label}</span>
137
135
  <span slot="value">${this.#r(this.value)}</span>
138
136
  ${this.suffix?`<span slot="suffix">${this.suffix}</span>`:""}
@@ -147,7 +145,7 @@ parent-template-re-read pattern that works across frameworks.`);return}if(this.d
147
145
  <select-ui slot="model" placeholder="Model" aria-label="Select model" divider></select-ui>
148
146
  <button-ui icon="paper-plane-right" variant="ghost" slot="send" aria-label="Send message"></button-ui>
149
147
  </div>
150
- `),this.#t=this.querySelector("textarea-ui"),this.#e=this.querySelector('[slot="send"]'),this.#i=this.querySelector('[slot="model"]'),this.#e&&!this.#e.hasAttribute("aria-label")&&this.#e.setAttribute("aria-label","Send message"),this.#i&&!this.#i.hasAttribute("aria-label")&&this.#i.setAttribute("aria-label","Select model"),this.#n.length&&this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model));let t=this.querySelector('[slot="toolbar"]');if(t&&!t.querySelector('[slot="attach"]')){this.#o=document.createElement("input"),this.#o.type="file",this.#o.accept="image/*",this.#o.multiple=!0,this.#o.style.display="none",this.appendChild(this.#o),this.#s=document.createElement("button-ui"),this.#s.setAttribute("icon","image"),this.#s.setAttribute("variant","ghost"),this.#s.setAttribute("slot","attach"),this.#s.setAttribute("size","sm"),this.#s.setAttribute("aria-label","Attach image");let e=t.querySelector('[slot="send"]');t.insertBefore(this.#s,e),this.#s.addEventListener("press",this.#c),this.#o.addEventListener("change",this.#h)}this.#a=document.createElement("div"),this.#a.setAttribute("slot","preview"),this.#a.hidden=!0,this.insertBefore(this.#a,this.querySelector('[slot="toolbar"]')),this.addEventListener("paste",this.#p),this.#e?.addEventListener("press",this.#f),this.#t?.addEventListener("submit",this.#f),this.#i?.addEventListener("change",this.#d),this.addEventListener("pointerdown",this.#u)}render(){this.#t&&(this.#t.disabled=this.disabled,this.#t.placeholder=this.placeholder),this.#e&&(this.#e.disabled=this.disabled||this.loading),this.#i&&this.model&&this.#i.value!==this.model&&(this.#i.value=this.model)}#u=t=>{t.target.closest("button-ui, select-ui, input-ui, a")||(this.#l=requestAnimationFrame(()=>{this.#l=null,this.#t?.focus()}))};#d=()=>{this.model=this.#i?.value||""};#f=()=>{if(this.disabled||this.loading)return;let t=this.value;!t&&!this.#r.length||this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,detail:{text:t,model:this.model,attachments:this.attachments}}))};#p=t=>{let e=t.clipboardData?.items;if(!e)return;let i=[...e].filter(r=>r.type.startsWith("image/"));if(i.length===0)return;t.preventDefault();let n=i.map(r=>r.getAsFile()).filter(Boolean);n.length&&this.#m(n)};#m(t){for(let e of t){let i=new FileReader;i.onload=()=>{this.#r.push({type:"image",dataUrl:i.result,name:e.name}),this.#b()},i.readAsDataURL(e)}}#g(t){this.#r.splice(t,1),this.#b()}#b(){this.#a&&(this.#a.innerHTML="",this.#a.hidden=this.#r.length===0,this.#r.forEach((t,e)=>{let i=document.createElement("div");i.setAttribute("data-preview-item","");let n=document.createElement("img");n.src=t.dataUrl,n.alt=t.name||"attachment";let r=document.createElement("button");r.textContent="\xD7",r.setAttribute("data-preview-remove",""),r.addEventListener("click",()=>this.#g(e)),i.appendChild(n),i.appendChild(r),this.#a.appendChild(i)}))}clear(){this.#t?.clear(),this.#r=[],this.#a&&(this.#a.innerHTML="",this.#a.hidden=!0)}focus(){this.#t?.focus()}disconnected(){this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),this.removeEventListener("paste",this.#p),this.#e?.removeEventListener("press",this.#f),this.#t?.removeEventListener("submit",this.#f),this.#i?.removeEventListener("change",this.#d),this.#s?.removeEventListener("press",this.#c),this.#o?.removeEventListener("change",this.#h),this.removeEventListener("pointerdown",this.#u),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#a=null,this.#o=null}};customElements.define("chat-input-ui",ba);var BA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},ob=s=>s.replace(/[&<>"]/g,t=>BA[t]);function xn(s){let t=s.split(`
148
+ `),this.#t=this.querySelector("textarea-ui"),this.#e=this.querySelector('[slot="send"]'),this.#i=this.querySelector('[slot="model"]'),this.#e&&!this.#e.hasAttribute("aria-label")&&this.#e.setAttribute("aria-label","Send message"),this.#i&&!this.#i.hasAttribute("aria-label")&&this.#i.setAttribute("aria-label","Select model"),this.#n.length&&this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model));let t=this.querySelector('[slot="toolbar"]');if(t&&!t.querySelector('[slot="attach"]')){this.#o=document.createElement("input"),this.#o.type="file",this.#o.accept="image/*",this.#o.multiple=!0,this.#o.style.display="none",this.appendChild(this.#o),this.#s=document.createElement("button-ui"),this.#s.setAttribute("icon","image"),this.#s.setAttribute("variant","ghost"),this.#s.setAttribute("slot","attach"),this.#s.setAttribute("size","sm"),this.#s.setAttribute("aria-label","Attach image");let e=t.querySelector('[slot="send"]');t.insertBefore(this.#s,e),this.#s.addEventListener("press",this.#c),this.#o.addEventListener("change",this.#h)}this.#a=document.createElement("div"),this.#a.setAttribute("slot","preview"),this.#a.hidden=!0,this.insertBefore(this.#a,this.querySelector('[slot="toolbar"]')),this.addEventListener("paste",this.#p),this.#e?.addEventListener("press",this.#f),this.#t?.addEventListener("submit",this.#f),this.#i?.addEventListener("change",this.#d),this.addEventListener("pointerdown",this.#u)}render(){this.#t&&(this.#t.disabled=this.disabled,this.#t.placeholder=this.placeholder),this.#e&&(this.#e.disabled=this.disabled||this.loading),this.#i&&this.model&&this.#i.value!==this.model&&(this.#i.value=this.model)}#u=t=>{t.target.closest("button-ui, select-ui, input-ui, a")||(this.#l=requestAnimationFrame(()=>{this.#l=null,this.#t?.focus()}))};#d=()=>{this.model=this.#i?.value||""};#f=()=>{if(this.disabled||this.loading)return;let t=this.value;!t&&!this.#r.length||this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,detail:{text:t,model:this.model,attachments:this.attachments}}))};#p=t=>{let e=t.clipboardData?.items;if(!e)return;let i=[...e].filter(r=>r.type.startsWith("image/"));if(i.length===0)return;t.preventDefault();let n=i.map(r=>r.getAsFile()).filter(Boolean);n.length&&this.#m(n)};#m(t){for(let e of t){let i=new FileReader;i.onload=()=>{this.#r.push({type:"image",dataUrl:i.result,name:e.name}),this.#b()},i.readAsDataURL(e)}}#g(t){this.#r.splice(t,1),this.#b()}#b(){this.#a&&(this.#a.innerHTML="",this.#a.hidden=this.#r.length===0,this.#r.forEach((t,e)=>{let i=document.createElement("div");i.setAttribute("data-preview-item","");let n=document.createElement("img");n.src=t.dataUrl,n.alt=t.name||"attachment";let r=document.createElement("button-ui");r.setAttribute("variant","ghost"),r.setAttribute("size","xs"),r.setAttribute("icon","x"),r.setAttribute("aria-label",`Remove ${t.name||"attachment"}`),r.setAttribute("data-preview-remove",""),r.addEventListener("click",()=>this.#g(e)),i.appendChild(n),i.appendChild(r),this.#a.appendChild(i)}))}clear(){this.#t?.clear(),this.#r=[],this.#a&&(this.#a.innerHTML="",this.#a.hidden=!0)}focus(){this.#t?.focus()}disconnected(){this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),this.removeEventListener("paste",this.#p),this.#e?.removeEventListener("press",this.#f),this.#t?.removeEventListener("submit",this.#f),this.#i?.removeEventListener("change",this.#d),this.#s?.removeEventListener("press",this.#c),this.#o?.removeEventListener("change",this.#h),this.removeEventListener("pointerdown",this.#u),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#a=null,this.#o=null}};customElements.define("chat-input-ui",ba);var BA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},ob=s=>s.replace(/[&<>"]/g,t=>BA[t]);function xn(s){let t=s.split(`
151
149
  `),e=[],i=0;for(;i<t.length;){let n=t[i],r=n.match(/^```(\w*)/);if(r){let l=r[1],h=[];for(i++;i<t.length&&!t[i].startsWith("```");)h.push(ob(t[i])),i++;i++;let c=h.join(`
152
150
  `);e.push(l?`<code-ui language="${l}">${c}</code-ui>`:`<pre><code>${c}</code></pre>`);continue}if(!n.trim()){i++;continue}let o=n.match(/^(#{1,6})\s+(.+)/);if(o){let l=o[1].length;e.push(`<h${l}>${vn(o[2])}</h${l}>`),i++;continue}if(/^[-*]\s/.test(n)){let l=[];for(;i<t.length&&/^[-*]\s/.test(t[i]);)l.push(`<li>${vn(t[i].replace(/^[-*]\s/,""))}</li>`),i++;e.push(`<ul>${l.join("")}</ul>`);continue}if(/^\d+\.\s/.test(n)){let l=[];for(;i<t.length&&/^\d+\.\s/.test(t[i]);)l.push(`<li>${vn(t[i].replace(/^\d+\.\s/,""))}</li>`),i++;e.push(`<ol>${l.join("")}</ol>`);continue}let a=[];for(;i<t.length&&t[i].trim()&&!/^```|^#{1,6}\s|^[-*]\s|^\d+\.\s/.test(t[i]);)a.push(t[i]),i++;e.push(`<p>${vn(a.join(" "))}</p>`)}return e.join(`
153
151
  `)}var zA=s=>`\0CODE${s}\0`,VA=/\0CODE(\d+)\0/g;function vn(s){let t=ob(s),e=[],i=t.replace(/`([^`]+)`/g,(n,r)=>{let o=e.length;return e.push(r),zA(o)});return i=i.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/_(.+?)_/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),i=i.replace(VA,(n,r)=>`<code>${e[Number(r)]}</code>`),i}P();function jA(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Sn=class extends k{static properties={streaming:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=null;#i=null;#s=null;get messages(){return[...this.#t]}connected(){!this.querySelector("header")&&!this.querySelector("section")&&(this.innerHTML=`
@@ -183,14 +181,14 @@ parent-template-re-read pattern that works across frameworks.`);return}if(this.d
183
181
  <span slot="label"></span>
184
182
  <span slot="description"></span>
185
183
  <span slot="time"></span>
186
- `)}render(){let t=this.querySelector(':scope > [slot="label"]'),e=this.querySelector(':scope > [slot="description"]'),i=this.querySelector(':scope > [slot="time"]');if(t&&(t.textContent=this.text),e&&(e.textContent=this.description),i&&(i.textContent=this.duration||this.time),this.icon){let r=this.querySelector(':scope > [slot="icon"]');r||(r=document.createElement("icon-ui"),r.setAttribute("slot","icon"),this.prepend(r)),r.setAttribute("name",this.icon)}else this.querySelector(':scope > [slot="icon"]')?.remove();let n=this.querySelector(':scope > [slot="outcomes"]');if(this.#t.length>0){n||(n=document.createElement("ul"),n.setAttribute("slot","outcomes"),this.appendChild(n)),n.innerHTML="";for(let a of this.#t){let l=document.createElement("li");l.textContent=a,n.appendChild(l)}n.hidden=!this.#e;let r=this.querySelector(":scope > [data-timeline-toggle]");r||(r=document.createElement("button"),r.type="button",r.setAttribute("data-timeline-toggle",""),r.setAttribute("aria-label","Toggle details"),r.addEventListener("click",a=>{a.stopPropagation(),this.#e=!this.#e,this.render(),this.dispatchEvent(new CustomEvent("timeline-toggle",{bubbles:!0,detail:{expanded:this.#e}}))}),this.appendChild(r)),r.innerHTML="";let o=document.createElement("icon-ui");o.setAttribute("name",this.#e?"caret-down":"caret-right"),o.setAttribute("color","muted"),o.setAttribute("size","sm"),r.appendChild(o)}else this.querySelector(":scope > [data-timeline-toggle]")?.remove(),n?.remove()}};x("timeline-ui",qn),x("timeline-item-ui",Nn);P();var Bn=class extends k{static properties={step:{type:Number,default:0,reflect:!0},orientation:{type:String,default:"horizontal",reflect:!0}};static template=()=>null;render(){let t=[...this.querySelectorAll("stepper-item-ui")];for(let i of t)i.removeAttribute("data-last");let e=t[t.length-1];e&&e.setAttribute("data-last",""),t.forEach((i,n)=>{i.setAttribute("data-index",n),n<this.step?i.setAttribute("status","completed"):n===this.step?i.setAttribute("status","active"):i.setAttribute("status","idle")})}next(){let t=this.querySelectorAll("stepper-item-ui").length;this.step<t-1&&this.step++}prev(){this.step>0&&this.step--}goTo(t){let e=this.querySelectorAll("stepper-item-ui").length-1;this.step=Math.max(0,Math.min(t,e))}},zn=class extends k{static properties={text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},status:{type:String,default:"idle",reflect:!0}};static template=()=>null;connected(){this.querySelector('[slot="label"]')||(this.innerHTML=`
184
+ `)}render(){let t=this.querySelector(':scope > [slot="label"]'),e=this.querySelector(':scope > [slot="description"]'),i=this.querySelector(':scope > [slot="time"]');if(t&&(t.textContent=this.text),e&&(e.textContent=this.description),i&&(i.textContent=this.duration||this.time),this.icon){let r=this.querySelector(':scope > [slot="icon"]');r||(r=document.createElement("icon-ui"),r.setAttribute("slot","icon"),this.prepend(r)),r.setAttribute("name",this.icon)}else this.querySelector(':scope > [slot="icon"]')?.remove();let n=this.querySelector(':scope > [slot="outcomes"]');if(this.#t.length>0){n||(n=document.createElement("ul"),n.setAttribute("slot","outcomes"),this.appendChild(n)),n.innerHTML="";for(let o of this.#t){let a=document.createElement("li");a.textContent=o,n.appendChild(a)}n.hidden=!this.#e;let r=this.querySelector(":scope > [data-timeline-toggle]");r||(r=document.createElement("button-ui"),r.setAttribute("variant","ghost"),r.setAttribute("size","xs"),r.setAttribute("data-timeline-toggle",""),r.setAttribute("aria-label","Toggle details"),r.addEventListener("click",o=>{o.stopPropagation(),this.#e=!this.#e,this.render(),this.dispatchEvent(new CustomEvent("timeline-toggle",{bubbles:!0,detail:{expanded:this.#e}}))}),this.appendChild(r)),r.setAttribute("icon",this.#e?"caret-down":"caret-right")}else this.querySelector(":scope > [data-timeline-toggle]")?.remove(),n?.remove()}};x("timeline-ui",qn),x("timeline-item-ui",Nn);P();var Bn=class extends k{static properties={step:{type:Number,default:0,reflect:!0},orientation:{type:String,default:"horizontal",reflect:!0}};static template=()=>null;render(){let t=[...this.querySelectorAll("stepper-item-ui")];for(let i of t)i.removeAttribute("data-last");let e=t[t.length-1];e&&e.setAttribute("data-last",""),t.forEach((i,n)=>{i.setAttribute("data-index",n),n<this.step?i.setAttribute("status","completed"):n===this.step?i.setAttribute("status","active"):i.setAttribute("status","idle")})}next(){let t=this.querySelectorAll("stepper-item-ui").length;this.step<t-1&&this.step++}prev(){this.step>0&&this.step--}goTo(t){let e=this.querySelectorAll("stepper-item-ui").length-1;this.step=Math.max(0,Math.min(t,e))}},zn=class extends k{static properties={text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},status:{type:String,default:"idle",reflect:!0}};static template=()=>null;connected(){this.querySelector('[slot="label"]')||(this.innerHTML=`
187
185
  <span slot="label"></span>
188
186
  <span slot="description"></span>
189
187
  `)}render(){let t=this.querySelector('[slot="label"]'),e=this.querySelector('[slot="description"]');if(t&&(t.textContent=this.text),e&&(e.textContent=this.description),this.icon){let i=this.querySelector('[slot="icon"]');i||(i=document.createElement("icon-ui"),i.setAttribute("slot","icon"),this.prepend(i)),i.setAttribute("name",this.icon)}else this.querySelector('[slot="icon"]')?.remove()}};x("stepper-ui",Bn),x("stepper-item-ui",zn);P();var Vn=class extends k{static properties={autoplay:{type:Boolean,default:!1,reflect:!0},interval:{type:Number,default:5e3,reflect:!0},noPauseOnHover:{type:Boolean,default:!1,reflect:!0,attribute:"no-pause-on-hover"},loop:{type:Boolean,default:!1,reflect:!0},peek:{type:Boolean,default:!1,reflect:!0},snap:{type:String,default:"start",reflect:!0},gap:{type:String,default:"",reflect:!0},slidesPerView:{type:String,default:"",reflect:!0,attribute:"slides-per-view"},chrome:{type:String,default:"default",reflect:!0},label:{type:String,default:""},counter:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=0;#r=!1;#a=!1;#o=null;get slides(){return this.#t?[...this.#t.children]:[]}get activeIndex(){return this.#n}connected(){if(!this.#t){for(this.#t=document.createElement("div"),this.#t.setAttribute("data-swiper-track","");this.firstChild;)this.#t.appendChild(this.firstChild);this.appendChild(this.#t)}this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),this.getAttribute("aria-label")||this.setAttribute("aria-label","Carousel"),this.#l(),this.#c(),this.#g(),this.#r||(this.#r=!0,this.noPauseOnHover||(this.addEventListener("pointerenter",this.#v),this.addEventListener("pointerleave",this.#w),this.addEventListener("focusin",this.#k),this.addEventListener("focusout",this.#A)),this.addEventListener("keydown",this.#$),this.#t.addEventListener("pointerdown",this.#M),this.#t.addEventListener("pointermove",this.#E),this.#t.addEventListener("pointerup",this.#P),this.#t.addEventListener("pointercancel",this.#P),this.#t.addEventListener("click",this.#R,!0),this.#t.addEventListener("dragstart",this.#L)),this.autoplay&&this.play()}render(){if(this.gap&&this.#t){let e=/^[0-9]+$/.test(this.gap)?`var(--a-space-${this.gap})`:this.gap;this.style.setProperty("--swiper-gap",e)}}disconnected(){this.pause(),this.#i?.disconnect(),this.#i=null,this.#t&&this.#s&&this.#t.removeEventListener("scroll",this.#s),this.#s=null,this.removeEventListener("pointerenter",this.#v),this.removeEventListener("pointerleave",this.#w),this.removeEventListener("focusin",this.#k),this.removeEventListener("focusout",this.#A),this.removeEventListener("keydown",this.#$),this.#t&&(this.#t.removeEventListener("pointerdown",this.#M),this.#t.removeEventListener("pointermove",this.#E),this.#t.removeEventListener("pointerup",this.#P),this.#t.removeEventListener("pointercancel",this.#P),this.#t.removeEventListener("click",this.#R,!0),this.#t.removeEventListener("dragstart",this.#L)),this.#o=null,this.#t=null,this.#r=!1}next(){let t=this.#u()-1,e=this.#m(this.#n),i=Math.min(e+1,t);if(i!==e||this.loop){let n=this.loop&&i===e?0:i;this.goTo(this.#p(n))}}prev(){let t=this.#u()-1,e=this.#m(this.#n),i=Math.max(e-1,0);if(i!==e||this.loop){let n=this.loop&&i===e?t:i;this.goTo(this.#p(n))}}goTo(t){let e=this.slides[t];if(!e||!this.#t)return;let i=Math.max(0,this.#d(e));this.#t.scrollTo({left:i,behavior:"smooth"})}play(){this.pause(),!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&(this.#e=setInterval(()=>{let t=this.#u()-1,i=this.#m(this.#n)>=t;i&&this.loop?this.goTo(this.#p(0)):i?this.pause():this.next()},this.interval||5e3))}pause(){this.#e&&(clearInterval(this.#e),this.#e=null)}#l(){let t=this.slides;t.forEach((e,i)=>{e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.getAttribute("aria-label")||e.setAttribute("aria-label",`${i+1} of ${t.length}`)})}#c(){this.#s=()=>{let t=this.#f();t!==this.#n&&(this.#n=t,this.#x(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{index:t,slide:this.slides[t]}})))},this.#t.addEventListener("scroll",this.#s,{passive:!0}),this.#n=this.#f()}#h(){if(!this.#t)return 1;let e=getComputedStyle(this.#t).getPropertyValue("--swiper-columns").trim(),i=parseInt(e,10);return Number.isFinite(i)&&i>0?i:1}#u(){let t=this.slides.length;return t===0?0:this.snap==="center"?t:Math.max(1,t-this.#h()+1)}#d(t){let e=this.#t.clientWidth,i=t.offsetLeft-this.#t.offsetLeft,n=t.offsetWidth;return this.snap==="center"?i+n/2-e/2:this.snap==="end"?i+n-e:i}#f(){if(!this.#t)return 0;let t=this.slides;if(t.length===0)return 0;let e=this.#t.scrollLeft,i=Math.max(0,this.#t.scrollWidth-this.#t.clientWidth),n=0,r=1/0;for(let o=0;o<t.length;o++){let a=Math.max(0,Math.min(i,this.#d(t[o]))),l=Math.abs(e-a);l<r&&(r=l,n=o)}return n}#p(t){if(this.snap!=="end")return t;let e=this.#h();return Math.min(this.slides.length-1,t+e-1)}#m(t){if(this.snap!=="end")return t;let e=this.#h();return Math.max(0,t-e+1)}#g(){this.#a||(this.#a=!0,this.chrome==="toolbar"?this.#y():this.#b(),this.#S(),typeof ResizeObserver<"u"&&(this.#i=new ResizeObserver(()=>this.#S()),this.#i.observe(this)))}#b(){let t=document.createElement("button-ui");t.setAttribute("data-swiper-btn",""),t.setAttribute("data-swiper-prev",""),t.setAttribute("icon","caret-left"),t.setAttribute("variant","ghost"),t.setAttribute("aria-label","Previous slide"),t.addEventListener("press",()=>this.prev());let e=document.createElement("button-ui");e.setAttribute("data-swiper-btn",""),e.setAttribute("data-swiper-next",""),e.setAttribute("icon","caret-right"),e.setAttribute("variant","ghost"),e.setAttribute("aria-label","Next slide"),e.addEventListener("press",()=>this.next()),this.appendChild(t),this.appendChild(e);let i=document.createElement("div");i.setAttribute("data-swiper-dots",""),i.setAttribute("role","tablist"),i.setAttribute("aria-label","Slide indicators"),this.appendChild(i)}#y(){let t=document.createElement("div");t.setAttribute("data-swiper-head","");let e=document.createElement("span");e.setAttribute("data-swiper-label",""),e.textContent=this.label||"",t.appendChild(e);let i=document.createElement("div");i.setAttribute("data-swiper-paddles","");let n=document.createElement("button-ui");n.setAttribute("icon","caret-left"),n.setAttribute("variant","ghost"),n.setAttribute("size","sm"),n.setAttribute("aria-label","Previous slide"),n.addEventListener("press",()=>this.prev());let r=document.createElement("button-ui");r.setAttribute("icon","caret-right"),r.setAttribute("variant","ghost"),r.setAttribute("size","sm"),r.setAttribute("aria-label","Next slide"),r.addEventListener("press",()=>this.next()),i.appendChild(n),i.appendChild(r),t.appendChild(i),this.insertBefore(t,this.#t);let o=document.createElement("div");o.setAttribute("data-swiper-foot","");let a=document.createElement("span");a.setAttribute("data-swiper-counter",""),o.appendChild(a);let l=document.createElement("div");l.setAttribute("data-swiper-dots",""),l.setAttribute("role","tablist"),l.setAttribute("aria-label","Slide indicators"),o.appendChild(l),this.appendChild(o),this.#O()}#O(){let t=this.querySelector("[data-swiper-counter]");if(!t)return;if(!this.counter){t.textContent="";return}let e=this.#m(this.#n)+1,i=this.#u();t.textContent=`${e} / ${i}`}#S(){let t=this.querySelector("[data-swiper-dots]");if(!t)return;let e=this.#u();if(t.children.length!==e){for(;t.firstChild;)t.removeChild(t.firstChild);for(let i=0;i<e;i++){let n=document.createElement("button");n.setAttribute("role","tab"),n.setAttribute("aria-label",`Page ${i+1}`),n.addEventListener("click",()=>this.goTo(this.#p(i))),t.appendChild(n)}}this.#x()}#x(){if(!this.#a)return;let t=this.querySelector("[data-swiper-dots]");if(t){let e=this.#u()-1,i=Math.min(Math.max(this.#m(this.#n),0),e);[...t.children].forEach((n,r)=>{n.setAttribute("aria-current",r===i?"true":"false")})}this.#O()}#v=()=>{this.#e&&(this.pause(),this.dispatchEvent(new CustomEvent("autoplay-pause",{bubbles:!0,detail:{reason:"hover"}})))};#w=()=>{this.autoplay&&!this.#e&&(this.play(),this.dispatchEvent(new CustomEvent("autoplay-resume",{bubbles:!0})))};#k=()=>{this.#e&&(this.pause(),this.dispatchEvent(new CustomEvent("autoplay-pause",{bubbles:!0,detail:{reason:"focus"}})))};#A=t=>{this.autoplay&&!this.contains(t.relatedTarget)&&(this.play(),this.dispatchEvent(new CustomEvent("autoplay-resume",{bubbles:!0})))};#$=t=>{t.key==="ArrowRight"&&(t.preventDefault(),this.next()),t.key==="ArrowLeft"&&(t.preventDefault(),this.prev())};#C=5;#M=t=>{t.pointerType!=="touch"&&t.button===0&&(t.target.closest("button, button-ui, a, input, select, textarea")||(this.#o={pointerId:t.pointerId,startX:t.clientX,startScrollLeft:this.#t.scrollLeft,hasMoved:!1},this.#t.style.scrollBehavior="auto",this.#t.setAttribute("data-dragging","")))};#E=t=>{if(!this.#o||t.pointerId!==this.#o.pointerId)return;let e=t.clientX-this.#o.startX;if(Math.abs(e)>=this.#C){if(!this.#o.hasMoved){this.#o.hasMoved=!0;try{this.#t.setPointerCapture(t.pointerId)}catch{}}this.#t.scrollLeft=this.#o.startScrollLeft-e,t.preventDefault()}};#P=t=>{if(!this.#o||t.pointerId!==this.#o.pointerId)return;let e=this.#o.hasMoved;if(e)try{this.#t.releasePointerCapture(t.pointerId)}catch{}this.#o=null,this.#t.style.scrollBehavior="",this.#t.removeAttribute("data-dragging"),e&&(this.#t.setAttribute("data-just-dragged",""),requestAnimationFrame(()=>this.#t?.removeAttribute("data-just-dragged")))};#R=t=>{this.#t?.hasAttribute("data-just-dragged")&&(t.preventDefault(),t.stopPropagation())};#L=t=>{this.#o&&t.preventDefault()}};x("swiper-ui",Vn);var jn=class extends Z{static labelDeprecated=!1;static properties={...Z.properties,label:{type:String,default:"",reflect:!0},accept:{type:String,default:"",reflect:!0},multiple:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=null;connected(){super.connected(),this.querySelector("[data-dropzone]")||(this.innerHTML=`
190
188
  <div data-dropzone tabindex="0" role="button">Drop files here or click to browse</div>
191
189
  <span hint="${this.hint||""}"></span>
192
190
  <div data-filelist></div>
193
- `),this.#e=this.querySelector("[data-dropzone]"),this.#e&&(this.#e.addEventListener("click",this.#i),this.#e.addEventListener("keydown",this.#s),this.#e.addEventListener("dragover",this.#o),this.#e.addEventListener("dragleave",this.#l),this.#e.addEventListener("drop",this.#c))}render(){let t=this.querySelector("[data-filelist]");if(!this.#e||!t)return;let e=this.querySelector("span[hint]");e&&this.hint&&e.setAttribute("hint",this.hint),t.innerHTML="";for(let i of this.#t){let n=document.createElement("span");n.textContent=i.name,t.appendChild(n)}}get files(){return this.#t}#i=()=>{this.disabled||this.#n()};#s=t=>{this.disabled||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n())};async#n(){try{if(window.showOpenFilePicker){let t=this.#a(),e={multiple:this.multiple};t.length&&(e.types=t);let i=await window.showOpenFilePicker(e);if(!this.isConnected)return;let n=await Promise.all(i.map(r=>r.getFile()));if(!this.isConnected)return;this.#h(n)}else this.#r()}catch(t){if(t.name!=="AbortError")throw t}}#r(){let t=document.createElement("input");t.type="file",this.accept&&(t.accept=this.accept),this.multiple&&(t.multiple=!0),t.style.display="none",document.body.appendChild(t),t.addEventListener("change",()=>{t.files?.length&&this.#h([...t.files]),t.remove()},{once:!0}),t.addEventListener("cancel",()=>t.remove(),{once:!0}),t.click()}#a(){if(!this.accept)return[];let t={};for(let e of this.accept.split(",")){let i=e.trim();i&&(i.startsWith(".")?(t["application/octet-stream"]=t["application/octet-stream"]||[],t["application/octet-stream"].push(i)):t[i]=t[i]||[])}return Object.keys(t).length?[{accept:t}]:[]}#o=t=>{t.preventDefault(),this.querySelector("[data-dropzone]")?.setAttribute("data-dragover","")};#l=()=>{this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover")};#c=t=>{if(t.preventDefault(),this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover"),this.disabled)return;let e=t.dataTransfer;e?.files?.length&&this.#h([...e.files])};#h(t){this.#t=t;let e=new FormData;for(let i of this.#t)e.append(this.name||"file",i);this.internals.setFormValue(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,files:this.files}})),this.render()}disconnected(){super.disconnected(),this.#e&&(this.#e.removeEventListener("click",this.#i),this.#e.removeEventListener("keydown",this.#s),this.#e.removeEventListener("dragover",this.#o),this.#e.removeEventListener("dragleave",this.#l),this.#e.removeEventListener("drop",this.#c)),this.#e=null}};x("upload-ui",jn);Hu();var _n=KO({name:"draggable",category:"motion-positioning",description:"Pointer drag to reposition",attributes:["data-draggable-dragging"],events:["drag-end"],config:[],setup({host:s}){let t=!1,e=0,i=0,n=0,r=0;function o(){return s.hasAttribute("disabled")}function a(c){if(o())return;t=!0,e=c.clientX,i=c.clientY;let u=getComputedStyle(s),d=u.translate;if(d&&d!=="none"){let f=d.split(/\s+/).map(parseFloat);n=f[0]||0,r=f[1]||0}else{let f=new DOMMatrixReadOnly(u.transform);n=f.m41,r=f.m42}s.setPointerCapture(c.pointerId),s.setAttribute("data-draggable-dragging",""),s.style.touchAction="none"}function l(c){if(!t)return;let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.style.translate=`${f}px ${p}px`}function h(c){if(!t)return;t=!1,s.removeAttribute("data-draggable-dragging");let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{x:f,y:p}}))}return s.addEventListener("pointerdown",a),s.addEventListener("pointermove",l),s.addEventListener("pointerup",h),()=>{s.removeEventListener("pointerdown",a),s.removeEventListener("pointermove",l),s.removeEventListener("pointerup",h),s.removeAttribute("data-draggable-dragging"),s.style.touchAction=""}}});P();var Wn=class extends k{static properties={variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"",reflect:!0},elevation:{type:Number,default:1,reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}};x("card-ui",Wn);P();var Yn=class extends k{static properties={src:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},shape:{type:String,default:"circle",reflect:!0}};get displayName(){return this.text}static template=()=>null;#t=null;#e=null;#i=null;connected(){this.setAttribute("role","img")}render(){!this.src&&!this.displayName&&!this.icon||(this.src?(this.#t||(this.#t=document.createElement("img"),this.#t.setAttribute("slot","img"),this.#t.onerror=()=>{this.#t.remove(),this.#t=null,this.#s()}),this.#t.src=this.src,this.#t.alt=this.displayName||"",this.#t.parentElement||this.appendChild(this.#t),this.#e&&(this.#e.remove(),this.#e=null)):this.icon?(this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null),this.#i||(this.#i=document.createElement("icon-ui"),this.#i.setAttribute("slot","icon"),this.appendChild(this.#i)),this.#i.setAttribute("name",this.icon)):(this.#t&&(this.#t.remove(),this.#t=null),this.#i&&(this.#i.remove(),this.#i=null),this.#s()),this.setAttribute("aria-label",this.displayName||this.icon||""))}#s(){if(!this.displayName)return;let t=this.displayName.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase();this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","initials"),this.appendChild(this.#e)),this.#e.textContent=t}},Fn=class extends k{static properties={max:{type:Number,default:5,reflect:!0},size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Avatar group")}render(){let t=[...this.querySelectorAll("avatar-ui")],e=this.max,i=t.length-e;if(this.size)for(let r of t)r.setAttribute("size",this.size);t.forEach((r,o)=>{r.style.display=o<e?"":"none",r.style.zIndex=String(t.length-o)});let n=this.querySelector('[slot="overflow"]');i>0?(n||(n=document.createElement("span"),n.setAttribute("slot","overflow"),this.appendChild(n)),n.textContent=`+${i}`,n.setAttribute("aria-label",`${i} more`),n.style.zIndex="0"):n&&n.remove()}};x("avatar-ui",Yn),x("avatar-group-ui",Fn);P();var Un=class extends k{static properties={value:{type:Number,default:null,reflect:!0},variant:{type:String,default:"bar",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"),this.variant==="bar"&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","track"),this.#e=document.createElement("div"),this.#e.setAttribute("slot","fill"),this.#t.appendChild(this.#e),this.appendChild(this.#t))}render(){let t=this.value==null||this.value<0,e=Math.max(0,Math.min(100,this.value));this.setAttribute("aria-busy",String(t)),t?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",String(e)),this.#e&&(this.#e.style.width=t?"100%":`${e}%`)}disconnected(){this.#t?.remove(),this.#t=null,this.#e=null}};x("progress-ui",Un);P();var Gn=class extends k{static properties={value:{type:Number,default:0,reflect:!0},total:{type:Number,default:0,reflect:!0},caption:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),!it(this,"caption").length&&!it(this,"track").length?(this.#t=document.createElement("span"),this.#t.setAttribute("slot","caption"),this.appendChild(this.#t),this.#e=document.createElement("div"),this.#e.setAttribute("slot","track"),this.appendChild(this.#e)):(this.#t=it(this,"caption")[0],this.#e=it(this,"track")[0])}render(){let t=Math.max(0,this.total|0),e=Math.max(0,Math.min(t,this.value|0));if(this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(e)),this.#t&&!this.#t.dataset.custom&&(this.#t.textContent=this.caption||"",this.#t.toggleAttribute("hidden",!this.caption)),this.#e){let i=this.#e.children.length;for(;this.#e.children.length<t;)this.#e.appendChild(document.createElement("span"));for(;this.#e.children.length>t;)this.#e.lastElementChild.remove();for(let n=0;n<this.#e.children.length;n++)this.#e.children[n].toggleAttribute("data-active",n<e)}}disconnected(){this.#t=null,this.#e=null}};x("step-progress-ui",Gn);P();var Hn=class extends k{static properties={width:{type:String,default:"100%",reflect:!0},height:{type:String,default:"1.2em",reflect:!0},radius:{type:String,default:"sm",reflect:!0},static:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("aria-hidden","true"),this.#t()}render(){this.#t()}#t(){this.style.width=this.width,this.style.height=this.height}};x("skeleton-ui",Hn);P();var Kn=class extends k{static properties={size:{type:String,default:"md",reflect:!0},variant:{type:String,default:"arc",reflect:!0},tone:{type:String,default:"current",reflect:!0},paused:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"Loading",reflect:!1}};static template=()=>null;connected(){this.hasAttribute("role")||this.setAttribute("role","progressbar"),this.hasAttribute("aria-busy")||this.setAttribute("aria-busy","true"),this.setAttribute("aria-valuetext",this.label||"Loading"),this.#t()}render(){this.setAttribute("aria-valuetext",this.label||"Loading"),this.#t()}#t(){let t=this.variant==="dots",e=this.querySelectorAll(":scope > [data-spinner-dot]");if(t){if(e.length===3)return;e.forEach(n=>n.remove());let i=document.createDocumentFragment();for(let n=1;n<=3;n++){let r=document.createElement("span");r.setAttribute("data-spinner-dot",String(n)),r.setAttribute("aria-hidden","true"),i.appendChild(r)}this.appendChild(i)}else e.length&&e.forEach(i=>i.remove())}};x("spinner-ui",Kn);P();var Jn=class extends k{static properties={active:{type:Boolean,default:!1,reflect:!0},delay:{type:Number,default:200,reflect:!0},label:{type:String,default:"Loading\u2026",reflect:!0},variant:{type:String,default:"default",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;constructor(){super();let t=Object.getOwnPropertyDescriptor(this,"active");if(t?.set){let e=t.set;Object.defineProperty(this,"active",{get:t.get,set:i=>{let n=!!t.get.call(this);e.call(this,i),!!i!==n&&this.#s(!!i)},configurable:!0})}}connected(){this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.setAttribute("aria-label",this.label||"Loading"),this.#t=this.parentElement,this.active&&this.#s(!0)}disconnected(){this.#a(),this.#i&&this.#r(),this.#t=null}render(){let t=this.label||"Loading";this.setAttribute("aria-label",t);let e=this.querySelector(":scope > spinner-ui[data-loading-overlay-auto]");e&&e.getAttribute("label")!==t&&e.setAttribute("label",t),this.children.length===0&&this.#o()}#s(t){if(this.#a(),t){let e=Math.max(0,Number(this.delay)||0);e===0?this.#n():this.#e=setTimeout(()=>{this.#e=null,this.active&&this.#n()},e)}else this.#i&&this.#r()}#n(){let t=this.#t||this.parentElement;t&&!t.hasAttribute("aria-busy")&&t.setAttribute("aria-busy","true"),this.#i=!0}#r(){let t=this.#t||this.parentElement;t&&t.getAttribute("aria-busy")==="true"&&t.removeAttribute("aria-busy"),this.#i=!1}#a(){this.#e!==null&&(clearTimeout(this.#e),this.#e=null)}#o(){let t=document.createElement("spinner-ui");t.setAttribute("size","lg"),t.setAttribute("tone","subtle"),t.setAttribute("label",this.label||"Loading"),t.setAttribute("data-loading-overlay-auto",""),this.appendChild(t)}};x("loading-overlay-ui",Jn);P();var fb=new Set;function pb(s,t){fb.has(s)||(fb.add(s),console.warn(`[alert-ui] ${t}`))}var tr=class s extends k{static properties={text:{type:String,default:"",reflect:!0},title:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},closable:{type:Boolean,default:!1,reflect:!0},dismissible:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0},pattern:{type:String,default:"",reflect:!0},amount:{type:Number,default:0,reflect:!0},currency:{type:String,default:"USD",reflect:!0},dueAt:{type:String,default:"",reflect:!0,attribute:"due-at"},cardLast4:{type:String,default:"",reflect:!0,attribute:"card-last4"},reason:{type:String,default:"",reflect:!0}};static parts={leading:'<icon-ui slot="leading"></icon-ui>',content:'<span slot="content"></span>',close:'<button-ui slot="close" icon="x" variant="ghost" size="sm" aria-label="Close"></button-ui>'};static#t={declined:"x-circle",expired:"clock",insufficient:"wallet",network:"wifi-slash"};static template=()=>null;#e(){this.getAttribute("variant")==="error"&&(pb("variant-error",'variant="error" is not in the canonical enum [default, info, success, warning, danger, muted, neutral]. Mapping to "danger". Fix the source (LLM prompt / corpus pattern) to emit "danger" directly.'),this.setAttribute("variant","danger")),this.hasAttribute("closeable")&&!this.hasAttribute("closable")&&!this.hasAttribute("dismissible")&&(pb("alias-closeable","attribute [closeable] is a misspelled alias of canonical [closable]. Mapping. Fix the source to use [closable] or [dismissible]."),this.setAttribute("closable",""),this.removeAttribute("closeable")),this.hasAttribute("dismissible")&&!this.hasAttribute("closable")&&this.setAttribute("closable","")}#i=t=>{if(t.target.closest('[slot="close"]')){this.#h();return}if(this.pattern==="dunning"){let e=t.target.closest("[data-dunning-action]");if(e&&this.contains(e)){let i=e.getAttribute("data-dunning-action")||"";this.dispatchEvent(new CustomEvent("dunning-action",{bubbles:!0,composed:!0,detail:{action:i,amount:this.amount,currency:this.currency,dueAt:this.dueAt}}))}}};connected(){this.#e(),this.#c(),(this.icon||this.pattern==="dunning"&&this.reason)&&this.ensure("leading"),this.ensure("content"),this.closable&&this.ensure("close"),this.addEventListener("press",this.#i)}disconnected(){this.removeEventListener("press",this.#i)}render(){if(this.pattern==="dunning"){this.#s(),this.#c();return}if(this.icon){let e=this.ensure("leading");e&&e.setAttribute("name",this.icon)}else this.drop("leading");let t=this.ensure("content");if(t){let e=t.hasAttribute("data-alert-auto"),i=t.childNodes.length>0;if(!e&&i){if(this.title||this.description){let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}}else if(this.title||this.description){if(t.setAttribute("data-alert-auto","title-desc"),t.replaceChildren(),this.title){let r=document.createElement("strong");r.textContent=this.title,t.appendChild(r),this.description&&t.appendChild(document.createTextNode(" "))}this.description&&t.appendChild(document.createTextNode(this.description));let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}else this.text&&(t.setAttribute("data-alert-auto","text"),t.textContent=this.text)}this.closable||this.dismissible?this.ensure("close"):this.drop("close"),this.#c()}#s(){let t=this.icon||s.#t[this.reason]||"x-circle",e=this.ensure("leading");e&&e.setAttribute("name",t);let i=this.ensure("content");if(!i)return;i.setAttribute("data-alert-auto","dunning"),i.replaceChildren();let n=this.title||this.#n();if(n){let l=document.createElement("strong");l.setAttribute("data-dunning-title",""),l.textContent=n,i.appendChild(l)}let r=this.#r(),o=this.#o();if(r||o){if(i.appendChild(document.createTextNode(" ")),r){let l=document.createElement("span");l.setAttribute("data-dunning-amount",""),l.textContent=r,i.appendChild(l)}if(r&&o&&i.appendChild(document.createTextNode(" ")),o){let l=document.createElement("span");l.setAttribute("data-dunning-meta",""),l.textContent=o,i.appendChild(l)}}let a=[n,r,o].filter(Boolean).join(". ");a&&this.setAttribute("aria-label",a),this.closable||this.dismissible?this.ensure("close"):this.drop("close")}#n(){switch(this.reason){case"expired":return"Card expired";case"insufficient":return"Insufficient funds";case"network":return"Network error";case"declined":return"Payment failed";default:return this.variant==="warning"?"Payment due soon":"Payment failed"}}#r(){if(!this.amount&&this.amount!==0||this.amount===0)return"";try{let t=this.getAttribute("lang")||this.lang||void 0;return new Intl.NumberFormat(t,{style:"currency",currency:this.currency||"USD"}).format(this.amount)}catch{return`${this.currency||""} ${this.amount}`.trim()}}#a(){if(!this.dueAt)return"";let t=/^\d{4}-\d{2}-\d{2}$/.test(this.dueAt)?new Date(`${this.dueAt}T00:00:00`):new Date(this.dueAt);if(Number.isNaN(t.getTime()))return"";try{let e=this.getAttribute("lang")||this.lang||void 0;return new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"numeric"}).format(t)}catch{return t.toDateString()}}#o(){let t=[];this.cardLast4&&t.push(`Card ending ${this.cardLast4}`),this.reason&&this.reason!=="declined"&&t.push(this.#l());let e=this.#a();if(e){let i=this.variant==="warning"?"due":"failed";t.push(`${i} ${e}`)}return t.join(" \xB7 ")}#l(){switch(this.reason){case"expired":return"expired";case"insufficient":return"insufficient funds";case"network":return"network error";case"declined":return"declined";default:return""}}#c(){let t=this.variant==="danger"||this.variant==="warning"?"alert":"status";this.setAttribute("role",t)}#h(){this.dispatchEvent(new Event("close",{bubbles:!0})),this.remove()}};x("alert-ui",tr);P();var t$={info:"info",success:"check-circle",warning:"warning",danger:"x-circle"},er=class extends k{static properties={text:{type:String,default:"",reflect:!1},variant:{type:String,default:"default",reflect:!0},icon:{type:String,default:"",reflect:!0},live:{type:String,default:"",reflect:!0}};static parts={leading:'<icon-ui slot="leading"></icon-ui>'};static requiredIcons=["info","check-circle","warning","x-circle"];static template=()=>null;#t(t){return!!(t&&(t._uiPart||t.hasAttribute("data-im-auto")))}connected(){}render(){this.live?this.setAttribute("aria-live",this.live):this.hasAttribute("aria-live")&&this.removeAttribute("aria-live"),this.#e();let t=this.icon||t$[this.variant]||"",e=this.querySelector(':scope > [slot="leading"]');if(!(e&&!this.#t(e)))if(t){let i=this.ensure("leading");i&&(i.setAttribute("data-im-auto",""),i.getAttribute("name")!==t&&i.setAttribute("name",t))}else this.drop("leading")}#e(){let t=this.querySelector(":scope > [data-im-text]");if(Array.from(this.childNodes).some(i=>i===t?!1:i.nodeType===Node.ELEMENT_NODE?!(i.getAttribute&&i.getAttribute("slot")==="leading"):!!(i.nodeType===Node.TEXT_NODE&&i.textContent.trim()))){t&&t.remove();return}this.text?(t||(t=document.createElement("span"),t.setAttribute("data-im-text",""),this.appendChild(t)),t.textContent!==this.text&&(t.textContent=this.text)):t&&t.remove()}};x("inline-message-ui",er);P();var ir=class extends k{static properties={size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","presentation")}};x("kbd-ui",ir);P();var sr=class extends k{static requiredIcons=["x"];static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"md",reflect:!0},removable:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static parts={dismiss:'<button slot="dismiss" type="button" aria-label="Remove"><icon-ui name="x" weight="bold"></icon-ui></button>'};static template=()=>null;#t=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};#e=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};connected(){this.setAttribute("role","status"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}disconnected(){this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.disabled?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0")),this.removable&&!this.disabled){let t=this.ensure("dismiss");t&&t.parentElement!==this&&this.appendChild(t)}else this.drop("dismiss")}};x("tag-ui",sr);P();var e$=new Set(["block","dot","square","line","dashed"]),i$=new Set(["sm","md","lg"]),s$=new Set(["out-of-gamut","p3-only","apca-pass","apca-fail"]),n$={"out-of-gamut":"\u25B3","p3-only":"\u2726","apca-pass":"\u2713","apca-fail":"\u2717"},r$={"out-of-gamut":"Outside sRGB gamut","p3-only":"Display-P3 only","apca-pass":"Contrast passes APCA","apca-fail":"Contrast fails APCA"};function o$(s){return s?s.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t&&s$.has(t)):[]}var ls=null;function a$(s){if(!s||typeof s!="string"||typeof document>"u")return null;try{if(!ls){let u=document.createElement("canvas");u.width=1,u.height=1,ls=u.getContext("2d")}ls.fillStyle="#000",ls.clearRect(0,0,1,1),ls.fillStyle=s,ls.fillRect(0,0,1,1);let[t,e,i]=ls.getImageData(0,0,1,1).data;if(t===0&&e===0&&i===0&&s!=="#000"&&s!=="black"&&s!=="#000000")return null;let n=u=>{let d=u/255;return d<=.04045?d/12.92:Math.pow((d+.055)/1.055,2.4)},r=n(t),o=n(e),a=n(i),l=Math.cbrt(.4122214708*r+.5363325363*o+.0514459929*a),h=Math.cbrt(.2119034982*r+.6806995451*o+.1073969566*a),c=Math.cbrt(.0883024619*r+.2817188376*o+.6299787005*a);return .2104542553*l+.793617785*h-.0040720468*c}catch{return null}}var nr=class extends k{static properties={shape:{type:String,default:"square",reflect:!0},size:{type:String,default:"md",reflect:!0},color:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},detail:{type:String,default:"",reflect:!0},badge:{type:String,default:"",reflect:!0},copyable:{type:Boolean,default:!1,reflect:!0},copyValue:{type:String,default:""},selectable:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},autoContrast:{type:Boolean,default:!1,reflect:!0},labelPosition:{type:String,default:"below",reflect:!0,attribute:"label-position"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=!1;#a=null;#o=null;#l=null;#c=null;#h=null;#u=null;connected(){this.#d(),this.#S(),this.#u=new MutationObserver(t=>{let e=!1;for(let i of t){for(let n of i.addedNodes)if(n.nodeType===1){if(n.getAttribute?.("slot")==="chrome"){e=!0;break}if(n.tagName==="SPAN"&&n.style?.display==="contents"&&n.querySelector?.('[slot="chrome"]')){e=!0;break}}if(e)break}e&&(this.#f(),this.#u.takeRecords())}),this.#u.observe(this,{childList:!0})}render(){this.#d(),this.#p(),this.#m(),this.#b(),this.#y(),this.#O(),this.#g()}#d(){if(this.#r)return;let t=Array.from(this.children).filter(r=>r.getAttribute&&r.getAttribute("slot")==="chrome");for(let r of t)r.remove();let e=Array.from(this.children).filter(r=>r.tagName==="SPAN"&&r.style?.display==="contents"&&r.querySelector?.('[slot="chrome"]'));for(let r of e)r.remove();let i=[];for(let r of Array.from(this.childNodes))(r.nodeType===3&&!r.data||r.nodeType===8)&&i.push(r);for(let r of i)r.remove();let n=Array.from(this.childNodes).filter(r=>!(r.nodeType===1&&r.dataset&&(r.dataset.tile!==void 0||r.dataset.label!==void 0||r.dataset.detail!==void 0||r.dataset.badge!==void 0||r.dataset.copy!==void 0))&&!(r.nodeType===3&&!r.textContent.trim()));this.innerHTML="",this.#t=document.createElement("span"),this.#t.setAttribute("data-tile",""),this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t);for(let r of t)this.appendChild(r);for(let r of e)this.appendChild(r);for(let r of i)this.appendChild(r);if(this.#s=document.createElement("span"),this.#s.setAttribute("data-badge",""),this.#s.setAttribute("hidden",""),this.appendChild(this.#s),this.#e=document.createElement("span"),this.#e.setAttribute("data-label",""),n.length)for(let r of n)this.#e.appendChild(r);this.appendChild(this.#e),this.#i=document.createElement("span"),this.#i.setAttribute("data-detail",""),this.#i.setAttribute("hidden",""),this.appendChild(this.#i),this.#n=document.createElement("button"),this.#n.setAttribute("data-copy",""),this.#n.setAttribute("type","button"),this.#n.setAttribute("aria-label","Copy value"),this.#n.setAttribute("hidden",""),this.#n.textContent="\u29C9",this.appendChild(this.#n),this.#r=!0}#f(){if(!this.#t||!this.#s)return;let t=[];for(let e of this.children)if(e!==this.#t){if(e===this.#s)break;e.getAttribute?.("slot")==="chrome"&&t.push(e)}for(let e of Array.from(this.children))e!==this.#t&&e!==this.#s&&e!==this.#e&&e!==this.#i&&e!==this.#n&&e.getAttribute?.("slot")==="chrome"&&this.insertBefore(e,this.#s);for(let e of Array.from(this.children))e===this.#t||e===this.#s||e===this.#e||e===this.#i||e===this.#n||!(e.tagName==="SPAN"&&e.style?.display==="contents")||!e.querySelector?.('[slot="chrome"]')||this.insertBefore(e,this.#s)}#p(){if(!this.#t||!this.#e)return;this.#f();let t=e$.has(this.shape)?this.shape:"square",e=i$.has(this.size)?this.size:"md";t!==this.shape&&this.setAttribute("shape",t),e!==this.size&&this.setAttribute("size",e),this.color&&this.style.setProperty("--swatch-color",this.color),!this.#e.firstChild&&this.label?this.#e.textContent=this.label:this.#e.firstChild?.nodeType===3&&this.label&&(this.#e.textContent=this.label);let i=this.#e.textContent.trim().length>0||this.#e.firstElementChild!=null;this.#e.toggleAttribute("hidden",!i)}#m(){if(!this.#s)return;let t=o$(this.badge);if(t.length===0){this.#s.setAttribute("hidden",""),this.#s.replaceChildren();return}this.#s.removeAttribute("hidden");let e=Array.from(this.#s.children).map(r=>r.dataset.badgeVariant);if(e.length===t.length&&e.every((r,o)=>r===t[o]))return;let n=document.createDocumentFragment();for(let r of t){let o=document.createElement("span");o.setAttribute("data-badge-variant",r),o.setAttribute("role","img"),o.setAttribute("aria-label",r$[r]),o.textContent=n$[r],n.appendChild(o)}this.#s.replaceChildren(n)}#g(){if(!this.#e)return;if(!this.autoContrast){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark"),this.#a=null;return}let t=this.color||getComputedStyle(this).getPropertyValue("--swatch-color").trim();if(t===this.#a)return;this.#a=t;let e=a$(t);if(e==null){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark");return}let i=e<.62;this.#e.toggleAttribute("data-on-dark",i),this.#e.toggleAttribute("data-on-light",!i)}#b(){if(!this.#i)return;let t=(this.detail||"").trim();if(!t){this.#i.setAttribute("hidden",""),this.#i.textContent="";return}this.#i.removeAttribute("hidden"),this.#i.textContent!==t&&(this.#i.textContent=t)}#y(){if(!this.#n)return;if(!this.copyable){this.#n.setAttribute("hidden","");return}this.#n.removeAttribute("hidden");let t=this.#v();t?this.#n.setAttribute("aria-label",`Copy ${t}`):this.#n.setAttribute("aria-label","Copy value")}#O(){this.selectable?(this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.setAttribute("aria-pressed",this.selected?"true":"false")):(this.getAttribute("role")==="button"&&this.removeAttribute("role"),this.getAttribute("tabindex")==="0"&&this.removeAttribute("tabindex"),this.removeAttribute("aria-pressed"))}#S(){this.#o=t=>{!this.selectable||(t.composedPath?t.composedPath():[]).includes(this.#n)||this.#x()},this.#l=t=>{this.selectable&&(t.key!=="Enter"&&t.key!==" "||t.target!==this.#n&&(t.preventDefault(),this.#x()))},this.addEventListener("click",this.#o),this.addEventListener("keydown",this.#l),this.#c=t=>{if(t.stopPropagation(),!this.copyable)return;let e=this.#v();e&&this.#w(e)},this.#n.addEventListener("click",this.#c)}#x(){this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{value:this.color||this.label,color:this.color,label:this.label}}))}#v(){return this.copyValue?this.copyValue:this.color?this.color:""}async#w(t){let e=!1;try{navigator?.clipboard?.writeText&&(await navigator.clipboard.writeText(t),e=!0)}catch{}this.#k(e)}#k(t){this.#n&&(this.#h!=null&&clearTimeout(this.#h),this.#n.setAttribute("data-copy-state",t?"ok":"fail"),this.#n.textContent=t?"\u2713":"\u26A0",this.#h=setTimeout(()=>{this.#n&&(this.#n.removeAttribute("data-copy-state"),this.#n.textContent="\u29C9",this.#h=null)},1200))}disconnected(){this.#h!=null&&(clearTimeout(this.#h),this.#h=null),this.#u&&(this.#u.disconnect(),this.#u=null),this.#o&&this.removeEventListener("click",this.#o),this.#l&&this.removeEventListener("keydown",this.#l),this.#n&&this.#c&&this.#n.removeEventListener("click",this.#c),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#n=null,this.#r=!1}};x("swatch-ui",nr);_e();var mb={xs:0,sm:480,md:768,lg:1024,xl:1280},hs=Object.keys(mb),hd=Object.values(mb);function gb(){if(typeof window>"u")return"lg";let s=window.innerWidth;for(let t=hs.length-1;t>=0;t--)if(s>=hd[t])return hs[t];return"xs"}var $e=Xi(gb());if(typeof window<"u")for(let s=1;s<hd.length;s++)window.matchMedia(`(min-width: ${hd[s]}px)`).addEventListener("change",()=>{$e.value=gb()});function Xt(s,t=$e.value){if(!s)return null;if(!s.includes("@"))return s;let e=null,i=new Map;for(let a of s.trim().split(/\s+/)){let l=a.lastIndexOf("@");l===-1?e=a:i.set(a.slice(l+1),a.slice(0,l))}let n=hs.indexOf(t),r=null,o=-1;for(let[a,l]of i){let h=hs.indexOf(a);h!==-1&&h<=n&&h>o&&(r=l,o=h)}return r??e}P();var rr=class extends k{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"stretch",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;render(){let t=this.gap,e=this.align,i=this.justify,r=t?.includes("@")||e?.includes("@")||i?.includes("@")?$e.value:"";if(t?.includes("@")?this.style.setProperty("--col-gap",c$(Xt(t,r))):this.style.removeProperty("--col-gap"),e?.includes("@")){let o=Xt(e,r);this.style.setProperty("--col-align",u$(o)),this.style.textAlign=d$(o)}else this.style.removeProperty("--col-align"),this.style.textAlign="";i?.includes("@")?this.style.setProperty("--col-justify",f$(Xt(i,r))):this.style.removeProperty("--col-justify")}},l$={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},h$={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function c$(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function u$(s){return l$[s]??s}function d$(s){return{start:"start",center:"center",end:"end"}[s]??""}function f$(s){return h$[s]??s}x("col-ui",rr);P();var or=class s extends k{static properties={label:{type:String,default:"",reflect:!0},hint:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},align:{type:String,default:"start",reflect:!0}};get error(){return this.#g()?.error??""}static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=t=>{let e=this.#g();if(!e)return;let i=this.#y(e);i&&(t.preventDefault(),i.focus())};connected(){this.#u(),this.#d(),this.#f(),this.#p(),this.#c(),this.#t?.addEventListener("click",this.#r),this.#n=new MutationObserver(()=>{this.#p(),this.#c(),this.#m(),this.#a()}),this.#n.observe(this,{childList:!0}),this.#a()}disconnected(){this.#n?.disconnect(),this.#n=null,this.#h(),this.#t?.removeEventListener("click",this.#r),this.#t=null,this.#e=null,this.#i=null,this.#s=null}render(){this.#t&&this.#t.childNodes[0]&&(this.#t.childNodes[0].nodeValue=this.label||""),this.#e&&(this.#e.hidden=!this.required),this.#i&&(this.#i.textContent=this.hint||"",this.#i.hidden=!this.hint||!!this.error),this.#a(),this.#m()}#a(){if(!this.#s)return;let t=this.error;this.#s.textContent=t||"",this.#s.hidden=!t}#o=()=>{this.#a(),this.#m()};#l=null;#c(){let t=this.#g();t!==this.#l&&(this.#h(),t&&(this.#l=t,t.addEventListener("invalid",this.#o,!0),t.addEventListener("change",this.#o),t.addEventListener("input",this.#o)))}#h(){let t=this.#l;t&&(t.removeEventListener("invalid",this.#o,!0),t.removeEventListener("change",this.#o),t.removeEventListener("input",this.#o),this.#l=null)}#u(){if(this.#t=this.querySelector(":scope > [data-field-label]"),!this.#t){let t=document.createElement("label");t.setAttribute("slot","label"),t.setAttribute("data-field-label",""),t.appendChild(document.createTextNode(this.label||"")),this.prepend(t),this.#t=t}if(this.#e=this.#t.querySelector("[data-field-required]"),!this.#e){let t=document.createElement("span");t.setAttribute("data-field-required",""),t.setAttribute("aria-hidden","true"),t.textContent="*",t.hidden=!0,this.#t.appendChild(t),this.#e=t}}#d(){if(this.#i=this.querySelector(":scope > [data-field-hint]"),this.#i)return;let t=document.createElement("div");t.setAttribute("slot","hint"),t.setAttribute("data-field-hint",""),t.setAttribute("id",s.#v("hint")),t.hidden=!0,this.appendChild(t),this.#i=t}#f(){if(this.#s=this.querySelector(":scope > [data-field-error]"),this.#s)return;let t=document.createElement("div");t.setAttribute("slot","error"),t.setAttribute("data-field-error",""),t.setAttribute("id",s.#v("err")),t.setAttribute("role","alert"),t.hidden=!0,this.appendChild(t),this.#s=t}#p(){if(!this.#t)return;let t=this.#g();if(!t){this.#t.removeAttribute("for");return}t.id||(t.id=s.#S()),this.#t.setAttribute("for",t.id)}#m(){let t=this.#g();if(!t)return;let e=new Set;this.#i&&!this.#i.hidden&&e.add(this.#i.id),this.#s&&!this.#s.hidden&&e.add(this.#s.id);let n=[...(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(r=>r&&!r.startsWith("field-hint-")&&!r.startsWith("field-err-")),...e].join(" ").trim();n?t.setAttribute("aria-describedby",n):t.removeAttribute("aria-describedby")}#g(){let t=null,e=null;for(let i of this.children)if(!i.hasAttribute("slot")){if(t===null&&(t=i),s.#b.has(i.localName))return i;e===null&&this.#y(i)&&(e=i)}return e??t}static#b=new Set(["input-ui","textarea-ui","select-ui","combobox-ui","search-ui","check-ui","radio-ui","switch-ui","slider-ui","range-ui","otp-input-ui","tags-input-ui","chat-input-ui","autocomplete-input-ui","datetime-picker-ui","date-range-picker-ui","calendar-picker-ui","color-picker-ui","upload-ui","rating-ui","segmented-ui","input","textarea","select"]);#y(t){let e='input, textarea, select, button, [contenteditable], [tabindex]:not([tabindex="-1"])';return t.matches?.(e)?t:t.querySelector?.(e)??null}static#O=0;static#S(){return`field-ctl-${++s.#O}`}static#x=0;static#v(t){return`field-${t}-${++s.#x}`}};x("field-ui",or);P();var ar=class extends k{static properties={inline:{type:Boolean,default:!1,reflect:!0},columns:{type:Number,default:6,reflect:!0}};static template=()=>null;#t=null;connected(){this.#e(),this.#t=new MutationObserver(t=>{for(let e of t)if(e.type==="childList"&&(this.#i(e.addedNodes)||this.#i(e.removedNodes))){this.#e();return}}),this.#t.observe(this,{childList:!0})}disconnected(){this.#t?.disconnect(),this.#t=null}render(){this.#e()}#e(){let t=this.hasAttribute("inline");for(let e of this.children)e.localName==="field-ui"&&(t?e.hasAttribute("inline")||e.setAttribute("inline",""):e.hasAttribute("inline")&&e.removeAttribute("inline"))}#i(t){for(let e of t)if(e.nodeType===1&&e.localName==="field-ui")return!0;return!1}};x("fields-ui",ar);P();var Ob=0,Sa=class extends k{static properties={label:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},hint:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;connected(){this.setAttribute("role","group"),this.#t=this.querySelector(':scope > [slot="label"]'),this.#t||(this.#t=document.createElement("span"),this.#t.setAttribute("slot","label"),this.insertBefore(this.#t,this.firstChild)),this.#t.id||(this.#t.id=`display-field-label-${++Ob}`),this.#e=this.querySelector(':scope > [slot="value"]'),this.#i=this.querySelector(':scope > [slot="hint"]'),this.#s=this.querySelector(':scope > icon-ui[slot="icon"]')}render(){if(!this.#t)return;this.label?(this.#t.textContent=this.label,this.#t.hidden=!1,this.setAttribute("aria-labelledby",this.#t.id)):(this.#t.hidden=!0,this.removeAttribute("aria-labelledby")),this.querySelector(":scope > :not([slot])")?this.#e&&(this.#e.remove(),this.#e=null):(this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","value"),this.appendChild(this.#e)),this.#e.textContent=this.value),this.hint?(this.#i||(this.#i=document.createElement("span"),this.#i.setAttribute("slot","hint"),this.#i.id=`display-field-hint-${++Ob}`,this.appendChild(this.#i)),this.#i.textContent=this.hint,this.setAttribute("aria-describedby",this.#i.id)):this.#i&&(this.#i.remove(),this.#i=null,this.removeAttribute("aria-describedby")),this.icon?(this.#s||(this.#s=document.createElement("icon-ui"),this.#s.setAttribute("slot","icon"),this.#s.setAttribute("aria-hidden","true"),this.appendChild(this.#s)),this.#s.setAttribute("name",this.icon)):this.#s&&(this.#s.remove(),this.#s=null)}disconnected(){this.#t=null,this.#e=null,this.#i=null,this.#s=null}};x("display-field-ui",Sa);P();var lr=class extends k{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"center",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0},wrap:{type:Boolean,default:!1,reflect:!0},wrapAt:{type:String,default:"",reflect:!0,attribute:"wrap-at"},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}render(){let t=this.gap,e=this.align,i=this.justify,n=this.wrapAt,o=t?.includes("@")||e?.includes("@")||i?.includes("@")||!!n?$e.value:"";if(t?.includes("@")?this.style.setProperty("--row-gap",g$(Xt(t,o))):this.style.removeProperty("--row-gap"),e?.includes("@")?this.style.setProperty("--row-align",O$(Xt(e,o))):this.style.removeProperty("--row-align"),i?.includes("@")?this.style.setProperty("--row-justify",b$(Xt(i,o))):this.style.removeProperty("--row-justify"),n){let a=hs.indexOf(o),l=hs.indexOf(n);this.style.flexWrap=l!==-1&&a>=l?"wrap":""}else this.style.flexWrap=""}},p$={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},m$={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function g$(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function O$(s){return p$[s]??s}function b$(s){return m$[s]??s}x("row-ui",lr);P();var hr=class extends k{static properties={columns:{type:String,default:"3",reflect:!0},gap:{type:String,default:"md",reflect:!0},columnGap:{type:String,default:"",reflect:!0,attribute:"column-gap"},rowGap:{type:String,default:"",reflect:!0,attribute:"row-gap"},minColumnWidth:{type:String,default:"",reflect:!0,attribute:"min-column-width"}};static template=()=>null;render(){let t=$e.value,e=this.columns;if(e?.includes("@")){let n=Xt(e,t);this.style.gridTemplateColumns=this.#t(n),this.style.gridAutoFlow=n?"row":"",this.style.gridAutoColumns=n?"auto":""}else this.style.gridTemplateColumns="",this.style.gridAutoFlow="",this.style.gridAutoColumns="";this.minColumnWidth?this.style.setProperty("--grid-min-col",this.minColumnWidth):this.style.removeProperty("--grid-min-col");let i=this.gap;if(i?.includes("@")){let n=Xt(i,t),r=this.#e(n);this.style.columnGap=r,this.style.rowGap=r}else this.style.columnGap="",this.style.rowGap=""}#t(t){return t?/^\d+$/.test(t)?`repeat(${t}, 1fr)`:t==="auto-fill"?"repeat(auto-fill, minmax(var(--grid-min-col, 12rem), 1fr))":t==="auto-fit"?"repeat(auto-fit, minmax(var(--grid-min-col, 12rem), 1fr))":t:""}#e(t){return!t||t==="0"?"0":/^\d+$/.test(t)?`var(--a-space-${t})`:`var(--a-gap-${t})`}};x("grid-ui",hr);P();var cr=class extends k{static properties={align:{type:String,default:"center",reflect:!0}};static template=()=>null};x("stack-ui",cr);P();var ur=class extends k{static properties={};static template=()=>null};x("frame-ui",ur);P();function cs(s,t,e=5){let n=(t-s||1)/e,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r,l=(o<=1.5?1:o<=3?2:o<=7?5:10)*r,h=Math.floor(s/l)*l,c=Math.ceil(t/l)*l,u=[];for(let d=h;d<=c+l*.5;d+=l)u.push(+d.toFixed(10));return u}function bb(s){if(s==null)return"";let t=+s;return Number.isNaN(t)?String(s):Math.abs(t)>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":Math.abs(t)>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":Number.isInteger(t)?String(t):t.toFixed(1)}function ne(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function bt({label:s,value:t,pct:e,series:i}){let n="";return s!=null&&(n+=` data-tip-label="${ne(String(s))}"`),t!=null&&(n+=` data-tip-value="${t}"`),e!=null&&(n+=` data-tip-pct="${e}"`),i!=null&&(n+=` data-tip-series="${ne(String(i))}"`),n}function re(s,t,e){return s+t*Math.cos(e)}function oe(s,t,e){return s+t*Math.sin(e)}function y$(s,t,e,i,n){let r=re(s,e,i),o=oe(t,e,i),a=re(s,e,n),l=oe(t,e,n),h=n-i>Math.PI?1:0;return`M ${s} ${t} L ${r} ${o} A ${e} ${e} 0 ${h} 1 ${a} ${l} Z`}function cd(s,t,e,i,n,r,o=0){let a=(e-i)/2,l=r-n,h=Math.max(0,Math.min(o,a)),c=()=>{let Ot=re(s,e,n),pt=oe(t,e,n),St=re(s,e,r),Ct=oe(t,e,r),wt=re(s,i,r),Wt=oe(t,i,r),Yt=re(s,i,n),Ii=oe(t,i,n),ns=l>Math.PI?1:0;return`M ${Ot} ${pt} A ${e} ${e} 0 ${ns} 1 ${St} ${Ct} L ${wt} ${Wt} A ${i} ${i} 0 ${ns} 0 ${Yt} ${Ii} Z`};if(h<=0)return c();let u=h/e,d=h/i;if(l<=(u+d)*1.05)return c();let f=n+u,p=r-u,m=n+d,O=r-d,g=p-f>Math.PI?1:0,y=re(s,e,f),v=oe(t,e,f),S=re(s,e,p),w=oe(t,e,p),$=re(s,i,O),A=oe(t,i,O),E=re(s,i,m),L=oe(t,i,m),Q=re(s,e-h,n),X=oe(t,e-h,n),D=re(s,i+h,n),_=oe(t,i+h,n),W=re(s,e-h,r),Y=oe(t,e-h,r),et=re(s,i+h,r),at=oe(t,i+h,r);return`M ${y} ${v} A ${e} ${e} 0 ${g} 1 ${S} ${w} A ${h} ${h} 0 0 1 ${W} ${Y} L ${et} ${at} A ${h} ${h} 0 0 1 ${$} ${A} A ${i} ${i} 0 ${g} 0 ${E} ${L} A ${h} ${h} 0 0 1 ${D} ${_} L ${Q} ${X} A ${h} ${h} 0 0 1 ${y} ${v} Z`}function wa(s,t=.4){if(s.length<2)return"";if(t<=0)return"M"+s.map(n=>`${n.x},${n.y}`).join(" L");let e=s.length,i=`M${s[0].x},${s[0].y}`;for(let n=0;n<e-1;n++){let r=s[Math.max(n-1,0)],o=s[n],a=s[n+1],l=s[Math.min(n+2,e-1)],h=o.x+(a.x-r.x)*t/3,c=o.y+(a.y-r.y)*t/3,u=a.x-(l.x-o.x)*t/3,d=a.y-(l.y-o.y)*t/3;i+=` C${h},${c} ${u},${d} ${a.x},${a.y}`}return i}function ud(s,t,e=.4){let i=wa(s,e),n=s[s.length-1],r=s[0];return`${i} L${n.x},${t} L${r.x},${t} Z`}function Hl(s,t,e,i,n=0){if(i<=0||e<=0)return"";let r=Math.max(0,Math.min(n,e/2,i));return r===0?`M${s},${t} H${s+e} V${t+i} H${s} Z`:`M${s},${t+i} V${t+r} Q${s},${t} ${s+r},${t} H${s+e-r} Q${s+e},${t} ${s+e},${t+r} V${t+i} Z`}var v$={std:{ratio:4/3}},dr=class extends k{static properties={type:{type:String,default:"bar",reflect:!0},x:{type:String,default:"",reflect:!0},y:{type:String,default:"",reflect:!0},hideAverage:{type:Boolean,default:!1,reflect:!0,attribute:"hide-average"},color:{type:String,default:"",reflect:!0},hideGrid:{type:Boolean,default:!1,reflect:!0,attribute:"hide-grid"},hideValues:{type:Boolean,default:!1,reflect:!0,attribute:"hide-values"},radius:{type:Number,default:null,reflect:!0},smooth:{type:Number,default:.4,reflect:!0},size:{type:String,default:"",reflect:!0},format:{type:String,default:"abbr",reflect:!0},loading:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=!1;#i=null;#s=null;#n=0;#r=0;#a=new Set;#o(){if(this.radius!=null)return this.radius;let t=getComputedStyle(this).getPropertyValue("--a-radius").trim(),e=parseFloat(t);return Number.isFinite(e)&&e>0?e:6}set data(t){!Array.isArray(t)&&!this.#e&&(this.#e=!0,console.warn(`[chart-ui] .data must be an array of plain objects \u2014 received ${t===null?"null":typeof t}. The {labels, datasets} envelope is the Chart.js API, not the chart-ui API.
191
+ `),this.#e=this.querySelector("[data-dropzone]"),this.#e&&(this.#e.addEventListener("click",this.#i),this.#e.addEventListener("keydown",this.#s),this.#e.addEventListener("dragover",this.#o),this.#e.addEventListener("dragleave",this.#l),this.#e.addEventListener("drop",this.#c))}render(){let t=this.querySelector("[data-filelist]");if(!this.#e||!t)return;let e=this.querySelector("span[hint]");e&&this.hint&&e.setAttribute("hint",this.hint),t.innerHTML="";for(let i of this.#t){let n=document.createElement("span");n.textContent=i.name,t.appendChild(n)}}get files(){return this.#t}#i=()=>{this.disabled||this.#n()};#s=t=>{this.disabled||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n())};async#n(){try{if(window.showOpenFilePicker){let t=this.#a(),e={multiple:this.multiple};t.length&&(e.types=t);let i=await window.showOpenFilePicker(e);if(!this.isConnected)return;let n=await Promise.all(i.map(r=>r.getFile()));if(!this.isConnected)return;this.#h(n)}else this.#r()}catch(t){if(t.name!=="AbortError")throw t}}#r(){let t=document.createElement("input");t.type="file",this.accept&&(t.accept=this.accept),this.multiple&&(t.multiple=!0),t.style.display="none",document.body.appendChild(t),t.addEventListener("change",()=>{t.files?.length&&this.#h([...t.files]),t.remove()},{once:!0}),t.addEventListener("cancel",()=>t.remove(),{once:!0}),t.click()}#a(){if(!this.accept)return[];let t={};for(let e of this.accept.split(",")){let i=e.trim();i&&(i.startsWith(".")?(t["application/octet-stream"]=t["application/octet-stream"]||[],t["application/octet-stream"].push(i)):t[i]=t[i]||[])}return Object.keys(t).length?[{accept:t}]:[]}#o=t=>{t.preventDefault(),this.querySelector("[data-dropzone]")?.setAttribute("data-dragover","")};#l=()=>{this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover")};#c=t=>{if(t.preventDefault(),this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover"),this.disabled)return;let e=t.dataTransfer;e?.files?.length&&this.#h([...e.files])};#h(t){this.#t=t;let e=new FormData;for(let i of this.#t)e.append(this.name||"file",i);this.internals.setFormValue(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,files:this.files}})),this.render()}disconnected(){super.disconnected(),this.#e&&(this.#e.removeEventListener("click",this.#i),this.#e.removeEventListener("keydown",this.#s),this.#e.removeEventListener("dragover",this.#o),this.#e.removeEventListener("dragleave",this.#l),this.#e.removeEventListener("drop",this.#c)),this.#e=null}};x("upload-ui",jn);Hu();var _n=KO({name:"draggable",category:"motion-positioning",description:"Pointer drag to reposition",attributes:["data-draggable-dragging"],events:["drag-end"],config:[],setup({host:s}){let t=!1,e=0,i=0,n=0,r=0;function o(){return s.hasAttribute("disabled")}function a(c){if(o())return;t=!0,e=c.clientX,i=c.clientY;let u=getComputedStyle(s),d=u.translate;if(d&&d!=="none"){let f=d.split(/\s+/).map(parseFloat);n=f[0]||0,r=f[1]||0}else{let f=new DOMMatrixReadOnly(u.transform);n=f.m41,r=f.m42}s.setPointerCapture(c.pointerId),s.setAttribute("data-draggable-dragging",""),s.style.touchAction="none"}function l(c){if(!t)return;let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.style.translate=`${f}px ${p}px`}function h(c){if(!t)return;t=!1,s.removeAttribute("data-draggable-dragging");let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{x:f,y:p}}))}return s.addEventListener("pointerdown",a),s.addEventListener("pointermove",l),s.addEventListener("pointerup",h),()=>{s.removeEventListener("pointerdown",a),s.removeEventListener("pointermove",l),s.removeEventListener("pointerup",h),s.removeAttribute("data-draggable-dragging"),s.style.touchAction=""}}});P();var Wn=class extends k{static properties={variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"",reflect:!0},elevation:{type:Number,default:1,reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}};x("card-ui",Wn);P();var Yn=class extends k{static properties={src:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},shape:{type:String,default:"circle",reflect:!0}};get displayName(){return this.text}static template=()=>null;#t=null;#e=null;#i=null;connected(){this.setAttribute("role","img")}render(){!this.src&&!this.displayName&&!this.icon||(this.src?(this.#t||(this.#t=document.createElement("img"),this.#t.setAttribute("slot","img"),this.#t.onerror=()=>{this.#t.remove(),this.#t=null,this.#s()}),this.#t.src=this.src,this.#t.alt=this.displayName||"",this.#t.parentElement||this.appendChild(this.#t),this.#e&&(this.#e.remove(),this.#e=null)):this.icon?(this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null),this.#i||(this.#i=document.createElement("icon-ui"),this.#i.setAttribute("slot","icon"),this.appendChild(this.#i)),this.#i.setAttribute("name",this.icon)):(this.#t&&(this.#t.remove(),this.#t=null),this.#i&&(this.#i.remove(),this.#i=null),this.#s()),this.setAttribute("aria-label",this.displayName||this.icon||""))}#s(){if(!this.displayName)return;let t=this.displayName.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase();this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","initials"),this.appendChild(this.#e)),this.#e.textContent=t}},Fn=class extends k{static properties={max:{type:Number,default:5,reflect:!0},size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Avatar group")}render(){let t=[...this.querySelectorAll("avatar-ui")],e=this.max,i=t.length-e;if(this.size)for(let r of t)r.setAttribute("size",this.size);t.forEach((r,o)=>{r.style.display=o<e?"":"none",r.style.zIndex=String(t.length-o)});let n=this.querySelector('[slot="overflow"]');i>0?(n||(n=document.createElement("span"),n.setAttribute("slot","overflow"),this.appendChild(n)),n.textContent=`+${i}`,n.setAttribute("aria-label",`${i} more`),n.style.zIndex="0"):n&&n.remove()}};x("avatar-ui",Yn),x("avatar-group-ui",Fn);P();var Un=class extends k{static properties={value:{type:Number,default:null,reflect:!0},variant:{type:String,default:"bar",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"),this.variant==="bar"&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","track"),this.#e=document.createElement("div"),this.#e.setAttribute("slot","fill"),this.#t.appendChild(this.#e),this.appendChild(this.#t))}render(){let t=this.value==null||this.value<0,e=Math.max(0,Math.min(100,this.value));this.setAttribute("aria-busy",String(t)),t?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",String(e)),this.#e&&(this.#e.style.width=t?"100%":`${e}%`)}disconnected(){this.#t?.remove(),this.#t=null,this.#e=null}};x("progress-ui",Un);P();var Gn=class extends k{static properties={value:{type:Number,default:0,reflect:!0},total:{type:Number,default:0,reflect:!0},caption:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),!it(this,"caption").length&&!it(this,"track").length?(this.#t=document.createElement("span"),this.#t.setAttribute("slot","caption"),this.appendChild(this.#t),this.#e=document.createElement("div"),this.#e.setAttribute("slot","track"),this.appendChild(this.#e)):(this.#t=it(this,"caption")[0],this.#e=it(this,"track")[0])}render(){let t=Math.max(0,this.total|0),e=Math.max(0,Math.min(t,this.value|0));if(this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(e)),this.#t&&!this.#t.dataset.custom&&(this.#t.textContent=this.caption||"",this.#t.toggleAttribute("hidden",!this.caption)),this.#e){let i=this.#e.children.length;for(;this.#e.children.length<t;)this.#e.appendChild(document.createElement("span"));for(;this.#e.children.length>t;)this.#e.lastElementChild.remove();for(let n=0;n<this.#e.children.length;n++)this.#e.children[n].toggleAttribute("data-active",n<e)}}disconnected(){this.#t=null,this.#e=null}};x("step-progress-ui",Gn);P();var Hn=class extends k{static properties={width:{type:String,default:"100%",reflect:!0},height:{type:String,default:"1.2em",reflect:!0},radius:{type:String,default:"sm",reflect:!0},static:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("aria-hidden","true"),this.#t()}render(){this.#t()}#t(){this.style.width=this.width,this.style.height=this.height}};x("skeleton-ui",Hn);P();var Kn=class extends k{static properties={size:{type:String,default:"md",reflect:!0},variant:{type:String,default:"arc",reflect:!0},tone:{type:String,default:"current",reflect:!0},paused:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"Loading",reflect:!1}};static template=()=>null;connected(){this.hasAttribute("role")||this.setAttribute("role","progressbar"),this.hasAttribute("aria-busy")||this.setAttribute("aria-busy","true"),this.setAttribute("aria-valuetext",this.label||"Loading"),this.#t()}render(){this.setAttribute("aria-valuetext",this.label||"Loading"),this.#t()}#t(){let t=this.variant==="dots",e=this.querySelectorAll(":scope > [data-spinner-dot]");if(t){if(e.length===3)return;e.forEach(n=>n.remove());let i=document.createDocumentFragment();for(let n=1;n<=3;n++){let r=document.createElement("span");r.setAttribute("data-spinner-dot",String(n)),r.setAttribute("aria-hidden","true"),i.appendChild(r)}this.appendChild(i)}else e.length&&e.forEach(i=>i.remove())}};x("spinner-ui",Kn);P();var Jn=class extends k{static properties={active:{type:Boolean,default:!1,reflect:!0},delay:{type:Number,default:200,reflect:!0},label:{type:String,default:"Loading\u2026",reflect:!0},variant:{type:String,default:"default",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;constructor(){super();let t=Object.getOwnPropertyDescriptor(this,"active");if(t?.set){let e=t.set;Object.defineProperty(this,"active",{get:t.get,set:i=>{let n=!!t.get.call(this);e.call(this,i),!!i!==n&&this.#s(!!i)},configurable:!0})}}connected(){this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.setAttribute("aria-label",this.label||"Loading"),this.#t=this.parentElement,this.active&&this.#s(!0)}disconnected(){this.#a(),this.#i&&this.#r(),this.#t=null}render(){let t=this.label||"Loading";this.setAttribute("aria-label",t);let e=this.querySelector(":scope > spinner-ui[data-loading-overlay-auto]");e&&e.getAttribute("label")!==t&&e.setAttribute("label",t),this.children.length===0&&this.#o()}#s(t){if(this.#a(),t){let e=Math.max(0,Number(this.delay)||0);e===0?this.#n():this.#e=setTimeout(()=>{this.#e=null,this.active&&this.#n()},e)}else this.#i&&this.#r()}#n(){let t=this.#t||this.parentElement;t&&!t.hasAttribute("aria-busy")&&t.setAttribute("aria-busy","true"),this.#i=!0}#r(){let t=this.#t||this.parentElement;t&&t.getAttribute("aria-busy")==="true"&&t.removeAttribute("aria-busy"),this.#i=!1}#a(){this.#e!==null&&(clearTimeout(this.#e),this.#e=null)}#o(){let t=document.createElement("spinner-ui");t.setAttribute("size","lg"),t.setAttribute("tone","subtle"),t.setAttribute("label",this.label||"Loading"),t.setAttribute("data-loading-overlay-auto",""),this.appendChild(t)}};x("loading-overlay-ui",Jn);P();var fb=new Set;function pb(s,t){fb.has(s)||(fb.add(s),console.warn(`[alert-ui] ${t}`))}var tr=class s extends k{static properties={text:{type:String,default:"",reflect:!0},title:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},closable:{type:Boolean,default:!1,reflect:!0},dismissible:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0},pattern:{type:String,default:"",reflect:!0},amount:{type:Number,default:0,reflect:!0},currency:{type:String,default:"USD",reflect:!0},dueAt:{type:String,default:"",reflect:!0,attribute:"due-at"},cardLast4:{type:String,default:"",reflect:!0,attribute:"card-last4"},reason:{type:String,default:"",reflect:!0}};static parts={leading:'<icon-ui slot="leading"></icon-ui>',content:'<span slot="content"></span>',close:'<button-ui slot="close" icon="x" variant="ghost" size="sm" aria-label="Close"></button-ui>'};static#t={declined:"x-circle",expired:"clock",insufficient:"wallet",network:"wifi-slash"};static template=()=>null;#e(){this.getAttribute("variant")==="error"&&(pb("variant-error",'variant="error" is not in the canonical enum [default, info, success, warning, danger, muted, neutral]. Mapping to "danger". Fix the source (LLM prompt / corpus pattern) to emit "danger" directly.'),this.setAttribute("variant","danger")),this.hasAttribute("closeable")&&!this.hasAttribute("closable")&&!this.hasAttribute("dismissible")&&(pb("alias-closeable","attribute [closeable] is a misspelled alias of canonical [closable]. Mapping. Fix the source to use [closable] or [dismissible]."),this.setAttribute("closable",""),this.removeAttribute("closeable")),this.hasAttribute("dismissible")&&!this.hasAttribute("closable")&&this.setAttribute("closable","")}#i=t=>{if(t.target.closest('[slot="close"]')){this.#h();return}if(this.pattern==="dunning"){let e=t.target.closest("[data-dunning-action]");if(e&&this.contains(e)){let i=e.getAttribute("data-dunning-action")||"";this.dispatchEvent(new CustomEvent("dunning-action",{bubbles:!0,composed:!0,detail:{action:i,amount:this.amount,currency:this.currency,dueAt:this.dueAt}}))}}};connected(){this.#e(),this.#c(),(this.icon||this.pattern==="dunning"&&this.reason)&&this.ensure("leading"),this.ensure("content"),this.closable&&this.ensure("close"),this.addEventListener("press",this.#i)}disconnected(){this.removeEventListener("press",this.#i)}render(){if(this.pattern==="dunning"){this.#s(),this.#c();return}if(this.icon){let e=this.ensure("leading");e&&e.setAttribute("name",this.icon)}else this.drop("leading");let t=this.ensure("content");if(t){let e=t.hasAttribute("data-alert-auto"),i=t.childNodes.length>0;if(!e&&i){if(this.title||this.description){let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}}else if(this.title||this.description){if(t.setAttribute("data-alert-auto","title-desc"),t.replaceChildren(),this.title){let r=document.createElement("strong");r.textContent=this.title,t.appendChild(r),this.description&&t.appendChild(document.createTextNode(" "))}this.description&&t.appendChild(document.createTextNode(this.description));let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}else this.text&&(t.setAttribute("data-alert-auto","text"),t.textContent=this.text)}this.closable||this.dismissible?this.ensure("close"):this.drop("close"),this.#c()}#s(){let t=this.icon||s.#t[this.reason]||"x-circle",e=this.ensure("leading");e&&e.setAttribute("name",t);let i=this.ensure("content");if(!i)return;i.setAttribute("data-alert-auto","dunning"),i.replaceChildren();let n=this.title||this.#n();if(n){let l=document.createElement("strong");l.setAttribute("data-dunning-title",""),l.textContent=n,i.appendChild(l)}let r=this.#r(),o=this.#o();if(r||o){if(i.appendChild(document.createTextNode(" ")),r){let l=document.createElement("span");l.setAttribute("data-dunning-amount",""),l.textContent=r,i.appendChild(l)}if(r&&o&&i.appendChild(document.createTextNode(" ")),o){let l=document.createElement("span");l.setAttribute("data-dunning-meta",""),l.textContent=o,i.appendChild(l)}}let a=[n,r,o].filter(Boolean).join(". ");a&&this.setAttribute("aria-label",a),this.closable||this.dismissible?this.ensure("close"):this.drop("close")}#n(){switch(this.reason){case"expired":return"Card expired";case"insufficient":return"Insufficient funds";case"network":return"Network error";case"declined":return"Payment failed";default:return this.variant==="warning"?"Payment due soon":"Payment failed"}}#r(){if(!this.amount&&this.amount!==0||this.amount===0)return"";try{let t=this.getAttribute("lang")||this.lang||void 0;return new Intl.NumberFormat(t,{style:"currency",currency:this.currency||"USD"}).format(this.amount)}catch{return`${this.currency||""} ${this.amount}`.trim()}}#a(){if(!this.dueAt)return"";let t=/^\d{4}-\d{2}-\d{2}$/.test(this.dueAt)?new Date(`${this.dueAt}T00:00:00`):new Date(this.dueAt);if(Number.isNaN(t.getTime()))return"";try{let e=this.getAttribute("lang")||this.lang||void 0;return new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"numeric"}).format(t)}catch{return t.toDateString()}}#o(){let t=[];this.cardLast4&&t.push(`Card ending ${this.cardLast4}`),this.reason&&this.reason!=="declined"&&t.push(this.#l());let e=this.#a();if(e){let i=this.variant==="warning"?"due":"failed";t.push(`${i} ${e}`)}return t.join(" \xB7 ")}#l(){switch(this.reason){case"expired":return"expired";case"insufficient":return"insufficient funds";case"network":return"network error";case"declined":return"declined";default:return""}}#c(){let t=this.variant==="danger"||this.variant==="warning"?"alert":"status";this.setAttribute("role",t)}#h(){this.dispatchEvent(new Event("close",{bubbles:!0})),this.remove()}};x("alert-ui",tr);P();var t$={info:"info",success:"check-circle",warning:"warning",danger:"x-circle"},er=class extends k{static properties={text:{type:String,default:"",reflect:!1},variant:{type:String,default:"default",reflect:!0},icon:{type:String,default:"",reflect:!0},live:{type:String,default:"",reflect:!0}};static parts={leading:'<icon-ui slot="leading"></icon-ui>'};static requiredIcons=["info","check-circle","warning","x-circle"];static template=()=>null;#t(t){return!!(t&&(t._uiPart||t.hasAttribute("data-im-auto")))}connected(){}render(){this.live?this.setAttribute("aria-live",this.live):this.hasAttribute("aria-live")&&this.removeAttribute("aria-live"),this.#e();let t=this.icon||t$[this.variant]||"",e=this.querySelector(':scope > [slot="leading"]');if(!(e&&!this.#t(e)))if(t){let i=this.ensure("leading");i&&(i.setAttribute("data-im-auto",""),i.getAttribute("name")!==t&&i.setAttribute("name",t))}else this.drop("leading")}#e(){let t=this.querySelector(":scope > [data-im-text]");if(Array.from(this.childNodes).some(i=>i===t?!1:i.nodeType===Node.ELEMENT_NODE?!(i.getAttribute&&i.getAttribute("slot")==="leading"):!!(i.nodeType===Node.TEXT_NODE&&i.textContent.trim()))){t&&t.remove();return}this.text?(t||(t=document.createElement("span"),t.setAttribute("data-im-text",""),this.appendChild(t)),t.textContent!==this.text&&(t.textContent=this.text)):t&&t.remove()}};x("inline-message-ui",er);P();var ir=class extends k{static properties={size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","presentation")}};x("kbd-ui",ir);P();var sr=class extends k{static requiredIcons=["x"];static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"md",reflect:!0},removable:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static parts={dismiss:'<button-ui slot="dismiss" variant="ghost" size="xs" aria-label="Remove"><icon-ui slot="icon" name="x" weight="bold"></icon-ui></button-ui>'};static template=()=>null;#t=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};#e=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};connected(){this.setAttribute("role","status"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}disconnected(){this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.disabled?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0")),this.removable&&!this.disabled){let t=this.ensure("dismiss");t&&t.parentElement!==this&&this.appendChild(t)}else this.drop("dismiss")}};x("tag-ui",sr);P();var e$=new Set(["block","dot","square","line","dashed"]),i$=new Set(["sm","md","lg"]),s$=new Set(["out-of-gamut","p3-only","apca-pass","apca-fail"]),n$={"out-of-gamut":"\u25B3","p3-only":"\u2726","apca-pass":"\u2713","apca-fail":"\u2717"},r$={"out-of-gamut":"Outside sRGB gamut","p3-only":"Display-P3 only","apca-pass":"Contrast passes APCA","apca-fail":"Contrast fails APCA"};function o$(s){return s?s.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t&&s$.has(t)):[]}var ls=null;function a$(s){if(!s||typeof s!="string"||typeof document>"u")return null;try{if(!ls){let u=document.createElement("canvas");u.width=1,u.height=1,ls=u.getContext("2d")}ls.fillStyle="#000",ls.clearRect(0,0,1,1),ls.fillStyle=s,ls.fillRect(0,0,1,1);let[t,e,i]=ls.getImageData(0,0,1,1).data;if(t===0&&e===0&&i===0&&s!=="#000"&&s!=="black"&&s!=="#000000")return null;let n=u=>{let d=u/255;return d<=.04045?d/12.92:Math.pow((d+.055)/1.055,2.4)},r=n(t),o=n(e),a=n(i),l=Math.cbrt(.4122214708*r+.5363325363*o+.0514459929*a),h=Math.cbrt(.2119034982*r+.6806995451*o+.1073969566*a),c=Math.cbrt(.0883024619*r+.2817188376*o+.6299787005*a);return .2104542553*l+.793617785*h-.0040720468*c}catch{return null}}var nr=class extends k{static properties={shape:{type:String,default:"square",reflect:!0},size:{type:String,default:"md",reflect:!0},color:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},detail:{type:String,default:"",reflect:!0},badge:{type:String,default:"",reflect:!0},copyable:{type:Boolean,default:!1,reflect:!0},copyValue:{type:String,default:""},selectable:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},autoContrast:{type:Boolean,default:!1,reflect:!0},labelPosition:{type:String,default:"below",reflect:!0,attribute:"label-position"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=!1;#a=null;#o=null;#l=null;#c=null;#h=null;#u=null;connected(){this.#d(),this.#S(),this.#u=new MutationObserver(t=>{let e=!1;for(let i of t){for(let n of i.addedNodes)if(n.nodeType===1){if(n.getAttribute?.("slot")==="chrome"){e=!0;break}if(n.tagName==="SPAN"&&n.style?.display==="contents"&&n.querySelector?.('[slot="chrome"]')){e=!0;break}}if(e)break}e&&(this.#f(),this.#u.takeRecords())}),this.#u.observe(this,{childList:!0})}render(){this.#d(),this.#p(),this.#m(),this.#b(),this.#y(),this.#O(),this.#g()}#d(){if(this.#r)return;let t=Array.from(this.children).filter(r=>r.getAttribute&&r.getAttribute("slot")==="chrome");for(let r of t)r.remove();let e=Array.from(this.children).filter(r=>r.tagName==="SPAN"&&r.style?.display==="contents"&&r.querySelector?.('[slot="chrome"]'));for(let r of e)r.remove();let i=[];for(let r of Array.from(this.childNodes))(r.nodeType===3&&!r.data||r.nodeType===8)&&i.push(r);for(let r of i)r.remove();let n=Array.from(this.childNodes).filter(r=>!(r.nodeType===1&&r.dataset&&(r.dataset.tile!==void 0||r.dataset.label!==void 0||r.dataset.detail!==void 0||r.dataset.badge!==void 0||r.dataset.copy!==void 0))&&!(r.nodeType===3&&!r.textContent.trim()));this.innerHTML="",this.#t=document.createElement("span"),this.#t.setAttribute("data-tile",""),this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t);for(let r of t)this.appendChild(r);for(let r of e)this.appendChild(r);for(let r of i)this.appendChild(r);if(this.#s=document.createElement("span"),this.#s.setAttribute("data-badge",""),this.#s.setAttribute("hidden",""),this.appendChild(this.#s),this.#e=document.createElement("span"),this.#e.setAttribute("data-label",""),n.length)for(let r of n)this.#e.appendChild(r);this.appendChild(this.#e),this.#i=document.createElement("span"),this.#i.setAttribute("data-detail",""),this.#i.setAttribute("hidden",""),this.appendChild(this.#i),this.#n=document.createElement("button-ui"),this.#n.setAttribute("data-copy",""),this.#n.setAttribute("variant","ghost"),this.#n.setAttribute("size","xs"),this.#n.setAttribute("aria-label","Copy value"),this.#n.setAttribute("hidden",""),this.#n.setAttribute("text","\u29C9"),this.appendChild(this.#n),this.#r=!0}#f(){if(!this.#t||!this.#s)return;let t=[];for(let e of this.children)if(e!==this.#t){if(e===this.#s)break;e.getAttribute?.("slot")==="chrome"&&t.push(e)}for(let e of Array.from(this.children))e!==this.#t&&e!==this.#s&&e!==this.#e&&e!==this.#i&&e!==this.#n&&e.getAttribute?.("slot")==="chrome"&&this.insertBefore(e,this.#s);for(let e of Array.from(this.children))e===this.#t||e===this.#s||e===this.#e||e===this.#i||e===this.#n||!(e.tagName==="SPAN"&&e.style?.display==="contents")||!e.querySelector?.('[slot="chrome"]')||this.insertBefore(e,this.#s)}#p(){if(!this.#t||!this.#e)return;this.#f();let t=e$.has(this.shape)?this.shape:"square",e=i$.has(this.size)?this.size:"md";t!==this.shape&&this.setAttribute("shape",t),e!==this.size&&this.setAttribute("size",e),this.color&&this.style.setProperty("--swatch-color",this.color),!this.#e.firstChild&&this.label?this.#e.textContent=this.label:this.#e.firstChild?.nodeType===3&&this.label&&(this.#e.textContent=this.label);let i=this.#e.textContent.trim().length>0||this.#e.firstElementChild!=null;this.#e.toggleAttribute("hidden",!i)}#m(){if(!this.#s)return;let t=o$(this.badge);if(t.length===0){this.#s.setAttribute("hidden",""),this.#s.replaceChildren();return}this.#s.removeAttribute("hidden");let e=Array.from(this.#s.children).map(r=>r.dataset.badgeVariant);if(e.length===t.length&&e.every((r,o)=>r===t[o]))return;let n=document.createDocumentFragment();for(let r of t){let o=document.createElement("span");o.setAttribute("data-badge-variant",r),o.setAttribute("role","img"),o.setAttribute("aria-label",r$[r]),o.textContent=n$[r],n.appendChild(o)}this.#s.replaceChildren(n)}#g(){if(!this.#e)return;if(!this.autoContrast){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark"),this.#a=null;return}let t=this.color||getComputedStyle(this).getPropertyValue("--swatch-color").trim();if(t===this.#a)return;this.#a=t;let e=a$(t);if(e==null){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark");return}let i=e<.62;this.#e.toggleAttribute("data-on-dark",i),this.#e.toggleAttribute("data-on-light",!i)}#b(){if(!this.#i)return;let t=(this.detail||"").trim();if(!t){this.#i.setAttribute("hidden",""),this.#i.textContent="";return}this.#i.removeAttribute("hidden"),this.#i.textContent!==t&&(this.#i.textContent=t)}#y(){if(!this.#n)return;if(!this.copyable){this.#n.setAttribute("hidden","");return}this.#n.removeAttribute("hidden");let t=this.#v();t?this.#n.setAttribute("aria-label",`Copy ${t}`):this.#n.setAttribute("aria-label","Copy value")}#O(){this.selectable?(this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.setAttribute("aria-pressed",this.selected?"true":"false")):(this.getAttribute("role")==="button"&&this.removeAttribute("role"),this.getAttribute("tabindex")==="0"&&this.removeAttribute("tabindex"),this.removeAttribute("aria-pressed"))}#S(){this.#o=t=>{!this.selectable||(t.composedPath?t.composedPath():[]).includes(this.#n)||this.#x()},this.#l=t=>{!this.selectable||t.key!=="Enter"&&t.key!==" "||(t.composedPath?t.composedPath():[t.target]).includes(this.#n)||(t.preventDefault(),this.#x())},this.addEventListener("click",this.#o),this.addEventListener("keydown",this.#l),this.#c=t=>{if(t.stopPropagation(),!this.copyable)return;let e=this.#v();e&&this.#w(e)},this.#n.addEventListener("click",this.#c)}#x(){this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{value:this.color||this.label,color:this.color,label:this.label}}))}#v(){return this.copyValue?this.copyValue:this.color?this.color:""}async#w(t){let e=!1;try{navigator?.clipboard?.writeText&&(await navigator.clipboard.writeText(t),e=!0)}catch{}this.#k(e)}#k(t){this.#n&&(this.#h!=null&&clearTimeout(this.#h),this.#n.setAttribute("data-copy-state",t?"ok":"fail"),this.#n.setAttribute("text",t?"\u2713":"\u26A0"),this.#h=setTimeout(()=>{this.#n&&(this.#n.removeAttribute("data-copy-state"),this.#n.setAttribute("text","\u29C9"),this.#h=null)},1200))}disconnected(){this.#h!=null&&(clearTimeout(this.#h),this.#h=null),this.#u&&(this.#u.disconnect(),this.#u=null),this.#o&&this.removeEventListener("click",this.#o),this.#l&&this.removeEventListener("keydown",this.#l),this.#n&&this.#c&&this.#n.removeEventListener("click",this.#c),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#n=null,this.#r=!1}};x("swatch-ui",nr);_e();var mb={xs:0,sm:480,md:768,lg:1024,xl:1280},hs=Object.keys(mb),hd=Object.values(mb);function gb(){if(typeof window>"u")return"lg";let s=window.innerWidth;for(let t=hs.length-1;t>=0;t--)if(s>=hd[t])return hs[t];return"xs"}var $e=Xi(gb());if(typeof window<"u")for(let s=1;s<hd.length;s++)window.matchMedia(`(min-width: ${hd[s]}px)`).addEventListener("change",()=>{$e.value=gb()});function Xt(s,t=$e.value){if(!s)return null;if(!s.includes("@"))return s;let e=null,i=new Map;for(let a of s.trim().split(/\s+/)){let l=a.lastIndexOf("@");l===-1?e=a:i.set(a.slice(l+1),a.slice(0,l))}let n=hs.indexOf(t),r=null,o=-1;for(let[a,l]of i){let h=hs.indexOf(a);h!==-1&&h<=n&&h>o&&(r=l,o=h)}return r??e}P();var rr=class extends k{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"stretch",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;render(){let t=this.gap,e=this.align,i=this.justify,r=t?.includes("@")||e?.includes("@")||i?.includes("@")?$e.value:"";if(t?.includes("@")?this.style.setProperty("--col-gap",c$(Xt(t,r))):this.style.removeProperty("--col-gap"),e?.includes("@")){let o=Xt(e,r);this.style.setProperty("--col-align",u$(o)),this.style.textAlign=d$(o)}else this.style.removeProperty("--col-align"),this.style.textAlign="";i?.includes("@")?this.style.setProperty("--col-justify",f$(Xt(i,r))):this.style.removeProperty("--col-justify")}},l$={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},h$={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function c$(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function u$(s){return l$[s]??s}function d$(s){return{start:"start",center:"center",end:"end"}[s]??""}function f$(s){return h$[s]??s}x("col-ui",rr);P();var or=class s extends k{static properties={label:{type:String,default:"",reflect:!0},hint:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},align:{type:String,default:"start",reflect:!0}};get error(){return this.#g()?.error??""}static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=t=>{let e=this.#g();if(!e)return;let i=this.#y(e);i&&(t.preventDefault(),i.focus())};connected(){this.#u(),this.#d(),this.#f(),this.#p(),this.#c(),this.#t?.addEventListener("click",this.#r),this.#n=new MutationObserver(()=>{this.#p(),this.#c(),this.#m(),this.#a()}),this.#n.observe(this,{childList:!0}),this.#a()}disconnected(){this.#n?.disconnect(),this.#n=null,this.#h(),this.#t?.removeEventListener("click",this.#r),this.#t=null,this.#e=null,this.#i=null,this.#s=null}render(){this.#t&&this.#t.childNodes[0]&&(this.#t.childNodes[0].nodeValue=this.label||""),this.#e&&(this.#e.hidden=!this.required),this.#i&&(this.#i.textContent=this.hint||"",this.#i.hidden=!this.hint||!!this.error),this.#a(),this.#m()}#a(){if(!this.#s)return;let t=this.error;this.#s.textContent=t||"",this.#s.hidden=!t}#o=()=>{this.#a(),this.#m()};#l=null;#c(){let t=this.#g();t!==this.#l&&(this.#h(),t&&(this.#l=t,t.addEventListener("invalid",this.#o,!0),t.addEventListener("change",this.#o),t.addEventListener("input",this.#o)))}#h(){let t=this.#l;t&&(t.removeEventListener("invalid",this.#o,!0),t.removeEventListener("change",this.#o),t.removeEventListener("input",this.#o),this.#l=null)}#u(){if(this.#t=this.querySelector(":scope > [data-field-label]"),!this.#t){let t=document.createElement("label");t.setAttribute("slot","label"),t.setAttribute("data-field-label",""),t.appendChild(document.createTextNode(this.label||"")),this.prepend(t),this.#t=t}if(this.#e=this.#t.querySelector("[data-field-required]"),!this.#e){let t=document.createElement("span");t.setAttribute("data-field-required",""),t.setAttribute("aria-hidden","true"),t.textContent="*",t.hidden=!0,this.#t.appendChild(t),this.#e=t}}#d(){if(this.#i=this.querySelector(":scope > [data-field-hint]"),this.#i)return;let t=document.createElement("div");t.setAttribute("slot","hint"),t.setAttribute("data-field-hint",""),t.setAttribute("id",s.#v("hint")),t.hidden=!0,this.appendChild(t),this.#i=t}#f(){if(this.#s=this.querySelector(":scope > [data-field-error]"),this.#s)return;let t=document.createElement("div");t.setAttribute("slot","error"),t.setAttribute("data-field-error",""),t.setAttribute("id",s.#v("err")),t.setAttribute("role","alert"),t.hidden=!0,this.appendChild(t),this.#s=t}#p(){if(!this.#t)return;let t=this.#g();if(!t){this.#t.removeAttribute("for");return}t.id||(t.id=s.#S()),this.#t.setAttribute("for",t.id)}#m(){let t=this.#g();if(!t)return;let e=new Set;this.#i&&!this.#i.hidden&&e.add(this.#i.id),this.#s&&!this.#s.hidden&&e.add(this.#s.id);let n=[...(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(r=>r&&!r.startsWith("field-hint-")&&!r.startsWith("field-err-")),...e].join(" ").trim();n?t.setAttribute("aria-describedby",n):t.removeAttribute("aria-describedby")}#g(){let t=null,e=null;for(let i of this.children)if(!i.hasAttribute("slot")){if(t===null&&(t=i),s.#b.has(i.localName))return i;e===null&&this.#y(i)&&(e=i)}return e??t}static#b=new Set(["input-ui","textarea-ui","select-ui","combobox-ui","search-ui","check-ui","radio-ui","switch-ui","slider-ui","range-ui","otp-input-ui","tags-input-ui","chat-input-ui","autocomplete-input-ui","datetime-picker-ui","date-range-picker-ui","calendar-picker-ui","color-picker-ui","upload-ui","rating-ui","segmented-ui","input","textarea","select"]);#y(t){let e='input, textarea, select, button, [contenteditable], [tabindex]:not([tabindex="-1"])';return t.matches?.(e)?t:t.querySelector?.(e)??null}static#O=0;static#S(){return`field-ctl-${++s.#O}`}static#x=0;static#v(t){return`field-${t}-${++s.#x}`}};x("field-ui",or);P();var ar=class extends k{static properties={inline:{type:Boolean,default:!1,reflect:!0},columns:{type:Number,default:6,reflect:!0}};static template=()=>null;#t=null;connected(){this.#e(),this.#t=new MutationObserver(t=>{for(let e of t)if(e.type==="childList"&&(this.#i(e.addedNodes)||this.#i(e.removedNodes))){this.#e();return}}),this.#t.observe(this,{childList:!0})}disconnected(){this.#t?.disconnect(),this.#t=null}render(){this.#e()}#e(){let t=this.hasAttribute("inline");for(let e of this.children)e.localName==="field-ui"&&(t?e.hasAttribute("inline")||e.setAttribute("inline",""):e.hasAttribute("inline")&&e.removeAttribute("inline"))}#i(t){for(let e of t)if(e.nodeType===1&&e.localName==="field-ui")return!0;return!1}};x("fields-ui",ar);P();var Ob=0,Sa=class extends k{static properties={label:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},hint:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;connected(){this.setAttribute("role","group"),this.#t=this.querySelector(':scope > [slot="label"]'),this.#t||(this.#t=document.createElement("span"),this.#t.setAttribute("slot","label"),this.insertBefore(this.#t,this.firstChild)),this.#t.id||(this.#t.id=`display-field-label-${++Ob}`),this.#e=this.querySelector(':scope > [slot="value"]'),this.#i=this.querySelector(':scope > [slot="hint"]'),this.#s=this.querySelector(':scope > icon-ui[slot="icon"]')}render(){if(!this.#t)return;this.label?(this.#t.textContent=this.label,this.#t.hidden=!1,this.setAttribute("aria-labelledby",this.#t.id)):(this.#t.hidden=!0,this.removeAttribute("aria-labelledby")),this.querySelector(":scope > :not([slot])")?this.#e&&(this.#e.remove(),this.#e=null):(this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","value"),this.appendChild(this.#e)),this.#e.textContent=this.value),this.hint?(this.#i||(this.#i=document.createElement("span"),this.#i.setAttribute("slot","hint"),this.#i.id=`display-field-hint-${++Ob}`,this.appendChild(this.#i)),this.#i.textContent=this.hint,this.setAttribute("aria-describedby",this.#i.id)):this.#i&&(this.#i.remove(),this.#i=null,this.removeAttribute("aria-describedby")),this.icon?(this.#s||(this.#s=document.createElement("icon-ui"),this.#s.setAttribute("slot","icon"),this.#s.setAttribute("aria-hidden","true"),this.appendChild(this.#s)),this.#s.setAttribute("name",this.icon)):this.#s&&(this.#s.remove(),this.#s=null)}disconnected(){this.#t=null,this.#e=null,this.#i=null,this.#s=null}};x("display-field-ui",Sa);P();var lr=class extends k{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"center",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0},wrap:{type:Boolean,default:!1,reflect:!0},wrapAt:{type:String,default:"",reflect:!0,attribute:"wrap-at"},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(_n),this.#t=!0)}render(){let t=this.gap,e=this.align,i=this.justify,n=this.wrapAt,o=t?.includes("@")||e?.includes("@")||i?.includes("@")||!!n?$e.value:"";if(t?.includes("@")?this.style.setProperty("--row-gap",g$(Xt(t,o))):this.style.removeProperty("--row-gap"),e?.includes("@")?this.style.setProperty("--row-align",O$(Xt(e,o))):this.style.removeProperty("--row-align"),i?.includes("@")?this.style.setProperty("--row-justify",b$(Xt(i,o))):this.style.removeProperty("--row-justify"),n){let a=hs.indexOf(o),l=hs.indexOf(n);this.style.flexWrap=l!==-1&&a>=l?"wrap":""}else this.style.flexWrap=""}},p$={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},m$={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function g$(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function O$(s){return p$[s]??s}function b$(s){return m$[s]??s}x("row-ui",lr);P();var hr=class extends k{static properties={columns:{type:String,default:"3",reflect:!0},gap:{type:String,default:"md",reflect:!0},columnGap:{type:String,default:"",reflect:!0,attribute:"column-gap"},rowGap:{type:String,default:"",reflect:!0,attribute:"row-gap"},minColumnWidth:{type:String,default:"",reflect:!0,attribute:"min-column-width"}};static template=()=>null;render(){let t=$e.value,e=this.columns;if(e?.includes("@")){let n=Xt(e,t);this.style.gridTemplateColumns=this.#t(n),this.style.gridAutoFlow=n?"row":"",this.style.gridAutoColumns=n?"auto":""}else this.style.gridTemplateColumns="",this.style.gridAutoFlow="",this.style.gridAutoColumns="";this.minColumnWidth?this.style.setProperty("--grid-min-col",this.minColumnWidth):this.style.removeProperty("--grid-min-col");let i=this.gap;if(i?.includes("@")){let n=Xt(i,t),r=this.#e(n);this.style.columnGap=r,this.style.rowGap=r}else this.style.columnGap="",this.style.rowGap=""}#t(t){return t?/^\d+$/.test(t)?`repeat(${t}, 1fr)`:t==="auto-fill"?"repeat(auto-fill, minmax(var(--grid-min-col, 12rem), 1fr))":t==="auto-fit"?"repeat(auto-fit, minmax(var(--grid-min-col, 12rem), 1fr))":t:""}#e(t){return!t||t==="0"?"0":/^\d+$/.test(t)?`var(--a-space-${t})`:`var(--a-gap-${t})`}};x("grid-ui",hr);P();var cr=class extends k{static properties={align:{type:String,default:"center",reflect:!0}};static template=()=>null};x("stack-ui",cr);P();var ur=class extends k{static properties={};static template=()=>null};x("frame-ui",ur);P();function cs(s,t,e=5){let n=(t-s||1)/e,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r,l=(o<=1.5?1:o<=3?2:o<=7?5:10)*r,h=Math.floor(s/l)*l,c=Math.ceil(t/l)*l,u=[];for(let d=h;d<=c+l*.5;d+=l)u.push(+d.toFixed(10));return u}function bb(s){if(s==null)return"";let t=+s;return Number.isNaN(t)?String(s):Math.abs(t)>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":Math.abs(t)>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":Number.isInteger(t)?String(t):t.toFixed(1)}function ne(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function bt({label:s,value:t,pct:e,series:i}){let n="";return s!=null&&(n+=` data-tip-label="${ne(String(s))}"`),t!=null&&(n+=` data-tip-value="${t}"`),e!=null&&(n+=` data-tip-pct="${e}"`),i!=null&&(n+=` data-tip-series="${ne(String(i))}"`),n}function re(s,t,e){return s+t*Math.cos(e)}function oe(s,t,e){return s+t*Math.sin(e)}function y$(s,t,e,i,n){let r=re(s,e,i),o=oe(t,e,i),a=re(s,e,n),l=oe(t,e,n),h=n-i>Math.PI?1:0;return`M ${s} ${t} L ${r} ${o} A ${e} ${e} 0 ${h} 1 ${a} ${l} Z`}function cd(s,t,e,i,n,r,o=0){let a=(e-i)/2,l=r-n,h=Math.max(0,Math.min(o,a)),c=()=>{let Ot=re(s,e,n),pt=oe(t,e,n),St=re(s,e,r),Ct=oe(t,e,r),wt=re(s,i,r),Wt=oe(t,i,r),Yt=re(s,i,n),Ii=oe(t,i,n),ns=l>Math.PI?1:0;return`M ${Ot} ${pt} A ${e} ${e} 0 ${ns} 1 ${St} ${Ct} L ${wt} ${Wt} A ${i} ${i} 0 ${ns} 0 ${Yt} ${Ii} Z`};if(h<=0)return c();let u=h/e,d=h/i;if(l<=(u+d)*1.05)return c();let f=n+u,p=r-u,m=n+d,O=r-d,g=p-f>Math.PI?1:0,y=re(s,e,f),v=oe(t,e,f),S=re(s,e,p),w=oe(t,e,p),$=re(s,i,O),A=oe(t,i,O),E=re(s,i,m),L=oe(t,i,m),Q=re(s,e-h,n),X=oe(t,e-h,n),D=re(s,i+h,n),_=oe(t,i+h,n),W=re(s,e-h,r),Y=oe(t,e-h,r),et=re(s,i+h,r),at=oe(t,i+h,r);return`M ${y} ${v} A ${e} ${e} 0 ${g} 1 ${S} ${w} A ${h} ${h} 0 0 1 ${W} ${Y} L ${et} ${at} A ${h} ${h} 0 0 1 ${$} ${A} A ${i} ${i} 0 ${g} 0 ${E} ${L} A ${h} ${h} 0 0 1 ${D} ${_} L ${Q} ${X} A ${h} ${h} 0 0 1 ${y} ${v} Z`}function wa(s,t=.4){if(s.length<2)return"";if(t<=0)return"M"+s.map(n=>`${n.x},${n.y}`).join(" L");let e=s.length,i=`M${s[0].x},${s[0].y}`;for(let n=0;n<e-1;n++){let r=s[Math.max(n-1,0)],o=s[n],a=s[n+1],l=s[Math.min(n+2,e-1)],h=o.x+(a.x-r.x)*t/3,c=o.y+(a.y-r.y)*t/3,u=a.x-(l.x-o.x)*t/3,d=a.y-(l.y-o.y)*t/3;i+=` C${h},${c} ${u},${d} ${a.x},${a.y}`}return i}function ud(s,t,e=.4){let i=wa(s,e),n=s[s.length-1],r=s[0];return`${i} L${n.x},${t} L${r.x},${t} Z`}function Hl(s,t,e,i,n=0){if(i<=0||e<=0)return"";let r=Math.max(0,Math.min(n,e/2,i));return r===0?`M${s},${t} H${s+e} V${t+i} H${s} Z`:`M${s},${t+i} V${t+r} Q${s},${t} ${s+r},${t} H${s+e-r} Q${s+e},${t} ${s+e},${t+r} V${t+i} Z`}var v$={std:{ratio:4/3}},dr=class extends k{static properties={type:{type:String,default:"bar",reflect:!0},x:{type:String,default:"",reflect:!0},y:{type:String,default:"",reflect:!0},hideAverage:{type:Boolean,default:!1,reflect:!0,attribute:"hide-average"},color:{type:String,default:"",reflect:!0},hideGrid:{type:Boolean,default:!1,reflect:!0,attribute:"hide-grid"},hideValues:{type:Boolean,default:!1,reflect:!0,attribute:"hide-values"},radius:{type:Number,default:null,reflect:!0},smooth:{type:Number,default:.4,reflect:!0},size:{type:String,default:"",reflect:!0},format:{type:String,default:"abbr",reflect:!0},loading:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=!1;#i=null;#s=null;#n=0;#r=0;#a=new Set;#o(){if(this.radius!=null)return this.radius;let t=getComputedStyle(this).getPropertyValue("--a-radius").trim(),e=parseFloat(t);return Number.isFinite(e)&&e>0?e:6}set data(t){!Array.isArray(t)&&!this.#e&&(this.#e=!0,console.warn(`[chart-ui] .data must be an array of plain objects \u2014 received ${t===null?"null":typeof t}. The {labels, datasets} envelope is the Chart.js API, not the chart-ui API.
194
192
  Correct shape for <chart-ui x="label" y="value">:
195
193
  [{ label: "Jan", value: 100 }, { label: "Feb", value: 200 }]`)),this.#t=Array.isArray(t)?t:[],this.#c(),this.#f()}get data(){return this.#t}#l=!1;#c(){if(this.#l)return;let t=this.#h();this.#t.length>t&&(console.warn(`[chart-ui] .data has ${this.#t.length} rows which exceeds the recommended perf budget of ${t}. Consider downsampling at the data layer (e.g., LTTB, bucket aggregation). Override the budget via CSS: chart-ui { --chart-perf-budget: 10000 }.`),this.#l=!0)}#h(){let t=getComputedStyle(this).getPropertyValue("--chart-perf-budget").trim(),e=parseInt(t,10);return Number.isFinite(e)&&e>0?e:5e3}connected(){if(this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",`${this.type} chart`),this.#t.length===0&&this.hasAttribute("data"))try{let t=JSON.parse(this.getAttribute("data"));Array.isArray(t)&&(this.data=t)}catch{}document.addEventListener("toggle",this.#S),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this.#L),this.addEventListener("focus",this.#P),this.addEventListener("blur",this.#R),this.addEventListener("pointerover",this.#I),this.addEventListener("pointermove",this.#Q),this.addEventListener("pointerleave",this.#N),this.addEventListener("pointerdown",this.#B),this.addEventListener("click",this.#_),this.#i=new ResizeObserver(t=>{let{inlineSize:e,blockSize:i}=t[0].contentBoxSize[0];if(!this.#t.length)return;let n=Math.round(e),r=Math.round(i);n===this.#n&&(!this.hasAttribute("resize")||r===this.#r)||(this.#n=n,this.#r=r,!this.#s&&(this.#s=requestAnimationFrame(()=>{this.#s=null,this.#f()})))}),this.#i.observe(this)}render(){if(this.loading){let e=this.querySelector("skeleton-ui[data-chart-skel]");e||(e=document.createElement("skeleton-ui"),e.setAttribute("data-chart-skel",""),e.style.cssText="display:block;width:100%;height:100%;min-height:4rem;border-radius:var(--a-radius-md)"),this.innerHTML="",this.appendChild(e);return}let t=this.querySelector("skeleton-ui[data-chart-skel]");t&&t.remove(),this.#f()}#u(){let t=this.clientWidth||300,e=this.clientHeight||0,i=v$.std,n=this.#t.length||1,r=Math.max(t,120),a=(this.hasAttribute("resize")||this.style.height)&&e>40?e:Math.round(r/i.ratio),l=parseFloat(getComputedStyle(this).maxHeight);isFinite(l)&&l>0&&a>l&&(a=Math.round(l));let h=Math.min(r,a),c=this.size||(h<150?"sm":h<300?"md":"lg"),u=c==="sm"?9:c==="md"?10:11,d=u,f=c==="sm"?8:c==="md"?9:10,p=this.hideGrid,m=p?0:u*3.2,O=!!this.x,g={top:p?2:u*1.6,right:p?2:u*1.2,bottom:!O||p?2:u*2.2,left:m},y=r-g.left-g.right,v=Math.max(4,y/n*.6);return{width:r,height:a,pad:g,fontSize:u,labelSize:d,valueSize:f,barMinW:v,plotW:y,n,sizeClass:c}}#d=null;#f(){if(!this.isConnected)return;let t=this.querySelector(':scope > [slot="empty"]');if(t&&!this.#d&&(this.#d=t.cloneNode(!0)),this.innerHTML="",this.#d&&this.appendChild(this.#d.cloneNode(!0)),!this.#t.length){this.removeAttribute("data-has-data");return}this.setAttribute("data-has-data",""),this.#p();let e=document.createElement("div");this.type==="sparkline"&&e.setAttribute("data-sparkline",""),this.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");e.appendChild(i);let n="",r="";switch(this.type){case"bar":({svg:n,viewBox:r}=this.#G());break;case"line":({svg:n,viewBox:r}=this.#K());break;case"pie":({svg:n,viewBox:r}=this.#tt());break;case"donut":({svg:n,viewBox:r}=this.#J());break;case"radar":({svg:n,viewBox:r}=this.#et());break;case"sparkline":({svg:n,viewBox:r}=this.#it());break;case"segments":({svg:n,viewBox:r}=this.#ht());break;case"area":({svg:n,viewBox:r}=this.#st());break;case"scatter":({svg:n,viewBox:r}=this.#nt());break;case"radial-bar":({svg:n,viewBox:r}=this.#H());break;case"gauge":({svg:n,viewBox:r}=this.#Y());break;case"funnel":({svg:n,viewBox:r}=this.#rt());break;case"treemap":({svg:n,viewBox:r}=this.#ot());break;case"sankey":({svg:n,viewBox:r}=this.#at());break;case"composed":({svg:n,viewBox:r}=this.#lt());break;case"stacked-bar":({svg:n,viewBox:r}=this.#ct());break;case"grouped-bar":({svg:n,viewBox:r}=this.#ut());break;case"multi-line":({svg:n,viewBox:r}=this.#dt());break;default:({svg:n,viewBox:r}=this.#G());break}if(i.setAttribute("viewBox",r),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.innerHTML=n,["pie","donut","stacked-bar","grouped-bar","multi-line","radial-bar"].includes(this.type)&&!this.#y()){let o=this.#ft();o&&this.appendChild(o)}this.dispatchEvent(new CustomEvent("legend-update",{bubbles:!0}))}#p(){let t=this.#D();for(let e=0;e<t.length;e++){let i=e%10;this.style.setProperty(`--color-${t[e]}`,`var(--chart-${i})`)}}#m(t,e){return e?` data-slice="${t}" data-series-key="${ne(e)}" style="fill: var(--color-${e}, var(--chart-${t}))"`:` data-slice="${t}"`}#g(t,e){return e?` data-slice="${t}" data-series-key="${ne(e)}" style="stroke: var(--color-${e}, var(--chart-${t}))"`:` data-slice="${t}"`}#b=null;disconnected(){this.#i?.disconnect(),this.#i=null,this.#s&&(cancelAnimationFrame(this.#s),this.#s=null),document.removeEventListener("toggle",this.#S),document.removeEventListener("pointerdown",this.#Z),this.removeEventListener("keydown",this.#L),this.removeEventListener("focus",this.#P),this.removeEventListener("blur",this.#R),this.removeEventListener("pointerover",this.#I),this.removeEventListener("pointermove",this.#Q),this.removeEventListener("pointerleave",this.#N),this.removeEventListener("pointerdown",this.#B),this.removeEventListener("click",this.#_),this.#z()}#y(){return this.id?!!document.querySelector(`chart-legend-ui[for="${CSS.escape(this.id)}"]`):!1}#O(){return this.id?!!document.querySelector(`tooltip-ui[follows="pointer"][for="${CSS.escape(this.id)}"]`):!1}#S=t=>{let e=t.target?.closest?.("chart-legend-ui[for]");if(!e||e.getAttribute("for")!==this.id)return;let{key:i,active:n}=t.detail||{};i&&(n?this.#a.delete(i):this.#a.add(i),this.#f())};#x(t){return!!t&&this.#a.has(t)}#v(t){if(t==null||t==="")return"";let e=+t;if(!Number.isFinite(e))return String(t);switch(this.format||"abbr"){case"decimal":return e.toFixed(2);case"percent":return`${(e*100).toFixed(1)}%`;case"currency":{let n=getComputedStyle(this).getPropertyValue("--chart-currency-prefix").trim();return(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1)),`${n||"$"}${bb(e)}`}default:return bb(e)}}#w=-1;#k(){return Array.from(this.querySelectorAll("[data-tip-label], [data-tip-value]"))}#A(t){let e=this.#k();if(!e.length){this.#C();return}this.#w=Math.max(0,Math.min(t,e.length-1)),this.#$(),this.#M()}#$(){let t=this.#k();for(let i of t)i.removeAttribute("data-a11y-focus");let e=t[this.#w];if(!e)return this.removeAttribute("data-a11y-focused");e.setAttribute("data-a11y-focus",""),this.setAttribute("data-a11y-focused","")}#C(){this.#w=-1;for(let t of this.#k())t.removeAttribute("data-a11y-focus");this.removeAttribute("data-a11y-focused")}#M(){let t=this.#k()[this.#w];if(!t)return;let e=t.getBoundingClientRect(),i={clientX:e.left+e.width/2,clientY:e.top+e.height/2};this.#q(t,i)}#E(){let t=this.#k()[this.#w];if(!t)return;let e=t.getBoundingClientRect(),i={clientX:e.left+e.width/2,clientY:e.top+e.height/2};this.dispatchEvent(new CustomEvent("chart-select",{bubbles:!0,detail:this.#W(t,i)}))}#P=()=>{this.#w===-1&&this.#A(0)};#R=()=>{this.#C(),this.#T&&this.#X()};#L=t=>{let e=this.#k();if(e.length)switch(t.key){case"ArrowRight":case"ArrowDown":t.preventDefault(),this.#A(this.#w+1);break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),this.#A(Math.max(0,this.#w-1));break;case"Home":t.preventDefault(),this.#A(0);break;case"End":t.preventDefault(),this.#A(e.length-1);break;case"Enter":case" ":t.preventDefault(),this.#E();break;case"Escape":t.preventDefault(),this.#C(),this.#T&&this.#X();break}};#T=null;#I=t=>{if(t.pointerType==="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");e&&(this.#F(e,t),this.#q(e,t))};#Q=t=>{if(t.pointerType==="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");if(!e)return this.#T&&this.#X(),this.#z();this.#F(e,t),e!==this.#T&&this.#q(e,t)};#N=t=>{t&&t.pointerType==="touch"||(this.#z(),this.#T&&this.#X())};#B=t=>{if(t.pointerType!=="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");if(!e)return this.#T&&this.#X(),this.#z();this.#F(e,t),e!==this.#T&&this.#q(e,t),document.addEventListener("pointerdown",this.#Z)};#Z=t=>{t.pointerType==="touch"&&(this.contains(t.target)||(this.#z(),this.#T&&this.#X(),document.removeEventListener("pointerdown",this.#Z)))};#_=t=>{let e=t.target.closest("[data-tip-label], [data-tip-value]");e&&this.dispatchEvent(new CustomEvent("chart-select",{bubbles:!0,detail:this.#W(e,t)}))};#q(t,e){this.#T=t,this.dispatchEvent(new CustomEvent("chart-hover",{bubbles:!0,detail:this.#W(t,e)}))}#X(){this.#T=null,this.dispatchEvent(new CustomEvent("chart-leave",{bubbles:!0}))}#W(t,e){let{tipLabel:i,tipValue:n,tipPct:r,tipSeries:o}=t.dataset,a=t.dataset.slice!=null?Number(t.dataset.slice):null,l=n!=null?Number(n):null,h=r!=null?Number(r):null,c=i??null,u=o??null,d=this.#V(c,u)??[{series:u,label:c,value:Number.isFinite(l)?l:n??null,pct:Number.isFinite(h)?h:null,slot:a}];return{label:c,value:Number.isFinite(l)?l:n??null,pct:Number.isFinite(h)?h:null,series:u,slot:a,payload:d,pointerX:e?.clientX??null,pointerY:e?.clientY??null}}#V(t,e){if(t==null)return null;let i=this.x,n=this.#D();if(!i||n.length===0)return null;let r=this.#t.find(l=>String(l[i]??"")===String(t));if(!r)return null;let o=n.filter(l=>!this.#x(l)),a=e||(o.length===1?o[0]:null);return o.map((l,h)=>{let c=+(r[l]??0);return{series:l,label:t,value:Number.isFinite(c)?c:null,pct:null,slot:h%10,hovered:l===a}})}#F(t,e){if(this.#O())return;let{tipLabel:i,tipValue:n,tipPct:r,tipSeries:o}=t.dataset;if(!this.#b){let O=document.createElement("div");O.setAttribute("popover","manual"),O.setAttribute("role","tooltip"),O.classList.add("chart-tooltip-popup"),document.body.appendChild(O),this.#b=O}let a=[];if(o&&a.push(`<span data-tip-role="series">${ne(o)}</span>`),i&&a.push(`<span data-tip-role="label">${ne(i)}</span>`),n!==void 0){let O=r!==void 0?` <span data-tip-role="pct">(${r}%)</span>`:"";a.push(`<span data-tip-role="value">${this.#v(n)}${O}</span>`)}this.#b.innerHTML=a.join("");try{this.#b.showPopover()}catch{}let l=12,h=8,{clientX:c,clientY:u}=e,d=this.#b.offsetWidth||0,f=this.#b.offsetHeight||0,p=c-d/2,m=u-f-l;p<h&&(p=h),p+d>window.innerWidth-h&&(p=window.innerWidth-d-h),m<h&&(m=u+l),this.#b.style.left=`${p}px`,this.#b.style.top=`${m}px`}#z(){if(this.#b){try{this.#b.hidePopover()}catch{}this.#b.remove(),this.#b=null}}#D(){return this.y?this.y.split(",").map(t=>t.trim()).filter(Boolean):[]}#U(t,e,i,n,r,o){let a=r,l=o?.fontSize||10,h=o?.labelSize||l,c="",u=i;if(o?.sizeClass==="sm"&&i.length>4&&(u=i.filter((d,f)=>f%2===0||f===i.length-1)),!this.hideGrid){let f=i[i.length-1]-i[0]||1;for(let p of u){let m=a.top+(e-a.top-a.bottom)*(1-(p-i[0])/f);c+=`<line data-grid x1="${a.left}" y1="${m}" x2="${t-a.right}" y2="${m}"/>`}for(let p of u){let m=a.top+(e-a.top-a.bottom)*(1-(p-i[0])/f);c+=`<text data-y-label x="${a.left-4}" y="${m+l*.35}" text-anchor="end" font-size="${l}">${this.#v(p)}</text>`}if(n){let m=(t-a.left-a.right)/n.length,g=n.reduce((S,w)=>Math.max(S,String(w).length),1)*h*.6+h*.75,y=Math.max(1,Math.ceil(g/m)),v=n.length-1;for(let S=0;S<n.length;S++){if(S%y!==0&&S!==v||S!==v&&v-S<y)continue;let w=a.left+m*S+m/2;c+=`<text data-x-label x="${w}" y="${e-l*.5}" text-anchor="middle" font-size="${h}">${ne(n[S])}</text>`}}}return c}#G(){let t=this.#u(),e=this.#t,i=this.#D()[0]||this.y,n=e.map(v=>+(v[i]??0)),r=e.map(v=>v[this.x]??""),o=cs(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/e.length,p=f*.6,m=(f-p)/2,O=this.#U(l,h,o,r,c,t),g=!this.hideValues&&t.sizeClass!=="sm",y=!this.hideAverage&&n.length>1&&t.sizeClass!=="sm"&&!this.hideGrid;for(let v=0;v<e.length;v++){let S=n[v],w=a?S/a*u:0,$=c.left+f*v+m,A=c.top+u-w;O+=`<path data-bar${bt({label:r[v],value:S})} d="${Hl($,A,p,w,this.#o())}"/>`,g&&(O+=`<text data-value x="${$+p/2}" y="${A-4}" text-anchor="middle" font-size="${t.valueSize}">${this.#v(S)}</text>`)}if(y){let v=n.reduce((w,$)=>w+$,0)/n.length,S=c.top+u-(a?v/a*u:0);O+=`<line data-avg x1="${c.left}" y1="${S}" x2="${l-c.right}" y2="${S}"/>`,O+=`<text data-avg-label x="${l-c.right+2}" y="${S+3}" text-anchor="start" font-size="${t.valueSize}">${this.#v(v)}</text>`,O+=`<line data-hit${bt({label:"Average",value:v})} x1="${c.left}" y1="${S}" x2="${l-c.right}" y2="${S}" stroke="transparent" stroke-width="12"/>`}return{svg:O,viewBox:`0 0 ${l} ${h}`}}#K(){let t=this.#u(),e=this.#t,i=this.#D()[0]||this.y,n=e.map(A=>+(A[i]??0)),r=e.map(A=>A[this.x]??""),o=cs(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(e.length-1,1),p=this.#U(l,h,o,r,c,t),m=n.map((A,E)=>{let L=c.left+f*E,Q=c.top+u-(a?A/a*u:0);return{x:L,y:Q,v:A,label:r[E]}}),O=c.top+u,g=Math.max(0,Math.min(1,this.smooth));p+=`<path data-area d="${ud(m,O,g)}"/>`,p+=`<path data-line d="${wa(m,g)}"/>`;let y=t.sizeClass==="sm",v=y?1.5:3,S=Math.max(v,10),w=!this.hideValues&&!y,$=!this.hideAverage&&n.length>1&&!y&&!this.hideGrid;for(let A of m)p+=`<circle data-dot cx="${A.x}" cy="${A.y}" r="${v}"/>`,p+=`<circle data-hit${bt({label:A.label,value:A.v})} cx="${A.x}" cy="${A.y}" r="${S}" fill="transparent"/>`,w&&(p+=`<text data-value x="${A.x}" y="${A.y-8}" text-anchor="middle" font-size="${t.valueSize}">${this.#v(A.v)}</text>`);if($){let A=n.reduce((L,Q)=>L+Q,0)/n.length,E=c.top+u-(a?A/a*u:0);p+=`<line data-avg x1="${c.left}" y1="${E}" x2="${l-c.right}" y2="${E}"/>`,p+=`<text data-avg-label x="${l-c.right+2}" y="${E+3}" text-anchor="start" font-size="${t.valueSize}">${this.#v(A)}</text>`,p+=`<line data-hit${bt({label:"Average",value:A})} x1="${c.left}" y1="${E}" x2="${l-c.right}" y2="${E}" stroke="transparent" stroke-width="12"/>`}return{svg:p,viewBox:`0 0 ${l} ${h}`}}#tt(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(p=>+(p[e]??0)),n=i.reduce((p,m)=>p+m,0)||1,r=t.map(p=>p[this.x]??""),o=this.#u(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.42),d="",f=-Math.PI/2;for(let p=0;p<i.length;p++){let m=i[p]/n*Math.PI*2;if(m===0)continue;let O=f+m,g=(i[p]/n*100).toFixed(1),y=` data-slice="${p%10}"${bt({label:r[p],value:i[p],pct:g})}`;Math.abs(m-Math.PI*2)<.001?d+=`<circle${y} cx="${h}" cy="${c}" r="${u}"/>`:d+=`<path${y} d="${y$(h,c,u,f,O)}"/>`,f=O}return this.#j=t.map((p,m)=>({label:r[m],value:i[m],pct:(i[m]/n*100).toFixed(1),slot:m%10})),{svg:d,viewBox:`0 0 ${a} ${l}`}}#J(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(g=>+(g[e]??0)),n=i.reduce((g,y)=>g+y,0)||1,r=t.map(g=>g[this.x]??""),o=this.#u(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.42),d=u*.72,f="",p=-Math.PI/2;for(let g=0;g<i.length;g++){let y=i[g]/n*Math.PI*2;if(y===0)continue;let v=p+y,S=(i[g]/n*100).toFixed(1),w=` data-slice="${g%10}"${bt({label:r[g],value:i[g],pct:S})}`;Math.abs(y-Math.PI*2)<.001?(f+=`<circle${w} cx="${h}" cy="${c}" r="${(u+d)/2}" fill="none" stroke-width="${u-d}" style="fill:none"/>`,f+=`<path${w} d="M ${h-u} ${c} A ${u} ${u} 0 1 1 ${h+u} ${c} A ${u} ${u} 0 1 1 ${h-u} ${c} Z M ${h-d} ${c} A ${d} ${d} 0 1 0 ${h+d} ${c} A ${d} ${d} 0 1 0 ${h-d} ${c} Z" fill-rule="evenodd"/>`):f+=`<path${w} d="${cd(h,c,u,d,p,v,this.#o())}"/>`,p=v}let m=Math.max(14,Math.round(u*.32)),O=Math.max(9,Math.round(u*.16));return f+=`<text data-donut-total x="${h}" y="${c}" text-anchor="middle" dominant-baseline="central" font-size="${m}">${this.#v(n)}</text>`,f+=`<text data-donut-label x="${h}" y="${c+m}" text-anchor="middle" dominant-baseline="central" font-size="${O}">Total</text>`,this.#j=t.map((g,y)=>({label:r[y],value:i[y],pct:(i[y]/n*100).toFixed(1),slot:y%10})),{svg:f,viewBox:`0 0 ${a} ${l}`}}#et(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(w=>+(w[e]??0)),n=t.map(w=>w[this.x]??""),r=Math.max(...i)||1,o=t.length,a=this.#u(),{width:l,height:h,fontSize:c}=a,u=l/2,d=h/2,f=c*3.5,p=Math.max(40,Math.min(l,h)/2-f),m="",O=Math.PI*2/o;for(let w=1;w<=3;w++){let $=p*w/3,A="";for(let E=0;E<o;E++){let L=-Math.PI/2+O*E,Q=u+$*Math.cos(L),X=d+$*Math.sin(L);A+=(E===0?"M":"L")+` ${Q} ${X}`}A+=" Z",m+=`<path data-grid d="${A}"/>`}for(let w=0;w<o;w++){let $=-Math.PI/2+O*w,A=u+p*Math.cos($),E=d+p*Math.sin($);m+=`<line data-grid x1="${u}" y1="${d}" x2="${A}" y2="${E}"/>`}let g="",y=[];for(let w=0;w<o;w++){let $=-Math.PI/2+O*w,A=i[w]/r*p,E=u+A*Math.cos($),L=d+A*Math.sin($);g+=(w===0?"M":"L")+` ${E} ${L}`,y.push({px:E,py:L})}g+=" Z",m+=`<path data-radar-fill d="${g}"/>`,m+=`<path data-radar-line d="${g}"/>`;let v=Math.max(c,10);for(let w=0;w<o;w++){let{px:$,py:A}=y[w];m+=`<circle data-hit${bt({label:n[w],value:i[w]})} cx="${$}" cy="${A}" r="${v}" fill="transparent"/>`}let S=c*1.3;for(let w=0;w<o;w++){let $=-Math.PI/2+O*w,A=u+(p+S)*Math.cos($),E=d+(p+S)*Math.sin($),L=Math.abs(Math.cos($))<.1?"middle":Math.cos($)>0?"start":"end";m+=`<text data-x-label x="${A}" y="${E}" text-anchor="${L}" dominant-baseline="central" font-size="${c}">${ne(n[w])}</text>`}return{svg:m,viewBox:`0 0 ${l} ${h}`}}#it(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(y=>+(y[e]??0)),n=Math.max(...i)||1,r=Math.min(...i),o=n-r||1,a=this.clientWidth||120,l=this.clientHeight||32,h=Math.max(40,a),c=Math.max(16,l),u=h/Math.max(i.length-1,1),d=Math.max(2,Math.min(6,c*.1)),f=t.map(y=>y[this.x]??""),p=i.map((y,v)=>({x:u*v,y:c-(y-r)/o*(c-d*2)-d,v:y,label:f[v]})),m=Math.max(0,Math.min(1,this.smooth)),O="";O+=`<path data-area d="${ud(p,c,m)}"/>`,O+=`<path data-line d="${wa(p,m)}"/>`;let g=Math.max(u/2,6);for(let y of p)O+=`<circle data-hit${bt({label:y.label,value:y.v})} cx="${y.x}" cy="${y.y}" r="${g}" fill="transparent"/>`;return{svg:O,viewBox:`0 0 ${h} ${c}`}}#st(){return this.#K()}#nt(){let t=this.#u(),e=this.#t,i=this.#D()[0]||this.y,n=e.map(g=>+(g[i]??0)),r=e.map(g=>g[this.x]??""),o=cs(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(e.length-1,1),p=this.#U(l,h,o,r,c,t),m=t.sizeClass==="sm"?2.5:4,O=Math.max(m*2,10);for(let g=0;g<n.length;g++){let y=c.left+f*g,v=c.top+u-(a?n[g]/a*u:0);p+=`<circle data-dot data-scatter cx="${y}" cy="${v}" r="${m}"/>`,p+=`<circle data-hit${bt({label:r[g],value:n[g]})} cx="${y}" cy="${v}" r="${O}" fill="transparent"/>`}return{svg:p,viewBox:`0 0 ${l} ${h}`}}#H(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(g=>+(g[e]??0)),n=t.map(g=>g[this.x]??""),r=Math.max(...i)||1,o=this.#u(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.45),d=u*.3,f=i.length||1,p=(u-d)/f,m=Math.min(2,p*.15),O="";for(let g=0;g<i.length;g++){let y=d+p*g+m/2,v=d+p*(g+1)-m/2,S=(y+v)/2,w=v-y,$=2*Math.PI*S,A=Math.max(0,Math.min(1,i[g]/r))*$;if(O+=`<circle data-radial-track cx="${h}" cy="${c}" r="${S}" fill="none" stroke-width="${w}"/>`,A<=0)continue;let E=(i[g]/r*100).toFixed(1),L=bt({label:n[g],value:i[g],pct:E}),Q=Math.abs(A-$)<.5,X=Q?"butt":"round",D=Q?`${$} 0`:`${A} ${$-A}`;O+=`<circle data-slice="${g%10}"${L} data-radial-bar cx="${h}" cy="${c}" r="${S}" fill="none" stroke-width="${w}" stroke-linecap="${X}" stroke-dasharray="${D}" transform="rotate(-90 ${h} ${c})"/>`}return this.#j=t.map((g,y)=>({label:n[y],key:n[y],value:i[y],pct:(i[y]/r*100).toFixed(1),slot:y%10})),{svg:O,viewBox:`0 0 ${a} ${l}`}}#Y(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(S=>+(S[e]??0)),n=i.reduce((S,w)=>S+w,0)||1,r=i[0]??0,o=t[0]?.max!=null?+t[0].max:i.length===1?Math.max(r,1):n,a=Math.max(0,Math.min(1,r/o)),l=this.#u(),{width:h,height:c}=l,u=h/2,d=c*.68,f=Math.max(40,Math.min(h*.45,c*.6)),p=f*.72,m=(f-p)/2,O="";if(O+=`<path data-radial-track d="${cd(u,d,f,p,Math.PI,2*Math.PI,m)}"/>`,a>0){let S=Math.PI+Math.PI*a,w=bt({label:t[0]?.[this.x]??"Value",value:r,pct:(a*100).toFixed(1)});O+=`<path data-slice="0"${w} data-gauge-fill d="${cd(u,d,f,p,Math.PI,S,m)}"/>`}let g=Math.max(18,Math.round(f*.42)),y=Math.max(10,Math.round(f*.2)),v=d-f*.15;return O+=`<text data-gauge-value x="${u}" y="${v}" text-anchor="middle" dominant-baseline="central" font-size="${g}">${this.#v(r)}</text>`,o!==r&&(O+=`<text data-gauge-max x="${u}" y="${v+g*.8}" text-anchor="middle" dominant-baseline="central" font-size="${y}">of ${this.#v(o)}</text>`),{svg:O,viewBox:`0 0 ${h} ${c}`}}#rt(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(v=>+(v[e]??0)),n=t.map(v=>v[this.x]??""),r=i.length;if(r===0)return{svg:"",viewBox:"0 0 100 100"};let o=Math.max(...i)||1,a=this.#u(),{width:l,height:h}=a,c=a.fontSize,u=Math.max(l*.18,80),d=c*.8,f=l-u*2,m=(h-d*2)/r,O=Math.max(2,m*.08),g=l/2,y="";for(let v=0;v<r;v++){let S=i[v],w=v<r-1?i[v+1]:i[v],$=S/o*(f/2),A=w/o*(f/2),E=d+m*v+O/2,L=d+m*(v+1)-O/2,Q=(S/o*100).toFixed(1),X=bt({label:n[v],value:S,pct:Q}),D=`M ${g-$} ${E} L ${g+$} ${E} L ${g+A} ${L} L ${g-A} ${L} Z`;if(y+=`<path data-slice="${v%10}" data-funnel-stage${X} d="${D}"/>`,y+=`<text data-funnel-label x="${u-8}" y="${E+m/2}" text-anchor="end" dominant-baseline="central" font-size="${c}">${ne(n[v])}</text>`,y+=`<text data-funnel-value x="${l-u+8}" y="${E+m/2}" text-anchor="start" dominant-baseline="central" font-size="${c}">${this.#v(S)}</text>`,v>0){let _=(i[v]/i[0]*100).toFixed(0);y+=`<text data-funnel-drop x="${l-u+8}" y="${E+m/2+c*1.1}" text-anchor="start" dominant-baseline="central" font-size="${c*.85}">${_}%</text>`}}return this.#j=t.map((v,S)=>({label:n[S],value:i[S],pct:(i[S]/o*100).toFixed(1),slot:S%10})),{svg:y,viewBox:`0 0 ${l} ${h}`}}#ot(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(Q=>+(Q[e]??0)),n=t.map(Q=>Q[this.x]??""),r=i.length;if(r===0)return{svg:"",viewBox:"0 0 100 100"};let o=this.#u(),{width:a,height:l,fontSize:h}=o,c=i.reduce((Q,X)=>Q+X,0)||1,u=Array.from({length:r},(Q,X)=>X).sort((Q,X)=>i[X]-i[Q]),d=[],f=a*l,p=u.map(Q=>i[Q]/c*f),m=0,O=0,g=a,y=l,v=[],S=0,w=(Q,X)=>{if(Q.length===0)return 1/0;let D=Q.reduce((at,Ot)=>at+Ot,0),_=Math.max(...Q),W=Math.min(...Q),Y=X*X,et=D*D;return Math.max(Y*_/et,et/(Y*W))},$=(Q,X,D,_,W,Y)=>{let et=Q.reduce((Ct,wt)=>Ct+wt,0),at=W>=Y,Ot=at?et/W:Y,pt=at?W:et/Y,St=0;for(let Ct=0;Ct<Q.length;Ct++){let wt=Q[Ct]/et,Wt=u[X+Ct];if(at){let Yt=wt*W;d.push({i:Wt,x:D+St,y:_,w:Yt,h:Ot}),St+=Yt}else{let Yt=wt*Y;d.push({i:Wt,x:D,y:_+St,w:pt,h:Yt}),St+=Yt}}return at?{x:D,y:_+Ot,w:W,h:Y-Ot}:{x:D+pt,y:_,w:W-pt,h:Y}},A=p.slice();for(;A.length>0;){v=[A[0]],S=p.length-A.length;let Q=Math.min(g,y),X=1;for(;X<A.length;){let _=v.concat(A[X]);if(w(_,Q)>w(v,Q))break;v=_,X++}let D=$(v,S,m,O,g,y);m=D.x,O=D.y,g=D.w,y=D.h,A=A.slice(v.length)}let E="",L=2;for(let Q of d){let X=(i[Q.i]/c*100).toFixed(1),D=bt({label:n[Q.i],value:i[Q.i],pct:X});E+=`<rect data-slice="${Q.i%10}" data-treemap-tile${D} x="${Q.x+L}" y="${Q.y+L}" width="${Math.max(0,Q.w-L*2)}" height="${Math.max(0,Q.h-L*2)}" rx="${this.#o()}"/>`;let _=Q.x+8,W=Q.w>h*4,Y=W&&Q.h>h*2.5,et=W&&!Y&&Q.h>h*1.2;if(Y)E+=`<text data-treemap-label x="${_}" y="${Q.y+h+4}" font-size="${h}" dominant-baseline="hanging">${ne(n[Q.i])}</text>`,E+=`<text data-treemap-value x="${_}" y="${Q.y+h*2+6}" font-size="${h*.9}" dominant-baseline="hanging">${this.#v(i[Q.i])}</text>`;else if(et){let at=Q.y+Q.h/2;E+=`<text data-treemap-label x="${_}" y="${at}" font-size="${h}" dominant-baseline="central">${ne(n[Q.i])}</text>`}}return this.#j=t.map((Q,X)=>({label:n[X],value:i[X],pct:(i[X]/c*100).toFixed(1),slot:X%10})),{svg:E,viewBox:`0 0 ${a} ${l}`}}#at(){let t=this.#t;if(!t.length)return{svg:"",viewBox:"0 0 100 100"};let e=new Map,i=new Map;for(let S of t){let w=S.source??S.from??"",$=S.target??S.to??"",A=+(S.value??S.v??0);e.has(w)||e.set(w,{name:w,flow:0}),i.has($)||i.set($,{name:$,flow:0}),e.get(w).flow+=A,i.get($).flow+=A}let n=this.#u(),{width:r,height:o,fontSize:a}=n,l=Math.max(8,r*.03),h=l+a*5,c=[...e.values()].reduce((S,w)=>S+w.flow,0)||1,u=[...i.values()].reduce((S,w)=>S+w.flow,0)||1,d=a*.6,f=[...e.values()],p=[...i.values()],m=o-d*(f.length-1),O=o-d*(p.length-1),g=0;for(let S of f){let w=S.flow/c*m;S.y0=g,S.y1=g+w,S.cursor=g,g+=w+d}g=0;for(let S of p){let w=S.flow/u*O;S.y0=g,S.y1=g+w,S.cursor=g,g+=w+d}let y="",v=Math.min(this.#o(),l/2);f.forEach((S,w)=>{y+=`<rect data-sankey-node data-slice="${w%10}" x="${h-l}" y="${S.y0}" width="${l}" height="${S.y1-S.y0}" rx="${v}"/>`,y+=`<text data-sankey-label x="${h-l-6}" y="${(S.y0+S.y1)/2}" text-anchor="end" dominant-baseline="central" font-size="${a}">${ne(S.name)}</text>`}),p.forEach((S,w)=>{y+=`<rect data-sankey-node data-slice="${(f.length+w)%10}" x="${r-h}" y="${S.y0}" width="${l}" height="${S.y1-S.y0}" rx="${v}"/>`,y+=`<text data-sankey-label x="${r-h+l+6}" y="${(S.y0+S.y1)/2}" text-anchor="start" dominant-baseline="central" font-size="${a}">${ne(S.name)}</text>`});for(let S of t){let w=e.get(S.source??S.from??""),$=i.get(S.target??S.to??"");if(!w||!$)continue;let A=+(S.value??S.v??0);if(A<=0)continue;let E=A/c*m,L=A/u*O,Q=w.cursor,X=Q+E,D=$.cursor,_=D+L;w.cursor+=E,$.cursor+=L;let W=h,Y=r-h,et=(W+Y)/2,at=bt({label:`${w.name} \u2192 ${$.name}`,value:A}),Ot=`M ${W} ${Q} C ${et} ${Q}, ${et} ${D}, ${Y} ${D} L ${Y} ${_} C ${et} ${_}, ${et} ${X}, ${W} ${X} Z`;y+=`<path data-sankey-link${at} d="${Ot}"/>`}return{svg:y,viewBox:`0 0 ${r} ${o}`}}#lt(){let t=this.#u(),e=this.#t,i=this.#D(),n=i[0]||"bar",r=i[1]||"line",o=e.map($=>$[this.x]??""),a=e.map($=>+($[n]??0)),l=e.map($=>+($[r]??0)),h=[...a,...l],c=cs(0,Math.max(...h),5),u=c[c.length-1],{width:d,height:f,pad:p}=t,m=f-p.top-p.bottom,O=d-p.left-p.right,g=O/e.length,y=g*.6,v=(g-y)/2,S=O/Math.max(e.length-1,1),w=this.#U(d,f,c,o,p,t);if(!this.#x(n))for(let $=0;$<e.length;$++){let A=a[$],E=u?A/u*m:0,L=p.left+g*$+v,Q=p.top+m-E;w+=`<path${this.#m(0,n)}${bt({label:o[$],value:A,series:n})} d="${Hl(L,Q,y,E,this.#o())}"/>`}if(!this.#x(r)){let $=l.map((E,L)=>({x:p.left+g*L+g/2,y:p.top+m-(u?E/u*m:0),v:E,label:o[L]})),A=Math.max(0,Math.min(1,this.smooth));w+=`<path data-line${this.#g(1,r)} d="${wa($,A)}"/>`;for(let E of $)w+=`<circle data-dot${this.#m(1,r)} cx="${E.x}" cy="${E.y}" r="3"/>`,w+=`<circle data-hit${bt({label:E.label,value:E.v,series:r})} cx="${E.x}" cy="${E.y}" r="10" fill="transparent"/>`}return this.#j=[{label:n,key:n,slot:0},{label:r,key:r,slot:1}],{svg:w,viewBox:`0 0 ${d} ${f}`}}#ht(){let t=this.#t,e=this.#D()[0]||this.y,i=t.map(p=>+(p[e]??0)),n=i.reduce((p,m)=>p+m,0)||1,r=t.map(p=>p[this.x]??""),o=getComputedStyle(this),a=Math.max(40,this.clientWidth||200),l=24,h=Math.min(this.#o(),l/2),c=Math.max(0,parseFloat(o.getPropertyValue("--chart-segments-gap"))||2),u=[],d=0;for(let p=0;p<i.length;p++){let m=p===i.length-1?a:Math.round((d*n+i[p]*a)/n),O=p===i.length-1?a:i.slice(0,p+1).reduce((y,v)=>y+v,0)/n*a,g=p===0?0:i.slice(0,p).reduce((y,v)=>y+v,0)/n*a;u.push({x:g,w:Math.max(0,O-g)}),d=m}let f="";for(let p=0;p<u.length;p++){let{x:m,w:O}=u[p];if(O<=0)continue;let g=p===0,y=p===u.length-1,v=Math.max(0,O-(y?0:c)),S=(i[p]/n*100).toFixed(1),w=bt({label:r[p],value:i[p],pct:S}),$=`<title>${ne(r[p])}: ${i[p]} (${S}%)</title>`;if(g&&y||!g&&!y||h===0)f+=`<rect data-slice="${p%10}"${w} x="${m}" y="0" width="${v}" height="${l}"${(g||y)&&h?` rx="${h}"`:""}>${$}</rect>`;else{let A=h,E=m+v,L;g?L=`M ${m+A} 0 H ${E} V ${l} H ${m+A} A ${A} ${A} 0 0 1 ${m} ${l-A} V ${A} A ${A} ${A} 0 0 1 ${m+A} 0 Z`:L=`M ${m} 0 H ${E-A} A ${A} ${A} 0 0 1 ${E} ${A} V ${l-A} A ${A} ${A} 0 0 1 ${E-A} ${l} H ${m} Z`,f+=`<path data-slice="${p%10}"${w} d="${L}">${$}</path>`}}return this.#j=t.map((p,m)=>({label:r[m],value:i[m],pct:(i[m]/n*100).toFixed(1),slot:m%10})),{svg:f,viewBox:`0 0 ${a} ${l}`}}#ct(){let t=this.#t,e=this.#D(),i=t.map(g=>g[this.x]??""),n=t.map(g=>e.reduce((y,v)=>y+ +(g[v]??0),0)),r=cs(0,Math.max(...n),5),o=r[r.length-1],a=this.#u(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/t.length,p=f*.6,m=(f-p)/2,O=this.#U(l,h,r,i,c,a);for(let g=0;g<t.length;g++){let y=c.top+u,v=e.length;for(let S=0;S<v;S++){if(this.#x(e[S]))continue;let w=+(t[g][e[S]]??0),$=o?w/o*u:0;if($<=0){y-=$;continue}y-=$;let A=c.left+f*g+m,E=y,L=$,Q=S===v-1,X=this.#o(),D=`${this.#m(S%10,e[S])}${bt({label:i[g],value:w,series:e[S]})}`;Q?O+=`<path${D} d="${Hl(A,E,p,L,X)}"/>`:O+=`<rect${D} x="${A}" y="${E}" width="${p}" height="${L}"/>`}}return this.#j=e.map((g,y)=>({label:g,key:g,slot:y%10})),{svg:O,viewBox:`0 0 ${l} ${h}`}}#ut(){let t=this.#t,e=this.#D(),i=t.map(v=>v[this.x]??""),n=t.flatMap(v=>e.map(S=>+(v[S]??0))),r=cs(0,Math.max(...n),5),o=r[r.length-1],a=this.#u(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/t.length,p=3,m=f*.7,O=(m-p*(e.length-1))/e.length,g=(f-m)/2,y=this.#U(l,h,r,i,c,a);for(let v=0;v<t.length;v++)for(let S=0;S<e.length;S++){if(this.#x(e[S]))continue;let w=+(t[v][e[S]]??0),$=o?w/o*u:0,A=c.left+f*v+g+(O+p)*S,E=c.top+u-$;y+=`<path${this.#m(S%10,e[S])}${bt({label:i[v],value:w,series:e[S]})} d="${Hl(A,E,O,$,this.#o())}"/>`,this.hideValues||(y+=`<text data-value x="${A+O/2}" y="${E-4}" text-anchor="middle" font-size="${a.valueSize}">${this.#v(w)}</text>`)}return this.#j=e.map((v,S)=>({label:v,key:v,slot:S%10})),{svg:y,viewBox:`0 0 ${l} ${h}`}}#dt(){let t=this.#t,e=this.#D(),i=t.map(m=>m[this.x]??""),n=t.flatMap(m=>e.map(O=>+(m[O]??0))),r=cs(0,Math.max(...n),5),o=r[r.length-1],a=this.#u(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(t.length-1,1),p=this.#U(l,h,r,i,c,a);for(let m=0;m<e.length;m++){if(this.#x(e[m]))continue;let g=t.map(S=>+(S[e[m]]??0)).map((S,w)=>{let $=c.left+f*w,A=c.top+u-(o?S/o*u:0);return{x:$,y:A,v:S,label:i[w]}}),y=c.top+u,v=Math.max(0,Math.min(1,this.smooth));p+=`<path data-area${this.#m(m%10,e[m])} d="${ud(g,y,v)}"/>`,p+=`<path data-line${this.#g(m%10,e[m])} d="${wa(g,v)}"/>`;for(let S of g)p+=`<circle data-dot${this.#m(m%10,e[m])} cx="${S.x}" cy="${S.y}" r="3"/>`,p+=`<circle data-hit${bt({label:S.label,value:S.v,series:e[m]})} cx="${S.x}" cy="${S.y}" r="10" fill="transparent"/>`}return this.#j=e.map((m,O)=>({label:m,key:m,slot:O%10})),{svg:p,viewBox:`0 0 ${l} ${h}`}}#j=null;get legendData(){return this.#j?this.#j.map(t=>({...t})):null}#ft(){if(!this.#j||!this.#j.length)return null;let t=document.createElement("div");t.setAttribute("data-legend","");for(let e of this.#j){let i=document.createElement("span");i.setAttribute("data-legend-item",""),e.key&&i.setAttribute("data-series-key",e.key);let n=document.createElement("span");n.setAttribute("data-legend-dot",""),n.setAttribute("data-slice",String(e.slot)),e.key&&(n.style.background=`var(--color-${e.key}, var(--chart-${e.slot}))`),i.appendChild(n);let r=document.createElement("span");r.textContent=e.pct?`${e.label} (${e.pct}%)`:e.label,i.appendChild(r),t.appendChild(i)}return t}};x("chart-ui",dr);P();var fr=class s extends k{static properties={for:{type:String,default:"",reflect:!0},items:{type:String,default:"",reflect:!1},shape:{type:String,default:"dot",reflect:!0},position:{type:String,default:"bottom",reflect:!0},static:{type:Boolean,default:!1,reflect:!0},onToggle:{type:String,default:"hide",reflect:!0,attribute:"on-toggle"}};static template=()=>null;#t=null;#e=null;#i=new Set;connected(){this.setAttribute("role","list"),this.#s(),this.#a()}disconnected(){this.#n()}render(){this.#s(),this.#a()}#s(){if(this.#n(),!this.for)return;let t=this.getRootNode()?.getElementById?.(this.for)||document.getElementById(this.for);if(!t){s._warned||(s._warned=new WeakSet);let e={el:this,id:this.for};s._warned.has(this)||(console.warn(`[chart-legend-ui] [for="${this.for}"] did not resolve to an element.`),s._warned.add(this));return}this.#t=t,this.#e=()=>this.#a(),t.addEventListener("legend-update",this.#e)}#n(){this.#t&&this.#e&&this.#t.removeEventListener("legend-update",this.#e),this.#t=null,this.#e=null}#r(){if(this.items)try{let t=JSON.parse(this.items);if(Array.isArray(t))return t}catch{}return this.#t&&Array.isArray(this.#t.legendData)?this.#t.legendData:[]}#a(){let t=this.#r();if(this.innerHTML="",!!t.length)for(let e of t){let i=e.key??e.label??"",n=e.label??i,r=e.slot!=null?e.slot:0,o=!this.#i.has(i),a=document.createElement("badge-ui");a.setAttribute("data-row",""),a.setAttribute("role",this.static?"listitem":"button"),a.setAttribute("text",n),i&&a.setAttribute("data-key",i),o&&a.setAttribute("data-active",""),this.static||(a.setAttribute("tabindex","0"),a.setAttribute("aria-pressed",o?"true":"false"));let l=this.shape||"dot",h=document.createElement("swatch-ui");h.setAttribute("shape",l),h.setAttribute("size","sm");let c=i?`var(--color-${i}, var(--a-data-${r}))`:`var(--a-data-${r})`;h.style.setProperty("--swatch-color",c),a.appendChild(h),this.static||(a.addEventListener("click",u=>this.#o(u,i)),a.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this.#o(u,i))})),this.appendChild(a)}}#o(t,e){if(!e)return;let n=!!this.#i.has(e);n?this.#i.delete(e):this.#i.add(e);let r=t.currentTarget;n?r.setAttribute("data-active",""):r.removeAttribute("data-active"),r.setAttribute("aria-pressed",n?"true":"false"),this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,detail:{key:e,active:n,mode:this.onToggle||"hide"}}))}};x("chart-legend-ui",fr);P();var x$=120,pr=class extends k{static properties={placement:{type:String,default:"bottom",reflect:!0},gap:{type:Number,default:4,reflect:!0},open:{type:Boolean,default:!1,reflect:!0},trigger:{type:String,default:"click",reflect:!0}};static template=()=>null;#t=null;#e=!1;#i=null;#s=null;#n=null;connected(){let t=this.querySelector('[slot="content"]');t&&(t.hasAttribute("popover")||t.setAttribute("popover","manual"),t.addEventListener("toggle",this.#d),this.#s=t),this.#e||(this.#e=!0,this.trigger==="click"&&this.addEventListener("click",this.#o),this.trigger==="hover"&&(this.addEventListener("pointerenter",this.#h),this.addEventListener("pointerleave",this.#u),t&&(t.addEventListener("pointerenter",this.#h),t.addEventListener("pointerleave",this.#u))))}render(){this.open?this.#r():this.#a()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#r(){let t=this.querySelector('[slot="trigger"]'),e=this.#s??this.querySelector('[slot="content"]');if(!(!t||!e)){if(!e.matches(":popover-open"))try{e.showPopover()}catch{}this.#t?.(),this.#t=lt(t,e,{placement:this.placement,gap:this.gap}),(this.trigger==="click"||this.trigger==="manual")&&(this.#n=requestAnimationFrame(()=>{this.#n=null,document.addEventListener("pointerdown",this.#l),document.addEventListener("keydown",this.#c)}))}}#a(){this.#t?.(),this.#t=null;let t=this.#s??this.querySelector('[slot="content"]');if(t?.matches(":popover-open"))try{t.hidePopover()}catch{}this.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null),document.removeEventListener("pointerdown",this.#l),document.removeEventListener("keydown",this.#c)}#o=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.open=!this.open)};#l=t=>{if(!this.open)return;let e=this.#s;this.contains(t.target)||e?.contains(t.target)||(this.open=!1)};#c=t=>{t.key==="Escape"&&this.open&&(t.stopPropagation(),this.open=!1)};#h=()=>{clearTimeout(this.#i),this.open=!0};#u=()=>{clearTimeout(this.#i),this.#i=setTimeout(()=>{this.open=!1},x$)};#d=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){clearTimeout(this.#i),this.#a(),this.trigger==="click"&&this.removeEventListener("click",this.#o),this.trigger==="hover"&&(this.removeEventListener("pointerenter",this.#h),this.removeEventListener("pointerleave",this.#u),this.#s&&(this.#s.removeEventListener("pointerenter",this.#h),this.#s.removeEventListener("pointerleave",this.#u))),this.#s?.removeEventListener("toggle",this.#d),this.#s=null,this.#e=!1}};x("popover-ui",pr);P();var mr=class extends k{static requiredIcons=["caret-down"];static properties={multiple:{type:Boolean,default:!1,reflect:!0},variant:{type:String,default:"flat",reflect:!0}};static template=()=>null;connected(){this.addEventListener("toggle",this.#t)}disconnected(){this.removeEventListener("toggle",this.#t)}#t=t=>{if(this.multiple)return;let e=t.target;if(!e.open)return;let i=this.querySelectorAll("accordion-item-ui");for(let n of i)n!==e&&n.open&&(n.open=!1)}},gr=class extends k{static properties={text:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},variant:{type:String,default:"flat",reflect:!0}};static template=()=>null;#t=!1;connected(){let t=this.querySelector('[slot="header"]');if(t){if(!t.querySelector('[slot="caret"]')){let e=document.createElement("icon-ui");e.setAttribute("name","caret-down"),e.setAttribute("slot","caret"),t.appendChild(e)}}else{let e=document.createElement("div");e.setAttribute("slot","header"),e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),e.dataset.autofocusable="";let i=document.createElement("span");i.setAttribute("slot","header-text"),i.dataset.autolabel="",e.appendChild(i);let n=document.createElement("icon-ui");n.setAttribute("name","caret-down"),n.setAttribute("slot","caret"),e.appendChild(n),this.prepend(e)}if(!this.querySelector('[slot="body"]')){let e=document.createElement("div");e.setAttribute("slot","body");let i=[...this.childNodes].filter(n=>n.nodeType===1?!n.hasAttribute("slot"):n.nodeType===3&&n.textContent.trim());for(let n of i)e.appendChild(n);this.appendChild(e)}this.#t||(this.#t=!0,this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i))}disconnected(){this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i),this.#t=!1}render(){let t=this.querySelector('[slot="header-text"][data-autolabel]');t&&(t.textContent=this.text);let e=this.querySelector('[slot="header"][data-autofocusable]');e&&e.setAttribute("aria-expanded",String(this.open))}#e=t=>{let e=this.querySelector('[slot="header"]');!e||!e.contains(t.target)||t.target.closest('[slot="action"], [slot="actions"], [data-no-toggle]')||(this.open=!this.open,this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,detail:{open:this.open}})))};#i=t=>{let e=this.querySelector('[slot="header"][data-autofocusable]');!e||t.target!==e||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e.click())}};x("accordion-ui",mr),x("accordion-item-ui",gr);P();var Or=class extends k{static properties={label:{type:String,default:"",reflect:!0},vertical:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","separator")}render(){if(this.vertical?this.setAttribute("aria-orientation","vertical"):this.removeAttribute("aria-orientation"),this.label){let t=this.querySelector('[slot="label"]');t||(t=document.createElement("span"),t.setAttribute("slot","label"),this.appendChild(t)),t.textContent=this.label}else{let t=this.querySelector('[slot="label"]');t&&t.remove()}}};x("divider-ui",Or);P();var br=class extends k{static properties={cite:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.hasAttribute("role")||this.setAttribute("role","blockquote")}render(){let t=this.querySelector('[slot="cite"]:not([data-cite-stamped])'),e=this.querySelector('[slot="cite"][data-cite-stamped]');if(t){e?.remove();return}if(this.cite)if(e)e.textContent=this.cite;else{let i=document.createElement("span");i.setAttribute("slot","cite"),i.setAttribute("data-cite-stamped",""),i.textContent=this.cite,this.appendChild(i)}else e&&e.remove()}};x("blockquote-ui",br);P();var dd=[{limit:60,unit:"second",divisor:1},{limit:3600,unit:"minute",divisor:60},{limit:3600*24,unit:"hour",divisor:3600},{limit:3600*24*7,unit:"day",divisor:3600*24},{limit:3600*24*30,unit:"week",divisor:3600*24*7},{limit:3600*24*365,unit:"month",divisor:3600*24*30},{limit:1/0,unit:"year",divisor:3600*24*365}],yr=class extends k{static properties={datetime:{type:String,default:"",reflect:!0},timeStyle:{type:String,default:"long",reflect:!0,attribute:"time-style"},numeric:{type:String,default:"auto",reflect:!0},locale:{type:String,default:"",reflect:!0},updateInterval:{type:Number,default:60,reflect:!0,attribute:"update-interval"}};static template=()=>null;#t=null;#e(){return this.locale?this.locale:this.ownerDocument?.documentElement?.lang||void 0}#i(){if(!this.datetime)return"";let t=new Date(this.datetime);if(Number.isNaN(t.getTime()))return"";let e=(t.getTime()-Date.now())/1e3,i=Math.abs(e),n=dd.find(o=>i<=o.limit)||dd[dd.length-1],r=Math.round(e/n.divisor);try{return new Intl.RelativeTimeFormat(this.#e(),{style:this.timeStyle,numeric:this.numeric}).format(r,n.unit)}catch{let o=e<0,a=Math.abs(r);return o?`${a} ${n.unit}${a===1?"":"s"} ago`:`in ${a} ${n.unit}${a===1?"":"s"}`}}#s(){if(!this.datetime)return"";let t=new Date(this.datetime);if(Number.isNaN(t.getTime()))return"";try{return new Intl.DateTimeFormat(this.#e(),{dateStyle:"full",timeStyle:"long"}).format(t)}catch{return t.toString()}}connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","time"),this.#n()}render(){let t=this.#i();this.textContent=t,t&&!this.hasAttribute("data-suppress-title")&&this.setAttribute("title",this.#s()),this.datetime&&this.setAttribute("datetime",this.datetime),this.#n()}#n(){this.#r();let t=Number(this.updateInterval);!Number.isFinite(t)||t<=0||(this.#t=setInterval(()=>{this.textContent=this.#i()},t*1e3))}#r(){this.#t!=null&&(clearInterval(this.#t),this.#t=null)}disconnected(){super.disconnected(),this.#r()}};x("relative-time-ui",yr);P();var vr=class extends k{static properties={value:{type:Number,default:0,reflect:!0},numberStyle:{type:String,default:"decimal",reflect:!0,attribute:"number-style"},currency:{type:String,default:"",reflect:!0},unit:{type:String,default:"",reflect:!0},notation:{type:String,default:"standard",reflect:!0},compactDisplay:{type:String,default:"short",reflect:!0,attribute:"compact-display"},minimumFractionDigits:{type:Number,default:0,reflect:!0,attribute:"minimum-fraction-digits"},maximumFractionDigits:{type:Number,default:2,reflect:!0,attribute:"maximum-fraction-digits"},locale:{type:String,default:"",reflect:!0},signDisplay:{type:String,default:"auto",reflect:!0,attribute:"sign-display"}};static template=()=>null;#t(){return this.locale?this.locale:this.ownerDocument?.documentElement?.lang||void 0}#e(){let t=Number(this.value);if(!Number.isFinite(t)||this.numberStyle==="currency"&&!this.currency||this.numberStyle==="unit"&&!this.unit)return"";let e={style:this.numberStyle,notation:this.notation,signDisplay:this.signDisplay};this.numberStyle==="currency"&&(e.currency=this.currency),this.numberStyle==="unit"&&(e.unit=this.unit),this.notation==="compact"&&(e.compactDisplay=this.compactDisplay),Number.isFinite(this.minimumFractionDigits)&&(e.minimumFractionDigits=this.minimumFractionDigits),Number.isFinite(this.maximumFractionDigits)&&(e.maximumFractionDigits=this.maximumFractionDigits);try{return new Intl.NumberFormat(this.#t(),e).format(t)}catch{return String(t)}}connected(){super.connected()}render(){let t=this.#e();this.textContent=t,t&&Number.isFinite(Number(this.value))?this.setAttribute("aria-label",`${t} (raw: ${this.value})`):this.removeAttribute("aria-label")}};x("number-format-ui",vr);P();var fd=["Weak","Fair","Good","Strong"];function S$(s){if(!s)return-1;let t=0;s.length>=8&&t++,s.length>=12&&t++,s.length>=16&&t++;let e=[/[a-z]/.test(s),/[A-Z]/.test(s),/[0-9]/.test(s),/[^a-zA-Z0-9]/.test(s)].filter(Boolean).length;return e>=2&&t++,e>=3&&t++,e===4&&t++,/(.)\1{2,}/.test(s)&&t--,s.length<8&&(t=Math.min(t,0)),Math.max(0,Math.min(3,t))}var xr=class extends k{static properties={value:{type:String,default:""},minScore:{type:Number,default:2,reflect:!0,attribute:"min-score"},showLabel:{type:Boolean,default:!0,reflect:!0,attribute:"show-label"}};static template=()=>null;#t=-2;connected(){super.connected(),this.querySelector('[slot="bar"]')||(this.innerHTML=`
196
194
  <div slot="bar" aria-hidden="true">
@@ -252,9 +250,7 @@ Correct shape for <chart-ui x="label" y="value">:
252
250
  aria-controls="${e}"
253
251
  aria-labelledby="${t}"
254
252
  data-placeholder="${Ws(this.placeholder||"")}"></span>
255
- <button type="button" data-clear aria-label="Clear" tabindex="-1" style="display:none">
256
- <icon-ui name="x-circle"></icon-ui>
257
- </button>
253
+ <button-ui variant="ghost" size="xs" data-clear aria-label="Clear" tabindex="-1" style="display:none"><icon-ui slot="icon" name="x-circle"></icon-ui></button-ui>
258
254
  <span data-suffix>
259
255
  <icon-ui name="caret-down"></icon-ui>
260
256
  </span>